Bug 124680 - [CSS Shapes] ShapeOutsideInfo needs to use the parent's writing mode when calculating offsets
Summary: [CSS Shapes] ShapeOutsideInfo needs to use the parent's writing mode when cal...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rob Buis
URL:
Keywords:
Depends on:
Blocks: 98664
  Show dependency treegraph
 
Reported: 2013-11-20 14:42 PST by Bear Travis
Modified: 2013-12-06 12:59 PST (History)
8 users (show)

See Also:


Attachments
Test case (495 bytes, text/html)
2013-11-20 14:42 PST, Bear Travis
no flags Details
Patch (4.38 KB, patch)
2013-12-05 10:22 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (5.54 KB, patch)
2013-12-05 11:49 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (8.00 KB, patch)
2013-12-05 13:08 PST, Rob Buis
no flags Details | Formatted Diff | Diff
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 Details
Patch (8.83 KB, patch)
2013-12-05 14:50 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (8.71 KB, patch)
2013-12-06 12:20 PST, Rob Buis
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bear Travis 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.
Comment 1 Rob Buis 2013-12-05 10:22:09 PST
Created attachment 218523 [details]
Patch
Comment 2 Bem Jones-Bey 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.
Comment 3 Bear Travis 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.
Comment 4 Bem Jones-Bey 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.
Comment 5 Rob Buis 2013-12-05 11:49:21 PST
Created attachment 218527 [details]
Patch
Comment 6 Rob Buis 2013-12-05 13:08:02 PST
Created attachment 218537 [details]
Patch
Comment 7 Build Bot 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
Comment 8 Build Bot 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
Comment 9 Rob Buis 2013-12-05 14:50:05 PST
Created attachment 218547 [details]
Patch
Comment 10 Dirk Schulze 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();
Comment 11 Bem Jones-Bey 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?
Comment 12 Bear Travis 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.
Comment 13 Rob Buis 2013-12-06 12:20:15 PST
Created attachment 218611 [details]
Patch
Comment 14 WebKit Commit Bot 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>
Comment 15 WebKit Commit Bot 2013-12-06 12:59:30 PST
All reviewed patches have been landed.  Closing bug.