Skip to content

Commit

Permalink
Merge r220717 - The none smooth stroke applied to an SVG shape breaks…
Browse files Browse the repository at this point in the history
… its hit testing

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

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-08-14
Reviewed by Simon Fraser.

Source/WebCore:

Clear RenderSVGShape::m_path when calling RenderSVGRect::updateShapeFromElement().
The m_path will be recalculated when RenderSVGShape::updateShapeFromElement()
is called from RenderSVGRect::shapeDependentStrokeContains().

Test: svg/stroke/stroke-linejoin-click.html

* rendering/svg/RenderSVGRect.cpp:
(WebCore::RenderSVGRect::updateShapeFromElement):
* rendering/svg/RenderSVGShape.h:
(WebCore::RenderSVGShape::clearPath):

LayoutTests:

* svg/stroke/stroke-linejoin-click-expected.html: Added.
* svg/stroke/stroke-linejoin-click.html: Added.
  • Loading branch information
Said Abou-Hallawa authored and carlosgcampos committed Aug 17, 2017
1 parent fe8fd35 commit fb91505
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 0 deletions.
10 changes: 10 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
2017-08-14 Said Abou-Hallawa <sabouhallawa@apple.com>

The none smooth stroke applied to an SVG shape breaks its hit testing
https://bugs.webkit.org/show_bug.cgi?id=175506

Reviewed by Simon Fraser.

* svg/stroke/stroke-linejoin-click-expected.html: Added.
* svg/stroke/stroke-linejoin-click.html: Added.

2017-08-14 Zan Dobersek <zdobersek@igalia.com>

REGRESSION(r220517-r220521) [GTK] Various compositing tests fail
Expand Down
19 changes: 19 additions & 0 deletions LayoutTests/svg/stroke/stroke-linejoin-click-expected.html
@@ -0,0 +1,19 @@
<style>
html, body {
margin: 0;
padding: 0;
}
rect {
fill: none;
stroke-width: 6;
stroke-linejoin: round;
stroke: green;
width: 100px;
height: 100px;
}
</style>
<body>
<svg>
<rect x="30" y="30"/>
</svg>
</body>
37 changes: 37 additions & 0 deletions LayoutTests/svg/stroke/stroke-linejoin-click.html
@@ -0,0 +1,37 @@
<style>
html, body {
margin: 0;
padding: 0;
}
rect {
fill: none;
stroke-width: 6;
stroke-linejoin: round;
stroke: green;
width: 100px;
height: 100px;
}
</style>
<body>
<svg>
<rect x="10" y="10"/>
</svg>
<script>
function moveRect(rect) {
var x = parseFloat(rect.getAttribute("x"));
var y = parseFloat(rect.getAttribute("y"));
rect.setAttribute('x', x + 10);
rect.setAttribute('y', y + 10);
}

(function() {
var element = document.elementFromPoint(10, 10);
if (element instanceof SVGRectElement)
moveRect(element);

element = document.elementFromPoint(20, 20);
if (element instanceof SVGRectElement)
moveRect(element);
})();
</script>
</body>
18 changes: 18 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,21 @@
2017-08-14 Said Abou-Hallawa <sabouhallawa@apple.com>

The none smooth stroke applied to an SVG shape breaks its hit testing
https://bugs.webkit.org/show_bug.cgi?id=175506

Reviewed by Simon Fraser.

Clear RenderSVGShape::m_path when calling RenderSVGRect::updateShapeFromElement().
The m_path will be recalculated when RenderSVGShape::updateShapeFromElement()
is called from RenderSVGRect::shapeDependentStrokeContains().

Test: svg/stroke/stroke-linejoin-click.html

* rendering/svg/RenderSVGRect.cpp:
(WebCore::RenderSVGRect::updateShapeFromElement):
* rendering/svg/RenderSVGShape.h:
(WebCore::RenderSVGShape::clearPath):

2017-08-10 Zan Dobersek <zdobersek@igalia.com>

Unreviewed GTK+ build fix for ENABLE_GLES2=ON.
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/rendering/svg/RenderSVGRect.cpp
Expand Up @@ -52,6 +52,7 @@ void RenderSVGRect::updateShapeFromElement()
m_fillBoundingBox = FloatRect();
m_innerStrokeRect = FloatRect();
m_outerStrokeRect = FloatRect();
clearPath();

SVGLengthContext lengthContext(&rectElement());
FloatSize boundingBoxSize(lengthContext.valueForLength(style().width(), LengthModeWidth), lengthContext.valueForLength(style().height(), LengthModeHeight));
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/rendering/svg/RenderSVGShape.h
Expand Up @@ -63,6 +63,7 @@ class RenderSVGShape : public RenderSVGModelObject {
ASSERT(m_path);
return *m_path;
}
void clearPath() { m_path = nullptr; }

protected:
void element() const = delete;
Expand Down

0 comments on commit fb91505

Please sign in to comment.