Title: [222934] trunk
- Revision
- 222934
- Author
- [email protected]
- Date
- 2017-10-05 14:54:16 -0700 (Thu, 05 Oct 2017)
Log Message
RenderSVGRoot should check the renderers inside its visualOverflowRect for hit testing if the overflow is visible
https://bugs.webkit.org/show_bug.cgi?id=177953
<rdar://problem/34788389>
Patch by Said Abou-Hallawa <[email protected]> on 2017-10-05
Reviewed by Simon Fraser.
Source/WebCore:
Test: svg/hittest/svg-visual-overflow-rect.html
If an SVGElement is positioned outside the rectangle of the root element,
it can still be drawn if the root element has "overflow: visible" applied.
But since SVGElement can be drawn in this case, it should be accessible
through nodeAtPoint() which is used for hit testing.
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::nodeAtPoint):
LayoutTests:
* svg/hittest/svg-visual-overflow-rect-expected.html: Added.
* svg/hittest/svg-visual-overflow-rect.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (222933 => 222934)
--- trunk/LayoutTests/ChangeLog 2017-10-05 21:31:00 UTC (rev 222933)
+++ trunk/LayoutTests/ChangeLog 2017-10-05 21:54:16 UTC (rev 222934)
@@ -1,3 +1,14 @@
+2017-10-05 Said Abou-Hallawa <[email protected]>
+
+ RenderSVGRoot should check the renderers inside its visualOverflowRect for hit testing if the overflow is visible
+ https://bugs.webkit.org/show_bug.cgi?id=177953
+ <rdar://problem/34788389>
+
+ Reviewed by Simon Fraser.
+
+ * svg/hittest/svg-visual-overflow-rect-expected.html: Added.
+ * svg/hittest/svg-visual-overflow-rect.html: Added.
+
2017-10-05 Per Arne Vollan <[email protected]>
Mark 4 fast/text layout tests as flaky on Windows.
Added: trunk/LayoutTests/svg/hittest/svg-visual-overflow-rect-expected.html (0 => 222934)
--- trunk/LayoutTests/svg/hittest/svg-visual-overflow-rect-expected.html (rev 0)
+++ trunk/LayoutTests/svg/hittest/svg-visual-overflow-rect-expected.html 2017-10-05 21:54:16 UTC (rev 222934)
@@ -0,0 +1,16 @@
+<style>
+ html, body {
+ margin: 0;
+ padding: 0;
+ }
+ div {
+ position: absolute;
+ width: 100px;
+ height: 100px;
+ }
+</style>
+<body>
+ <div style="background-color: red;"></div>
+ <div style="left: 100px; background-color: green;"></div>
+ <div style="left: 200px; background-color: blue;"></div>
+</body>
Added: trunk/LayoutTests/svg/hittest/svg-visual-overflow-rect.html (0 => 222934)
--- trunk/LayoutTests/svg/hittest/svg-visual-overflow-rect.html (rev 0)
+++ trunk/LayoutTests/svg/hittest/svg-visual-overflow-rect.html 2017-10-05 21:54:16 UTC (rev 222934)
@@ -0,0 +1,45 @@
+<style>
+ html, body {
+ margin: 0;
+ padding: 0;
+ }
+ svg {
+ overflow: visible;
+ width: 100px;
+ height: 100px;
+ }
+ div {
+ position: absolute;
+ left: 200px;
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ z-index: 1;
+ }
+</style>
+<body>
+ <div></div>
+ <svg>
+ <rect x="100"width="100" height="100" fill="red"/>
+ <rect x="200"width="100" height="100" fill="blue"/>
+ </svg>
+ <script>
+ function moveSVGElement(element, x, y) {
+ element.setAttribute('x', x);
+ element.setAttribute('y', y);
+ }
+
+ function moveHTMLElement(rect, x, y) {
+ element.style.left = x + 'px';
+ element.style.top = y + 'px';
+ }
+
+ var element = document.elementFromPoint(150, 50);
+ if (element instanceof SVGRectElement)
+ moveSVGElement(element, 0, 0);
+
+ element = document.elementFromPoint(250, 50);
+ if (element instanceof HTMLDivElement)
+ moveHTMLElement(element, 100, 0);
+ </script>
+</body>
Modified: trunk/Source/WebCore/ChangeLog (222933 => 222934)
--- trunk/Source/WebCore/ChangeLog 2017-10-05 21:31:00 UTC (rev 222933)
+++ trunk/Source/WebCore/ChangeLog 2017-10-05 21:54:16 UTC (rev 222934)
@@ -1,3 +1,21 @@
+2017-10-05 Said Abou-Hallawa <[email protected]>
+
+ RenderSVGRoot should check the renderers inside its visualOverflowRect for hit testing if the overflow is visible
+ https://bugs.webkit.org/show_bug.cgi?id=177953
+ <rdar://problem/34788389>
+
+ Reviewed by Simon Fraser.
+
+ Test: svg/hittest/svg-visual-overflow-rect.html
+
+ If an SVGElement is positioned outside the rectangle of the root element,
+ it can still be drawn if the root element has "overflow: visible" applied.
+ But since SVGElement can be drawn in this case, it should be accessible
+ through nodeAtPoint() which is used for hit testing.
+
+ * rendering/svg/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::nodeAtPoint):
+
2017-10-05 Zalan Bujtas <[email protected]>
RenderButton should not hold raw pointers to its direct children.
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (222933 => 222934)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2017-10-05 21:31:00 UTC (rev 222933)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2017-10-05 21:54:16 UTC (rev 222934)
@@ -406,9 +406,9 @@
LayoutPoint pointInParent = locationInContainer.point() - toLayoutSize(accumulatedOffset);
LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location());
- // Only test SVG content if the point is in our content box.
+ // Test SVG content if the point is in our content box or it is inside the visualOverflowRect and the overflow is visible.
// FIXME: This should be an intersection when rect-based hit tests are supported by nodeAtFloatPoint.
- if (contentBoxRect().contains(pointInBorderBox)) {
+ if (contentBoxRect().contains(pointInBorderBox) || (!shouldApplyViewportClip() && visualOverflowRect().contains(pointInParent))) {
FloatPoint localPoint = localToParentTransform().inverse().value_or(AffineTransform()).mapPoint(FloatPoint(pointInParent));
for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes