Closed
Bug 983175
Opened 12 years ago
Closed 10 years ago
Add style-system support for CSS Grid’s subgrid feature
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla31
People
(Reporter: SimonSapin, Assigned: SimonSapin)
References
(Blocks 1 open bug, )
Details
(Keywords: DevAdvocacy)
Attachments
(3 files, 4 obsolete files)
7.17 KB,
patch
|
dbaron
:
review+
dholbert
:
feedback+
|
Details | Diff | Splinter Review |
7.04 KB,
patch
|
SimonSapin
:
review+
dholbert
:
review+
|
Details | Diff | Splinter Review |
31.98 KB,
patch
|
SimonSapin
:
review+
|
Details | Diff | Splinter Review |
Bug 976787 added support for the grid-template-columns and grid-template-rows properties, but skipped the 'subgrid' feature.
There was a proposal to punt the feature to Level 2 of the spec, but also some disagreement. No decision has been made yet.
http://lists.w3.org/Archives/Public/www-style/2014Feb/0047.html
http://lists.w3.org/Archives/Public/www-style/2014Mar/0035.html
Still, we may want to write the style system code for subgrid. The parsing is a bit tricky, especially in the grid-template and grid shorthands (bug 981752)
Assignee | ||
Comment 1•12 years ago
|
||
One non-obvious is how to represent this in computed values.
Currently, the computed value of the grid-template-columns and grid-template-rows properties is represented (each) as a nsStyleGridTrackList struct (defined in layout/style/nsStyleStruct.h) with the following fields:
nsTArray<nsTArray<nsString>> mLineNameLists;
nsTArray<nsStyleCoord> mMinTrackSizingFunctions;
nsTArray<nsStyleCoord> mMaxTrackSizingFunctions;
This represents 'none' when all arrays are empty, or a <track-list> otherwise.
One option could be to add a boolean field:
bool mIsSubgrid;
When that field is true, mLineNameLists is re-used but the other two arrays are empty/ignored.
One option to
Assignee | ||
Comment 2•12 years ago
|
||
Assignee | ||
Comment 3•12 years ago
|
||
Attachment #8396752 -
Flags: review?(dholbert)
Comment 4•12 years ago
|
||
Comment on attachment 8396751 [details] [diff] [review]
Patch 1: Refactor
>From: Simon Sapin <simon.sapin@exyr.org>
>Bug 983175 part 1: Have ParseGridLineNames distinguish "OK" and "Not found".
Commit-message nit: could you make the description more concrete, e.g.:
Bug 983175 part 1: Make ParseGridLineNames distinguish between empty list "()" and the lack of a list.
r=me with that
(Note: we probably should rename nsParsingStatus to something like CSSParsingStatus, since the "ns" prefix is kind of a vestigial thing that we're trying to move away from. That's a trivial search-and-replace, though, and I or someone else can get to it later, if you don't get to it. Maybe file a bug for that, though?)
Assignee | ||
Comment 5•12 years ago
|
||
> (Note: we probably should rename nsParsingStatus to something like
> CSSParsingStatus, since the "ns" prefix is kind of a vestigial thing that
> we're trying to move away from. That's a trivial search-and-replace, though,
> and I or someone else can get to it later, if you don't get to it. Maybe
> file a bug for that, though?)
Doing this first to get it out of the way.
Attachment #8397404 -
Flags: review?(dholbert)
Assignee | ||
Comment 6•12 years ago
|
||
Rebase on top of patch 0 and expend commit message per review comment.
Attachment #8396751 -
Attachment is obsolete: true
Attachment #8396751 -
Flags: review?(dholbert)
Attachment #8397406 -
Flags: review+
Comment 7•12 years ago
|
||
Comment on attachment 8397404 [details] [diff] [review]
Patch 0: Rename nsParsingStatus to CSSParseResult.
Punting review on the enum name to dbaron. (Looks good to me, FWIW.)
Attachment #8397404 -
Flags: review?(dholbert)
Attachment #8397404 -
Flags: review?(dbaron)
Attachment #8397404 -
Flags: feedback+
Assignee | ||
Comment 8•12 years ago
|
||
Rebase on top of patch 0.
Attachment #8396752 -
Attachment is obsolete: true
Attachment #8396752 -
Flags: review?(dholbert)
Attachment #8397407 -
Flags: review?(dholbert)
Attachment #8397404 -
Flags: review?(dbaron) → review+
Comment 9•12 years ago
|
||
Comment on attachment 8397407 [details] [diff] [review]
Patch 2 v2: subgrid
Looks good! Just a few nits; nothing functional.
>From: Simon Sapin <simon.sapin@exyr.org>
>Bug 983175 part 2: Add style system support for 'subgrid'
Add " keyword in grid-template* properties" to the end of the commit message there.
>diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp
>+// Assuming a 'subgrid' keyword was already consumed, parse <line-name-list>?
>+bool
>+CSSParserImpl::ParseSubgridLineNameList(nsCSSValue& aValue)
Maybe name this "ParseOptionalSubgridLineNameList()" (or even "ParseOptionalLineNameListAfterSubgrid()"), to make it clearer that the parsed thing here is *optional*.
That will make it more obvious that in e.g. this chunk from ParseGridTemplate...
if (!ParseSubgridLineNameList(value)) {
return false;
}
...we aren't actually *requiring* a <line-name-list>.
>@@ -7275,18 +7310,41 @@ CSSParserImpl::ParseGridTemplate()
>- // TODO (bug 983175): add parsing for subgrid
>- // as part of <'grid-template-columns'>
>+ nsSubstring* ident = NextIdent();
>+ if (ident) {
>+ if (ident->LowerCaseEqualsLiteral("subgrid")) {
>+ if (!ParseSubgridLineNameList(value)) {
>+ return false;
>+ }
>+ AppendValue(eCSSProperty_grid_template_columns, value);
>+ if (ExpectSymbol('/', true)) {
>+ return ParseGridTemplateAfterSlash(/* aColumnsIsTrackList = */ false);
>+ }
Add a comment towards the beginning here, saying that the "subgrid" keyword can appear by itself (per the shorthand syntax) *or* it could be the start of a <'grid-template-columns'> / <'grid-template-rows'> expression.
(Since superficially, the property's value definition makes it look like "subgrid" can only appear on its own, since it only gets called out on its own.)
(I guess this technically applies to "none", too. Maybe add a comment for that, too? Or a single comment covering both keywords?)
> bool
> CSSParserImpl::ParseGridTemplateAfterSlash(bool aColumnsIsTrackList)
> {
>+ if (ParseVariant(rowsValue, VARIANT_NONE, nullptr)) {
>+ // <'grid-template-columns'> / <'grid-template-rows'>
>+ AppendValue(eCSSProperty_grid_template_rows, rowsValue);
>+ nsCSSValue areasValue(eCSSUnit_None); // implied
>+ AppendValue(eCSSProperty_grid_template_areas, areasValue);
>+ return true;
The <'grid-template-columns'> / <'grid-template-rows'> comment there is a bit confusing on its own. (but it's useful once I realize why it's there / what it's saying)
This would be clearer if you extended the comment above this function to say something along the lines of:
/*
* NOTE: This parses the portion after the slash, for *one* of the
* following types of expressions:
* - <'grid-template-columns'> / <'grid-template-rows'>
* - [ <track-list> / ]? [ <line-names>? <string> <track-size>? <line-names>? ]+
*
* We don't know which type of expression we've got until we've parsed the
* second half, since the pre-slash part is ambiguous. The various return
* clauses below are labeled with the type of expression they're completing.)
*/
r=me with the above.
Attachment #8397407 -
Flags: review?(dholbert) → review+
Assignee | ||
Comment 10•12 years ago
|
||
Try run with patches 0, 1v2, 2v3:
https://tbpl.mozilla.org/?tree=Try&rev=f4376c0a983e
Attachment #8397407 -
Attachment is obsolete: true
Attachment #8397648 -
Flags: review+
Assignee | ||
Comment 11•12 years ago
|
||
Try failures seem to be intermittent/known. http://logbot.glob.com.au/?c=mozilla%23ateam#c771282
Keywords: checkin-needed
Comment 12•12 years ago
|
||
Patch 2 doesn't apply. Please rebase. Also, dholbert, can you please formally r+ patch 1? Right now, there's only an "r= with..." comment for it.
Keywords: checkin-needed
Assignee | ||
Comment 13•12 years ago
|
||
Looks like I uploaded the wrong file in attachment 8397648 [details] [diff] [review], sorry about that.
Attachment #8397648 -
Attachment is obsolete: true
Attachment #8397858 -
Flags: review+
Comment 14•12 years ago
|
||
Comment on attachment 8397406 [details] [diff] [review]
Patch 1 v2: Refactor. r=dholbert
r=me (sorry for not setting the flag in comment 4)
Attachment #8397406 -
Flags: review+
Comment 15•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/acba6fd6fb2c
https://hg.mozilla.org/integration/mozilla-inbound/rev/63d2474f84f8
https://hg.mozilla.org/integration/mozilla-inbound/rev/038c28096bfe
Flags: in-testsuite+
https://hg.mozilla.org/mozilla-central/rev/acba6fd6fb2c
https://hg.mozilla.org/mozilla-central/rev/63d2474f84f8
https://hg.mozilla.org/mozilla-central/rev/038c28096bfe
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
Comment 17•10 years ago
|
||
As authors are digging into how to use Grid, as industry leaders are writing their books about Grid, it seems like punting Subgrids is a bad idea. Even if including it means delaying Grid for months. There's not consensus yet, but a brewing question... Here's Eric Meyer's investigation, with usecases: http://meyerweb.com/eric/thoughts/2016/01/15/subgrids-considered-essential/
(I'm reopening this ticket because of it's name. Is it better to leave it closed, since specific work was finished on this ticket, and open a new one?)
Comment 18•10 years ago
|
||
It's best to keep an individual bug focused on a single chunk of work, landing at a single point in time -- otherwise, backouts & regression-tracking gets pretty complicated/unmanageable. (though dummy "tracking bugs" are a notable exception)
Given that this bug already had some work land 2 years ago, we shouldn't reopen & pile on any additional work here. Instead, I've filed a new bug -- bug 1240834 -- on getting layout support for subgrid (as opposed to the css parsing support which happened in this bug here). (I thought we already had such a bug, but it seems we do not.)
(I've also transferred the "DevAdvocacy" keyword over there. I suspect it's not useful to leave it on this bug here, for work that was done 2 years ago.)
Updated•10 years ago
|
Status: REOPENED → RESOLVED
Closed: 12 years ago → 10 years ago
Resolution: --- → FIXED
Comment 19•10 years ago
|
||
Yes. Thanks so much, Daniel.
You need to log in
before you can comment on or make changes to this bug.
Description
•