Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Unified Diff: Source/core/css/resolver/StyleBuilderCustom.cpp

Issue 636993002: [CSS Grid Layout] Upgrade justify-content parsing to CSS3 Box Alignment spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/css/resolver/StyleBuilderCustom.cpp
diff --git a/Source/core/css/resolver/StyleBuilderCustom.cpp b/Source/core/css/resolver/StyleBuilderCustom.cpp
index fc398e94d81b97711bae6c0a8681b72b8e785929..982fa45ee446d15e21abd4d9127717276e7795f6 100644
--- a/Source/core/css/resolver/StyleBuilderCustom.cpp
+++ b/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -189,6 +189,47 @@ void StyleBuilderFunctions::applyValueCSSPropertyJustifyItems(StyleResolverState
}
}
+void StyleBuilderFunctions::applyInitialCSSPropertyJustifyContent(StyleResolverState& state)
+{
+ state.style()->setJustifyContent(RenderStyle::initialJustifyContent());
+ state.style()->setJustifyContentOverflowAlignment(RenderStyle::initialJustifyContentOverflowAlignment());
+ state.style()->setJustifyContentDistribution(RenderStyle::initialJustifyContentDistribution());
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertyJustifyContent(StyleResolverState& state)
+{
+ state.style()->setJustifyContent(state.parentStyle()->justifyContent());
+ state.style()->setJustifyContentOverflowAlignment(state.parentStyle()->justifyContentOverflowAlignment());
+ state.style()->setJustifyContentDistribution(state.parentStyle()->justifyContentDistribution());
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertyJustifyContent(StyleResolverState& state, CSSValue* value)
+{
+ CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+ if (Pair* pairValue = primitiveValue->getPairValue()) {
+ if (Pair* nestedPairValue = pairValue->first()->getPairValue()) {
+ state.style()->setJustifyContentDistribution(*nestedPairValue->first());
+ state.style()->setJustifyContent(*nestedPairValue->second());
+ state.style()->setJustifyContentOverflowAlignment(*pairValue->second());
+ } else if (CSSPrimitiveValue::isContentDistributionKeyword(pairValue->first()->getValueID())) {
+ state.style()->setJustifyContentDistribution(*pairValue->first());
+ if (CSSPrimitiveValue::isContentPositionKeyword(pairValue->second()->getValueID()))
+ state.style()->setJustifyContent(*pairValue->second());
+ else
+ state.style()->setJustifyContentOverflowAlignment(*pairValue->second());
+ } else {
Timothy Loh 2014/10/21 03:51:09 Seems weird to not set all three values in these c
jfernandez 2014/10/27 11:44:37 Well, only explicit values are set. The ones not s
Timothy Loh 2014/10/27 11:55:30 We can go through this function multiple times for
jfernandez 2014/10/27 14:09:24 Oh, I see now. I'll assign the 2 values as you sug
+ state.style()->setJustifyContent(*pairValue->first());
+ state.style()->setJustifyContentOverflowAlignment(*pairValue->second());
+ }
+ } else {
+ if (CSSPrimitiveValue::isContentDistributionKeyword(primitiveValue->getValueID())) {
Julien - ping for review 2014/10/20 21:24:02 I usually say that we control the format that gets
jfernandez 2014/10/27 11:44:37 Good idea, thanks. Ill try that approach in the ne
+ state.style()->setJustifyContentDistribution(*primitiveValue);
+ } else {
+ state.style()->setJustifyContent(*primitiveValue);
+ }
+ }
+}
+
void StyleBuilderFunctions::applyInitialCSSPropertyCursor(StyleResolverState& state)
{
state.style()->clearCursorList();

Powered by Google App Engine
This is Rietveld 408576698