Closed
Bug 1237754
Opened 9 years ago
Closed
[css-grid][css-align] Make 'align-content:normal' behave as 'stretch' for Grid containers.
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla47
People
(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)
Details
Attachments
(2 files, 2 obsolete files)
2.00 KB,
patch
|
dholbert
:
review+
|
Details | Diff | Splinter Review |
5.91 KB,
patch
|
Details | Diff | Splinter Review |
https://lists.w3.org/Archives/Public/www-style/2016Jan/0031.html
"
Grid
----
- RESOLVED: Change the initial value of align-content to stretch
"
Which is kind of nonsensical, since the initial value is 'normal',
but I guess they mean 'normal' "behaves as" 'stretch', same as
for Flex containers:
https://drafts.csswg.org/css-align-3/#propdef-align-content
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8705637 -
Flags: review?(dholbert)
Assignee | ||
Comment 2•9 years ago
|
||
Comment 3•9 years ago
|
||
Comment on attachment 8705637 [details] [diff] [review]
fix
Review of attachment 8705637 [details] [diff] [review]:
-----------------------------------------------------------------
r=me, just one nit:
::: layout/generic/nsGridContainerFrame.cpp
@@ +2916,5 @@
> auto alignment = ::GetAlignJustifyValue(valueAndFallback, wm, isAlign,
> &overflowSafe);
> if (alignment == NS_STYLE_ALIGN_NORMAL) {
> + alignment = isAlign ? NS_STYLE_ALIGN_STRETCH : NS_STYLE_ALIGN_START;
> + valueAndFallback = alignment; // we may need a fallback for 'stretch' below
At first look, this assignment confused me, because it looks like we're stomping on whatever fallback value exists in the high bits of |valueAndFallback|. (i.e. we're clearing the author's chosen fallback value)
But after checking the spec and looking at how this is used, I *think* this is actually OK, because IIUC 'normal' can't be specified with a fallback value. To make it clearer that this is OK, could you add an assertion before this assignment? Something like:
MOZ_ASSERT(valueAndFallback == NS_STYLE_ALIGN_NORMAL,
"*-content:normal cannot be specified with explicit fallback");
Attachment #8705637 -
Flags: review?(dholbert) → review+
Comment 4•9 years ago
|
||
Actually, I think this 'normal' resolution might really want to happen inside of GetAlignJustifyValue()... That's where we resolve 'left' and 'right', at least -- based in part on whether we're "align-content" vs "justify-content" -- and this feels similar.
I think we'd just need a new clause in this 'switch' statement:
http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsGridContainerFrame.cpp?mark=1356-1362#1349
Then the caller won't need the special-case that I quoted in comment 3 anymore, I think.
Flags: needinfo?(mats)
Comment 5•9 years ago
|
||
Assignee | ||
Comment 7•9 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #3)
> To make it clearer that this is OK, could you add an assertion
> before this assignment? Something like:
>
> MOZ_ASSERT(valueAndFallback == NS_STYLE_ALIGN_NORMAL,
> "*-content:normal cannot be specified with explicit fallback");
Sure, I added that assertion (for documentation purposes).
(In reply to Daniel Holbert [:dholbert] from comment #4)
> Actually, I think this 'normal' resolution might really want to happen
> inside of GetAlignJustifyValue()...
That wouldn't work because we need to modify |valueAndFallback| for the next
call to GetAlignJustifyValue(). That's what the added comment is about,
i.e. 'normal' -> 'stretch' -> 'start', where the last step occurs if there
is overflow.
Flags: needinfo?(mats) → in-testsuite+
Assignee | ||
Comment 8•9 years ago
|
||
s/GetAlignJustifyValue/GetAlignJustifyFallbackIfAny/ in my last comment.
And yes, I could have mapped it both in GetAlignJustifyValue and
GetAlignJustifyFallbackIfAny instead I guess. It's probably clearer
to have it in one place though (i.e. as it landed).
Comment 9•9 years ago
|
||
backed this out for https://treeherder.mozilla.org/logviewer.html#?job_id=19964147&repo=mozilla-inbound that changed into frequent failures after this push
Flags: needinfo?(mats)
Comment 10•9 years ago
|
||
Assignee | ||
Comment 11•9 years ago
|
||
I'm only changing nsGridContainerFrame.cpp here which is only used for display:[inline-]grid.
So I'm confident that the intermittent failure wasn't caused by this bug.
Please re-land.
Looking at the failure in reftest-analyzer, I see a few pixels of anti-aliasing.
Adding some fuzz in bug 1240297 seems like the right fix (as was recently done
in bug 1186405 for inline--display-block--01.xhtml)
Flags: needinfo?(mats) → needinfo?(cbook)
Comment 12•9 years ago
|
||
(This made me realize that I actually added fuzz for the wrong file in bug 1186405 - I've fixed it now, though. So, inline--display-block--01.xhtml shouldn't report these errors anymore, as of bug 1186405 comment 44. And regardless, there's no chance its fuzzy-failures were related to this bug's patches.)
Comment 13•9 years ago
|
||
The spec was just updated to reflect this change, though it was updated in a way that suggests "justify-content:normal" changed as well: https://hg.csswg.org/drafts/rev/041ec4086fcf
I think that may have just been a mistake -- I emailed the list to clarify:
https://lists.w3.org/Archives/Public/www-style/2016Jan/0129.html
Comment 14•9 years ago
|
||
Nope, not a mistake; just, the meeting-notes that we were reading from (quoted in comment 0 here) were incomplete:
https://lists.w3.org/Archives/Public/www-style/2016Jan/0130.html
So, we don't need to branch on "isAlign" here anymore. Mats, maybe we should fix that before re-landing here, since the current patches are based on what turned out to be an incorrect understanding of the CSSWG resolution?
Flags: needinfo?(cbook) → needinfo?(mats)
Assignee | ||
Comment 15•9 years ago
|
||
Good catch; let's fix justify-content too before relanding.
Flags: needinfo?(mats)
Assignee | ||
Comment 16•9 years ago
|
||
Intra-diff for the code change:
-+ alignment = isAlign ? NS_STYLE_ALIGN_STRETCH : NS_STYLE_ALIGN_START;
++ alignment = NS_STYLE_ALIGN_STRETCH;
Attachment #8705637 -
Attachment is obsolete: true
Attachment #8710203 -
Flags: review?(dholbert)
Assignee | ||
Comment 17•9 years ago
|
||
Attachment #8705638 -
Attachment is obsolete: true
Assignee | ||
Comment 18•9 years ago
|
||
Comment 19•9 years ago
|
||
Comment on attachment 8710203 [details] [diff] [review]
fix
Review of attachment 8710203 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks! r=me
Attachment #8710203 -
Flags: review?(dholbert) → review+
Comment 20•9 years ago
|
||
Comment 21•9 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/f49d6b3581ed
https://hg.mozilla.org/mozilla-central/rev/e555b1530ebb
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox47:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Comment 22•9 years ago
|
||
bugherder |
Comment 23•9 years ago
|
||
You need to log in
before you can comment on or make changes to this bug.
Description
•