Changeset 169349 in webkit
- Timestamp:
- May 26, 2014 9:25:25 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r169345 r169349 1 2014-05-26 Javier Fernandez <jfernandez@igalia.com> 2 3 [CSS Grid Layout] Implementation of the "grid" shorthand. 4 https://bugs.webkit.org/show_bug.cgi?id=132122 5 6 Reviewed by Darin Adler. 7 8 Layout Test for the basic functionality of the 'grid' shorthand. It was 9 also added a new javascript file with some utility functions. 10 11 * fast/css-grid-layout/grid-shorthand-get-set-expected.txt: Added. 12 * fast/css-grid-layout/grid-shorthand-get-set.html: Added. 13 * fast/css-grid-layout/resources/grid-shorthand-parsing-utils.js: Added. 14 (testGridDefinitionsValues): 15 (testGridDefinitionsSetJSValues): 16 (testNonGridDefinitionsSetJSValues): 17 (checkGridDefinitionsSetJSValues): 18 (testGridDefinitionsSetBadJSValues): 19 1 20 2014-05-26 Michał Pakuła vel Rutka <m.pakula@samsung.com> 2 21 -
trunk/Source/WebCore/ChangeLog
r169346 r169349 1 2014-05-26 Javier Fernandez <jfernandez@igalia.com> 2 3 [CSS Grid Layout] Implementation of the "grid" shorthand. 4 https://bugs.webkit.org/show_bug.cgi?id=132122 5 6 Reviewed by Darin Adler. 7 8 The grid property is a shorthand that sets all of the explicit 9 grid properties (grid-template-rows, grid-template-columns, and 10 grid-template-areas) as well as all the implicit grid properties 11 (grid-auto-rows, grid-auto-columns, and grid-auto-flow) in a 12 single declaration 13 14 Notice that either explicit or implicit grid can be specified, 15 assigning the initial values to the omitted properties. 16 17 Test: fast/css-grid-layout/grid-shorthand-get-set.html 18 19 * css/CSSComputedStyleDeclaration.cpp: 20 (WebCore::ComputedStyleExtractor::propertyValue): 21 * css/CSSParser.cpp: 22 (WebCore::CSSParser::parseValue): 23 (WebCore::CSSParser::parseGridShorthand): 24 * css/CSSParser.h: 25 * css/CSSPropertyNames.in: 26 * css/StylePropertyShorthand.cpp: 27 (WebCore::webkitGridShorthand): 28 * css/StylePropertyShorthand.h: 29 1 30 2014-05-26 Zalan Bujtas <zalan@apple.com> 2 31 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r167935 r169349 2085 2085 case CSSPropertyWebkitGridTemplate: 2086 2086 return getCSSPropertyValuesForGridShorthand(webkitGridTemplateShorthand()); 2087 case CSSPropertyWebkitGrid: 2088 return getCSSPropertyValuesForGridShorthand(webkitGridShorthand()); 2087 2089 case CSSPropertyWebkitGridColumn: 2088 2090 return getCSSPropertyValuesForGridShorthand(webkitGridColumnShorthand()); -
trunk/Source/WebCore/css/CSSParser.cpp
r168873 r169349 2586 2586 return parseGridTemplateShorthand(important); 2587 2587 2588 case CSSPropertyWebkitGrid: 2589 return parseGridShorthand(important); 2590 2588 2591 case CSSPropertyWebkitGridArea: 2589 2592 return parseGridAreaShorthand(important); … … 4886 4889 m_valueList->setCurrentIndex(index); 4887 4890 return parseGridTemplateRowsAndAreas(columnsValue, important); 4891 } 4892 4893 bool CSSParser::parseGridShorthand(bool important) 4894 { 4895 ShorthandScope scope(this, CSSPropertyWebkitGrid); 4896 ASSERT(shorthandForProperty(CSSPropertyWebkitGrid).length() == 6); 4897 4898 // 1- <grid-template> 4899 if (parseGridTemplateShorthand(important)) { 4900 // It can only be specified the explicit or the implicit grid properties in a single grid declaration. 4901 // The sub-properties not specified are set to their initial value, as normal for shorthands. 4902 addProperty(CSSPropertyWebkitGridAutoFlow, cssValuePool().createImplicitInitialValue(), important); 4903 addProperty(CSSPropertyWebkitGridAutoColumns, cssValuePool().createImplicitInitialValue(), important); 4904 addProperty(CSSPropertyWebkitGridAutoRows, cssValuePool().createImplicitInitialValue(), important); 4905 return true; 4906 } 4907 4908 // Need to rewind parsing to explore the alternative syntax of this shorthand. 4909 m_valueList->setCurrentIndex(0); 4910 4911 // 2- <grid-auto-flow> [ <grid-auto-columns> [ / <grid-auto-rows> ]? ] 4912 CSSValueID id = m_valueList->current()->id; 4913 if (id != CSSValueRow && id != CSSValueColumn && id != CSSValueNone) 4914 return false; 4915 4916 RefPtr<CSSValue> autoFlowValue = cssValuePool().createIdentifierValue(id); 4917 RefPtr<CSSValue> autoColumnsValue; 4918 RefPtr<CSSValue> autoRowsValue; 4919 4920 if (m_valueList->next()) { 4921 autoColumnsValue = parseGridTrackSize(*m_valueList); 4922 if (!autoColumnsValue) 4923 return false; 4924 if (m_valueList->current()) { 4925 if (!isForwardSlashOperator(m_valueList->current()) || !m_valueList->next()) 4926 return false; 4927 autoRowsValue = parseGridTrackSize(*m_valueList); 4928 if (!autoRowsValue) 4929 return false; 4930 } 4931 if (m_valueList->current()) 4932 return false; 4933 } else { 4934 // Other omitted values are set to their initial values. 4935 autoColumnsValue = cssValuePool().createImplicitInitialValue(); 4936 autoRowsValue = cssValuePool().createImplicitInitialValue(); 4937 } 4938 4939 // if <grid-auto-rows> value is omitted, it is set to the value specified for grid-auto-columns. 4940 if (!autoRowsValue) 4941 autoRowsValue = autoColumnsValue; 4942 4943 addProperty(CSSPropertyWebkitGridAutoFlow, autoFlowValue.release(), important); 4944 addProperty(CSSPropertyWebkitGridAutoColumns, autoColumnsValue.release(), important); 4945 addProperty(CSSPropertyWebkitGridAutoRows, autoRowsValue.release(), important); 4946 4947 // It can only be specified the explicit or the implicit grid properties in a single grid declaration. 4948 // The sub-properties not specified are set to their initial value, as normal for shorthands. 4949 addProperty(CSSPropertyWebkitGridTemplateColumns, cssValuePool().createImplicitInitialValue(), important); 4950 addProperty(CSSPropertyWebkitGridTemplateRows, cssValuePool().createImplicitInitialValue(), important); 4951 addProperty(CSSPropertyWebkitGridTemplateAreas, cssValuePool().createImplicitInitialValue(), important); 4952 4953 return true; 4888 4954 } 4889 4955 -
trunk/Source/WebCore/css/CSSParser.h
r168416 r169349 163 163 bool parseGridTemplateRowsAndAreas(PassRefPtr<CSSValue>, bool important); 164 164 bool parseGridTemplateShorthand(bool important); 165 bool parseGridShorthand(bool important); 165 166 bool parseGridAreaShorthand(bool important); 166 167 bool parseSingleGridAreaLonghand(RefPtr<CSSValue>&); -
trunk/Source/WebCore/css/CSSPropertyNames.in
r167799 r169349 306 306 -webkit-font-size-delta 307 307 #if defined(ENABLE_CSS_GRID_LAYOUT) && ENABLE_CSS_GRID_LAYOUT 308 -webkit-grid 308 309 -webkit-grid-area 309 310 -webkit-grid-auto-columns -
trunk/Source/WebCore/css/StyleProperties.cpp
r167967 r169349 163 163 case CSSPropertyWebkitGridTemplate: 164 164 return getShorthandValue(webkitGridTemplateShorthand()); 165 case CSSPropertyWebkitGrid: 166 return getShorthandValue(webkitGridShorthand()); 165 167 case CSSPropertyWebkitGridColumn: 166 168 return getShorthandValue(webkitGridColumnShorthand()); -
trunk/Source/WebCore/css/StylePropertyShorthand.cpp
r167821 r169349 353 353 354 354 #if ENABLE(CSS_GRID_LAYOUT) 355 StylePropertyShorthand webkitGridShorthand() 356 { 357 static const CSSPropertyID webkitGridProperties[] = { 358 CSSPropertyWebkitGridTemplateColumns, 359 CSSPropertyWebkitGridTemplateRows, 360 CSSPropertyWebkitGridTemplateAreas, 361 CSSPropertyWebkitGridAutoFlow, 362 CSSPropertyWebkitGridAutoColumns, 363 CSSPropertyWebkitGridAutoRows 364 }; 365 return StylePropertyShorthand(CSSPropertyWebkitGrid, webkitGridProperties, WTF_ARRAY_LENGTH(webkitGridProperties)); 366 } 367 355 368 StylePropertyShorthand webkitGridTemplateShorthand() 356 369 { … … 570 583 case CSSPropertyWebkitGridTemplate: 571 584 return webkitGridTemplateShorthand(); 585 case CSSPropertyWebkitGrid: 586 return webkitGridShorthand(); 572 587 case CSSPropertyWebkitGridColumn: 573 588 return webkitGridColumnShorthand(); … … 773 788 case CSSPropertyWebkitGridTemplateRows: 774 789 case CSSPropertyWebkitGridTemplateAreas: 775 return makeVector(webkitGridTemplateShorthand()); 790 return makeVector(webkitGridTemplateShorthand(), webkitGridShorthand()); 791 case CSSPropertyWebkitGridAutoFlow: 792 case CSSPropertyWebkitGridAutoColumns: 793 case CSSPropertyWebkitGridAutoRows: 794 return makeVector(webkitGridShorthand()); 776 795 #endif 777 796 case CSSPropertyWebkitMarginBeforeCollapse: -
trunk/Source/WebCore/css/StylePropertyShorthand.h
r167799 r169349 100 100 StylePropertyShorthand webkitFlexFlowShorthand(); 101 101 StylePropertyShorthand webkitFlexShorthand(); 102 StylePropertyShorthand webkitGridShorthand(); 102 103 StylePropertyShorthand webkitGridTemplateShorthand(); 103 104 StylePropertyShorthand webkitGridAreaShorthand();
Note: See TracChangeset
for help on using the changeset viewer.