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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 state.style()->setJustifyItems(*pairValue->second()); 182 state.style()->setJustifyItems(*pairValue->second());
183 } else { 183 } else {
184 state.style()->setJustifyItems(*pairValue->first()); 184 state.style()->setJustifyItems(*pairValue->first());
185 state.style()->setJustifyItemsOverflowAlignment(*pairValue->second() ); 185 state.style()->setJustifyItemsOverflowAlignment(*pairValue->second() );
186 } 186 }
187 } else { 187 } else {
188 state.style()->setJustifyItems(*primitiveValue); 188 state.style()->setJustifyItems(*primitiveValue);
189 } 189 }
190 } 190 }
191 191
192 void StyleBuilderFunctions::applyInitialCSSPropertyJustifyContent(StyleResolverS tate& state)
193 {
194 state.style()->setJustifyContent(RenderStyle::initialJustifyContent());
195 state.style()->setJustifyContentOverflowAlignment(RenderStyle::initialJustif yContentOverflowAlignment());
196 state.style()->setJustifyContentDistribution(RenderStyle::initialJustifyCont entDistribution());
197 }
198
199 void StyleBuilderFunctions::applyInheritCSSPropertyJustifyContent(StyleResolverS tate& state)
200 {
201 state.style()->setJustifyContent(state.parentStyle()->justifyContent());
202 state.style()->setJustifyContentOverflowAlignment(state.parentStyle()->justi fyContentOverflowAlignment());
203 state.style()->setJustifyContentDistribution(state.parentStyle()->justifyCon tentDistribution());
204 }
205
206 void StyleBuilderFunctions::applyValueCSSPropertyJustifyContent(StyleResolverSta te& state, CSSValue* value)
207 {
208 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
209 if (Pair* pairValue = primitiveValue->getPairValue()) {
210 if (Pair* nestedPairValue = pairValue->first()->getPairValue()) {
211 state.style()->setJustifyContentDistribution(*nestedPairValue->first ());
212 state.style()->setJustifyContent(*nestedPairValue->second());
213 state.style()->setJustifyContentOverflowAlignment(*pairValue->second ());
214 } else if (CSSPrimitiveValue::isContentDistributionKeyword(pairValue->fi rst()->getValueID())) {
215 state.style()->setJustifyContentDistribution(*pairValue->first());
216 if (CSSPrimitiveValue::isContentPositionKeyword(pairValue->second()- >getValueID()))
217 state.style()->setJustifyContent(*pairValue->second());
218 else
219 state.style()->setJustifyContentOverflowAlignment(*pairValue->se cond());
220 } 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
221 state.style()->setJustifyContent(*pairValue->first());
222 state.style()->setJustifyContentOverflowAlignment(*pairValue->second ());
223 }
224 } else {
225 if (CSSPrimitiveValue::isContentDistributionKeyword(primitiveValue->getV alueID())) {
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
226 state.style()->setJustifyContentDistribution(*primitiveValue);
227 } else {
228 state.style()->setJustifyContent(*primitiveValue);
229 }
230 }
231 }
232
192 void StyleBuilderFunctions::applyInitialCSSPropertyCursor(StyleResolverState& st ate) 233 void StyleBuilderFunctions::applyInitialCSSPropertyCursor(StyleResolverState& st ate)
193 { 234 {
194 state.style()->clearCursorList(); 235 state.style()->clearCursorList();
195 state.style()->setCursor(RenderStyle::initialCursor()); 236 state.style()->setCursor(RenderStyle::initialCursor());
196 } 237 }
197 238
198 void StyleBuilderFunctions::applyInheritCSSPropertyCursor(StyleResolverState& st ate) 239 void StyleBuilderFunctions::applyInheritCSSPropertyCursor(StyleResolverState& st ate)
199 { 240 {
200 state.style()->setCursor(state.parentStyle()->cursor()); 241 state.style()->setCursor(state.parentStyle()->cursor());
201 state.style()->setCursorList(state.parentStyle()->cursors()); 242 state.style()->setCursorList(state.parentStyle()->cursors());
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 break; 1240 break;
1200 default: 1241 default:
1201 ASSERT_NOT_REACHED(); 1242 ASSERT_NOT_REACHED();
1202 break; 1243 break;
1203 } 1244 }
1204 1245
1205 state.style()->setGridAutoFlow(autoFlow); 1246 state.style()->setGridAutoFlow(autoFlow);
1206 } 1247 }
1207 1248
1208 } // namespace blink 1249 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698