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

Side by Side Diff: Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 642303002: Move style building for grid-auto-flow to StyleBuilderConverter. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove unreachable code. 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 * 3 *
4 * * Redistributions of source code must retain the above copyright 4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer. 5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above 6 * * Redistributions in binary form must reproduce the above
7 * copyright notice, this list of conditions and the following disclaimer 7 * copyright notice, this list of conditions and the following disclaimer
8 * in the documentation and/or other materials provided with the 8 * in the documentation and/or other materials provided with the
9 * distribution. 9 * distribution.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 331
332 if (angle <= 45.0f || angle > 315.0f) 332 if (angle <= 45.0f || angle > 315.0f)
333 return GO_0DEG; 333 return GO_0DEG;
334 if (angle > 45.0f && angle <= 135.0f) 334 if (angle > 45.0f && angle <= 135.0f)
335 return GO_90DEG; 335 return GO_90DEG;
336 if (angle > 135.0f && angle <= 225.0f) 336 if (angle > 135.0f && angle <= 225.0f)
337 return GO_180DEG; 337 return GO_180DEG;
338 return GO_270DEG; 338 return GO_270DEG;
339 } 339 }
340 340
341 GridAutoFlow StyleBuilderConverter::convertGridAutoFlow(StyleResolverState&, CSS Value* value)
342 {
343 CSSValueList* list = toCSSValueList(value);
344
345 ASSERT(list->length() >= 1);
346 CSSPrimitiveValue* first = toCSSPrimitiveValue(list->item(0));
347 CSSPrimitiveValue* second = list->length() == 2 ? toCSSPrimitiveValue(list-> item(1)) : nullptr;
348
349 switch (first->getValueID()) {
350 case CSSValueRow:
351 if (second) {
352 if (second->getValueID() == CSSValueDense)
353 return AutoFlowRowDense;
354 return AutoFlowStackRow;
355 }
356 return AutoFlowRow;
357 case CSSValueColumn:
358 if (second) {
359 if (second->getValueID() == CSSValueDense)
360 return AutoFlowColumnDense;
361 return AutoFlowStackColumn;
362 }
363 return AutoFlowColumn;
364 case CSSValueDense:
365 if (second && second->getValueID() == CSSValueColumn)
366 return AutoFlowColumnDense;
367 return AutoFlowRowDense;
368 case CSSValueStack:
369 if (second && second->getValueID() == CSSValueColumn)
370 return AutoFlowStackColumn;
371 return AutoFlowStackRow;
372 default:
373 ASSERT_NOT_REACHED();
374 return RenderStyle::initialGridAutoFlow();
375 }
376 }
377
341 GridPosition StyleBuilderConverter::convertGridPosition(StyleResolverState&, CSS Value* value) 378 GridPosition StyleBuilderConverter::convertGridPosition(StyleResolverState&, CSS Value* value)
342 { 379 {
343 // We accept the specification's grammar: 380 // We accept the specification's grammar:
344 // 'auto' | [ <integer> || <custom-ident> ] | [ span && [ <integer> || <cust om-ident> ] ] | <custom-ident> 381 // 'auto' | [ <integer> || <custom-ident> ] | [ span && [ <integer> || <cust om-ident> ] ] | <custom-ident>
345 382
346 GridPosition position; 383 GridPosition position;
347 384
348 if (value->isPrimitiveValue()) { 385 if (value->isPrimitiveValue()) {
349 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 386 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
350 // We translate <custom-ident> to <string> during parsing as it 387 // We translate <custom-ident> to <string> during parsing as it
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 { 720 {
684 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 721 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
685 if (primitiveValue->getValueID()) { 722 if (primitiveValue->getValueID()) {
686 float multiplier = convertLineWidth<float>(state, value); 723 float multiplier = convertLineWidth<float>(state, value);
687 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS _EMS)->computeLength<float>(state.cssToLengthConversionData()); 724 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS _EMS)->computeLength<float>(state.cssToLengthConversionData());
688 } 725 }
689 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( )); 726 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( ));
690 } 727 }
691 728
692 } // namespace blink 729 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.h ('k') | Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698