Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Issue 745383007: Fix an issue where hit detection could fail on rect and ellipse shapes (Closed)

Created:
6 years ago by dtrebbien
Modified:
6 years ago
CC:
blink-reviews, blink-reviews-rendering, zoltan1, pdr+renderingwatchlist_chromium.org, eae+blinkwatch, leviw+renderwatch, kouhei+svg_chromium.org, ed+blinkwatch_opera.com, krit, f(malita), gyuyoung.kim_webkit.org, jchaffraix+rendering, Stephen Chennney, rwlbuis, pdr+svgwatchlist_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Fix an issue where hit detection could fail on rect and ellipse shapes If the stroke of a <rect>, <circle>, or <ellipse> was dashed, or had a non-default linecap, linejoin, or miterlimit, then updating the shape attributes (x, y, width, height, cx, cy, rx, ry, or r) within a mouse event handler where the mouse pointer was within the shape's original bounding box would fail to update the cached bounding box, causing hit detection to fail. The issue is fixed by falling back to path-based hit detection when the stroke is dashed in the case of ellipses, and when the stroke is "non-simple" in the case of rects. Because RenderSVGRect and RenderSVGEllipse were the only callers of RenderSVGShape::hasSmoothStroke(), hasSmoothStroke() was removed and replaced with RenderSVGRect::definitelyHasSimpleStroke() and RenderSVGEllipse::hasContinuousStroke() so that the conditions when we fall back to path-based hit detection can be tailored to the shape. The expected RenderSVGEllipse bounds in dasharrayOrigin-expected.txt for the red <circle> were corrected. The RenderSVGEllipse bounds for a <circle> or <ellipse> is the minimal bounding box of the fill and stroke bounding boxes. In the case of the red <circle> in dasharrayOrigin.svg, the red stroke does not extend through a full semicircle, and the actual bounding box of the stroke is (50.3979187, 100, 102.105911, 52.50383). The fill bounding box is (50, 50, 100, 100), so the RenderSVGEllipse bounds of the red circle should be (50, 50, 102.50383, 102.50383). Mark struct-use-recursion-02-t.svg and struct-use-recursion-03-t.svg as NeedsRebaseline because now that we are falling back on path-based hit detection and bounds calculation, the stroke bounding boxes are slightly different. In the case of struct-use-recursion-03-t.svg, the gray dashed circle previously had a stroke bounding box of (89, 14, 22, 22) and now it has a stroke bounding box of (88.9905624, 14.0065498, 22.0109711, 22.0050201). BUG=436214 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=186650

Patch Set 1 #

Total comments: 5

Patch Set 2 : #

Total comments: 2

Patch Set 3 : #

Total comments: 1

Patch Set 4 : #

Patch Set 5 : Address test failures #

