Changeset 258508 in webkit


Ignore:
Timestamp:
Mar 16, 2020 10:34:43 AM (4 years ago)
Author:
dbates@webkit.org
Message:
ASSERTION FAILURE: !result.innerNode()
(request.resultIsElementList() && result.listBasedTestResult().size()) in RenderLayer::hitTestContents()

https://bugs.webkit.org/show_bug.cgi?id=209112

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Update test result now that more sub-tests are passing.

  • web-platform-tests/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint-expected.txt:

Source/WebCore:

Fix rect-based hit testing (e.g. used in the impl of document.elementsFromPoint()) of ::before
and ::after pseudo elements. Same issue as in r133330, updateHitTestResult() and addNodeToRectBasedTestResult()
are using different "hit" nodes. In particular, RenderObject::updateHitTestResult() knows how to
reason about ::before and ::after pseudo elements, but addNodeToRectBasedTestResult() cannot.
Standardize the concept of the node used for hit testing from something-specifically added to RenderBlock
in r133330 to all renderers. Have both updateHitTestResult() and addNodeToRectBasedTestResult()
make use of this concept so that they consider the same hit node.

Test: fast/dom/nodesFromRect/pseudo-empty-svg-image-crash.html

  • layout/integration/LayoutIntegrationLineLayout.cpp:

(WebCore::LayoutIntegration::LineLayout::hitTest):

  • rendering/EllipsisBox.cpp:

(WebCore::EllipsisBox::nodeAtPoint):

  • rendering/InlineFlowBox.cpp:

(WebCore::InlineFlowBox::nodeAtPoint):

  • rendering/InlineTextBox.cpp:

(WebCore::InlineTextBox::nodeAtPoint):
Update code to call nodeForHitTest() to keep the code behavior we have today. Note that RenderElement::element()
and RenderText::textNode() just cast the return value of RenderObject::node().

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::nodeForHitTest const): Remove special case for RenderView now that I added RenderView::nodeForHitTest().
Moreover, this special case was returning the document even though RenderView::updateHitTestResult() hit
test the document element. See remarks for RenderView::nodeForHitTest() for more details.

  • rendering/RenderBlock.h:
  • rendering/RenderBox.cpp:

(WebCore::RenderBox::nodeAtPoint): Use nodeForHitTest(). This fixes the bug. Currently, updateHitTestResult()
knows that when RenderObject::node() is nullptr and the parent renderer is for generated content that it can
walk up the hierarchy to find the hit PseudoElement. But in the call to addNodeToListBasedTestResult(), RenderObject::element()
was passed, which is nullptr for an anonymous node, and addNodeToListBasedTestResult() doesn't have enough info
to know that this means generated content was hit and hence it is not able to find the PseudoElement. This
disagreement caused the assertion failure because updateHitTestResult() would update the inner node, but
addNodeToListBasedTestResult() would not add a node to the set.

  • rendering/RenderInline.cpp:

(WebCore::RenderInline::hitTestCulledInline): Use nodeForHitTest().
(WebCore::RenderInline::updateHitTestResult): Update code as needed to use nodeForHitTest(). Also while I
am here fix up code style of comment and rename the local from element to node to match the return value
of nodeForHitTest().

  • rendering/RenderMultiColumnSet.cpp:

(WebCore::RenderMultiColumnSet::nodeForHitTest const): Added.
(WebCore::RenderMultiColumnSet::updateHitTestResult): Update code as needed to use nodeForHitTest().

  • rendering/RenderMultiColumnSet.h:
  • rendering/RenderObject.cpp:

(WebCore::RenderObject::nodeForHitTest const): Added.
(WebCore::RenderObject::updateHitTestResult): Update code as needed to use nodeForHitTest().

  • rendering/RenderObject.h:
  • rendering/RenderTable.cpp:

(WebCore::RenderTable::nodeAtPoint): Ditto.

  • rendering/RenderView.cpp:

