Changeset 202972 in webkit
- Timestamp:
- Jul 8, 2016 1:57:50 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r202970 r202972 1 2016-07-08 Manuel Rego Casasnovas <rego@igalia.com> 2 3 [css-grid] Disallow repeat() in grid-template shorthand 4 https://bugs.webkit.org/show_bug.cgi?id=159200 5 6 Reviewed by Sergio Villar Senin. 7 8 Modified test to follow the new behavior including new cases. 9 10 * fast/css-grid-layout/grid-template-shorthand-get-set-expected.txt: 11 * fast/css-grid-layout/grid-template-shorthand-get-set.html: 12 1 13 2016-07-08 Frederic Wang <fwang@igalia.com> 2 14 -
trunk/LayoutTests/fast/css-grid-layout/grid-template-shorthand-get-set-expected.txt
r201919 r202972 41 41 PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleRowsWithoutRowsSizes, '').getPropertyValue('grid-template-rows') is "[head1] 0px [tail1 head2] 0px [tail2]" 42 42 PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleRowsWithoutRowsSizes, '').getPropertyValue('grid-template-areas') is "\"a\" \"b\"" 43 PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleRowsAndColumns, '').getPropertyValue('grid-template-columns') is "[first] 10px [nav nav2] 15px [nav nav2] 15px"43 PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleRowsAndColumns, '').getPropertyValue('grid-template-columns') is "[first] 10px [nav nav2] 15px [nav] 15px [last]" 44 44 PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleRowsAndColumns, '').getPropertyValue('grid-template-rows') is "100px [nav nav2] 25px [nav nav2] 25px [last]" 45 45 PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleRowsAndColumns, '').getPropertyValue('grid-template-areas') is "\"a b c\" \"d e f\" \"g h i\"" 46 PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleRowsAndColumnsWithoutRowsSizes, '').getPropertyValue('grid-template-columns') is "[first] 10px [nav nav2] 15px [nav nav2] 15px"46 PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleRowsAndColumnsWithoutRowsSizes, '').getPropertyValue('grid-template-columns') is "[first] 10px [nav nav2] 15px [nav] 15px [last]" 47 47 PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleRowsAndColumnsWithoutRowsSizes, '').getPropertyValue('grid-template-rows') is "0px [nav nav2] 0px [nav nav2] 0px [last]" 48 48 PASS window.getComputedStyle(gridTemplateComplexFormWithLineNamesMultipleRowsAndColumnsWithoutRowsSizes, '').getPropertyValue('grid-template-areas') is "\"a b c\" \"d e f\" \"g h i\"" … … 130 130 PASS window.getComputedStyle(gridTemplateNoColumnsRowWithEmptyTrailingLineNamesAndNonEmptyLeadingLineNames, '').getPropertyValue('grid-template-rows') is "none" 131 131 PASS window.getComputedStyle(gridTemplateNoColumnsRowWithEmptyTrailingLineNamesAndNonEmptyLeadingLineNames, '').getPropertyValue('grid-template-areas') is "none" 132 PASS window.getComputedStyle(gridTemplateRepeat, '').getPropertyValue('grid-template-columns') is "none" 133 PASS window.getComputedStyle(gridTemplateRepeat, '').getPropertyValue('grid-template-rows') is "none" 134 PASS window.getComputedStyle(gridTemplateRepeat, '').getPropertyValue('grid-template-areas') is "none" 135 PASS window.getComputedStyle(gridTemplateRepeatAutoFill, '').getPropertyValue('grid-template-columns') is "none" 136 PASS window.getComputedStyle(gridTemplateRepeatAutoFill, '').getPropertyValue('grid-template-rows') is "none" 137 PASS window.getComputedStyle(gridTemplateRepeatAutoFill, '').getPropertyValue('grid-template-areas') is "none" 138 PASS window.getComputedStyle(gridTemplateRepeatAutoFit, '').getPropertyValue('grid-template-columns') is "none" 139 PASS window.getComputedStyle(gridTemplateRepeatAutoFit, '').getPropertyValue('grid-template-rows') is "none" 140 PASS window.getComputedStyle(gridTemplateRepeatAutoFit, '').getPropertyValue('grid-template-areas') is "none" 132 141 133 142 Test the initial value … … 198 207 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none" 199 208 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" 209 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none" 210 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none" 211 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" 212 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none" 213 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none" 214 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" 215 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none" 216 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none" 217 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-areas') is "none" 200 218 PASS successfullyParsed is true 201 219 -
trunk/LayoutTests/fast/css-grid-layout/grid-template-shorthand-get-set.html
r201919 r202972 46 46 grid-template: "a b c" 100px [nav] 47 47 [nav2] "d e f" 25px [nav] 48 [nav2] "g h i" 25px [last] / [first] 10px repeat(2, [nav nav2] 15px);48 [nav2] "g h i" 25px [last] / [first] 10px [nav nav2] 15px [nav] 15px [last]; 49 49 } 50 50 #gridTemplateComplexFormWithLineNamesMultipleRowsAndColumnsWithoutRowsSizes { 51 51 grid-template: "a b c" [nav] 52 52 [nav2] "d e f" [nav] 53 [nav2] "g h i" [last] / [first] 10px repeat(2, [nav nav2] 15px);53 [nav2] "g h i" [last] / [first] 10px [nav nav2] 15px [nav] 15px [last]; 54 54 } 55 55 #gridTemplateComplexFormWithAuto { … … 137 137 #gridTemplateNoColumnsRowWithEmptyTrailingLineNamesAndNonEmptyLeadingLineNames { 138 138 grid-template: [first] "a" auto [] [tail]; 139 } 140 #gridTemplateRepeat { 141 grid-template: "a" / repeat(1, 100px); 142 } 143 #gridTemplateRepeatAutoFill { 144 grid-template: "a" / repeat(auto-fill, 100px); 145 } 146 #gridTemplateRepeatAutoFit { 147 grid-template: "a" / repeat(auto-fit, 100px); 139 148 } 140 149 … … 185 194 <div class="grid" id="gridTemplateComplexFormWithNoneColumns"></div> 186 195 <div class="grid" id="gridTemplateNoColumnsRowWithTwoEmptyTrailingLineNames"></div> 196 <div class="grid" id="gridTemplateRepeat"></div> 197 <div class="grid" id="gridTemplateRepeatAutoFill"></div> 198 <div class="grid" id="gridTemplateRepeatAutoFit"></div> 187 199 <script src="resources/grid-template-shorthand-parsing-utils.js"></script> 188 200 <script> … … 202 214 testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleRows"), "10px", "[head1] 15px [tail1 head2] 20px [tail2]", '"a" "b"'); 203 215 testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleRowsWithoutRowsSizes"), "10px", "[head1] 0px [tail1 head2] 0px [tail2]", '"a" "b"'); 204 testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleRowsAndColumns"), "[first] 10px [nav nav2] 15px [nav nav2] 15px", "100px [nav nav2] 25px [nav nav2] 25px [last]", '"a b c" "d e f" "g h i"');205 testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleRowsAndColumnsWithoutRowsSizes"), "[first] 10px [nav nav2] 15px [nav nav2] 15px", "0px [nav nav2] 0px [nav nav2] 0px [last]", '"a b c" "d e f" "g h i"');216 testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleRowsAndColumns"), "[first] 10px [nav nav2] 15px [nav] 15px [last]", "100px [nav nav2] 25px [nav nav2] 25px [last]", '"a b c" "d e f" "g h i"'); 217 testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleRowsAndColumnsWithoutRowsSizes"), "[first] 10px [nav nav2] 15px [nav] 15px [last]", "0px [nav nav2] 0px [nav nav2] 0px [last]", '"a b c" "d e f" "g h i"'); 206 218 testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithAuto"), "10px", "0px", '"a"'); 207 219 testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormOnlyAreas"), "0px", "0px", '"a"'); … … 234 246 testGridDefinitionsValues(document.getElementById("gridTemplateNoColumnsRowWithTwoEmptyTrailingLineNames"), "none", "none", "none"); 235 247 testGridDefinitionsValues(document.getElementById("gridTemplateNoColumnsRowWithEmptyTrailingLineNamesAndNonEmptyLeadingLineNames"), "none", "none", "none"); 248 testGridDefinitionsValues(document.getElementById("gridTemplateRepeat"), "none", "none", "none"); 249 testGridDefinitionsValues(document.getElementById("gridTemplateRepeatAutoFill"), "none", "none", "none"); 250 testGridDefinitionsValues(document.getElementById("gridTemplateRepeatAutoFit"), "none", "none", "none"); 236 251 237 252 debug(""); … … 264 279 testGridDefinitionsSetBadJSValues("20px none / 15px"); 265 280 testGridDefinitionsSetBadJSValues("10px 'a' / 25px"); 281 testGridDefinitionsSetBadJSValues("'a b' / 100px repeat(1, 200px)"); 282 testGridDefinitionsSetBadJSValues("'a b c' / repeat(2, 200px) 100px"); 283 testGridDefinitionsSetBadJSValues("'a b c d' / 100px repeat(auto-fill, 200px) 100px"); 266 284 267 285 </script> -
trunk/Source/WebCore/ChangeLog
r202970 r202972 1 2016-07-08 Manuel Rego Casasnovas <rego@igalia.com> 2 3 [css-grid] Disallow repeat() in grid-template shorthand 4 https://bugs.webkit.org/show_bug.cgi?id=159200 5 6 Reviewed by Sergio Villar Senin. 7 8 As discussed on www-style, "repeat()" notation shouldn't be allowed 9 in the ASCII branch of the grid-template shorthand. 10 https://lists.w3.org/Archives/Public/www-style/2016May/0193.html 11 12 The patch uses an enum to invalidate "repeat()" when parsing 13 the grid-template shorthand. 14 15 Test: fast/css-grid-layout/grid-template-shorthand-get-set.html 16 17 * css/CSSParser.cpp: 18 (WebCore::CSSParser::parseGridTemplateColumns): Add enum. 19 (WebCore::CSSParser::parseGridTemplateRowsAndAreasAndColumns): Pass "DisallowRepeat" 20 when calling parseGridTemplateColumns(). 21 (WebCore::CSSParser::parseGridTrackList): Use enum to allow/disallow repeat. 22 * css/CSSParser.h: Define the new enum and modify method signatures to use it, 23 setting it to "AllowRepeat" by default. 24 1 25 2016-07-08 Frederic Wang <fwang@igalia.com> 2 26 -
trunk/Source/WebCore/css/CSSParser.cpp
r202950 r202972 5632 5632 } 5633 5633 5634 RefPtr<CSSValue> CSSParser::parseGridTemplateColumns( )5634 RefPtr<CSSValue> CSSParser::parseGridTemplateColumns(TrackListType trackListType) 5635 5635 { 5636 5636 ASSERT(isCSSGridLayoutEnabled()); … … 5638 5638 if (!(m_valueList->current() && isForwardSlashOperator(*m_valueList->current()) && m_valueList->next())) 5639 5639 return nullptr; 5640 if (auto columnsValue = parseGridTrackList( )) {5640 if (auto columnsValue = parseGridTrackList(trackListType)) { 5641 5641 if (m_valueList->current()) 5642 5642 return nullptr; … … 5691 5691 } 5692 5692 5693 // [ <track-list> /]?5693 // [/ <explicit-track-list> ]? 5694 5694 RefPtr<CSSValue> templateColumns; 5695 5695 if (m_valueList->current()) { 5696 5696 ASSERT(isForwardSlashOperator(*m_valueList->current())); 5697 templateColumns = parseGridTemplateColumns( );5697 templateColumns = parseGridTemplateColumns(DisallowRepeat); 5698 5698 if (!templateColumns) 5699 5699 return false; … … 5931 5931 } 5932 5932 5933 RefPtr<CSSValue> CSSParser::parseGridTrackList( )5933 RefPtr<CSSValue> CSSParser::parseGridTrackList(TrackListType trackListType) 5934 5934 { 5935 5935 ASSERT(isCSSGridLayoutEnabled()); … … 5954 5954 break; 5955 5955 if (currentValue->unit == CSSParserValue::Function && equalLettersIgnoringASCIICase(currentValue->function->name, "repeat(")) { 5956 if (trackListType == DisallowRepeat) 5957 return nullptr; 5956 5958 bool isAutoRepeat; 5957 5959 if (!parseGridTrackRepeatFunction(values, isAutoRepeat, allTracksAreFixedSized)) -
trunk/Source/WebCore/css/CSSParser.h
r202950 r202972 236 236 RefPtr<CSSValue> parseGridPosition(); 237 237 bool parseGridItemPositionShorthand(CSSPropertyID, bool important); 238 RefPtr<CSSValue> parseGridTemplateColumns(); 238 enum TrackListType { AllowRepeat, DisallowRepeat }; 239 RefPtr<CSSValue> parseGridTemplateColumns(TrackListType = AllowRepeat); 239 240 bool parseGridTemplateRowsAndAreasAndColumns(bool important); 240 241 bool parseGridTemplateShorthand(bool important); … … 243 244 bool parseGridGapShorthand(bool important); 244 245 bool parseSingleGridAreaLonghand(RefPtr<CSSValue>&); 245 RefPtr<CSSValue> parseGridTrackList( );246 RefPtr<CSSValue> parseGridTrackList(TrackListType = AllowRepeat); 246 247 bool parseGridTrackRepeatFunction(CSSValueList&, bool& isAutoRepeat, bool& allTracksAreFixedSized); 247 248 RefPtr<CSSValue> parseGridTrackSize(CSSParserValueList& inputList);
Note: See TracChangeset
for help on using the changeset viewer.