Unified diffs Side-by-side diffs Delta from patch set Stats (+628 lines, -19 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
M LayoutTests/svg/custom/dasharrayOrigin-expected.txt View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
A LayoutTests/svg/hittest/rect-miterlimit.html View 1 2 3 1 chunk +92 lines, -0 lines 0 comments Download
A LayoutTests/svg/hittest/rect-miterlimit-expected.txt View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
A LayoutTests/svg/hittest/update-ellipse.html View 1 1 chunk +214 lines, -0 lines 0 comments Download
A LayoutTests/svg/hittest/update-ellipse-expected.txt View 1 1 chunk +22 lines, -0 lines 0 comments Download
A LayoutTests/svg/hittest/update-rect.html View 1 1 chunk +219 lines, -0 lines 0 comments Download
A LayoutTests/svg/hittest/update-rect-expected.txt View 1 1 chunk +26 lines, -0 lines 0 comments Download
M Source/core/rendering/svg/RenderSVGEllipse.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/rendering/svg/RenderSVGEllipse.cpp View 1 3 chunks +11 lines, -4 lines 0 comments Download
M Source/core/rendering/svg/RenderSVGRect.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/rendering/svg/RenderSVGRect.cpp View 1 2 3 4 3 chunks +34 lines, -4 lines 0 comments Download
M Source/core/rendering/svg/RenderSVGShape.h View 1 1 chunk +0 lines, -1 line 0 comments Download
M Source/core/rendering/svg/RenderSVGShape.cpp View 1 1 chunk +0 lines, -9 lines 0 comments Download

Messages

Total messages: 29 (6 generated)
dtrebbien
6 years ago (2014-12-03 14:29:35 UTC) #2
Erik Dahlström (inactive)
Looks a little bit related to http://crbug.com/350338, if you're looking for more things in this ...
6 years ago (2014-12-03 15:16:35 UTC) #4
fs
On 2014/12/03 15:16:35, Erik Dahlström wrote: > Looks a little bit related to http://crbug.com/350338, if ...
6 years ago (2014-12-03 15:56:07 UTC) #6
dtrebbien
> Maybe 'hasContinousStroke' instead? (and make it clear it's for non-<path> > shapes only.) It ...
6 years ago (2014-12-03 17:46:23 UTC) #7
dtrebbien
On 2014/12/03 17:46:23, dtrebbien wrote: > > Maybe 'hasContinousStroke' instead? (and make it clear it's ...
6 years ago (2014-12-03 18:01:12 UTC) #8
Erik Dahlström (inactive)
On 2014/12/03 18:01:12, dtrebbien wrote: > On 2014/12/03 17:46:23, dtrebbien wrote: > > > Maybe ...
6 years ago (2014-12-04 07:48:10 UTC) #9
dtrebbien
On 2014/12/03 15:16:35, Erik Dahlström wrote: > Looks a little bit related to http://crbug.com/350338, if ...
6 years ago (2014-12-04 12:27:36 UTC) #10
dtrebbien
On 2014/12/03 15:56:07, fs wrote: > On 2014/12/03 15:16:35, Erik Dahlström wrote: > > Looks ...
6 years ago (2014-12-04 12:29:03 UTC) #11
fs
Almost there... https://codereview.chromium.org/745383007/diff/20001/Source/core/rendering/svg/RenderSVGEllipse.h File Source/core/rendering/svg/RenderSVGEllipse.h (right): https://codereview.chromium.org/745383007/diff/20001/Source/core/rendering/svg/RenderSVGEllipse.h#newcode43 Source/core/rendering/svg/RenderSVGEllipse.h:43: protected: Please restore the access specifiers ('protected' ...
6 years ago (2014-12-04 13:10:36 UTC) #12
dtrebbien
On 2014/12/04 13:10:36, fs wrote: > Almost there... > > https://codereview.chromium.org/745383007/diff/20001/Source/core/rendering/svg/RenderSVGEllipse.h > File Source/core/rendering/svg/RenderSVGEllipse.h (right): ...
6 years ago (2014-12-04 13:46:20 UTC) #13
fs
lgtm
6 years ago (2014-12-04 14:21:44 UTC) #14
Erik Dahlström (inactive)
I'd like to see some tests for the "forced bevel" linejoins (due to miterlimit) on ...
6 years ago (2014-12-04 14:25:49 UTC) #15
dtrebbien
On 2014/12/04 14:25:49, Erik Dahlström wrote: > I'd like to see some tests for the ...
6 years ago (2014-12-05 13:00:47 UTC) #16
fs
On 2014/12/05 13:00:47, dtrebbien wrote: > On 2014/12/04 14:25:49, Erik Dahlström wrote: > > I'd ...
6 years ago (2014-12-05 13:12:02 UTC) #17
Erik Dahlström (inactive)
On 2014/12/05 13:00:47, dtrebbien wrote: > On 2014/12/04 14:25:49, Erik Dahlström wrote: > > I'd ...
6 years ago (2014-12-05 13:12:21 UTC) #18
fs
On 2014/12/05 13:12:02, fs wrote: ... > I'm not sue this (the rename) was entirely ...
6 years ago (2014-12-05 13:12:47 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/745383007/60001
6 years ago (2014-12-05 13:15:04 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/37129)
6 years ago (2014-12-05 14:16:59 UTC) #23
dtrebbien
On 2014/12/05 14:16:59, I haz the power (commit-bot) wrote: > Try jobs failed on following ...
6 years ago (2014-12-07 01:31:17 UTC) #24
fs
On 2014/12/07 01:31:17, dtrebbien wrote: > On 2014/12/05 14:16:59, I haz the power (commit-bot) wrote: ...
6 years ago (2014-12-07 21:05:18 UTC) #25
dtrebbien
On 2014/12/07 21:05:18, fs wrote: > On 2014/12/07 01:31:17, dtrebbien wrote: > > On 2014/12/05 ...
6 years ago (2014-12-07 22:45:10 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/745383007/80001
6 years ago (2014-12-07 22:46:40 UTC) #28
commit-bot: I haz the power
6 years ago (2014-12-07 23:56:23 UTC) #29
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=186650

Powered by Google App Engine
This is Rietveld 408576698