DescriptionFix 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 #Messages
Total messages: 29 (6 generated)
|