Changeset 159808 in webkit
- Timestamp:
- Nov 27, 2013 12:31:14 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r159807 r159808 1 2013-11-26 Sergio Villar Senin <svillar@igalia.com> 2 3 [CSS Grid Layout] Support grid-definition-{rows|columns} repeat() syntax 4 https://bugs.webkit.org/show_bug.cgi?id=103312 5 6 Reviewed by Andreas Kling. 7 8 Based on Blink r153155 by <jchaffraix@chromium.org>. Some code was 9 refactored in a helper function to have a more compact test. 10 11 * fast/css-grid-layout/grid-element-repeat-get-set-expected.txt: Added. 12 * fast/css-grid-layout/grid-element-repeat-get-set.html: Added. 13 1 14 2013-11-26 Ryosuke Niwa <rniwa@webkit.org> 2 15 -
trunk/PerformanceTests/ChangeLog
r159805 r159808 1 2013-11-26 Sergio Villar Senin <svillar@igalia.com> 2 3 [CSS Grid Layout] Support grid-definition-{rows|columns} repeat() syntax 4 https://bugs.webkit.org/show_bug.cgi?id=103312 5 6 Reviewed by Andreas Kling. 7 8 Use the repeat() syntax to build the huge grids used by the 9 performance tests. 10 11 * Layout/auto-grid-lots-of-data.html: 12 * Layout/fixed-grid-lots-of-data.html: 13 1 14 2013-11-26 Ryosuke Niwa <rniwa@webkit.org> 2 15 -
trunk/PerformanceTests/Layout/auto-grid-lots-of-data.html
r159685 r159808 14 14 body { 15 15 display: -webkit-grid; 16 /* FIXME: change to repeat(100, auto) when repeat() syntax becomes available. */ 17 -webkit-grid-definition-rows: auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto; 18 -webkit-grid-definition-columns: auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto auto; 16 -webkit-grid-definition-rows: repeat(100, auto); 17 -webkit-grid-definition-columns: repeat(20, auto); 19 18 } 20 19 -
trunk/PerformanceTests/Layout/fixed-grid-lots-of-data.html
r159684 r159808 13 13 14 14 body { 15 /* FIXME: replace by repeat() syntax when available */16 15 display: -webkit-grid; 17 -webkit-grid-definition-rows: 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px;18 -webkit-grid-definition-columns: 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px 200px;16 -webkit-grid-definition-rows: repeat(100, 200px); 17 -webkit-grid-definition-columns: repeat(20, 200px); 19 18 } 20 19 -
trunk/Source/WebCore/ChangeLog
r159806 r159808 1 2013-11-26 Sergio Villar Senin <svillar@igalia.com> 2 3 [CSS Grid Layout] Support grid-definition-{rows|columns} repeat() syntax 4 https://bugs.webkit.org/show_bug.cgi?id=103312 5 6 Reviewed by Andreas Kling. 7 8 Added support for the repeat() syntax inside 9 grid-definition-{rows|columns} by just adding the repeated values 10 to our list of column|row definitions. 11 12 The parsing of <track-name> was refactored in a new function as 13 it's used now in three different places. The <track-size> parsing 14 was also refactored to share it with the repeat() parsing. 15 16 Test: fast/css-grid-layout/grid-element-repeat-get-set.html 17 18 * css/CSSParser.cpp: 19 (WebCore::CSSParser::parseValue): 20 (WebCore::CSSParser::parseGridTrackNames): 21 (WebCore::CSSParser::parseGridTrackList): 22 (WebCore::CSSParser::parseGridTrackRepeatFunction): 23 (WebCore::CSSParser::parseGridTrackSize): 24 * css/CSSParser.h: 25 1 26 2013-11-26 Marcelo Lira <marcelo.lira@openbossa.org> 2 27 -
trunk/Source/WebCore/css/CSSParser.cpp
r159591 r159808 2698 2698 if (!cssGridLayoutEnabled()) 2699 2699 return false; 2700 parsedValue = parseGridTrackSize( );2700 parsedValue = parseGridTrackSize(*m_valueList); 2701 2701 break; 2702 2702 … … 5031 5031 } 5032 5032 5033 void CSSParser::parseGridTrackNames(CSSParserValueList& parserValues, CSSValueList& values) 5034 { 5035 do { 5036 RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(parserValues.current()); 5037 values.append(name.release()); 5038 parserValues.next(); 5039 } while (parserValues.current() && parserValues.current()->unit == CSSPrimitiveValue::CSS_STRING); 5040 } 5041 5033 5042 bool CSSParser::parseGridTrackList(CSSPropertyID propId, bool important) 5034 5043 { … … 5044 5053 RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated(); 5045 5054 // Handle leading track names 5046 while (m_valueList->current() && m_valueList->current()->unit == CSSPrimitiveValue::CSS_STRING) { 5047 RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(m_valueList->current()); 5048 values->append(name.release()); 5049 m_valueList->next(); 5050 } 5051 5052 bool seenTrackSize = false; 5053 while (m_valueList->current()) { 5054 RefPtr<CSSPrimitiveValue> primitiveValue = parseGridTrackSize(); 5055 if (!primitiveValue) 5056 return false; 5057 5058 seenTrackSize = true; 5059 values->append(primitiveValue.release()); 5060 5061 while (m_valueList->current() && m_valueList->current()->unit == CSSPrimitiveValue::CSS_STRING) { 5062 RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(m_valueList->current()); 5063 values->append(name.release()); 5064 m_valueList->next(); 5065 } 5066 } 5067 5068 if (!seenTrackSize) 5055 if (m_valueList->current() && m_valueList->current()->unit == CSSPrimitiveValue::CSS_STRING) 5056 parseGridTrackNames(*m_valueList, *values); 5057 5058 bool seenTrackSizeOrRepeatFunction = false; 5059 while (CSSParserValue* currentValue = m_valueList->current()) { 5060 if (currentValue->unit == CSSParserValue::Function && equalIgnoringCase(currentValue->function->name, "repeat(")) { 5061 if (!parseGridTrackRepeatFunction(*values)) 5062 return false; 5063 } else { 5064 RefPtr<CSSPrimitiveValue> primitiveValue = parseGridTrackSize(*m_valueList); 5065 if (!primitiveValue) 5066 return false; 5067 values->append(primitiveValue.release()); 5068 } 5069 seenTrackSizeOrRepeatFunction = true; 5070 5071 if (m_valueList->current() && m_valueList->current()->unit == CSSPrimitiveValue::CSS_STRING) 5072 parseGridTrackNames(*m_valueList, *values); 5073 } 5074 5075 if (!seenTrackSizeOrRepeatFunction) 5069 5076 return false; 5070 5077 … … 5073 5080 } 5074 5081 5075 PassRefPtr<CSSPrimitiveValue> CSSParser::parseGridTrackSize() 5076 { 5077 CSSParserValue* currentValue = m_valueList->current(); 5082 bool CSSParser::parseGridTrackRepeatFunction(CSSValueList& list) 5083 { 5084 CSSParserValueList* arguments = m_valueList->current()->function->args.get(); 5085 if (!arguments || arguments->size() < 3 || !validUnit(arguments->valueAt(0), FPositiveInteger) || !isComma(arguments->valueAt(1))) 5086 return false; 5087 5088 ASSERT_WITH_SECURITY_IMPLICATION(arguments->valueAt(0)->fValue > 0); 5089 size_t repetitions = arguments->valueAt(0)->fValue; 5090 RefPtr<CSSValueList> repeatedValues = CSSValueList::createSpaceSeparated(); 5091 arguments->next(); // Skip the repetition count. 5092 arguments->next(); // Skip the comma. 5093 5094 while (arguments->current()) { 5095 if (arguments->current()->unit == CSSPrimitiveValue::CSS_STRING) 5096 parseGridTrackNames(*arguments, *repeatedValues); 5097 5098 if (!arguments->current()) 5099 break; 5100 5101 RefPtr<CSSPrimitiveValue> trackSize = parseGridTrackSize(*arguments); 5102 if (!trackSize) 5103 return false; 5104 5105 repeatedValues->append(trackSize.release()); 5106 } 5107 5108 for (size_t i = 0; i < repetitions; ++i) { 5109 for (size_t j = 0; j < repeatedValues->length(); ++j) 5110 list.append(repeatedValues->itemWithoutBoundsCheck(j)); 5111 } 5112 5078 5113 m_valueList->next(); 5114 return true; 5115 } 5116 5117 PassRefPtr<CSSPrimitiveValue> CSSParser::parseGridTrackSize(CSSParserValueList& inputList) 5118 { 5119 CSSParserValue* currentValue = inputList.current(); 5120 inputList.next(); 5079 5121 5080 5122 if (currentValue->id == CSSValueAuto) … … 5098 5140 } 5099 5141 5100 if (PassRefPtr<CSSPrimitiveValue> trackBreadth = parseGridBreadth(currentValue)) 5101 return trackBreadth; 5102 5103 return 0; 5142 return parseGridBreadth(currentValue); 5104 5143 } 5105 5144 -
trunk/Source/WebCore/css/CSSParser.h
r159591 r159808 171 171 bool parseSingleGridAreaLonghand(RefPtr<CSSValue>&); 172 172 bool parseGridTrackList(CSSPropertyID, bool important); 173 PassRefPtr<CSSPrimitiveValue> parseGridTrackSize(); 173 bool parseGridTrackRepeatFunction(CSSValueList&); 174 PassRefPtr<CSSPrimitiveValue> parseGridTrackSize(CSSParserValueList& inputList); 174 175 PassRefPtr<CSSPrimitiveValue> parseGridBreadth(CSSParserValue*); 175 176 PassRefPtr<CSSValue> parseGridTemplate(); 177 void parseGridTrackNames(CSSParserValueList& inputList, CSSValueList& values); 176 178 177 179 bool parseDashboardRegions(CSSPropertyID, bool important);
Note: See TracChangeset
for help on using the changeset viewer.