Diff
Modified: trunk/LayoutTests/ChangeLog (258507 => 258508)
--- trunk/LayoutTests/ChangeLog 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/LayoutTests/ChangeLog 2020-03-16 17:34:43 UTC (rev 258508)
@@ -1,3 +1,22 @@
+2020-03-16 Daniel Bates <[email protected]>
+
+ 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.
+
+ 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.
+
2020-03-16 Youenn Fablet <[email protected]>
Apply rotation at source level if WebRTC sink ask so
Modified: trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-child-frame-content.html (258507 => 258508)
--- trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-child-frame-content.html 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-child-frame-content.html 2020-03-16 17:34:43 UTC (rev 258508)
@@ -56,15 +56,15 @@
checkRect(220, 20, 70, 70, "DIV#left");
checkRect(250, 20, 100, 70, "DIV#right, DIV#left, HTML");
- checkRect(150, 50, 100, 100, "DIV#left, HTML, #document, IFRAME#iframe1, DIV#layer, DIV#div2, DIV#div1, DIV#sandbox");
+ checkRect(150, 50, 100, 100, "DIV#left, HTML, IFRAME#iframe1, DIV#layer, DIV#div2, DIV#div1, DIV#sandbox");
e.layer.setAttribute('class', 'rotate180');
checkRect(220, 20, 70, 70, "DIV#right");
- checkRect(150, 50, 100, 100, "DIV#right, HTML, #document, IFRAME#iframe1, DIV#layer, DIV#div2, DIV#div1, DIV#sandbox");
+ checkRect(150, 50, 100, 100, "DIV#right, HTML, IFRAME#iframe1, DIV#layer, DIV#div2, DIV#div1, DIV#sandbox");
e.layer.setAttribute('class', 'rotate90');
checkRect(250, 20, 100, 70, "DIV#left");
- checkRect(150, 20, 200, 60, "DIV#left, HTML, #document, IFRAME#iframe1, DIV#layer, DIV#div1, DIV#sandbox");
+ checkRect(150, 20, 200, 60, "DIV#left, HTML, IFRAME#iframe1, DIV#layer, DIV#div1, DIV#sandbox");
e.sandbox.display = 'none';
finishJSTest();
Modified: trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content.html (258507 => 258508)
--- trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content.html 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content.html 2020-03-16 17:34:43 UTC (rev 258508)
@@ -55,7 +55,7 @@
checkRect(25, 25, 100, 100, "DIV#right, DIV#left, HTML");
checkRect(250, 20, 100, 70, "DIV#right, DIV#left, HTML");
- checkRect(150, 50, 100, 100, "DIV#right, HTML, #document, OBJECT#childframe2, DIV#left, HTML, #document, EMBED#childframe1, DIV#sandbox");
+ checkRect(150, 50, 100, 100, "DIV#right, HTML, OBJECT#childframe2, DIV#left, HTML, EMBED#childframe1, DIV#sandbox");
e.sandbox.display = 'none';
Added: trunk/LayoutTests/fast/dom/nodesFromRect/pseudo-empty-svg-image-crash-expected.txt (0 => 258508)
--- trunk/LayoutTests/fast/dom/nodesFromRect/pseudo-empty-svg-image-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/nodesFromRect/pseudo-empty-svg-image-crash-expected.txt 2020-03-16 17:34:43 UTC (rev 258508)
@@ -0,0 +1,2 @@
+ALERT: PASS: This test did not trigger an ASSERT.
+
Added: trunk/LayoutTests/fast/dom/nodesFromRect/pseudo-empty-svg-image-crash.html (0 => 258508)
--- trunk/LayoutTests/fast/dom/nodesFromRect/pseudo-empty-svg-image-crash.html (rev 0)
+++ trunk/LayoutTests/fast/dom/nodesFromRect/pseudo-empty-svg-image-crash.html 2020-03-16 17:34:43 UTC (rev 258508)
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style id="test-styles">
+.icon {
+ position: absolute;
+}
+.icon::before {
+ content: url('data:image/svg+xml,<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" version="1.1" height="727px"></svg>');
+}
+</style>
+</head>
+<body>
+<div class="icon"></div>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function nodesInRect(x, y, width, height)
+{
+ if (!window.internals)
+ return;
+
+ let leftPadding = Math.floor(width / 2);
+ let topPadding = Math.floor(height / 2);
+ let centerX = Math.floor(x + leftPadding);
+ let centerY = Math.floor(y + topPadding);
+ // FIXME: When nodesFromRect is changed to not add 1 to width and height, remove the correction here.
+ let bottomPadding = Math.floor((height - 1) - topPadding);
+ let rightPadding = Math.floor((width - 1) - leftPadding);
+
+ const ignoreClipping = false;
+ const allowUserAgentShadowContent = false;
+ const allowChildFrameContent = false;
+ return internals.nodesFromRect(document, centerX, centerY, topPadding, rightPadding, bottomPadding, leftPadding, ignoreClipping, allowUserAgentShadowContent, allowChildFrameContent);
+}
+
+function runTest()
+{
+ if (!window.internals) {
+ alert("This test requires window.internals");
+ return ;
+ }
+
+ function handleStylesheetLoaded() {
+ function actualRunTest() {
+ nodesInRect(0, 0, 1061, 552);
+
+ alert("PASS: This test did not trigger an ASSERT.");
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ // Need to use a zero-timer as the ::before content may not have loaded, yet.
+ window.setTimeout(actualRunTest, 0);
+ }
+ document.getElementById("test-styles").addEventListener("load", handleStylesheetLoaded, false);
+}
+
+runTest();
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (258507 => 258508)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-03-16 17:34:43 UTC (rev 258508)
@@ -1,3 +1,14 @@
+2020-03-16 Daniel Bates <[email protected]>
+
+ 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.
+
+ Update test result now that more sub-tests are passing.
+
+ * web-platform-tests/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint-expected.txt:
+
2020-03-16 youenn fablet <[email protected]>
RTCRtpSender of kind video should have a null dtmf attribute
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint-expected.txt (258507 => 258508)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint-expected.txt 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint-expected.txt 2020-03-16 17:34:43 UTC (rev 258508)
@@ -39,6 +39,6 @@
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
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
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
-FAIL shadowRoot.elementsFromPoint must behave the same with document.elementsFromPoint regarding HTML element assert_array_equals: lengths differ, expected 5 got 4
-FAIL elementsFromPoint should return all elements under a point, even when context object is not connected assert_equals: expected 4 but got 3
+PASS shadowRoot.elementsFromPoint must behave the same with document.elementsFromPoint regarding HTML element
+PASS elementsFromPoint should return all elements under a point, even when context object is not connected
Modified: trunk/Source/WebCore/ChangeLog (258507 => 258508)
--- trunk/Source/WebCore/ChangeLog 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/ChangeLog 2020-03-16 17:34:43 UTC (rev 258508)
@@ -1,3 +1,78 @@
+2020-03-16 Daniel Bates <[email protected]>
+
+ 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.
+
+ 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.
+
2020-03-16 Youenn Fablet <[email protected]>
Make CoreAudioCaptureSourceFactoryIOS an AudioSession::InterruptionObserver
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (258507 => 258508)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -349,7 +349,7 @@
auto& renderer = const_cast<RenderObject&>(*m_boxTree.rendererForLayoutBox(run.layoutBox()));
renderer.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
- if (result.addNodeToListBasedTestResult(renderer.node(), request, locationInContainer, runRect) == HitTestProgress::Stop)
+ if (result.addNodeToListBasedTestResult(renderer.nodeForHitTest(), request, locationInContainer, runRect) == HitTestProgress::Stop)
return true;
}
Modified: trunk/Source/WebCore/rendering/EllipsisBox.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/EllipsisBox.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/EllipsisBox.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -163,7 +163,7 @@
LayoutRect boundsRect { adjustedLocation, LayoutSize(LayoutUnit(logicalWidth()), m_height) };
if (visibleToHitTesting() && boundsRect.intersects(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) {
blockFlow().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
- if (result.addNodeToListBasedTestResult(blockFlow().element(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)
+ if (result.addNodeToListBasedTestResult(blockFlow().nodeForHitTest(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)
return true;
}
Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -1141,7 +1141,7 @@
if (locationInContainer.intersects(rect)) {
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.
- if (result.addNodeToListBasedTestResult(renderer().element(), request, locationInContainer, rect) == HitTestProgress::Stop)
+ if (result.addNodeToListBasedTestResult(renderer().nodeForHitTest(), request, locationInContainer, rect) == HitTestProgress::Stop)
return true;
}
Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/InlineTextBox.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -385,7 +385,7 @@
if (locationInContainer.intersects(rect)) {
renderer().updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(accumulatedOffset)));
- if (result.addNodeToListBasedTestResult(renderer().textNode(), request, locationInContainer, rect) == HitTestProgress::Stop)
+ if (result.addNodeToListBasedTestResult(renderer().nodeForHitTest(), request, locationInContainer, rect) == HitTestProgress::Stop)
return true;
}
return false;
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -1990,8 +1990,6 @@
// If we are in the margins of block elements that are part of a
// continuation we're actually still inside the enclosing element
// that was split. Use the appropriate inner node.
- if (isRenderView())
- return &document();
return continuation() ? continuation()->element() : element();
}
Modified: trunk/Source/WebCore/rendering/RenderBlock.h (258507 => 258508)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2020-03-16 17:34:43 UTC (rev 258508)
@@ -397,6 +397,9 @@
void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const override;
void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override;
+ // Public for EllipsisBox
+ Node* nodeForHitTest() const override;
+
protected:
virtual void addOverflowFromChildren();
// FIXME-BLOCKFLOW: Remove virtualization when all callers have moved to RenderBlockFlow
@@ -435,8 +438,6 @@
bool isSelfCollapsingBlock() const override;
virtual bool childrenPreventSelfCollapsing() const;
-
- Node* nodeForHitTest() const;
// FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
virtual void paintFloats(PaintInfo&, const LayoutPoint&, bool) { }
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -1251,7 +1251,7 @@
boundsRect.moveBy(adjustedLocation);
if (visibleToHitTesting() && action == HitTestForeground && locationInContainer.intersects(boundsRect)) {
updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
- if (result.addNodeToListBasedTestResult(element(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)
+ if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)
return true;
}
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -560,7 +560,7 @@
updateHitTestResult(result, tmpLocation.point());
// We cannot use addNodeToListBasedTestResult to determine if we fully enclose the hit-test area
// because it can only handle rectangular targets.
- result.addNodeToListBasedTestResult(element(), request, locationInContainer);
+ result.addNodeToListBasedTestResult(nodeForHitTest(), request, locationInContainer);
return regionResult.contains(tmpLocation.boundingBox());
}
return false;
@@ -1036,20 +1036,17 @@
return;
LayoutPoint localPoint(point);
- if (Element* element = this->element()) {
+ if (auto* node = nodeForHitTest()) {
if (isContinuation()) {
- // We're in the continuation of a split inline. Adjust our local point to be in the coordinate space
- // of the principal renderer's containing block. This will end up being the innerNonSharedNode.
- RenderBlock* firstBlock = element->renderer()->containingBlock();
-
- // Get our containing block.
- RenderBox* block = containingBlock();
- localPoint.moveBy(block->location() - firstBlock->locationOffset());
+ // We're in the continuation of a split inline. Adjust our local point to be in the coordinate space
+ // of the principal renderer's containing block. This will end up being the innerNonSharedNode.
+ auto* firstBlock = node->renderer()->containingBlock();
+ localPoint.moveBy(containingBlock()->location() - firstBlock->locationOffset());
}
- result.setInnerNode(element);
+ result.setInnerNode(node);
if (!result.innerNonSharedNode())
- result.setInnerNonSharedNode(element);
+ result.setInnerNonSharedNode(node);
result.setLocalPoint(localPoint);
}
}
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -964,6 +964,11 @@
return logicalPoint;
}
+Node* RenderMultiColumnSet::nodeForHitTest() const
+{
+ return document().documentElement();
+}
+
void RenderMultiColumnSet::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
{
if (result.innerNode() || !parent()->isRenderView())
@@ -971,8 +976,7 @@
// Note this does not work with column spans, but once we implement RenderPageSet, we can move this code
// over there instead (and spans of course won't be allowed on pages).
- Node* node = document().documentElement();
- if (node) {
+ if (auto* node = nodeForHitTest()) {
result.setInnerNode(node);
if (!result.innerNonSharedNode())
result.setInnerNonSharedNode(node);
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.h (258507 => 258508)
--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.h 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.h 2020-03-16 17:34:43 UTC (rev 258508)
@@ -136,6 +136,8 @@
bool isRenderMultiColumnSet() const override { return true; }
void layout() override;
+ Node* nodeForHitTest() const override;
+
LogicalExtentComputedValues computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop) const override;
void paintObject(PaintInfo&, const LayoutPoint&) override { }
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -1552,13 +1552,9 @@
return inside;
}
-void RenderObject::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
+Node* RenderObject::nodeForHitTest() const
{
- if (result.innerNode())
- return;
-
- Node* node = this->node();
-
+ auto* node = this->node();
// If we hit the anonymous renderers inside generated content we should
// actually hit the generated content so walk up to the PseudoElement.
if (!node && parent() && parent()->isBeforeOrAfterContent()) {
@@ -1565,8 +1561,15 @@
for (auto* renderer = parent(); renderer && !node; renderer = renderer->parent())
node = renderer->element();
}
+ return node;
+}
- if (node) {
+void RenderObject::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
+{
+ if (result.innerNode())
+ return;
+
+ if (auto* node = nodeForHitTest()) {
result.setInnerNode(node);
if (!result.innerNonSharedNode())
result.setInnerNonSharedNode(node);
Modified: trunk/Source/WebCore/rendering/RenderObject.h (258507 => 258508)
--- trunk/Source/WebCore/rendering/RenderObject.h 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2020-03-16 17:34:43 UTC (rev 258508)
@@ -553,7 +553,9 @@
bool isComposited() const;
bool hitTest(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestFilter = HitTestAll);
+ virtual Node* nodeForHitTest() const;
virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&);
+
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
virtual Position positionForPoint(const LayoutPoint&);
Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/RenderTable.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -1544,7 +1544,7 @@
LayoutRect boundsRect(adjustedLocation, size());
if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && locationInContainer.intersects(boundsRect)) {
updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(adjustedLocation)));
- if (result.addNodeToListBasedTestResult(element(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)
+ if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)
return true;
}
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -662,6 +662,11 @@
return frameView().viewportSizeForCSSViewportUnits();
}
+Node* RenderView::nodeForHitTest() const
+{
+ return document().documentElement();
+}
+
void RenderView::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
{
if (result.innerNode())
@@ -670,8 +675,7 @@
if (multiColumnFlow() && multiColumnFlow()->firstMultiColumnSet())
return multiColumnFlow()->firstMultiColumnSet()->updateHitTestResult(result, point);
- Node* node = document().documentElement();
- if (node) {
+ if (auto* node = nodeForHitTest()) {
result.setInnerNode(node);
if (!result.innerNonSharedNode())
result.setInnerNonSharedNode(node);
Modified: trunk/Source/WebCore/rendering/RenderView.h (258507 => 258508)
--- trunk/Source/WebCore/rendering/RenderView.h 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/RenderView.h 2020-03-16 17:34:43 UTC (rev 258508)
@@ -211,6 +211,8 @@
bool isScrollableOrRubberbandableBox() const override;
+ Node* nodeForHitTest() const override;
+
private:
FrameView& m_frameView;
Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -170,7 +170,7 @@
if (!locationInContainer.intersects(lineRect))
continue;
renderer.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
- if (result.addNodeToListBasedTestResult(renderer.node(), request, locationInContainer, lineRect) == HitTestProgress::Stop)
+ if (result.addNodeToListBasedTestResult(renderer.nodeForHitTest(), request, locationInContainer, lineRect) == HitTestProgress::Stop)
return true;
}
return false;
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -177,7 +177,7 @@
// Accessibility wants to return SVG containers, if appropriate.
if (request.type() & HitTestRequest::AccessibilityHitTest && m_objectBoundingBox.contains(localPoint)) {
updateHitTestResult(result, LayoutPoint(localPoint));
- if (result.addNodeToListBasedTestResult(&element(), request, localPoint) == HitTestProgress::Stop)
+ if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, localPoint) == HitTestProgress::Stop)
return true;
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -229,7 +229,7 @@
if (hitRules.canHitFill) {
if (m_objectBoundingBox.contains(localPoint)) {
updateHitTestResult(result, LayoutPoint(localPoint));
- if (result.addNodeToListBasedTestResult(&imageElement(), request, localPoint) == HitTestProgress::Stop)
+ if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, localPoint) == HitTestProgress::Stop)
return true;
}
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -426,7 +426,7 @@
LayoutRect boundsRect(accumulatedOffset + location(), size());
if (locationInContainer.intersects(boundsRect)) {
updateHitTestResult(result, pointInBorderBox);
- if (result.addNodeToListBasedTestResult(&svgSVGElement(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)
+ if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, locationInContainer, boundsRect) == HitTestProgress::Stop)
return true;
}
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -377,7 +377,7 @@
|| (hitRules.canHitFill && (svgStyle.hasFill() || !hitRules.requireFill) && fillContains(localPoint, hitRules.requireFill, fillRule))
|| (hitRules.canHitBoundingBox && objectBoundingBox().contains(localPoint))) {
updateHitTestResult(result, LayoutPoint(localPoint));
- if (result.addNodeToListBasedTestResult(&graphicsElement(), request, localPoint) == HitTestProgress::Stop)
+ if (result.addNodeToListBasedTestResult(nodeForHitTest(), request, localPoint) == HitTestProgress::Stop)
return true;
}
}
Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (258507 => 258508)
--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp 2020-03-16 17:24:59 UTC (rev 258507)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp 2020-03-16 17:34:43 UTC (rev 258508)
@@ -668,7 +668,7 @@
if (fragmentQuad.containsPoint(locationInContainer.point())) {
renderer().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
- if (result.addNodeToListBasedTestResult(&renderer().textNode(), request, locationInContainer, rect) == HitTestProgress::Stop)
+ if (result.addNodeToListBasedTestResult(renderer().nodeForHitTest(), request, locationInContainer, rect) == HitTestProgress::Stop)
return true;
}
}