Chromium Code Reviews

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

Issue 983103003: Use Length for the stroke-width property in SVGLayoutStyle (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Adjust transitions/svg-transitions.html Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | 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 489 matching lines...)
500 std::sort(endResult.storedValue->value.begin(), endResult.storedValu e->value.end()); 500 std::sort(endResult.storedValue->value.begin(), endResult.storedValu e->value.end());
501 } 501 }
502 } 502 }
503 } 503 }
504 504
505 Length StyleBuilderConverter::convertLength(const StyleResolverState& state, CSS Value* value) 505 Length StyleBuilderConverter::convertLength(const StyleResolverState& state, CSS Value* value)
506 { 506 {
507 return toCSSPrimitiveValue(value)->convertToLength(state.cssToLengthConversi onData()); 507 return toCSSPrimitiveValue(value)->convertToLength(state.cssToLengthConversi onData());
508 } 508 }
509 509
510 UnzoomedLength StyleBuilderConverter::convertUnzoomedLength(const StyleResolverS tate& state, CSSValue* value)
511 {
512 return UnzoomedLength(toCSSPrimitiveValue(value)->convertToLength(state.cssT oLengthConversionData().copyWithAdjustedZoom(1.0f)));
513 }
514
510 Length StyleBuilderConverter::convertLengthOrAuto(const StyleResolverState& stat e, CSSValue* value) 515 Length StyleBuilderConverter::convertLengthOrAuto(const StyleResolverState& stat e, CSSValue* value)
511 { 516 {
512 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 517 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
513 if (primitiveValue->getValueID() == CSSValueAuto) 518 if (primitiveValue->getValueID() == CSSValueAuto)
514 return Length(Auto); 519 return Length(Auto);
515 return primitiveValue->convertToLength(state.cssToLengthConversionData()); 520 return primitiveValue->convertToLength(state.cssToLengthConversionData());
516 } 521 }
517 522
518 Length StyleBuilderConverter::convertLengthSizing(StyleResolverState& state, CSS Value* value) 523 Length StyleBuilderConverter::convertLengthSizing(StyleResolverState& state, CSS Value* value)
519 { 524 {
(...skipping 325 matching lines...)
845 850
846 Color StyleBuilderConverter::convertSVGColor(StyleResolverState& state, CSSValue * value) 851 Color StyleBuilderConverter::convertSVGColor(StyleResolverState& state, CSSValue * value)
847 { 852 {
848 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 853 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
849 if (primitiveValue->isRGBColor()) 854 if (primitiveValue->isRGBColor())
850 return primitiveValue->getRGBA32Value(); 855 return primitiveValue->getRGBA32Value();
851 ASSERT(primitiveValue->getValueID() == CSSValueCurrentcolor); 856 ASSERT(primitiveValue->getValueID() == CSSValueCurrentcolor);
852 return state.style()->color(); 857 return state.style()->color();
853 } 858 }
854 859
855 PassRefPtrWillBeRawPtr<SVGLength> StyleBuilderConverter::convertSVGLength(StyleR esolverState&, CSSValue* value)
856 {
857 return SVGLength::fromCSSPrimitiveValue(toCSSPrimitiveValue(value));
858 }
859
860 float StyleBuilderConverter::convertTextStrokeWidth(StyleResolverState& state, C SSValue* value) 860 float StyleBuilderConverter::convertTextStrokeWidth(StyleResolverState& state, C SSValue* value)
861 { 861 {
862 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 862 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
863 if (primitiveValue->getValueID()) { 863 if (primitiveValue->getValueID()) {
864 float multiplier = convertLineWidth<float>(state, value); 864 float multiplier = convertLineWidth<float>(state, value);
865 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS _EMS)->computeLength<float>(state.cssToLengthConversionData()); 865 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS _EMS)->computeLength<float>(state.cssToLengthConversionData());
866 } 866 }
867 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( )); 867 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( ));
868 } 868 }
869 869
870 TransformOrigin StyleBuilderConverter::convertTransformOrigin(StyleResolverState & state, CSSValue* value) 870 TransformOrigin StyleBuilderConverter::convertTransformOrigin(StyleResolverState & state, CSSValue* value)
871 { 871 {
872 CSSValueList* list = toCSSValueList(value); 872 CSSValueList* list = toCSSValueList(value);
873 ASSERT(list->length() == 3); 873 ASSERT(list->length() == 3);
874 874
875 CSSPrimitiveValue* primitiveValueX = toCSSPrimitiveValue(list->item(0)); 875 CSSPrimitiveValue* primitiveValueX = toCSSPrimitiveValue(list->item(0));
876 CSSPrimitiveValue* primitiveValueY = toCSSPrimitiveValue(list->item(1)); 876 CSSPrimitiveValue* primitiveValueY = toCSSPrimitiveValue(list->item(1));
877 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2)); 877 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2));
878 878
879 return TransformOrigin( 879 return TransformOrigin(
880 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX) , 880 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX) ,
881 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY) , 881 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY) ,
882 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu eZ) 882 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu eZ)
883 ); 883 );
884 } 884 }
885 885
886 } // namespace blink 886 } // namespace blink
OLDNEW

Powered by Google App Engine