Closed
Bug 1002607
Opened 11 years ago
Closed 11 years ago
GridTemplateAreasValue::mNColumns is one more than the given number of columns
Categories
(Core :: CSS Parsing and Computation, defect, P4)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla32
People
(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)
References
(Blocks 1 open bug)
Details
(Keywords: testcase)
Attachments
(1 file)
(deleted),
patch
|
SimonSapin
:
review+
|
Details | Diff | Splinter Review |
In layout code, I'm observing this:
data:text/html,<div style="display:grid; grid-template-areas:'' ">
gridTemplateAreas->mNColumns = 1
data:text/html,<div style="display:grid; grid-template-areas:'x' ">
gridTemplateAreas->mNColumns = 2
data:text/html,<div style="display:grid; grid-template-areas:'x x' ">
gridTemplateAreas->mNColumns = 3
I was expecting 0, 1, 2 etc
Assignee | ||
Comment 1•11 years ago
|
||
This fixes it for me.
Attachment #8413867 -
Flags: review?(simon.sapin)
Assignee | ||
Comment 2•11 years ago
|
||
grid-template-areas:'' (resulting in mNColumns==0) seems a bit odd.
The spec doesn't seem to mention it:
http://dev.w3.org/csswg/css-grid/#grid-template-areas-property
Should it be rejected?
Comment 3•11 years ago
|
||
The relevant code is in ParseGridTemplateAreasLine:
http://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSParser.cpp?rev=bfd16de7bf25#7555
Indeed, the name and the value are inconsistent. The value could be changed by adding `- 1` as appropriate in the code linked above, or the name could be changed to something like `mNbColumnLines`.
I suggest waiting to have some grid item placement code to decide which is more convenient to have. Note that line numbers start from 1 (not 0) in grid-column-start and related properties, as does (at the moment) GridNamedArea.mColumnStart. But maybe having this all be zero-based will turn out to be more convenient for implementation (in which case the `- 1` could be in ParseGridLine).
Comment 4•11 years ago
|
||
Comment on attachment 8413867 [details] [diff] [review]
fix
Review of attachment 8413867 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/style/nsCSSParser.cpp
@@ +7540,5 @@
> currentArea->mRowEnd = row + 1;
> }
> }
> }
> + if (currentArea && currentArea->mColumnEnd != column + 1) {
I’m not sure you want this, but running the tests should confirm.
IIRC, the right incantation is:
mach mochitest-plain layout/style/test
Comment 5•11 years ago
|
||
> I’m not sure you want this
Nevermind that, a bit more context shows that the patch is correct. Still, see Comment 3 about whether this is the change you want to make.
Assignee | ||
Comment 6•11 years ago
|
||
(In reply to Simon Sapin (:SimonSapin) from comment #3)
> I suggest waiting to have some grid item placement code to decide which is
> more convenient to have.
Yes, I now have code that does explicit grid placement, and I'm reflowing
child frames into those areas (see the test/screenshot in bug 616605).
> Note that line numbers start from 1 (not 0) ...
I found it convenient to use 1-based numbers in layout too, using zero to
represent "auto".
So, I think it's the right patch, and it matches NRows().
(and it passed mochitest-plain locally)
Comment 7•11 years ago
|
||
Comment on attachment 8413867 [details] [diff] [review]
fix
Review of attachment 8413867 [details] [diff] [review]:
-----------------------------------------------------------------
r=me with a "Column numbers start at 1" comment next to "uint32_t column = 0;" which seems to imply they start at 0.
I don’t have commit access to push this, though.
Attachment #8413867 -
Flags: review?(simon.sapin) → review+
Assignee | ||
Comment 8•11 years ago
|
||
With a code comment added:
https://hg.mozilla.org/integration/mozilla-inbound/rev/50a85e215d44
Flags: in-testsuite-
Comment 9•11 years ago
|
||
Assignee: nobody → matspal
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in
before you can comment on or make changes to this bug.
Description
•