WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 132132
[CSS Shapes] shape-outside polygon can fail when line-top intersects a vertex
https://bugs.webkit.org/show_bug.cgi?id=132132
Summary
[CSS Shapes] shape-outside polygon can fail when line-top intersects a vertex
Hans Muller
Reported
2014-04-24 09:59:14 PDT
Bear reported this. The attached test case demonstrates the problem (also:
http://jsfiddle.net/52UMu/2/
).
Attachments
Test case.
(850 bytes, text/html)
2014-04-24 10:00 PDT
,
Hans Muller
no flags
Details
Patch
(7.92 KB, patch)
2014-04-25 15:08 PDT
,
Hans Muller
bjonesbe
: review+
Details
Formatted Diff
Diff
Patch
(7.89 KB, patch)
2014-04-29 07:13 PDT
,
Hans Muller
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Hans Muller
Comment 1
2014-04-24 10:00:22 PDT
Created
attachment 230089
[details]
Test case. The test case can also be found here:
http://jsfiddle.net/52UMu/2/
Hans Muller
Comment 2
2014-04-25 15:08:24 PDT
Created
attachment 230210
[details]
Patch ShapeInterval now distinguishes between x1==x2 - isEmpty() and x1,x2 haven't been set yet - isUndefined(). The polygon algorithm for computing excluded intervals now ignores horizontal edges. It also ignores edges whose lower vertex matches the top of the line, if the edge's Y direction is upwards (away from the top of the line). The rationale for this was explained here:
http://hansmuller-webkit.blogspot.com/2012/11/revised-horizontal-box-algorithm.html
Bem Jones-Bey
Comment 3
2014-04-28 14:09:58 PDT
Comment on
attachment 230210
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=230210&action=review
IT would nice to see a test for the case where the top of a line overlaps the bottom of the shape, if it's not too much of a pain to create.
> Source/WebCore/ChangeLog:3 > + [CSS Shapes] shape-outside polygon fails when first vertex is 0,0
Nit: it would be nice if this was changed to better explain the issue, since it's not just when the first vertex is 0,0.
> Source/WebCore/rendering/shapes/ShapeInterval.h:43 > + : m_x1(-1) > + , m_x2(-2)
I wish there was a way to make these look less like magic numbers (as far as I can tell, any numbers would work as long as x2 < x1).
> Source/WebCore/rendering/shapes/ShapeInterval.h:81 > void setX1(T x1) > { > - ASSERT(m_x2 >= x1); > - m_x1 = x1; > + if (isUndefined()) { > + m_x1 = x1; > + m_x2 = x1; > + } else { > + ASSERT(m_x2 >= x1); > + m_x1 = x1; > + } > } > > void setX2(T x2) > { > - ASSERT(x2 >= m_x1); > - m_x2 = x2; > + if (isUndefined()) { > + m_x1 = x2; > + m_x2 = x2; > + } else { > + ASSERT(x2 >= m_x1); > + m_x2 = x2; > + } > }
With the addition of the undefined state, these two methods have become much more complex and potentially confusing (setting one can set the other?!?). It doesn't look like they're used anywhere, can we just remove them?
Bem Jones-Bey
Comment 4
2014-04-28 15:25:22 PDT
Comment on
attachment 230210
[details]
Patch Looks like the test covers more than I had thought. r=me, please to remove the setX methods before landing. :-)
Hans Muller
Comment 5
2014-04-28 16:32:58 PDT
(In reply to
comment #3
)
> Nit: it would be nice if this was changed to better explain the issue, since it's not just when the first vertex is 0,0.
The original bug description was just a guess about the scope of the problem. The real source of the problem was that polygon edges that only overlapped the vertical line interval because the top of the line interval was coincident with the bottom vertex of the edge were included in the exclusion boundary. A simple way to visualize the problem is to consider a 100x100 square polygon at 0,0 and line-height=100. We want the first line, whose vertical interval is 0,100 to be excluded by the polygon. The second line, whose vertical interval is 100,200 should not exclude the polygon, despite the fact that top of the line is coincident with the bottom of the polygon. Similarly, if the polygon's origin is 0,100, then the first line would not be excluded by the polygon, but the second line would (and the third line would not).
Hans Muller
Comment 6
2014-04-29 07:13:11 PDT
Created
attachment 230375
[details]
Patch
WebKit Commit Bot
Comment 7
2014-04-29 08:01:47 PDT
Comment on
attachment 230375
[details]
Patch Clearing flags on attachment: 230375 Committed
r167931
: <
http://trac.webkit.org/changeset/167931
>
WebKit Commit Bot
Comment 8
2014-04-29 08:01:51 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug