Bug 172707 - [css-align][css-flex][css-grid] 'auto' values of align-self and justify-self must not be resolved
Summary: [css-align][css-flex][css-grid] 'auto' values of align-self and justify-self ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Javier Fernandez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-30 05:00 PDT by Javier Fernandez
Modified: 2017-07-10 16:56 PDT (History)
8 users (show)

See Also:


Attachments
Patch (97.14 KB, patch)
2017-05-30 16:22 PDT, Javier Fernandez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews113 for mac-elcapitan (1.38 MB, application/zip)
2017-05-30 16:58 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews101 for mac-elcapitan (529.65 KB, application/zip)
2017-05-30 17:08 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews107 for mac-elcapitan-wk2 (545.15 KB, application/zip)
2017-05-30 17:12 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews122 for ios-simulator-wk2 (10.23 MB, application/zip)
2017-05-30 17:16 PDT, Build Bot
no flags Details
Patch (104.02 KB, patch)
2017-05-31 14:44 PDT, Javier Fernandez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews104 for mac-elcapitan-wk2 (1.15 MB, application/zip)
2017-05-31 15:51 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews101 for mac-elcapitan (1.05 MB, application/zip)
2017-05-31 15:54 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews112 for mac-elcapitan (1.81 MB, application/zip)
2017-05-31 16:05 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews121 for ios-simulator-wk2 (12.94 MB, application/zip)
2017-05-31 16:10 PDT, Build Bot
no flags Details
Patch (108.38 KB, patch)
2017-05-31 16:59 PDT, Javier Fernandez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews116 for mac-elcapitan (1.78 MB, application/zip)
2017-05-31 17:57 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews101 for mac-elcapitan (1.07 MB, application/zip)
2017-05-31 17:59 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews104 for mac-elcapitan-wk2 (1.14 MB, application/zip)
2017-05-31 18:07 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews125 for ios-simulator-wk2 (902.79 KB, application/zip)
2017-05-31 18:37 PDT, Build Bot
no flags Details
Patch (109.77 KB, patch)
2017-06-01 06:47 PDT, Javier Fernandez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-elcapitan (1.09 MB, application/zip)
2017-06-01 07:27 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews117 for mac-elcapitan (1.93 MB, application/zip)
2017-06-01 07:47 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews105 for mac-elcapitan-wk2 (1.38 MB, application/zip)
2017-06-01 11:14 PDT, Build Bot
no flags Details
Patch (110.98 KB, patch)
2017-06-01 15:42 PDT, Javier Fernandez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-elcapitan (1.24 MB, application/zip)
2017-06-01 16:18 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews104 for mac-elcapitan-wk2 (1.30 MB, application/zip)
2017-06-01 16:23 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews115 for mac-elcapitan (1.79 MB, application/zip)
2017-06-01 17:10 PDT, Build Bot
no flags Details
Patch (117.90 KB, patch)
2017-06-02 00:29 PDT, Javier Fernandez
no flags Details | Formatted Diff | Diff
Patch (111.32 KB, patch)
2017-07-10 15:28 PDT, Javier Fernandez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Javier Fernandez 2017-05-30 05:00:19 PDT
The 'auto' values on align-self and justify-self must not be resolved using the parent's align-items and justify-items computed value. 

https://lists.w3.org/Archives/Public/www-style/2015Dec/0061.html
Comment 1 Javier Fernandez 2017-05-30 16:22:58 PDT
Created attachment 311550 [details]
Patch
Comment 2 Build Bot 2017-05-30 16:58:12 PDT
Comment on attachment 311550 [details]
Patch

Attachment 311550 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3844993

Number of test failures exceeded the failure limit.
Comment 3 Build Bot 2017-05-30 16:58:13 PDT
Created attachment 311554 [details]
Archive of layout-test-results from ews113 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 4 Build Bot 2017-05-30 17:08:13 PDT
Comment on attachment 311550 [details]
Patch

Attachment 311550 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/3845064

Number of test failures exceeded the failure limit.
Comment 5 Build Bot 2017-05-30 17:08:15 PDT
Created attachment 311557 [details]
Archive of layout-test-results from ews101 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 6 Build Bot 2017-05-30 17:12:40 PDT
Comment on attachment 311550 [details]
Patch

Attachment 311550 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3845069

