Commit 1fc69cc5 authored by andersr@opera.com's avatar andersr@opera.com

Move style building for grid-auto-flow to StyleBuilderConverter.

There doesn't appear to be a reason for this property to have
custom behavior. It's better to use a converter and call that
from the generated function.

Review URL: https://codereview.chromium.org/642303002

git-svn-id: svn://svn.chromium.org/blink/trunk@183595 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 1645ce3a
...@@ -176,7 +176,7 @@ flood-opacity animatable, svg, converter=convertNumberOrPercentage ...@@ -176,7 +176,7 @@ flood-opacity animatable, svg, converter=convertNumberOrPercentage
glyph-orientation-horizontal inherited, svg, converter=convertGlyphOrientation glyph-orientation-horizontal inherited, svg, converter=convertGlyphOrientation
glyph-orientation-vertical inherited, svg, custom_value glyph-orientation-vertical inherited, svg, custom_value
grid-auto-columns runtime_flag=CSSGridLayout, converter=convertGridTrackSize grid-auto-columns runtime_flag=CSSGridLayout, converter=convertGridTrackSize
grid-auto-flow runtime_flag=CSSGridLayout, custom_value grid-auto-flow runtime_flag=CSSGridLayout, converter=convertGridAutoFlow
grid-auto-rows runtime_flag=CSSGridLayout, converter=convertGridTrackSize grid-auto-rows runtime_flag=CSSGridLayout, converter=convertGridTrackSize
grid-column-end runtime_flag=CSSGridLayout, converter=convertGridPosition grid-column-end runtime_flag=CSSGridLayout, converter=convertGridPosition
grid-column-start runtime_flag=CSSGridLayout, converter=convertGridPosition grid-column-start runtime_flag=CSSGridLayout, converter=convertGridPosition
......
...@@ -338,6 +338,43 @@ EGlyphOrientation StyleBuilderConverter::convertGlyphOrientation(StyleResolverSt ...@@ -338,6 +338,43 @@ EGlyphOrientation StyleBuilderConverter::convertGlyphOrientation(StyleResolverSt
return GO_270DEG; return GO_270DEG;
} }
GridAutoFlow StyleBuilderConverter::convertGridAutoFlow(StyleResolverState&, CSSValue* value)
{
CSSValueList* list = toCSSValueList(value);
ASSERT(list->length() >= 1);
CSSPrimitiveValue* first = toCSSPrimitiveValue(list->item(0));
CSSPrimitiveValue* second = list->length() == 2 ? toCSSPrimitiveValue(list->item(1)) : nullptr;
switch (first->getValueID()) {
case CSSValueRow:
if (second) {
if (second->getValueID() == CSSValueDense)
return AutoFlowRowDense;
return AutoFlowStackRow;
}
return AutoFlowRow;
case CSSValueColumn:
if (second) {
if (second->getValueID() == CSSValueDense)
return AutoFlowColumnDense;
return AutoFlowStackColumn;
}
return AutoFlowColumn;
case CSSValueDense:
if (second && second->getValueID() == CSSValueColumn)
return AutoFlowColumnDense;
return AutoFlowRowDense;
case CSSValueStack:
if (second && second->getValueID() == CSSValueColumn)
return AutoFlowStackColumn;
return AutoFlowStackRow;
default:
ASSERT_NOT_REACHED();
return RenderStyle::initialGridAutoFlow();
}
}
GridPosition StyleBuilderConverter::convertGridPosition(StyleResolverState&, CSSValue* value) GridPosition StyleBuilderConverter::convertGridPosition(StyleResolverState&, CSSValue* value)
{ {
// We accept the specification's grammar: // We accept the specification's grammar:
......
...@@ -55,6 +55,7 @@ public: ...@@ -55,6 +55,7 @@ public:
static FontWeight convertFontWeight(StyleResolverState&, CSSValue*); static FontWeight convertFontWeight(StyleResolverState&, CSSValue*);
static FontDescription::VariantLigatures convertFontVariantLigatures(StyleResolverState&, CSSValue*); static FontDescription::VariantLigatures convertFontVariantLigatures(StyleResolverState&, CSSValue*);
static EGlyphOrientation convertGlyphOrientation(StyleResolverState&, CSSValue*); static EGlyphOrientation convertGlyphOrientation(StyleResolverState&, CSSValue*);
static GridAutoFlow convertGridAutoFlow(StyleResolverState&, CSSValue*);
static GridPosition convertGridPosition(StyleResolverState&, CSSValue*); static GridPosition convertGridPosition(StyleResolverState&, CSSValue*);
static GridTrackSize convertGridTrackSize(StyleResolverState&, CSSValue*); static GridTrackSize convertGridTrackSize(StyleResolverState&, CSSValue*);
template <typename T> static T convertLineWidth(StyleResolverState&, CSSValue*); template <typename T> static T convertLineWidth(StyleResolverState&, CSSValue*);
......
...@@ -1130,60 +1130,4 @@ void StyleBuilderFunctions::applyValueCSSPropertyBaselineShift(StyleResolverStat ...@@ -1130,60 +1130,4 @@ void StyleBuilderFunctions::applyValueCSSPropertyBaselineShift(StyleResolverStat
} }
} }
void StyleBuilderFunctions::applyValueCSSPropertyGridAutoFlow(StyleResolverState& state, CSSValue* value)
{
ASSERT(value->isValueList());
CSSValueList* list = toCSSValueList(value);
CSSPrimitiveValue* first = list->length() >= 1 ? toCSSPrimitiveValue(list->item(0)) : nullptr;
if (!first) {
applyInitialCSSPropertyGridAutoFlow(state);
return;
}
CSSPrimitiveValue* second = list->length() == 2 ? toCSSPrimitiveValue(list->item(1)) : nullptr;
GridAutoFlow autoFlow = RenderStyle::initialGridAutoFlow();
switch (first->getValueID()) {
case CSSValueRow:
if (second) {
if (second->getValueID() == CSSValueDense)
autoFlow = AutoFlowRowDense;
else
autoFlow = AutoFlowStackRow;
} else {
autoFlow = AutoFlowRow;
}
break;
case CSSValueColumn:
if (second) {
if (second->getValueID() == CSSValueDense)
autoFlow = AutoFlowColumnDense;
else
autoFlow = AutoFlowStackColumn;
} else {
autoFlow = AutoFlowColumn;
}
break;
case CSSValueDense:
if (second && second->getValueID() == CSSValueColumn)
autoFlow = AutoFlowColumnDense;
else
autoFlow = AutoFlowRowDense;
break;
case CSSValueStack:
if (second && second->getValueID() == CSSValueColumn)
autoFlow = AutoFlowStackColumn;
else
autoFlow = AutoFlowStackRow;
break;
default:
ASSERT_NOT_REACHED();
break;
}
state.style()->setGridAutoFlow(autoFlow);
}
} // namespace blink } // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment