Changeset 190983 in webkit
- Timestamp:
- Oct 13, 2015, 6:12:25 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r190915 r190983 1 2015-10-12 Antti Koivisto <antti@apple.com> 2 3 Implement iterator for traversing composed DOM 4 https://bugs.webkit.org/show_bug.cgi?id=149997 5 6 Reviewed by Ryosuke Niwa. 7 8 * TestExpectations: 9 10 Re-enable fast/html/details-replace-text.html which is fixed by this change. 11 12 * fast/forms/select-listbox-focus-displaynone-expected.txt: 13 * fast/repaint/text-in-relative-positioned-inline-expected.txt: 14 * fullscreen/full-screen-fixed-pos-parent-expected.txt: 15 * platform/mac-mavericks/fast/html/details-open2-expected.txt: 16 * platform/mac/fast/html/details-add-child-2-expected.txt: 17 * platform/mac/fast/html/details-open2-expected.txt: 18 19 Non-visual whitespace changes. 20 1 21 2015-10-12 Zalan Bujtas <zalan@apple.com> 2 22 -
trunk/LayoutTests/TestExpectations
r190840 r190983 673 673 674 674 webkit.org/b/148695 fast/shadow-dom [ Failure ImageOnlyFailure ] 675 webkit.org/b/149997 fast/html/details-replace-text.html [ Failure ]676 675 677 676 # Marks as flaky (see also https://bugs.webkit.org/show_bug.cgi?id=132388) -
trunk/LayoutTests/fast/forms/select-listbox-focus-displaynone-expected.txt
r166174 r190983 1 1 PASS -
trunk/LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.txt
r166174 r190983 5 5 RenderBody {BODY} at (8,8) size 784x584 6 6 RenderBlock {DIV} at (100,0) size 684x100 7 RenderText {#text} at (0,0) size 0x08 7 RenderBlock {DIV} at (0,0) size 100x100 [bgcolor=#008000] -
trunk/LayoutTests/fullscreen/full-screen-fixed-pos-parent-expected.txt
r166174 r190983 1 1 2 -
trunk/LayoutTests/platform/mac-mavericks/fast/html/details-open2-expected.txt
r190840 r190983 11 11 RenderBlock (anonymous) at (0,18) size 784x23 12 12 RenderTextControl {INPUT} at (2,2) size 146x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)] 13 RenderText {#text} at (0,0) size 0x0 14 RenderText {#text} at (0,0) size 0x0 13 15 layer at (13,31) size 139x13 14 16 RenderBlock {DIV} at (3,3) size 140x13 -
trunk/LayoutTests/platform/mac/fast/html/details-add-child-2-expected.txt
r190840 r190983 13 13 RenderText {#text} at (0,0) size 144x18 14 14 text run at (0,0) width 144: "should have bold test" 15 RenderText {#text} at (0,0) size 0x0 16 RenderText {#text} at (0,0) size 0x0 -
trunk/LayoutTests/platform/mac/fast/html/details-open2-expected.txt
r190840 r190983 11 11 RenderBlock (anonymous) at (0,18) size 784x23 12 12 RenderTextControl {INPUT} at (2,2) size 137x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)] 13 RenderText {#text} at (0,0) size 0x0 14 RenderText {#text} at (0,0) size 0x0 13 15 layer at (13,31) size 130x13 14 16 RenderBlock {DIV} at (3,3) size 131x13 -
trunk/Source/WebCore/CMakeLists.txt
r190884 r190983 1413 1413 dom/CollectionIndexCache.cpp 1414 1414 dom/Comment.cpp 1415 dom/ComposedTreeIterator.cpp 1415 1416 dom/CompositionEvent.cpp 1416 1417 dom/ContainerNode.cpp -
trunk/Source/WebCore/ChangeLog
r190970 r190983 1 2015-10-12 Antti Koivisto <antti@apple.com> 2 3 Implement iterator for traversing composed DOM 4 https://bugs.webkit.org/show_bug.cgi?id=149997 5 6 Reviewed by Ryosuke Niwa. 7 8 ComposedTreeIterator traverses the DOM in composed tree order. This means it enters 9 shadow trees and follows slots created by Shadow DOM API correctly. 10 11 auto children = composedTreeChildren(containerNode); 12 for (auto& composedChild : children) 13 ... 14 15 auto descendants = composedTreeDescendants(containerNode); 16 for (auto& composedDescendant : descendants) 17 ... 18 19 * WebCore.xcodeproj/project.pbxproj: 20 * dom/ComposedTreeIterator.cpp: Added. 21 (WebCore::ComposedTreeIterator::initializeShadowStack): 22 (WebCore::ComposedTreeIterator::traverseNextInShadowTree): 23 (WebCore::ComposedTreeIterator::traverseNextSiblingSlot): 24 (WebCore::ComposedTreeIterator::traversePreviousSiblingSlot): 25 (WebCore::ComposedTreeIterator::traverseParentInShadowTree): 26 * dom/ComposedTreeIterator.h: Added. 27 (WebCore::ComposedTreeIterator::operator*): 28 (WebCore::ComposedTreeIterator::operator->): 29 (WebCore::ComposedTreeIterator::operator==): 30 (WebCore::ComposedTreeIterator::operator!=): 31 (WebCore::ComposedTreeIterator::ShadowContext::ShadowContext): 32 (WebCore::ComposedTreeIterator::ComposedTreeIterator): 33 (WebCore::ComposedTreeIterator::traverseNext): 34 (WebCore::ComposedTreeIterator::traverseNextSibling): 35 (WebCore::ComposedTreeIterator::traversePreviousSibling): 36 (WebCore::ComposedTreeIterator::traverseParent): 37 (WebCore::ComposedTreeChildAdapter::Iterator::Iterator): 38 (WebCore::ComposedTreeChildAdapter::Iterator::operator++): 39 (WebCore::ComposedTreeChildAdapter::Iterator::operator--): 40 (WebCore::ComposedTreeChildAdapter::ComposedTreeChildAdapter): 41 (WebCore::ComposedTreeChildAdapter::begin): 42 (WebCore::ComposedTreeChildAdapter::end): 43 (WebCore::ComposedTreeChildAdapter::at): 44 (WebCore::composedTreeChildren): 45 * dom/NodeRenderingTraversal.cpp: 46 (WebCore::NodeRenderingTraversal::parentSlow): 47 (WebCore::NodeRenderingTraversal::nextInScope): 48 (WebCore::NodeRenderingTraversal::firstChildSlow): Deleted. 49 (WebCore::NodeRenderingTraversal::nextSiblingSlow): Deleted. 50 (WebCore::NodeRenderingTraversal::previousSiblingSlow): Deleted. 51 * dom/NodeRenderingTraversal.h: 52 (WebCore::NodeRenderingTraversal::parent): 53 (WebCore::NodeRenderingTraversal::firstChild): Deleted. 54 (WebCore::NodeRenderingTraversal::nextSibling): Deleted. 55 (WebCore::NodeRenderingTraversal::previousSibling): Deleted. 56 * style/RenderTreePosition.cpp: 57 (WebCore::RenderTreePosition::computeNextSibling): 58 59 Restore the full assert. 60 61 (WebCore::RenderTreePosition::invalidateNextSibling): 62 (WebCore::RenderTreePosition::previousSiblingRenderer): 63 (WebCore::RenderTreePosition::nextSiblingRenderer): 64 65 Make these member functions. 66 Use the iterator. This is fixes some bugs and allows enabling a test case. 67 68 * style/RenderTreePosition.h: 69 * style/StyleResolveTree.cpp: 70 (WebCore::Style::textRendererIsNeeded): 71 1 72 2015-10-13 ChangSeok Oh <changseok.oh@collabora.com> 2 73 -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r190845 r190983 1 <?xml version="1.0" encoding="utf-8"?>1 <?xml version="1.0" encoding="utf-8"?> 2 2 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 3 <ItemGroup Label="ProjectConfigurations"> … … 13705 13705 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild> 13706 13706 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild> 13707 </ClCompile> 13708 <ClCompile Include="..\dom\ComposedTreeIterator.cpp"> 13709 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> 13710 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> 13711 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild> 13712 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild> 13713 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild> 13714 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild> 13715 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> 13716 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> 13717 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild> 13718 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild> 13719 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild> 13720 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild> 13707 13721 </ClCompile> 13708 13722 <ClCompile Include="..\dom\CompositionEvent.cpp"> … … 21950 21964 <ClInclude Include="..\dom\CollectionIndexCache.h" /> 21951 21965 <ClInclude Include="..\dom\Comment.h" /> 21966 <ClInclude Include="..\dom\ComposedTreeIterator.h" /> 21952 21967 <ClInclude Include="..\dom\CompositionEvent.h" /> 21953 21968 <ClInclude Include="..\dom\ContainerNode.h" /> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r190884 r190983 6423 6423 E44B4BB4141650D7002B1D8B /* SelectorChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = E44B4BB2141650D7002B1D8B /* SelectorChecker.h */; }; 6424 6424 E44EE3A817577EBD00EEE8CF /* FontGenericFamilies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44EE3A617576E5500EEE8CF /* FontGenericFamilies.cpp */; }; 6425 E44FA1851BCA6B5A0091B6EF /* ComposedTreeIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E44FA1841BCA6B5A0091B6EF /* ComposedTreeIterator.h */; settings = {ASSET_TAGS = (); }; }; 6426 E44FA1871BCA91560091B6EF /* ComposedTreeIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44FA1861BCA91560091B6EF /* ComposedTreeIterator.cpp */; settings = {ASSET_TAGS = (); }; }; 6425 6427 E45322AB140CE267005A0F92 /* SelectorQuery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45322A9140CE267005A0F92 /* SelectorQuery.cpp */; }; 6426 6428 E45322AC140CE267005A0F92 /* SelectorQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = E45322AA140CE267005A0F92 /* SelectorQuery.h */; }; … … 14241 14243 E44EE3A617576E5500EEE8CF /* FontGenericFamilies.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FontGenericFamilies.cpp; sourceTree = "<group>"; }; 14242 14244 E44EE3A717576E5500EEE8CF /* FontGenericFamilies.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontGenericFamilies.h; sourceTree = "<group>"; }; 14245 E44FA1841BCA6B5A0091B6EF /* ComposedTreeIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComposedTreeIterator.h; sourceTree = "<group>"; }; 14246 E44FA1861BCA91560091B6EF /* ComposedTreeIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComposedTreeIterator.cpp; sourceTree = "<group>"; }; 14243 14247 E45322A9140CE267005A0F92 /* SelectorQuery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectorQuery.cpp; sourceTree = "<group>"; }; 14244 14248 E45322AA140CE267005A0F92 /* SelectorQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectorQuery.h; sourceTree = "<group>"; }; … … 23526 23530 6550B698099DF0270090D781 /* Comment.h */, 23527 23531 85089CC70A98C22600A275AA /* Comment.idl */, 23532 E44FA1861BCA91560091B6EF /* ComposedTreeIterator.cpp */, 23533 E44FA1841BCA6B5A0091B6EF /* ComposedTreeIterator.h */, 23528 23534 79F2F59E1091939A000D87CB /* CompositionEvent.cpp */, 23529 23535 79F2F59F1091939A000D87CB /* CompositionEvent.h */, … … 26124 26130 A83B79050CCAFF15000B0825 /* JSSVGFontFaceElement.h in Headers */, 26125 26131 A83B79000CCAFF15000B0825 /* JSSVGFontFaceFormatElement.h in Headers */, 26132 E44FA1851BCA6B5A0091B6EF /* ComposedTreeIterator.h in Headers */, 26126 26133 A83B79020CCAFF15000B0825 /* JSSVGFontFaceNameElement.h in Headers */, 26127 26134 A83B78FE0CCAFF15000B0825 /* JSSVGFontFaceSrcElement.h in Headers */, … … 29981 29988 A513B3D8114B166A001C429B /* KeyEventCocoa.mm in Sources */, 29982 29989 2655413A1489811C000DFC5D /* KeyEventIOS.mm in Sources */, 29990 E44FA1871BCA91560091B6EF /* ComposedTreeIterator.cpp in Sources */, 29983 29991 935C477009AC4D7300A6AAB4 /* KeyEventMac.mm in Sources */, 29984 29992 316FE1190E6E1DA700BF6088 /* KeyframeAnimation.cpp in Sources */, -
trunk/Source/WebCore/dom/DOMAllInOne.cpp
r190840 r190983 43 43 #include "CollectionIndexCache.cpp" 44 44 #include "Comment.cpp" 45 #include "ComposedTreeIterator.cpp" 45 46 #include "CompositionEvent.cpp" 46 47 #include "ContainerNode.cpp" -
trunk/Source/WebCore/dom/NodeRenderingTraversal.cpp
r190845 r190983 96 96 } 97 97 98 Node* firstChildSlow(const Node* node)99 {100 ASSERT(!node->isShadowRoot());101 102 return traverseFirstChild(node, DontCrossShadowRoot);103 }104 105 Node* nextSiblingSlow(const Node* node)106 {107 ASSERT(!node->isShadowRoot());108 109 return traverseNextSibling(node);110 }111 112 Node* previousSiblingSlow(const Node* node)113 {114 ASSERT(!node->isShadowRoot());115 116 return traversePreviousSibling(node);117 }118 119 98 Node* nextInScope(const Node* node) 120 99 { -
trunk/Source/WebCore/dom/NodeRenderingTraversal.h
r165465 r190983 36 36 37 37 ContainerNode* parent(const Node*); 38 Node* firstChild(const Node*);39 Node* nextSibling(const Node*);40 Node* previousSibling(const Node*);41 38 42 39 Node* nextInScope(const Node*); … … 46 43 47 44 ContainerNode* parentSlow(const Node*); 48 Node* firstChildSlow(const Node*);49 Node* nextSiblingSlow(const Node*);50 Node* previousSiblingSlow(const Node*);51 45 52 46 inline ContainerNode* parent(const Node* node) … … 60 54 } 61 55 62 inline Node* firstChild(const Node* node)63 {64 ASSERT(!node->isPseudoElement());65 if (node->needsNodeRenderingTraversalSlowPath())66 return firstChildSlow(node);67 68 ASSERT(nextSiblingSlow(node) == node->nextSibling());69 return node->firstChild();70 }71 72 inline Node* nextSibling(const Node* node)73 {74 ASSERT(!node->isPseudoElement());75 if (node->needsNodeRenderingTraversalSlowPath())76 return nextSiblingSlow(node);77 78 ASSERT(nextSiblingSlow(node) == node->nextSibling());79 return node->nextSibling();80 }81 82 inline Node* previousSibling(const Node* node)83 {84 ASSERT(!node->isPseudoElement());85 if (node->needsNodeRenderingTraversalSlowPath())86 return previousSiblingSlow(node);87 88 ASSERT(previousSiblingSlow(node) == node->previousSibling());89 return node->previousSibling();90 }91 92 56 } 93 57 -
trunk/Source/WebCore/style/RenderTreePosition.cpp
r190840 r190983 27 27 #include "RenderTreePosition.h" 28 28 29 #include "ComposedTreeIterator.h" 29 30 #include "NodeRenderingTraversal.h" 30 31 #include "PseudoElement.h" … … 41 42 const unsigned oNSquaredAvoidanceLimit = 20; 42 43 bool skipAssert = m_parent.isRenderView() || ++m_assertionLimitCounter > oNSquaredAvoidanceLimit; 43 // FIXME: Traversal needs to know about slots and this needs be removed. 44 skipAssert = skipAssert || (node.parentElement() && node.parentElement()->shadowRoot()); 45 46 ASSERT(skipAssert || nextSiblingRenderer(node, m_parent) == m_nextSibling); 44 ASSERT(skipAssert || nextSiblingRenderer(node) == m_nextSibling); 47 45 #endif 48 46 return; 49 47 } 50 m_nextSibling = nextSiblingRenderer(node , m_parent);48 m_nextSibling = nextSiblingRenderer(node); 51 49 m_hasValidNextSibling = true; 52 50 } … … 60 58 } 61 59 62 RenderObject* RenderTreePosition::previousSiblingRenderer(const Text& textNode) 60 RenderObject* RenderTreePosition::previousSiblingRenderer(const Text& textNode) const 63 61 { 64 62 if (textNode.renderer()) 65 63 return textNode.renderer()->previousSibling(); 66 for (Node* sibling = NodeRenderingTraversal::previousSibling(&textNode); sibling; sibling = NodeRenderingTraversal::previousSibling(sibling)) { 67 RenderObject* renderer = sibling->renderer(); 64 65 auto* parentElement = m_parent.element(); 66 67 auto composedChildren = composedTreeChildren(*parentElement); 68 for (auto it = composedChildren.at(textNode), end = composedChildren.end(); it != end; --it) { 69 RenderObject* renderer = it->renderer(); 68 70 if (renderer && !RenderTreePosition::isRendererReparented(*renderer)) 69 71 return renderer; 70 72 } 71 if (auto* parent = textNode.parentElement()) { 72 if (auto* before = parent->beforePseudoElement()) 73 return before->renderer(); 74 } 73 if (auto* before = parentElement->beforePseudoElement()) 74 return before->renderer(); 75 75 return nullptr; 76 76 } 77 77 78 RenderObject* RenderTreePosition::nextSiblingRenderer(const Node& node , const RenderElement& parentRenderer)78 RenderObject* RenderTreePosition::nextSiblingRenderer(const Node& node) const 79 79 { 80 if (!parentRenderer.element()) 80 auto* parentElement = m_parent.element(); 81 if (!parentElement) 81 82 return nullptr; 82 83 if (node.isAfterPseudoElement()) 83 84 return nullptr; 84 Node* sibling = node.isBeforePseudoElement() ? NodeRenderingTraversal::firstChild(parentRenderer.element()) : NodeRenderingTraversal::nextSibling(&node); 85 for (; sibling; sibling = NodeRenderingTraversal::nextSibling(sibling)) { 86 RenderObject* renderer = sibling->renderer(); 85 86 auto composedChildren = composedTreeChildren(*parentElement); 87 88 auto it = node.isBeforePseudoElement() ? composedChildren.begin() : composedChildren.at(node); 89 for (auto end = composedChildren.end(); it != end; ++it) { 90 RenderObject* renderer = it->renderer(); 87 91 if (renderer && !isRendererReparented(*renderer)) 88 92 return renderer; 89 93 } 90 if (PseudoElement* after = parent Renderer.element()->afterPseudoElement())94 if (PseudoElement* after = parentElement->afterPseudoElement()) 91 95 return after->renderer(); 92 96 return nullptr; -
trunk/Source/WebCore/style/RenderTreePosition.h
r183160 r190983 62 62 void invalidateNextSibling(const RenderObject&); 63 63 64 static RenderObject* previousSiblingRenderer(const Text&);65 static RenderObject* nextSiblingRenderer(const Node&, const RenderElement& parentRenderer);64 RenderObject* previousSiblingRenderer(const Text&) const; 65 RenderObject* nextSiblingRenderer(const Node&) const; 66 66 static bool isRendererReparented(const RenderObject&); 67 67 -
trunk/Source/WebCore/style/StyleResolveTree.cpp
r190840 r190983 31 31 #include "AuthorStyleSheets.h" 32 32 #include "CSSFontSelector.h" 33 #include "ComposedTreeIterator.h" 33 34 #include "ElementIterator.h" 34 35 #include "ElementRareData.h" … … 263 264 return true; 264 265 265 RenderObject* previousRenderer = RenderTreePosition::previousSiblingRenderer(textNode);266 RenderObject* previousRenderer = renderTreePosition.previousSiblingRenderer(textNode); 266 267 if (previousRenderer && previousRenderer->isBR()) // <span><br/> <br/></span> 267 268 return false; … … 278 279 while (first && first->isFloatingOrOutOfFlowPositioned()) 279 280 first = first->nextSibling(); 280 RenderObject* nextRenderer = RenderTreePosition::nextSiblingRenderer(textNode, parentRenderer);281 RenderObject* nextRenderer = renderTreePosition.nextSiblingRenderer(textNode); 281 282 if (!first || nextRenderer == first) { 282 283 // Whitespace at the start of a block just goes away. Don't even make a render object for this text.
Note:
See TracChangeset
for help on using the changeset viewer.