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

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

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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 | Annotate | Revision Log
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 return StyleBuilderConverter::convertLengthOrAuto(state, primitiveValue); 58 return StyleBuilderConverter::convertLengthOrAuto(state, primitiveValue);
59 } 59 }
60 60
61 } // namespace 61 } // namespace
62 62
63 PassRefPtr<StyleReflection> StyleBuilderConverter::convertBoxReflect(StyleResolv erState& state, CSSValue* value) 63 PassRefPtr<StyleReflection> StyleBuilderConverter::convertBoxReflect(StyleResolv erState& state, CSSValue* value)
64 { 64 {
65 if (value->isPrimitiveValue()) { 65 if (value->isPrimitiveValue()) {
66 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone); 66 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone);
67 return LayoutStyle::initialBoxReflect(); 67 return ComputedStyle::initialBoxReflect();
68 } 68 }
69 69
70 CSSReflectValue* reflectValue = toCSSReflectValue(value); 70 CSSReflectValue* reflectValue = toCSSReflectValue(value);
71 RefPtr<StyleReflection> reflection = StyleReflection::create(); 71 RefPtr<StyleReflection> reflection = StyleReflection::create();
72 reflection->setDirection(*reflectValue->direction()); 72 reflection->setDirection(*reflectValue->direction());
73 if (reflectValue->offset()) 73 if (reflectValue->offset())
74 reflection->setOffset(reflectValue->offset()->convertToLength(state.cssT oLengthConversionData())); 74 reflection->setOffset(reflectValue->offset()->convertToLength(state.cssT oLengthConversionData()));
75 NinePieceImage mask; 75 NinePieceImage mask;
76 mask.setMaskDefaults(); 76 mask.setMaskDefaults();
77 CSSToStyleMap::mapNinePieceImage(state, CSSPropertyWebkitBoxReflect, reflect Value->mask(), mask); 77 CSSToStyleMap::mapNinePieceImage(state, CSSPropertyWebkitBoxReflect, reflect Value->mask(), mask);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 case CSSValueColumn: 347 case CSSValueColumn:
348 if (second && second->getValueID() == CSSValueDense) 348 if (second && second->getValueID() == CSSValueDense)
349 return AutoFlowColumnDense; 349 return AutoFlowColumnDense;
350 return AutoFlowColumn; 350 return AutoFlowColumn;
351 case CSSValueDense: 351 case CSSValueDense:
352 if (second && second->getValueID() == CSSValueColumn) 352 if (second && second->getValueID() == CSSValueColumn)
353 return AutoFlowColumnDense; 353 return AutoFlowColumnDense;
354 return AutoFlowRowDense; 354 return AutoFlowRowDense;
355 default: 355 default:
356 ASSERT_NOT_REACHED(); 356 ASSERT_NOT_REACHED();
357 return LayoutStyle::initialGridAutoFlow(); 357 return ComputedStyle::initialGridAutoFlow();
358 } 358 }
359 } 359 }
360 360
361 GridPosition StyleBuilderConverter::convertGridPosition(StyleResolverState&, CSS Value* value) 361 GridPosition StyleBuilderConverter::convertGridPosition(StyleResolverState&, CSS Value* value)
362 { 362 {
363 // We accept the specification's grammar: 363 // We accept the specification's grammar:
364 // 'auto' | [ <integer> || <custom-ident> ] | [ span && [ <integer> || <cust om-ident> ] ] | <custom-ident> 364 // 'auto' | [ <integer> || <custom-ident> ] | [ span && [ <integer> || <cust om-ident> ] ] | <custom-ident>
365 365
366 GridPosition position; 366 GridPosition position;
367 367
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 if (primitiveValue->isPercentage()) 584 if (primitiveValue->isPercentage())
585 return Length((state.style()->computedFontSize() * primitiveValue->getIn tValue()) / 100.0, Fixed); 585 return Length((state.style()->computedFontSize() * primitiveValue->getIn tValue()) / 100.0, Fixed);
586 if (primitiveValue->isNumber()) 586 if (primitiveValue->isNumber())
587 return Length(primitiveValue->getDoubleValue() * 100.0, Percent); 587 return Length(primitiveValue->getDoubleValue() * 100.0, Percent);
588 if (primitiveValue->isCalculated()) { 588 if (primitiveValue->isCalculated()) {
589 Length zoomedLength = Length(primitiveValue->cssCalcValue()->toCalcValue (lineHeightToLengthConversionData(state))); 589 Length zoomedLength = Length(primitiveValue->cssCalcValue()->toCalcValue (lineHeightToLengthConversionData(state)));
590 return Length(valueForLength(zoomedLength, state.style()->fontSize()), F ixed); 590 return Length(valueForLength(zoomedLength, state.style()->fontSize()), F ixed);
591 } 591 }
592 592
593 ASSERT(primitiveValue->getValueID() == CSSValueNormal); 593 ASSERT(primitiveValue->getValueID() == CSSValueNormal);
594 return LayoutStyle::initialLineHeight(); 594 return ComputedStyle::initialLineHeight();
595 } 595 }
596 596
597 float StyleBuilderConverter::convertNumberOrPercentage(StyleResolverState& state , CSSValue* value) 597 float StyleBuilderConverter::convertNumberOrPercentage(StyleResolverState& state , CSSValue* value)
598 { 598 {
599 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 599 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
600 ASSERT(primitiveValue->isNumber() || primitiveValue->isPercentage()); 600 ASSERT(primitiveValue->isNumber() || primitiveValue->isPercentage());
601 if (primitiveValue->isNumber()) 601 if (primitiveValue->isNumber())
602 return primitiveValue->getFloatValue(); 602 return primitiveValue->getFloatValue();
603 return primitiveValue->getFloatValue() / 100.0f; 603 return primitiveValue->getFloatValue() / 100.0f;
604 } 604 }
(...skipping 25 matching lines...) Expand all
630 static float convertPerspectiveLength(StyleResolverState& state, CSSPrimitiveVal ue* primitiveValue) 630 static float convertPerspectiveLength(StyleResolverState& state, CSSPrimitiveVal ue* primitiveValue)
631 { 631 {
632 return std::max(primitiveValue->computeLength<float>(state.cssToLengthConver sionData()), 0.0f); 632 return std::max(primitiveValue->computeLength<float>(state.cssToLengthConver sionData()), 0.0f);
633 } 633 }
634 634
635 float StyleBuilderConverter::convertPerspective(StyleResolverState& state, CSSVa lue* value) 635 float StyleBuilderConverter::convertPerspective(StyleResolverState& state, CSSVa lue* value)
636 { 636 {
637 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 637 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
638 638
639 if (primitiveValue->getValueID() == CSSValueNone) 639 if (primitiveValue->getValueID() == CSSValueNone)
640 return LayoutStyle::initialPerspective(); 640 return ComputedStyle::initialPerspective();
641 641
642 // CSSPropertyWebkitPerspective accepts unitless numbers. 642 // CSSPropertyWebkitPerspective accepts unitless numbers.
643 if (primitiveValue->isNumber()) { 643 if (primitiveValue->isNumber()) {
644 RefPtrWillBeRawPtr<CSSPrimitiveValue> px = CSSPrimitiveValue::create(pri mitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX); 644 RefPtrWillBeRawPtr<CSSPrimitiveValue> px = CSSPrimitiveValue::create(pri mitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX);
645 return convertPerspectiveLength(state, px.get()); 645 return convertPerspectiveLength(state, px.get());
646 } 646 }
647 647
648 return convertPerspectiveLength(state, primitiveValue); 648 return convertPerspectiveLength(state, primitiveValue);
649 } 649 }
650 650
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 { 810 {
811 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 811 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
812 if (primitiveValue->getValueID() == CSSValueNormal) 812 if (primitiveValue->getValueID() == CSSValueNormal)
813 return 0; 813 return 0;
814 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( )); 814 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( ));
815 } 815 }
816 816
817 PassRefPtr<SVGDashArray> StyleBuilderConverter::convertStrokeDasharray(StyleReso lverState& state, CSSValue* value) 817 PassRefPtr<SVGDashArray> StyleBuilderConverter::convertStrokeDasharray(StyleReso lverState& state, CSSValue* value)
818 { 818 {
819 if (!value->isValueList()) 819 if (!value->isValueList())
820 return SVGLayoutStyle::initialStrokeDashArray(); 820 return SVGComputedStyle::initialStrokeDashArray();
821 821
822 CSSValueList* dashes = toCSSValueList(value); 822 CSSValueList* dashes = toCSSValueList(value);
823 823
824 RefPtr<SVGDashArray> array = SVGDashArray::create(); 824 RefPtr<SVGDashArray> array = SVGDashArray::create();
825 size_t length = dashes->length(); 825 size_t length = dashes->length();
826 for (size_t i = 0; i < length; ++i) { 826 for (size_t i = 0; i < length; ++i) {
827 CSSValue* currValue = dashes->item(i); 827 CSSValue* currValue = dashes->item(i);
828 if (!currValue->isPrimitiveValue()) 828 if (!currValue->isPrimitiveValue())
829 continue; 829 continue;
830 830
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2)); 872 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2));
873 873
874 return TransformOrigin( 874 return TransformOrigin(
875 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX) , 875 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX) ,
876 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY) , 876 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY) ,
877 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu eZ) 877 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu eZ)
878 ); 878 );
879 } 879 }
880 880
881 } // namespace blink 881 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleAdjuster.cpp ('k') | Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698