Number of test failures exceeded the failure limit.
Comment 7 Build Bot 2017-05-30 17:12:42 PDT
Created attachment 311558 [details]
Archive of layout-test-results from ews107 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 8 Build Bot 2017-05-30 17:16:10 PDT
Comment on attachment 311550 [details]
Patch

Attachment 311550 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3845019

Number of test failures exceeded the failure limit.
Comment 9 Build Bot 2017-05-30 17:16:12 PDT
Created attachment 311559 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.5
Comment 10 Javier Fernandez 2017-05-31 14:44:06 PDT
Created attachment 311637 [details]
Patch
Comment 11 Build Bot 2017-05-31 15:50:59 PDT
Comment on attachment 311637 [details]
Patch

Attachment 311637 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3850504

New failing tests:
fast/repaint/align-items-overflow-change.html
svg/css/getComputedStyle-basic.xhtml
css3/parse-alignment-of-root-elements.html
fast/css/getComputedStyle/computed-style.html
fast/css/getComputedStyle/computed-style-without-renderer.html
fast/repaint/align-items-change.html
fast/repaint/justify-items-overflow-change.html
Comment 12 Build Bot 2017-05-31 15:51:01 PDT
Created attachment 311645 [details]
Archive of layout-test-results from ews104 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 13 Build Bot 2017-05-31 15:54:12 PDT
Comment on attachment 311637 [details]
Patch

Attachment 311637 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/3850538

New failing tests:
fast/repaint/align-items-overflow-change.html
svg/css/getComputedStyle-basic.xhtml
css3/parse-alignment-of-root-elements.html
fast/css/getComputedStyle/computed-style.html
fast/css/getComputedStyle/computed-style-without-renderer.html
fast/repaint/align-items-change.html
fast/repaint/justify-items-overflow-change.html
Comment 14 Build Bot 2017-05-31 15:54:14 PDT
Created attachment 311646 [details]
Archive of layout-test-results from ews101 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 15 Build Bot 2017-05-31 16:05:10 PDT
Comment on attachment 311637 [details]
Patch

Attachment 311637 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3850509

New failing tests:
fast/css/getComputedStyle/computed-style-without-renderer.html
svg/css/getComputedStyle-basic.xhtml
css3/parse-alignment-of-root-elements.html
fast/css/getComputedStyle/computed-style.html
fast/repaint/align-items-overflow-change.html
fast/repaint/align-items-change.html
fast/repaint/justify-items-overflow-change.html
Comment 16 Build Bot 2017-05-31 16:05:11 PDT
Created attachment 311647 [details]
Archive of layout-test-results from ews112 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 17 Build Bot 2017-05-31 16:10:32 PDT
Comment on attachment 311637 [details]
Patch

Attachment 311637 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3850513

New failing tests:
css3/parse-alignment-of-root-elements.html
Comment 18 Build Bot 2017-05-31 16:10:34 PDT
Created attachment 311649 [details]
Archive of layout-test-results from ews121 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews121  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.5
Comment 19 Javier Fernandez 2017-05-31 16:59:49 PDT
Created attachment 311658 [details]
Patch
Comment 20 Build Bot 2017-05-31 17:57:04 PDT
Comment on attachment 311658 [details]
Patch

Attachment 311658 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3851105

New failing tests:
svg/css/getComputedStyle-basic.xhtml
fast/css/getComputedStyle/computed-style.html
fast/css/getComputedStyle/computed-style-without-renderer.html
Comment 21 Build Bot 2017-05-31 17:57:06 PDT
Created attachment 311667 [details]
Archive of layout-test-results from ews116 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 22 Build Bot 2017-05-31 17:59:10 PDT
Comment on attachment 311658 [details]
Patch

Attachment 311658 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/3851196

New failing tests:
svg/css/getComputedStyle-basic.xhtml
fast/css/getComputedStyle/computed-style.html
fast/css/getComputedStyle/computed-style-without-renderer.html
Comment 23 Build Bot 2017-05-31 17:59:11 PDT
Created attachment 311668 [details]
Archive of layout-test-results from ews101 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 24 Build Bot 2017-05-31 18:07:53 PDT
Comment on attachment 311658 [details]
Patch

Attachment 311658 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3851241

