Changeset 111632 in webkit
- Timestamp:
- Mar 21, 2012 6:08:22 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r111628 r111632 1 2012-03-21 Ryosuke Niwa <rniwa@webkit.org> 2 3 BDI element should have dir=auto by default 4 https://bugs.webkit.org/show_bug.cgi?id=68773 5 6 Reviewed by Daniel Bates. 7 8 Add a test written by Aharon Lanin. 9 10 * fast/text/international/bdi-dir-default-to-auto-expected.html: Added. 11 * fast/text/international/bdi-dir-default-to-auto.html: Added. 12 1 13 2012-03-21 Eric Carlson <eric.carlson@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r111631 r111632 1 2012-03-21 Ryosuke Niwa <rniwa@webkit.org> 2 3 BDI element should have dir=auto by default 4 https://bugs.webkit.org/show_bug.cgi?id=68773 5 6 Reviewed by Daniel Bates. 7 8 Treat bdi elements without dir content attribute as if they have dir=auto per spec: 9 http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-bdi-element 10 11 The patch tries to encapsulate the logic to look for dir content attribute and dir=auto. 12 13 It also adds HTMLBDIElement interface (binding remains to use HTMLElement) to set 14 selfOrAncestorHasDirAutoAttribute flag true by default, which is used by functions like 15 directionalityIfhasDirAutoAttribute to look for elements with dir=auto. Since dir=auto-ness of bdi 16 elements can be overridden by dir content attribute, we must change and only change the default value. 17 18 Tests: fast/text/international/bdi-dir-default-to-auto-expected.html 19 fast/text/international/bdi-dir-default-to-auto.html 20 21 * GNUmakefile.list.am: 22 * Target.pri: 23 * WebCore.gypi: 24 * WebCore.vcproj/WebCore.vcproj: 25 * WebCore.xcodeproj/project.pbxproj: 26 * css/CSSStyleSelector.cpp: 27 (WebCore::CSSStyleSelector::collectMatchingRulesForList): 28 * html/HTMLBDIElement.h: Added. 29 (WebCore): 30 (HTMLBDIElement): 31 (WebCore::HTMLBDIElement::create): 32 (WebCore::HTMLBDIElement::HTMLBDIElement): Sets selfOrAncestorHasDirAutoAttribute to true because 33 bdi elements are treated as if it has dir=auto by default. 34 * html/HTMLElement.cpp: 35 (WebCore::elementAffectsDirectionality): Added. Checks if the specified element is bdi or 36 has dir content attribute. 37 (WebCore): 38 (WebCore::setHasDirAutoFlagRecursively): 39 (WebCore::HTMLElement::hasDirectionAuto): Added. Checks if the specified element should be treated 40 as if it has dir=auto (bdi or element with dir=auto). 41 (WebCore::HTMLElement::directionalityIfhasDirAutoAttribute): 42 (WebCore::HTMLElement::adjustDirectionalityIfNeededAfterChildAttributeChanged): 43 (WebCore::HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged): 44 * html/HTMLElement.h: 45 (HTMLElement): 46 * html/HTMLTagNames.in: Use HTMLBDIElement instead of HTMLElement for constructing bdi element 47 to set selfOrAncestorHasDirAutoAttribute true but still use HTMLElement for binding. 48 1 49 2012-03-21 Luke Macpherson <macpherson@chromium.org> 2 50 -
trunk/Source/WebCore/GNUmakefile.list.am
r111474 r111632 2217 2217 Source/WebCore/html/HTMLBaseFontElement.cpp \ 2218 2218 Source/WebCore/html/HTMLBaseFontElement.h \ 2219 Source/WebCore/html/HTMLBDIElement.h \ 2219 2220 Source/WebCore/html/HTMLBodyElement.cpp \ 2220 2221 Source/WebCore/html/HTMLBodyElement.h \ -
trunk/Source/WebCore/Target.pri
r111578 r111632 1849 1849 html/HTMLBaseFontElement.h \ 1850 1850 html/HTMLBodyElement.h \ 1851 html/HTMLBDIElement.h \ 1851 1852 html/HTMLBRElement.h \ 1852 1853 html/HTMLButtonElement.h \ -
trunk/Source/WebCore/WebCore.gypi
r111572 r111632 5328 5328 'html/HTMLAudioElement.cpp', 5329 5329 'html/HTMLAudioElement.h', 5330 'html/HTMLBDIElement.h', 5330 5331 'html/HTMLBRElement.cpp', 5331 5332 'html/HTMLBRElement.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r111547 r111632 57675 57675 </File> 57676 57676 <File 57677 RelativePath="..\html\HTMLBDIElement.h" 57678 > 57679 </File> 57680 <File 57677 57681 RelativePath="..\html\HTMLBodyElement.cpp" 57678 57682 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r111474 r111632 3586 3586 9B0FB191140DB5790022588F /* HTTPValidation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B0FB18F140DB5790022588F /* HTTPValidation.cpp */; }; 3587 3587 9B0FB192140DB5790022588F /* HTTPValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B0FB190140DB5790022588F /* HTTPValidation.h */; }; 3588 9B24DE8E15194B9500C59C27 /* HTMLBDIElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B24DE8C15194B9500C59C27 /* HTMLBDIElement.h */; }; 3588 3589 9B2B7AC11509850A008932CC /* MicroDataItemValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B2F7CF714562120007F8B50 /* MicroDataItemValue.cpp */; }; 3589 3590 9B2D8A7914997CCF00ECEF3E /* UndoStep.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B2D8A7814997CCF00ECEF3E /* UndoStep.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 10562 10563 9B0FB18F140DB5790022588F /* HTTPValidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPValidation.cpp; sourceTree = "<group>"; }; 10563 10564 9B0FB190140DB5790022588F /* HTTPValidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPValidation.h; sourceTree = "<group>"; }; 10565 9B24DE8C15194B9500C59C27 /* HTMLBDIElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLBDIElement.h; sourceTree = "<group>"; }; 10564 10566 9B2D8A7814997CCF00ECEF3E /* UndoStep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UndoStep.h; sourceTree = "<group>"; }; 10565 10567 9B2F7CF714562120007F8B50 /* MicroDataItemValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MicroDataItemValue.cpp; sourceTree = "<group>"; }; … … 13643 13645 B22277CA0D00BF1E0071B782 /* svg */, 13644 13646 417DA4CD13734204007C57FB /* testing */, 13645 FD315FA212B025B100C1A359 /* webaudio */,13647 FD315FA212B025B100C1A359 /* Modules/webaudio */, 13646 13648 2E4346310F546A6800B0F1BA /* workers */, 13647 13649 E1F0424309839389006694EA /* xml */, … … 16772 16774 A8DF3FCA097FA0FB0052981B /* HTMLBaseFontElement.h */, 16773 16775 1AE2A9F10A1CDA5700B42B25 /* HTMLBaseFontElement.idl */, 16776 9B24DE8C15194B9500C59C27 /* HTMLBDIElement.h */, 16774 16777 A871DE1D0A152AC800B12A68 /* HTMLBodyElement.cpp */, 16775 16778 A871DE200A152AC800B12A68 /* HTMLBodyElement.h */, … … 21170 21173 sourceTree = "<group>"; 21171 21174 }; 21172 FD315FA212B025B100C1A359 /* webaudio */ = {21175 FD315FA212B025B100C1A359 /* Modules/webaudio */ = { 21173 21176 isa = PBXGroup; 21174 21177 children = ( … … 22691 22694 A871DC1F0A15205700B12A68 /* HTMLBaseElement.h in Headers */, 22692 22695 A8DF3FD2097FA0FC0052981B /* HTMLBaseFontElement.h in Headers */, 22696 9B24DE8E15194B9500C59C27 /* HTMLBDIElement.h in Headers */, 22693 22697 A871DE2C0A152AC800B12A68 /* HTMLBodyElement.h in Headers */, 22694 22698 A8CFF7AA0A156978000A4234 /* HTMLBRElement.h in Headers */, -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r111631 r111632 1274 1274 } 1275 1275 1276 inline bool elementHasDirectionAuto(Element* element) 1277 { 1278 return element->isHTMLElement() && toHTMLElement(element)->hasDirectionAuto(); 1279 } 1280 1276 1281 bool CSSStyleSelector::canShareStyleWithElement(StyledElement* element) const 1277 1282 { … … 1368 1373 #endif 1369 1374 1370 if (e qualIgnoringCase(element->fastGetAttribute(dirAttr), "auto") || equalIgnoringCase(m_element->fastGetAttribute(dirAttr), "auto"))1375 if (elementHasDirectionAuto(element) || elementHasDirectionAuto(m_element)) 1371 1376 return false; 1372 1377 -
trunk/Source/WebCore/html/HTMLElement.cpp
r110263 r111632 796 796 } 797 797 798 static inline bool elementAffectsDirectionality(const Node* node) 799 { 800 return node->isHTMLElement() && (node->hasTagName(bdiTag) || toHTMLElement(node)->hasAttribute(dirAttr)); 801 } 802 798 803 static void setHasDirAutoFlagRecursively(Node* firstNode, bool flag, Node* lastNode = 0) 799 804 { … … 806 811 return; 807 812 808 if ( node->isHTMLElement() && toElement(node)->hasAttribute(dirAttr)) {813 if (elementAffectsDirectionality(node)) { 809 814 if (node == lastNode) 810 815 return; … … 825 830 } 826 831 832 bool HTMLElement::hasDirectionAuto() const 833 { 834 const AtomicString& direction = fastGetAttribute(dirAttr); 835 return (hasTagName(bdiTag) && direction == nullAtom) || equalIgnoringCase(direction, "auto"); 836 } 837 827 838 TextDirection HTMLElement::directionalityIfhasDirAutoAttribute(bool& isAuto) const 828 839 { 829 if (!(selfOrAncestorHasDirAutoAttribute() && equalIgnoringCase(getAttribute(dirAttr), "auto"))) {840 if (!(selfOrAncestorHasDirAutoAttribute() && hasDirectionAuto())) { 830 841 isAuto = false; 831 842 return LTR; … … 900 911 Element* elementToAdjust = this; 901 912 for (; elementToAdjust; elementToAdjust = elementToAdjust->parentElement()) { 902 if (element ToAdjust->hasAttribute(dirAttr)) {913 if (elementAffectsDirectionality(elementToAdjust)) { 903 914 elementToAdjust->setNeedsStyleRecalc(); 904 915 return; … … 922 933 Node* node = beforeChange ? beforeChange->traverseNextSibling() : 0; 923 934 for (int counter = 0; node && counter < childCountDelta; counter++, node = node->traverseNextSibling()) { 924 if ( node->isElementNode() && toElement(node)->hasAttribute(dirAttr))935 if (elementAffectsDirectionality(node)) 925 936 continue; 926 937 … … 933 944 934 945 Node* oldMarkedNode = beforeChange ? beforeChange->traverseNextSibling() : 0; 935 while (oldMarkedNode && oldMarkedNode->isHTMLElement() && toHTMLElement(oldMarkedNode)->hasAttribute(dirAttr))946 while (oldMarkedNode && elementAffectsDirectionality(oldMarkedNode)) 936 947 oldMarkedNode = oldMarkedNode->traverseNextSibling(this); 937 948 if (oldMarkedNode) … … 939 950 940 951 for (Element* elementToAdjust = this; elementToAdjust; elementToAdjust = elementToAdjust->parentElement()) { 941 if (element ToAdjust->isHTMLElement() && elementToAdjust->hasAttribute(dirAttr)) {952 if (elementAffectsDirectionality(elementToAdjust)) { 942 953 toHTMLElement(elementToAdjust)->calculateAndAdjustDirectionality(); 943 954 return; -
trunk/Source/WebCore/html/HTMLElement.h
r110927 r111632 91 91 HTMLFormElement* findFormAncestor() const; 92 92 93 bool hasDirectionAuto() const; 93 94 TextDirection directionalityIfhasDirAutoAttribute(bool& isAuto) const; 94 95 -
trunk/Source/WebCore/html/HTMLTagNames.in
r111532 r111632 16 16 base 17 17 basefont interfaceName=HTMLBaseFontElement 18 bdi interfaceName=HTML Element18 bdi interfaceName=HTMLBDIElement, JSInterfaceName=HTMLElement 19 19 bdo interfaceName=HTMLElement 20 20 bgsound interfaceName=HTMLElement
Note: See TracChangeset
for help on using the changeset viewer.