(WebCore::RenderView::nodeForHitTest const): Added. This overrides RenderBlock::nodeForHitTest(), which
following r155370 was returning the document as the hit test node even though RenderView::updateHitTestResult()
considered the document element as the hit node for a RenderView. As a result of this change, the rect-based
hit testing no longer returns the document (seen in test results as #document) in the list of nodes.
(WebCore::RenderView::updateHitTestResult): Update code as needed to use nodeForHitTest().

  • rendering/RenderView.h:
  • rendering/SimpleLineLayoutFunctions.cpp:

(WebCore::SimpleLineLayout::hitTestFlow): Ditto.

  • rendering/svg/RenderSVGContainer.cpp:

(WebCore::RenderSVGContainer::nodeAtFloatPoint): Ditto.

  • rendering/svg/RenderSVGImage.cpp:

(WebCore::RenderSVGImage::nodeAtFloatPoint): Ditto.

  • rendering/svg/RenderSVGRoot.cpp:

(WebCore::RenderSVGRoot::nodeAtPoint): Ditto.

  • rendering/svg/RenderSVGShape.cpp:

(WebCore::RenderSVGShape::nodeAtFloatPoint): Ditto.

  • rendering/svg/SVGInlineTextBox.cpp:

(WebCore::SVGInlineTextBox::nodeAtPoint): Ditto.

LayoutTests:

Add a new test for an pseudo element.

Also update tests now that I added the RenderView::nodeForHitTest(), which returns the
same hit test node (the document element) as used in RenderView::updateHitTestResult().
Currently RenderView::nodeForHitTest() would actually fall back to RenderBlock::nodeForHitTest(),
which returned the document (seen in the test resutls as #document).

  • fast/dom/nodesFromRect/nodesFromRect-child-frame-content.html: Update test to match new results.
  • fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content.html: Ditto.
  • fast/dom/nodesFromRect/pseudo-empty-svg-image-crash-expected.txt: Added.
  • fast/dom/nodesFromRect/pseudo-empty-svg-image-crash.html: Added.
Location:
trunk
Files:
2 added
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r258504 r258508  
     12020-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
    1202020-03-16  Youenn Fablet  <youenn@apple.com>
    221
  • trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-child-frame-content.html

    r155265 r258508  
    5757            checkRect(250, 20, 100, 70, "DIV#right, DIV#left, HTML");
    5858
    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");
    6060
    6161            e.layer.setAttribute('class', 'rotate180');
    6262            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");
    6464
    6565            e.layer.setAttribute('class', 'rotate90');
    6666            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");
    6868
    6969            e.sandbox.display = 'none';
  • trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content.html

    r155265 r258508  
    5656            checkRect(250, 20, 100, 70, "DIV#right, DIV#left, HTML");
    5757
    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");
    5959
    6060
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r258502 r258508  
     12020-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
    1122020-03-16  youenn fablet  <youenn@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint-expected.txt

    r250696 r258508  
    4040PASS 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
    4141PASS 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
     42PASS shadowRoot.elementsFromPoint must behave the same with document.elementsFromPoint regarding HTML element
     43PASS elementsFromPoint should return all elements under a point, even when context object is not connected
    4444
  • trunk/Source/WebCore/ChangeLog

    r258506 r258508  
     12020-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
    1762020-03-16  Youenn Fablet  <youenn@apple.com>
    277
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

    r257637 r258508  
    350350
    351351        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)
    353353            return true;
    354354    }
  • trunk/Source/WebCore/rendering/EllipsisBox.cpp

    r256196 r258508  
    164164    if (visibleToHitTesting() && boundsRect.intersects(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) {
    165165        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)
    167167            return true;
    168168    }
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r256196 r258508  
    11421142    if (locationInContainer.intersects(rect)) {
    11431143        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)
    11451145            return true;
    11461146    }
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r258129 r258508  
    386386    if (locationInContainer.intersects(rect)) {
    387387        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)
    389389            return true;
    390390    }
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r258416 r258508  
    19911991    // continuation we're actually still inside the enclosing element
    19921992    // that was split. Use the appropriate inner node.
    1993     if (isRenderView())
    1994         return &document();
    19951993    return continuation() ? continuation()->element() : element();
    19961994}
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r258416 r258508  
    398398    void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override;
    399399
     400    // Public for EllipsisBox
     401    Node* nodeForHitTest() const override;
     402
    400403protected:
    401404    virtual void addOverflowFromChildren();
     
    436439    bool isSelfCollapsingBlock() const override;
    437440    virtual bool childrenPreventSelfCollapsing() const;
    438    
    439     Node* nodeForHitTest() const;
    440441
    441442    // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r258336 r258508  
    12521252    if (visibleToHitTesting() && action == HitTestForeground && locationInContainer.intersects(boundsRect)) {
    12531253        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)
    12551255            return true;
    12561256    }
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r258416 r258508  
    561561        // We cannot use addNodeToListBasedTestResult to determine if we fully enclose the hit-test area
    562562        // because it can only handle rectangular targets.
    563         result.addNodeToListBasedTestResult(element(), request, locationInContainer);
     563        result.addNodeToListBasedTestResult(nodeForHitTest(), request, locationInContainer);
    564564        return regionResult.contains(tmpLocation.boundingBox());
    565565    }
     
    10371037
    10381038    LayoutPoint localPoint(point);
    1039     if (Element* element = this->element()) {
     1039    if (auto* node = nodeForHitTest()) {
    10401040        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());
    10481045        }
    10491046
    1050         result.setInnerNode(element);
     1047        result.setInnerNode(node);
    10511048        if (!result.innerNonSharedNode())
    1052             result.setInnerNonSharedNode(element);
     1049            result.setInnerNonSharedNode(node);
    10531050        result.setLocalPoint(localPoint);
    10541051    }
  • trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp

    r245543 r258508  
    965965}
    966966
     967Node* RenderMultiColumnSet::nodeForHitTest() const
     968{
     969    return document().documentElement();
     970}
     971
    967972void RenderMultiColumnSet::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
    968973{
     
    972977    // Note this does not work with column spans, but once we implement RenderPageSet, we can move this code
    973978    // 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()) {
    976980        result.setInnerNode(node);
    977981        if (!result.innerNonSharedNode())
  • trunk/Source/WebCore/rendering/RenderMultiColumnSet.h

    r245543 r258508  
    137137    void layout() override;
    138138
     139    Node* nodeForHitTest() const override;
     140
    139141    LogicalExtentComputedValues computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop) const override;
    140142
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r258416 r258508  
    15531553}
    15541554
    1555 void RenderObject::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
    1556 {
    1557     if (result.innerNode())
    1558         return;
    1559 
    1560     Node* node = this->node();
    1561 
     1555Node* RenderObject::nodeForHitTest() const
     1556{
     1557    auto* node = this->node();
    15621558    // If we hit the anonymous renderers inside generated content we should
    15631559    // actually hit the generated content so walk up to the PseudoElement.
     
    15661562            node = renderer->element();
    15671563    }
    1568 
    1569     if (node) {
     1564    return node;
     1565}
     1566
     1567void RenderObject::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
     1568{
     1569    if (result.innerNode())
     1570        return;
     1571
     1572    if (auto* node = nodeForHitTest()) {
    15701573        result.setInnerNode(node);
    15711574        if (!result.innerNonSharedNode())
  • trunk/Source/WebCore/rendering/RenderObject.h

    r258416 r258508  
    554554
    555555    bool hitTest(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestFilter = HitTestAll);
     556    virtual Node* nodeForHitTest() const;
    556557    virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&);
     558
    557559    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
    558560
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r253139 r258508  
    15451545    if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && locationInContainer.intersects(boundsRect)) {
    15461546        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)
    15481548            return true;
    15491549    }
  • trunk/Source/WebCore/rendering/RenderView.cpp

    r256911 r258508  
    663663}
    664664
     665Node* RenderView::nodeForHitTest() const
     666{
     667    return document().documentElement();
     668}
     669
    665670void RenderView::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
    666671{
     
    671676        return multiColumnFlow()->firstMultiColumnSet()->updateHitTestResult(result, point);
    672677
    673     Node* node = document().documentElement();
    674     if (node) {
     678    if (auto* node = nodeForHitTest()) {
    675679        result.setInnerNode(node);
    676680        if (!result.innerNonSharedNode())
  • trunk/Source/WebCore/rendering/RenderView.h

    r256911 r258508  
    212212    bool isScrollableOrRubberbandableBox() const override;
    213213
     214    Node* nodeForHitTest() const override;
     215
    214216private:
    215217    FrameView& m_frameView;
  • trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp

    r254339 r258508  
    171171            continue;
    172172        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)
    174174            return true;
    175175    }
  • trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp

    r239461 r258508  
    178178    if (request.type() & HitTestRequest::AccessibilityHitTest && m_objectBoundingBox.contains(localPoint)) {
    179179        updateHitTestResult(result, LayoutPoint(localPoint));
    180         if (result.addNodeToListBasedTestResult(&element(), request, localPoint) == HitTestProgress::Stop)
     180        if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, localPoint) == HitTestProgress::Stop)
    181181            return true;
    182182    }
  • trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp

    r251378 r258508  
    230230            if (m_objectBoundingBox.contains(localPoint)) {
    231231                updateHitTestResult(result, LayoutPoint(localPoint));
    232                 if (result.addNodeToListBasedTestResult(&imageElement(), request, localPoint) == HitTestProgress::Stop)
     232                if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, localPoint) == HitTestProgress::Stop)
    233233                    return true;
    234234            }
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r239461 r258508  
    427427        if (locationInContainer.intersects(boundsRect)) {
    428428            updateHitTestResult(result, pointInBorderBox);
    429             if (result.addNodeToListBasedTestResult(&svgSVGElement(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)
     429            if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)
    430430                return true;
    431431        }
  • trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp

    r253916 r258508  
    378378            || (hitRules.canHitBoundingBox && objectBoundingBox().contains(localPoint))) {
    379379            updateHitTestResult(result, LayoutPoint(localPoint));
    380             if (result.addNodeToListBasedTestResult(&graphicsElement(), request, localPoint) == HitTestProgress::Stop)
     380            if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, localPoint) == HitTestProgress::Stop)
    381381                return true;
    382382        }
  • trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp

    r256196 r258508  
    669669                    if (fragmentQuad.containsPoint(locationInContainer.point())) {
    670670                        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)
    672672                            return true;
    673673                    }
Note: See TracChangeset for help on using the changeset viewer.