New failing tests:
svg/css/getComputedStyle-basic.xhtml
fast/css/getComputedStyle/computed-style.html
fast/css/getComputedStyle/computed-style-without-renderer.html
Comment 25 Build Bot 2017-05-31 18:07:54 PDT
Created attachment 311669 [details]
Archive of layout-test-results from ews104 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 26 Build Bot 2017-05-31 18:37:06 PDT
Comment on attachment 311658 [details]
Patch

Attachment 311658 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3851304

New failing tests:
compositing/masks/compositing-clip-path-change-no-repaint.html
Comment 27 Build Bot 2017-05-31 18:37:07 PDT
Created attachment 311670 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.5
Comment 28 Javier Fernandez 2017-06-01 06:47:58 PDT
Created attachment 311696 [details]
Patch
Comment 29 Build Bot 2017-06-01 07:27:15 PDT
Comment on attachment 311696 [details]
Patch

Attachment 311696 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/3853731

New failing tests:
svg/css/getComputedStyle-basic.xhtml
fast/css/getComputedStyle/computed-style.html
fast/css/getComputedStyle/computed-style-without-renderer.html
Comment 30 Build Bot 2017-06-01 07:27:16 PDT
Created attachment 311698 [details]
Archive of layout-test-results from ews101 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 31 Build Bot 2017-06-01 07:47:06 PDT
Comment on attachment 311696 [details]
Patch

Attachment 311696 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3853745

New failing tests:
svg/css/getComputedStyle-basic.xhtml
fast/css/getComputedStyle/computed-style.html
fast/css/getComputedStyle/computed-style-without-renderer.html
Comment 32 Build Bot 2017-06-01 07:47:07 PDT
Created attachment 311699 [details]
Archive of layout-test-results from ews117 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews117  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 33 Build Bot 2017-06-01 11:14:24 PDT
Comment on attachment 311696 [details]
Patch

Attachment 311696 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3854614

New failing tests:
svg/css/getComputedStyle-basic.xhtml
fast/css/getComputedStyle/computed-style.html
fast/css/getComputedStyle/computed-style-without-renderer.html
Comment 34 Build Bot 2017-06-01 11:14:25 PDT
Created attachment 311731 [details]
Archive of layout-test-results from ews105 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 35 Javier Fernandez 2017-06-01 15:42:36 PDT
Created attachment 311768 [details]
Patch
Comment 36 Build Bot 2017-06-01 16:18:21 PDT
Comment on attachment 311768 [details]
Patch

Attachment 311768 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/3856178

New failing tests:
svg/css/getComputedStyle-basic.xhtml
fast/css/getComputedStyle/computed-style.html
fast/css/getComputedStyle/computed-style-without-renderer.html
Comment 37 Build Bot 2017-06-01 16:18:22 PDT
Created attachment 311773 [details]
Archive of layout-test-results from ews102 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 38 Build Bot 2017-06-01 16:23:58 PDT
Comment on attachment 311768 [details]
Patch

Attachment 311768 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3856180

New failing tests:
svg/css/getComputedStyle-basic.xhtml
fast/css/getComputedStyle/computed-style.html
fast/css/getComputedStyle/computed-style-without-renderer.html
Comment 39 Build Bot 2017-06-01 16:23:59 PDT
Created attachment 311775 [details]
Archive of layout-test-results from ews104 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 40 Build Bot 2017-06-01 17:10:34 PDT
Comment on attachment 311768 [details]
Patch

Attachment 311768 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3856340

New failing tests:
svg/css/getComputedStyle-basic.xhtml
fast/css/getComputedStyle/computed-style.html
fast/css/getComputedStyle/computed-style-without-renderer.html
Comment 41 Build Bot 2017-06-01 17:10:35 PDT
Created attachment 311785 [details]
Archive of layout-test-results from ews115 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 42 Javier Fernandez 2017-06-02 00:29:43 PDT
Created attachment 311807 [details]
Patch
Comment 43 Antti Koivisto 2017-07-10 07:31:02 PDT
Comment on attachment 311807 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311807&action=review

This cleans up things nicely, r=me

