Changeset 258508 in webkit
- Timestamp:
- Mar 16, 2020, 10:34:43 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r258504 r258508 1 2020-03-16 Daniel Bates <dabates@apple.com> 2 3 ASSERTION FAILURE: !result.innerNode() || (request.resultIsElementList() && result.listBasedTestResult().size()) in RenderLayer::hitTestContents() 4 https://bugs.webkit.org/show_bug.cgi?id=209112 5 6 Reviewed by Darin Adler. 7 8 Add a new test for an pseudo element. 9 10 Also update tests now that I added the RenderView::nodeForHitTest(), which returns the 11 same hit test node (the document element) as used in RenderView::updateHitTestResult(). 12 Currently RenderView::nodeForHitTest() would actually fall back to RenderBlock::nodeForHitTest(), 13 which returned the document (seen in the test resutls as #document). 14 15 * fast/dom/nodesFromRect/nodesFromRect-child-frame-content.html: Update test to match new results. 16 * fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content.html: Ditto. 17 * fast/dom/nodesFromRect/pseudo-empty-svg-image-crash-expected.txt: Added. 18 * fast/dom/nodesFromRect/pseudo-empty-svg-image-crash.html: Added. 19 1 20 2020-03-16 Youenn Fablet <youenn@apple.com> 2 21 -
trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-child-frame-content.html
r155265 r258508 57 57 checkRect(250, 20, 100, 70, "DIV#right, DIV#left, HTML"); 58 58 59 checkRect(150, 50, 100, 100, "DIV#left, HTML, #document,IFRAME#iframe1, DIV#layer, DIV#div2, DIV#div1, DIV#sandbox");59 checkRect(150, 50, 100, 100, "DIV#left, HTML, IFRAME#iframe1, DIV#layer, DIV#div2, DIV#div1, DIV#sandbox"); 60 60 61 61 e.layer.setAttribute('class', 'rotate180'); 62 62 checkRect(220, 20, 70, 70, "DIV#right"); 63 checkRect(150, 50, 100, 100, "DIV#right, HTML, #document,IFRAME#iframe1, DIV#layer, DIV#div2, DIV#div1, DIV#sandbox");63 checkRect(150, 50, 100, 100, "DIV#right, HTML, IFRAME#iframe1, DIV#layer, DIV#div2, DIV#div1, DIV#sandbox"); 64 64 65 65 e.layer.setAttribute('class', 'rotate90'); 66 66 checkRect(250, 20, 100, 70, "DIV#left"); 67 checkRect(150, 20, 200, 60, "DIV#left, HTML, #document,IFRAME#iframe1, DIV#layer, DIV#div1, DIV#sandbox");67 checkRect(150, 20, 200, 60, "DIV#left, HTML, IFRAME#iframe1, DIV#layer, DIV#div1, DIV#sandbox"); 68 68 69 69 e.sandbox.display = 'none'; -
trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content.html
r155265 r258508 56 56 checkRect(250, 20, 100, 70, "DIV#right, DIV#left, HTML"); 57 57 58 checkRect(150, 50, 100, 100, "DIV#right, HTML, #document, OBJECT#childframe2, DIV#left, HTML, #document, EMBED#childframe1, DIV#sandbox");58 checkRect(150, 50, 100, 100, "DIV#right, HTML, OBJECT#childframe2, DIV#left, HTML, EMBED#childframe1, DIV#sandbox"); 59 59 60 60 -
trunk/LayoutTests/imported/w3c/ChangeLog
r258502 r258508 1 2020-03-16 Daniel Bates <dabates@apple.com> 2 3 ASSERTION FAILURE: !result.innerNode() || (request.resultIsElementList() && result.listBasedTestResult().size()) in RenderLayer::hitTestContents() 4 https://bugs.webkit.org/show_bug.cgi?id=209112 5 6 Reviewed by Darin Adler. 7 8 Update test result now that more sub-tests are passing. 9 10 * web-platform-tests/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint-expected.txt: 11 1 12 2020-03-16 youenn fablet <youenn@apple.com> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint-expected.txt
r250696 r258508 40 40 PASS document.elementsFromPoint must return the shadow host and its ancestors and shadowRoot.elementsFromPoint must return the slot parent of the fallback text and its non-shadow ancestors when the hit-tested text node is a fallback content and the host has display: block 41 41 PASS document.elementsFromPoint must return the shadow host and its ancestors and shadowRoot.elementsFromPoint must return the slot parent of the fallback text and its non-shadow ancestors when the hit-tested text node is a fallback content and the host has display: inline-block 42 FAIL shadowRoot.elementsFromPoint must behave the same with document.elementsFromPoint regarding HTML element assert_array_equals: lengths differ, expected 5 got 4 43 FAIL elementsFromPoint should return all elements under a point, even when context object is not connected assert_equals: expected 4 but got 3 42 PASS shadowRoot.elementsFromPoint must behave the same with document.elementsFromPoint regarding HTML element 43 PASS elementsFromPoint should return all elements under a point, even when context object is not connected 44 44 -
trunk/Source/WebCore/ChangeLog
r258506 r258508 1 2020-03-16 Daniel Bates <dabates@apple.com> 2 3 ASSERTION FAILURE: !result.innerNode() || (request.resultIsElementList() && result.listBasedTestResult().size()) in RenderLayer::hitTestContents() 4 https://bugs.webkit.org/show_bug.cgi?id=209112 5 6 Reviewed by Darin Adler. 7 8 Fix rect-based hit testing (e.g. used in the impl of document.elementsFromPoint()) of ::before 9 and ::after pseudo elements. Same issue as in r133330, updateHitTestResult() and addNodeToRectBasedTestResult() 10 are using different "hit" nodes. In particular, RenderObject::updateHitTestResult() knows how to 11 reason about ::before and ::after pseudo elements, but addNodeToRectBasedTestResult() cannot. 12 Standardize the concept of the node used for hit testing from something-specifically added to RenderBlock 13 in r133330 to all renderers. Have both updateHitTestResult() and addNodeToRectBasedTestResult() 14 make use of this concept so that they consider the same hit node. 15 16 Test: fast/dom/nodesFromRect/pseudo-empty-svg-image-crash.html 17 18 * layout/integration/LayoutIntegrationLineLayout.cpp: 19 (WebCore::LayoutIntegration::LineLayout::hitTest): 20 * rendering/EllipsisBox.cpp: 21 (WebCore::EllipsisBox::nodeAtPoint): 22 * rendering/InlineFlowBox.cpp: 23 (WebCore::InlineFlowBox::nodeAtPoint): 24 * rendering/InlineTextBox.cpp: 25 (WebCore::InlineTextBox::nodeAtPoint): 26 Update code to call nodeForHitTest() to keep the code behavior we have today. Note that RenderElement::element() 27 and RenderText::textNode() just cast the return value of RenderObject::node(). 28 * rendering/RenderBlock.cpp: 29 (WebCore::RenderBlock::nodeForHitTest const): Remove special case for RenderView now that I added RenderView::nodeForHitTest(). 30 Moreover, this special case was returning the document even though RenderView::updateHitTestResult() hit 31 test the document element. See remarks for RenderView::nodeForHitTest() for more details. 32 * rendering/RenderBlock.h: 33 * rendering/RenderBox.cpp: 34 (WebCore::RenderBox::nodeAtPoint): Use nodeForHitTest(). This fixes the bug. Currently, updateHitTestResult() 35 knows that when RenderObject::node() is nullptr and the parent renderer is for generated content that it can 36 walk up the hierarchy to find the hit PseudoElement. But in the call to addNodeToListBasedTestResult(), RenderObject::element() 37 was passed, which is nullptr for an anonymous node, and addNodeToListBasedTestResult() doesn't have enough info 38 to know that this means generated content was hit and hence it is not able to find the PseudoElement. This 39 disagreement caused the assertion failure because updateHitTestResult() would update the inner node, but 40 addNodeToListBasedTestResult() would not add a node to the set. 41 * rendering/RenderInline.cpp: 42 (WebCore::RenderInline::hitTestCulledInline): Use nodeForHitTest(). 43 (WebCore::RenderInline::updateHitTestResult): Update code as needed to use nodeForHitTest(). Also while I 44 am here fix up code style of comment and rename the local from element to node to match the return value 45 of nodeForHitTest(). 46 * rendering/RenderMultiColumnSet.cpp: 47 (WebCore::RenderMultiColumnSet::nodeForHitTest const): Added. 48 (WebCore::RenderMultiColumnSet::updateHitTestResult): Update code as needed to use nodeForHitTest(). 49 * rendering/RenderMultiColumnSet.h: 50 * rendering/RenderObject.cpp: 51 (WebCore::RenderObject::nodeForHitTest const): Added. 52 (WebCore::RenderObject::updateHitTestResult): Update code as needed to use nodeForHitTest(). 53 * rendering/RenderObject.h: 54 * rendering/RenderTable.cpp: 55 (WebCore::RenderTable::nodeAtPoint): Ditto. 56 * rendering/RenderView.cpp: 57 (WebCore::RenderView::nodeForHitTest const): Added. This overrides RenderBlock::nodeForHitTest(), which 58 following r155370 was returning the document as the hit test node even though RenderView::updateHitTestResult() 59 considered the document element as the hit node for a RenderView. As a result of this change, the rect-based 60 hit testing no longer returns the document (seen in test results as #document) in the list of nodes. 61 (WebCore::RenderView::updateHitTestResult): Update code as needed to use nodeForHitTest(). 62 * rendering/RenderView.h: 63 * rendering/SimpleLineLayoutFunctions.cpp: 64 (WebCore::SimpleLineLayout::hitTestFlow): Ditto. 65 * rendering/svg/RenderSVGContainer.cpp: 66 (WebCore::RenderSVGContainer::nodeAtFloatPoint): Ditto. 67 * rendering/svg/RenderSVGImage.cpp: 68 (WebCore::RenderSVGImage::nodeAtFloatPoint): Ditto. 69 * rendering/svg/RenderSVGRoot.cpp: 70 (WebCore::RenderSVGRoot::nodeAtPoint): Ditto. 71 * rendering/svg/RenderSVGShape.cpp: 72 (WebCore::RenderSVGShape::nodeAtFloatPoint): Ditto. 73 * rendering/svg/SVGInlineTextBox.cpp: 74 (WebCore::SVGInlineTextBox::nodeAtPoint): Ditto. 75 1 76 2020-03-16 Youenn Fablet <youenn@apple.com> 2 77 -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
r257637 r258508 350 350 351 351 renderer.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset)); 352 if (result.addNodeToListBasedTestResult(renderer.node (), request, locationInContainer, runRect) == HitTestProgress::Stop)352 if (result.addNodeToListBasedTestResult(renderer.nodeForHitTest(), request, locationInContainer, runRect) == HitTestProgress::Stop) 353 353 return true; 354 354 } -
trunk/Source/WebCore/rendering/EllipsisBox.cpp
r256196 r258508 164 164 if (visibleToHitTesting() && boundsRect.intersects(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) { 165 165 blockFlow().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation)); 166 if (result.addNodeToListBasedTestResult(blockFlow(). element(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)166 if (result.addNodeToListBasedTestResult(blockFlow().nodeForHitTest(), request, locationInContainer, boundsRect) == HitTestProgress::Stop) 167 167 return true; 168 168 } -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r256196 r258508 1142 1142 if (locationInContainer.intersects(rect)) { 1143 1143 renderer().updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(accumulatedOffset))); // Don't add in m_x or m_y here, we want coords in the containing block's space. 1144 if (result.addNodeToListBasedTestResult(renderer(). element(), request, locationInContainer, rect) == HitTestProgress::Stop)1144 if (result.addNodeToListBasedTestResult(renderer().nodeForHitTest(), request, locationInContainer, rect) == HitTestProgress::Stop) 1145 1145 return true; 1146 1146 } -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r258129 r258508 386 386 if (locationInContainer.intersects(rect)) { 387 387 renderer().updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(accumulatedOffset))); 388 if (result.addNodeToListBasedTestResult(renderer(). textNode(), request, locationInContainer, rect) == HitTestProgress::Stop)388 if (result.addNodeToListBasedTestResult(renderer().nodeForHitTest(), request, locationInContainer, rect) == HitTestProgress::Stop) 389 389 return true; 390 390 } -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r258416 r258508 1991 1991 // continuation we're actually still inside the enclosing element 1992 1992 // that was split. Use the appropriate inner node. 1993 if (isRenderView())1994 return &document();1995 1993 return continuation() ? continuation()->element() : element(); 1996 1994 } -
trunk/Source/WebCore/rendering/RenderBlock.h
r258416 r258508 398 398 void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override; 399 399 400 // Public for EllipsisBox 401 Node* nodeForHitTest() const override; 402 400 403 protected: 401 404 virtual void addOverflowFromChildren(); … … 436 439 bool isSelfCollapsingBlock() const override; 437 440 virtual bool childrenPreventSelfCollapsing() const; 438 439 Node* nodeForHitTest() const;440 441 441 442 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow -
trunk/Source/WebCore/rendering/RenderBox.cpp
r258336 r258508 1252 1252 if (visibleToHitTesting() && action == HitTestForeground && locationInContainer.intersects(boundsRect)) { 1253 1253 updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation)); 1254 if (result.addNodeToListBasedTestResult( element(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)1254 if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, locationInContainer, boundsRect) == HitTestProgress::Stop) 1255 1255 return true; 1256 1256 } -
trunk/Source/WebCore/rendering/RenderInline.cpp
r258416 r258508 561 561 // We cannot use addNodeToListBasedTestResult to determine if we fully enclose the hit-test area 562 562 // because it can only handle rectangular targets. 563 result.addNodeToListBasedTestResult( element(), request, locationInContainer);563 result.addNodeToListBasedTestResult(nodeForHitTest(), request, locationInContainer); 564 564 return regionResult.contains(tmpLocation.boundingBox()); 565 565 } … … 1037 1037 1038 1038 LayoutPoint localPoint(point); 1039 if ( Element* element = this->element()) {1039 if (auto* node = nodeForHitTest()) { 1040 1040 if (isContinuation()) { 1041 // We're in the continuation of a split inline. Adjust our local point to be in the coordinate space 1042 // of the principal renderer's containing block. This will end up being the innerNonSharedNode. 1043 RenderBlock* firstBlock = element->renderer()->containingBlock(); 1044 1045 // Get our containing block. 1046 RenderBox* block = containingBlock(); 1047 localPoint.moveBy(block->location() - firstBlock->locationOffset()); 1041 // We're in the continuation of a split inline. Adjust our local point to be in the coordinate space 1042 // of the principal renderer's containing block. This will end up being the innerNonSharedNode. 1043 auto* firstBlock = node->renderer()->containingBlock(); 1044 localPoint.moveBy(containingBlock()->location() - firstBlock->locationOffset()); 1048 1045 } 1049 1046 1050 result.setInnerNode( element);1047 result.setInnerNode(node); 1051 1048 if (!result.innerNonSharedNode()) 1052 result.setInnerNonSharedNode( element);1049 result.setInnerNonSharedNode(node); 1053 1050 result.setLocalPoint(localPoint); 1054 1051 } -
trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp
r245543 r258508 965 965 } 966 966 967 Node* RenderMultiColumnSet::nodeForHitTest() const 968 { 969 return document().documentElement(); 970 } 971 967 972 void RenderMultiColumnSet::updateHitTestResult(HitTestResult& result, const LayoutPoint& point) 968 973 { … … 972 977 // Note this does not work with column spans, but once we implement RenderPageSet, we can move this code 973 978 // over there instead (and spans of course won't be allowed on pages). 974 Node* node = document().documentElement(); 975 if (node) { 979 if (auto* node = nodeForHitTest()) { 976 980 result.setInnerNode(node); 977 981 if (!result.innerNonSharedNode()) -
trunk/Source/WebCore/rendering/RenderMultiColumnSet.h
r245543 r258508 137 137 void layout() override; 138 138 139 Node* nodeForHitTest() const override; 140 139 141 LogicalExtentComputedValues computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop) const override; 140 142 -
trunk/Source/WebCore/rendering/RenderObject.cpp
r258416 r258508 1553 1553 } 1554 1554 1555 void RenderObject::updateHitTestResult(HitTestResult& result, const LayoutPoint& point) 1556 { 1557 if (result.innerNode()) 1558 return; 1559 1560 Node* node = this->node(); 1561 1555 Node* RenderObject::nodeForHitTest() const 1556 { 1557 auto* node = this->node(); 1562 1558 // If we hit the anonymous renderers inside generated content we should 1563 1559 // actually hit the generated content so walk up to the PseudoElement. … … 1566 1562 node = renderer->element(); 1567 1563 } 1568 1569 if (node) { 1564 return node; 1565 } 1566 1567 void RenderObject::updateHitTestResult(HitTestResult& result, const LayoutPoint& point) 1568 { 1569 if (result.innerNode()) 1570 return; 1571 1572 if (auto* node = nodeForHitTest()) { 1570 1573 result.setInnerNode(node); 1571 1574 if (!result.innerNonSharedNode()) -
trunk/Source/WebCore/rendering/RenderObject.h
r258416 r258508 554 554 555 555 bool hitTest(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestFilter = HitTestAll); 556 virtual Node* nodeForHitTest() const; 556 557 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&); 558 557 559 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction); 558 560 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r253139 r258508 1545 1545 if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && locationInContainer.intersects(boundsRect)) { 1546 1546 updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(adjustedLocation))); 1547 if (result.addNodeToListBasedTestResult( element(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)1547 if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, locationInContainer, boundsRect) == HitTestProgress::Stop) 1548 1548 return true; 1549 1549 } -
trunk/Source/WebCore/rendering/RenderView.cpp
r256911 r258508 663 663 } 664 664 665 Node* RenderView::nodeForHitTest() const 666 { 667 return document().documentElement(); 668 } 669 665 670 void RenderView::updateHitTestResult(HitTestResult& result, const LayoutPoint& point) 666 671 { … … 671 676 return multiColumnFlow()->firstMultiColumnSet()->updateHitTestResult(result, point); 672 677 673 Node* node = document().documentElement(); 674 if (node) { 678 if (auto* node = nodeForHitTest()) { 675 679 result.setInnerNode(node); 676 680 if (!result.innerNonSharedNode()) -
trunk/Source/WebCore/rendering/RenderView.h
r256911 r258508 212 212 bool isScrollableOrRubberbandableBox() const override; 213 213 214 Node* nodeForHitTest() const override; 215 214 216 private: 215 217 FrameView& m_frameView; -
trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
r254339 r258508 171 171 continue; 172 172 renderer.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset)); 173 if (result.addNodeToListBasedTestResult(renderer.node (), request, locationInContainer, lineRect) == HitTestProgress::Stop)173 if (result.addNodeToListBasedTestResult(renderer.nodeForHitTest(), request, locationInContainer, lineRect) == HitTestProgress::Stop) 174 174 return true; 175 175 } -
trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp
r239461 r258508 178 178 if (request.type() & HitTestRequest::AccessibilityHitTest && m_objectBoundingBox.contains(localPoint)) { 179 179 updateHitTestResult(result, LayoutPoint(localPoint)); 180 if (result.addNodeToListBasedTestResult( &element(), request, localPoint) == HitTestProgress::Stop)180 if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, localPoint) == HitTestProgress::Stop) 181 181 return true; 182 182 } -
trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp
r251378 r258508 230 230 if (m_objectBoundingBox.contains(localPoint)) { 231 231 updateHitTestResult(result, LayoutPoint(localPoint)); 232 if (result.addNodeToListBasedTestResult( &imageElement(), request, localPoint) == HitTestProgress::Stop)232 if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, localPoint) == HitTestProgress::Stop) 233 233 return true; 234 234 } -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp
r239461 r258508 427 427 if (locationInContainer.intersects(boundsRect)) { 428 428 updateHitTestResult(result, pointInBorderBox); 429 if (result.addNodeToListBasedTestResult( &svgSVGElement(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)429 if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, locationInContainer, boundsRect) == HitTestProgress::Stop) 430 430 return true; 431 431 } -
trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp
r253916 r258508 378 378 || (hitRules.canHitBoundingBox && objectBoundingBox().contains(localPoint))) { 379 379 updateHitTestResult(result, LayoutPoint(localPoint)); 380 if (result.addNodeToListBasedTestResult( &graphicsElement(), request, localPoint) == HitTestProgress::Stop)380 if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, localPoint) == HitTestProgress::Stop) 381 381 return true; 382 382 } -
trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
r256196 r258508 669 669 if (fragmentQuad.containsPoint(locationInContainer.point())) { 670 670 renderer().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset)); 671 if (result.addNodeToListBasedTestResult( &renderer().textNode(), request, locationInContainer, rect) == HitTestProgress::Stop)671 if (result.addNodeToListBasedTestResult(renderer().nodeForHitTest(), request, locationInContainer, rect) == HitTestProgress::Stop) 672 672 return true; 673 673 }
Note:
See TracChangeset
for help on using the changeset viewer.