Bug 175506 - The none smooth stroke applied to an SVG shape breaks its hit testing
Summary: The none smooth stroke applied to an SVG shape breaks its hit testing
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
Keywords: InRadar
Depends on:
Reported: 2017-08-11 18:27 PDT by Said Abou-Hallawa
Modified: 2019-04-03 17:26 PDT (History)
6 users (show)

See Also:

test case (1.07 KB, text/html)
2017-08-11 18:27 PDT, Said Abou-Hallawa
no flags Details
Patch (4.54 KB, patch)
2017-08-11 18:52 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2017-08-11 18:27:26 PDT
Created attachment 317983 [details]
test case

Open the attached test case and try on click multiple times on the bottom right border of the two rectangles. The two rectangles are supposed to move 10px down and 10px down.

Result: The red rectangle seems to respond only on its original rectangle in spite of its movement. This can be seen if you hover its border after the first click. The cursor should change to the move shape but it does not. So the only way to move it to after the first click is to keep the mouse position still and do not move it. The green rectangle works as expected.

The reason is the red rectangle has the attribute stroke-linejoin="round". This makes the function RenderSVGRect::shapeDependentStrokeContains() falls back to the slow path through calling RenderSVGShape::shapeDependentStrokeContains() which uses m_path to check whether the stroke contains the point or not.

The bug is m_path gets only updated in RenderSVGRect::shapeDependentStrokeContains() when it is null. When RenderSVGRect::updateShapeFromElement() changes the renderer rectangles because of changing the 'x' and the 'y' attributes, the RenderSVGShape::m_path stays as is with the old rectangle. The fix is to make RenderSVGRect::updateShapeFromElement() clear RenderSVGShape::m_path so it is recalculated by RenderSVGRect::shapeDependentStrokeContains() when it is needed.
Comment 1 Said Abou-Hallawa 2017-08-11 18:52:50 PDT
Created attachment 317986 [details]
Comment 2 Said Abou-Hallawa 2017-08-11 18:53:54 PDT
Comment 3 WebKit Commit Bot 2017-08-14 15:00:31 PDT
Comment on attachment 317986 [details]

Clearing flags on attachment: 317986

Committed r220717: <http://trac.webkit.org/changeset/220717>
Comment 4 WebKit Commit Bot 2017-08-14 15:00:33 PDT
All reviewed patches have been landed.  Closing bug.