Bug 145860

Summary: [CSS Grid Layout] Fix grid-template-areas parsing to avoid spaces
Product: WebKit Reporter: Manuel Rego Casasnovas <rego>
Component: CSSAssignee: Manuel Rego Casasnovas <rego>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, commit-queue, jfernandez, ossy, rniwa, svillar
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 145927    
Bug Blocks: 60731    
Attachments:
Description Flags
Patch
none
Patch
none
Archive of layout-test-results from ews107 for mac-mavericks-wk2
none
Archive of layout-test-results from ews101 for mac-mavericks
none
Patch
none
Patch
none
Patch none

Manuel Rego Casasnovas
Reported 2015-06-10 15:28:58 PDT
We should allow to remove the spaces between the dots and the idents (for reference see discussion at CSS WG mailing list: https://lists.w3.org/Archives/Public/www-style/2015May/0239.html). So, the following example: grid-template-areas: ". title ." "nav main aside"; should be equivalent to: grid-template-areas: "....title....." "nav main aside"; and: grid-template-areas: ".title." "nav main aside";
Attachments
Patch (8.35 KB, patch)
2015-06-10 15:38 PDT, Manuel Rego Casasnovas
no flags
Patch (9.93 KB, patch)
2015-06-11 07:07 PDT, Manuel Rego Casasnovas
no flags
Archive of layout-test-results from ews107 for mac-mavericks-wk2 (904.08 KB, application/zip)
2015-06-11 08:43 PDT, Build Bot
no flags
Archive of layout-test-results from ews101 for mac-mavericks (696.47 KB, application/zip)
2015-06-11 08:46 PDT, Build Bot
no flags
Patch (10.48 KB, patch)
2015-06-11 11:38 PDT, Manuel Rego Casasnovas
no flags
Patch (10.51 KB, patch)
2015-06-11 13:38 PDT, Manuel Rego Casasnovas
no flags
Patch (10.38 KB, patch)
2015-06-12 13:52 PDT, Manuel Rego Casasnovas
no flags
Manuel Rego Casasnovas
Comment 1 2015-06-10 15:38:50 PDT
Sergio Villar Senin
Comment 2 2015-06-11 02:08:23 PDT
Comment on attachment 254686 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=254686&action=review Looking good but I think we can improve the tokenization... > Source/WebCore/css/CSSParser.cpp:5994 > + areaName.append(text[i]); Instead of appending one by one, I think it would be better to keep track of the index of the start of the area name, and then just simply do a substring() call (perhaps even substringSharingImpl()) as gridRowNames will be valid throughout the whole life of columnNames I think) > LayoutTests/fast/css-grid-layout/grid-template-areas-get-set.html:80 > +} Although you already consider some of them I think we should have separate test cases for the following situations: a) ....A b) A.. c) ...A.. d) A.B e) ..A.B f) A.B.. g) ..A..B...
Manuel Rego Casasnovas
Comment 3 2015-06-11 07:07:34 PDT
Manuel Rego Casasnovas
Comment 4 2015-06-11 07:10:42 PDT
Thanks for the review! (In reply to comment #2) > > Source/WebCore/css/CSSParser.cpp:5994 > > + areaName.append(text[i]); > > Instead of appending one by one, I think it would be better to keep track of > the index of the start of the area name, and then just simply do a > substring() call (perhaps even substringSharingImpl()) as gridRowNames will > be valid throughout the whole life of columnNames I think) Yeah I think this approach makes the code a bit simpler. > > LayoutTests/fast/css-grid-layout/grid-template-areas-get-set.html:80 > > +} > > Although you already consider some of them I think we should have separate > test cases for the following situations: > a) ....A > b) A.. > c) ...A.. > d) A.B > e) ..A.B > f) A.B.. > g) ..A..B... I've added more cases like these ones and other too.
Sergio Villar Senin
Comment 5 2015-06-11 08:35:53 PDT
Comment on attachment 254720 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=254720&action=review > Source/WebCore/css/CSSParser.cpp:5971 > + while (index < text.length()) { let's cache text.length() in a local variable in order not to repeat the same call over and over again. > Source/WebCore/css/CSSParser.cpp:5975 > + index++; I think it's ok to use a single line for this. > Source/WebCore/css/CSSParser.cpp:5982 > + index++; Ditto. > LayoutTests/fast/css-grid-layout/grid-template-areas-get-set-expected.txt:21 > +PASS getComputedStyle(gridWithDotsNoSpace).getPropertyValue('-webkit-grid-template-areas') is "\". title . nav . . main test\"" Seems like you forgot to upload all the new expectations?
Build Bot
Comment 6 2015-06-11 08:43:32 PDT
Comment on attachment 254720 [details] Patch Attachment 254720 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5739303049101312 New failing tests: fast/css-grid-layout/grid-template-areas-get-set.html
Build Bot
Comment 7 2015-06-11 08:43:34 PDT
Created attachment 254722 [details] Archive of layout-test-results from ews107 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Build Bot
Comment 8 2015-06-11 08:46:04 PDT
Comment on attachment 254720 [details] Patch Attachment 254720 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/4917405222436864 New failing tests: fast/css-grid-layout/grid-template-areas-get-set.html
Build Bot
Comment 9 2015-06-11 08:46:07 PDT
Created attachment 254723 [details] Archive of layout-test-results from ews101 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-mavericks Platform: Mac OS X 10.9.5
Manuel Rego Casasnovas
Comment 10 2015-06-11 11:38:24 PDT
WebKit Commit Bot
Comment 11 2015-06-11 11:42:06 PDT
Attachment 254735 [details] did not pass style-queue: ERROR: Source/WebCore/css/CSSParser.cpp:5975: More than one command on the same line in while [whitespace/parens] [4] ERROR: Source/WebCore/css/CSSParser.cpp:5981: More than one command on the same line in while [whitespace/parens] [4] Total errors found: 2 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Manuel Rego Casasnovas
Comment 12 2015-06-11 13:38:18 PDT
Manuel Rego Casasnovas
Comment 13 2015-06-12 00:30:49 PDT
Thanks for the review. (In reply to comment #5) > Comment on attachment 254720 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=254720&action=review > > > Source/WebCore/css/CSSParser.cpp:5971 > > + while (index < text.length()) { > > let's cache text.length() in a local variable in order not to repeat the > same call over and over again. Done. > > Source/WebCore/css/CSSParser.cpp:5975 > > + index++; > > I think it's ok to use a single line for this. It seems the style checker didn't like it. > > LayoutTests/fast/css-grid-layout/grid-template-areas-get-set-expected.txt:21 > > +PASS getComputedStyle(gridWithDotsNoSpace).getPropertyValue('-webkit-grid-template-areas') is "\". title . nav . . main test\"" > > Seems like you forgot to upload all the new expectations? True :-)
WebKit Commit Bot
Comment 14 2015-06-12 01:20:12 PDT
Comment on attachment 254754 [details] Patch Clearing flags on attachment: 254754 Committed r185492: <http://trac.webkit.org/changeset/185492>
WebKit Commit Bot
Comment 15 2015-06-12 01:20:16 PDT
All reviewed patches have been landed. Closing bug.
Csaba Osztrogonác
Comment 16 2015-06-12 04:37:42 PDT
(In reply to comment #14) > Comment on attachment 254754 [details] > Patch > > Clearing flags on attachment: 254754 > > Committed r185492: <http://trac.webkit.org/changeset/185492> It caused 11 assertions on Apple's debug bots: https://build.webkit.org/builders/Apple%20Mavericks%20Debug%20WK2%20%28Tests%29/builds/12379
WebKit Commit Bot
Comment 17 2015-06-12 05:45:10 PDT
Re-opened since this is blocked by bug 145927
Manuel Rego Casasnovas
Comment 18 2015-06-12 13:52:54 PDT
Manuel Rego Casasnovas
Comment 19 2015-06-12 13:56:26 PDT
(In reply to comment #16) > (In reply to comment #14) > > Comment on attachment 254754 [details] > > Patch > > > > Clearing flags on attachment: 254754 > > > > Committed r185492: <http://trac.webkit.org/changeset/185492> > > It caused 11 assertions on Apple's debug bots: > https://build.webkit.org/builders/ > Apple%20Mavericks%20Debug%20WK2%20%28Tests%29/builds/12379 Yes it was a silly mistake "index < length" was the last condition at: while (text[index] != ' ' && text[index] != '.' && index < length) When it should be the first one. :-(
Manuel Rego Casasnovas
Comment 20 2015-06-12 14:01:57 PDT
Comment on attachment 254817 [details] Patch Clearing flags on attachment: 254817 Committed r185520: <http://trac.webkit.org/changeset/185520>
Manuel Rego Casasnovas
Comment 21 2015-06-12 14:02:07 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 22 2015-06-12 18:33:38 PDT
Comment on attachment 254817 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=254817&action=review > Source/WebCore/css/CSSParser.cpp:5964 > +static Vector<String> parseGridTemplateAreasColumnNames(const String& gridRowNames) Could save some memory allocation by making this take a StringView and return a Vector<StringView>. Then can convert to a string when we need to. Probably a bit of a project, though.
Note You need to log in before you can comment on or make changes to this bug.