RESOLVED FIXED Bug 124680
[CSS Shapes] ShapeOutsideInfo needs to use the parent's writing mode when calculating offsets
https://bugs.webkit.org/show_bug.cgi?id=124680
Summary [CSS Shapes] ShapeOutsideInfo needs to use the parent's writing mode when cal...
Bear Travis
Reported 2013-11-20 14:42:35 PST
Created attachment 217482 [details] Test case ShapeOutsideInfo is currently using its element's writing mode to setup the shape and compute line offsets. This needs to be done in writing mode of the parent of the line box instead.
Attachments
Test case (495 bytes, text/html)
2013-11-20 14:42 PST, Bear Travis
no flags
Patch (4.38 KB, patch)
2013-12-05 10:22 PST, Rob Buis
no flags
Patch (5.54 KB, patch)
2013-12-05 11:49 PST, Rob Buis
no flags
Patch (8.00 KB, patch)
2013-12-05 13:08 PST, Rob Buis
no flags
Archive of layout-test-results from webkit-ews-02 for mac-mountainlion (600.05 KB, application/zip)
2013-12-05 14:35 PST, Build Bot
no flags
Patch (8.83 KB, patch)
2013-12-05 14:50 PST, Rob Buis
no flags
Patch (8.71 KB, patch)
2013-12-06 12:20 PST, Rob Buis
no flags
Rob Buis
Comment 1 2013-12-05 10:22:09 PST
Bem Jones-Bey
Comment 2 2013-12-05 10:31:19 PST
Comment on attachment 218523 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=218523&action=review > Source/WebCore/rendering/shapes/ShapeInfo.cpp:63 > + WritingMode writingMode = m_renderer.isFloating() ? m_renderer.containingBlock()->style().writingMode() : m_renderer.style().writingMode(); You actually need to switch on it being shape-outside versus shape-inside because we can have the situation where m_renderer is floating and we want to compute the shape-inside for it's content, and in that case, we need to use m_renderer's writing mode, not that of the parent.
Bear Travis
Comment 3 2013-12-05 11:27:36 PST
You may want to factor out a virtual method for ShapeOutsideInfo vs ShapeInsideInfo to solve the problem Bem mentioned. Also, you don't always want the containing block's writing mode. For example: <div> <div style='shape-outside: content-box; float: left;'></div> <div style='writing-mode: vertical-lr'>I will be affected by the shape</div> </div> You may also have overhanging floats: <div> <div style='shape-outside: content-box; float: left;'>I am bigger than my container</div> </div> <div style='writing-mode: vertical-lr'>I will be affected by the shape</div> So you'll need to work out a transformation between the writing mode of the inline content, and whatever coordinate system the float is using. I think it is probably more than one patch.
Bem Jones-Bey
Comment 4 2013-12-05 11:32:35 PST
(In reply to comment #3) > You may want to factor out a virtual method for ShapeOutsideInfo vs ShapeInsideInfo to solve the problem Bem mentioned. > > Also, you don't always want the containing block's writing mode. For example: > <div> > <div style='shape-outside: content-box; float: left;'></div> > <div style='writing-mode: vertical-lr'>I will be affected by the shape</div> > </div> > > You may also have overhanging floats: > <div> > <div style='shape-outside: content-box; float: left;'>I am bigger than my container</div> > </div> > <div style='writing-mode: vertical-lr'>I will be affected by the shape</div> > > So you'll need to work out a transformation between the writing mode of the inline content, and whatever coordinate system the float is using. I think it is probably more than one patch. Bear, your example is incorrect; a writing mode establishes a block formatting context, and floats don't cross BFCs, so the float won't affect the content in your example. Overhanging/intruding floats also can only affect content with the same writing mode as their containing block, so checking the writing mode on the containing block is sufficient.
Rob Buis
Comment 5 2013-12-05 11:49:21 PST
Rob Buis
Comment 6 2013-12-05 13:08:02 PST
Build Bot
Comment 7 2013-12-05 14:35:05 PST
Comment on attachment 218537 [details] Patch Attachment 218537 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/44298010 New failing tests: inspector-protocol/model/highlight-shape-outside.html
Build Bot
Comment 8 2013-12-05 14:35:06 PST
Created attachment 218545 [details] Archive of layout-test-results from webkit-ews-02 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-02 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Rob Buis
Comment 9 2013-12-05 14:50:05 PST
Dirk Schulze
Comment 10 2013-12-06 10:00:54 PST
Comment on attachment 218547 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=218547&action=review I would like to hear Bems or Bears opinion before r=me. At the moment I do not understand what this change is about. > Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp:106 > + if (m_renderer.isFloating()) { > + if (m_renderer.containingBlock()) this can be if (m_renderer.isFloating() && m_renderer.containingBlock()) return m_renderer.containingBlock()->style().writingMode();
Bem Jones-Bey
Comment 11 2013-12-06 11:15:26 PST
Comment on attachment 218547 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=218547&action=review >> Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp:106 >> + if (m_renderer.containingBlock()) > > this can be > > if (m_renderer.isFloating() && m_renderer.containingBlock()) > return m_renderer.containingBlock()->style().writingMode(); ShapeOutside shouldn't ever use the internal writing mode, since it always affects content outside of the block, so I'd remove the isFloating() check. As for the containingBlock() check: will we ever be in a situation where we have a valid shape-outside and don't have a containingBlock? I'd lean more towards an ASSERT for this and to remove the if statement entirely. > LayoutTests/TestExpectations:72 > +# A problem in both EFL and GTK. Doesn't this fail on Mac as well after this patch? Perhaps just remove the comment?
Bear Travis
Comment 12 2013-12-06 11:28:16 PST
The test passes on Mac, the root of the problem is whether rectangle paths contain the last line segment or omit it. It's a platform dependent issue (yay). Looks fine to me.
Rob Buis
Comment 13 2013-12-06 12:20:15 PST
WebKit Commit Bot
Comment 14 2013-12-06 12:59:27 PST
Comment on attachment 218611 [details] Patch Clearing flags on attachment: 218611 Committed r160243: <http://trac.webkit.org/changeset/160243>
WebKit Commit Bot
Comment 15 2013-12-06 12:59:30 PST
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.