> Source/WebCore/rendering/RenderFlexibleBox.cpp:249
> +        for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) {

You should be able to use

    for (auto& child : childrenOfType<RenderBox>(*this)) {

> Source/WebCore/rendering/RenderFlexibleBox.cpp:250
> +            ItemPosition previousAlignment =child->style().resolvedAlignSelf(oldStyle, selfAlignmentNormalBehavior()).position();

missing space after =

> Source/WebCore/rendering/RenderGrid.cpp:96
> +StyleSelfAlignmentData RenderGrid::selfAlignmentForChild(GridAxis axis, const RenderBox& child, const RenderStyle* style) const

Why is the style a pointer? I don't see this being called with null style.

> Source/WebCore/rendering/RenderGrid.cpp:128
> +        for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {

Here too

> Source/WebCore/rendering/RenderGrid.cpp:1205
> +StyleSelfAlignmentData RenderGrid::alignSelfForChild(const RenderBox& child, const RenderStyle* style) const

It is bit unclear whose style the 'style' is and when it is ok to call this will null style.

> Source/WebCore/rendering/RenderGrid.cpp:1212
> +StyleSelfAlignmentData RenderGrid::justifySelfForChild(const RenderBox& child, const RenderStyle* style) const

Same here.
Comment 44 Javier Fernandez 2017-07-10 07:40:53 PDT
Comment on attachment 311807 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311807&action=review

>> Source/WebCore/rendering/RenderGrid.cpp:96
>> +StyleSelfAlignmentData RenderGrid::selfAlignmentForChild(GridAxis axis, const RenderBox& child, const RenderStyle* style) const
> 
> Why is the style a pointer? I don't see this being called with null style.

Actually it's default to nullptr in the function declaration, since the regular use of this function doesn't require an explicit style to resolve the 'auto' values. We should just uses the grid's style for resolving grid item's 'auto' values.

>> Source/WebCore/rendering/RenderGrid.cpp:1205
>> +StyleSelfAlignmentData RenderGrid::alignSelfForChild(const RenderBox& child, const RenderStyle* style) const
> 
> It is bit unclear whose style the 'style' is and when it is ok to call this will null style.

This follows the same patten that the selfAlignmentForChild function, so we allow passing nullptr so it uses the caller's style for resolving any 'auto' values.
Comment 45 Antti Koivisto 2017-07-10 09:00:00 PDT
> Actually it's default to nullptr in the function declaration, since the
> regular use of this function doesn't require an explicit style to resolve
> the 'auto' values. We should just uses the grid's style for resolving grid
> item's 'auto' values.

You just added the function and as far as I see all call sites call it with non-null style. Are you planning to add more call sites?

> This follows the same patten that the selfAlignmentForChild function, so we
> allow passing nullptr so it uses the caller's style for resolving any 'auto'
> values.

Maybe there is a more descriptive name for it than just 'style'? There are two styles involved in

return child.style().resolvedJustifySelf(style, selfAlignmentNormalBehavior(&child)); 

Would the latter be for example 'gridStyle' or 'parentStyle'?
Comment 46 Javier Fernandez 2017-07-10 09:26:22 PDT
(In reply to Antti Koivisto from comment #45)
> > Actually it's default to nullptr in the function declaration, since the
> > regular use of this function doesn't require an explicit style to resolve
> > the 'auto' values. We should just uses the grid's style for resolving grid
> > item's 'auto' values.
> 
> You just added the function and as far as I see all call sites call it with
> non-null style. Are you planning to add more call sites?


Yes, I've got another patch that will call that function several times with the nullptr style. I'm still working on it, so I'd be ok with simplifying this function now if you think it's clearer.  

> 
> > This follows the same patten that the selfAlignmentForChild function, so we
> > allow passing nullptr so it uses the caller's style for resolving any 'auto'
> > values.
> 
> Maybe there is a more descriptive name for it than just 'style'? There are
> two styles involved in
> 
> return child.style().resolvedJustifySelf(style,
> selfAlignmentNormalBehavior(&child)); 
> 
> Would the latter be for example 'gridStyle' or 'parentStyle'?

Yes, those would be definitively better names.
Comment 47 Javier Fernandez 2017-07-10 15:28:16 PDT
Created attachment 315036 [details]
Patch
Comment 48 WebKit Commit Bot 2017-07-10 16:56:25 PDT
Comment on attachment 315036 [details]
Patch

Clearing flags on attachment: 315036

Committed r219315: <http://trac.webkit.org/changeset/219315>
Comment 49 WebKit Commit Bot 2017-07-10 16:56:27 PDT
All reviewed patches have been landed.  Closing bug.