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

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

Issue 1376573004: Split out Color from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_property
Patch Set: Rebase and review feedback Created 5 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 mask.setMaskDefaults(); 84 mask.setMaskDefaults();
85 CSSToStyleMap::mapNinePieceImage(state, CSSPropertyWebkitBoxReflect, *re flectValue.mask(), mask); 85 CSSToStyleMap::mapNinePieceImage(state, CSSPropertyWebkitBoxReflect, *re flectValue.mask(), mask);
86 reflection->setMask(mask); 86 reflection->setMask(mask);
87 } 87 }
88 88
89 return reflection.release(); 89 return reflection.release();
90 } 90 }
91 91
92 Color StyleBuilderConverter::convertColor(StyleResolverState& state, const CSSVa lue& value, bool forVisitedLink) 92 Color StyleBuilderConverter::convertColor(StyleResolverState& state, const CSSVa lue& value, bool forVisitedLink)
93 { 93 {
94 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 94 return state.document().textLinkColors().colorFromCSSValue(value, state.styl e()->color(), forVisitedLink);
95 return state.document().textLinkColors().colorFromPrimitiveValue(primitiveVa lue, state.style()->color(), forVisitedLink);
96 } 95 }
97 96
98 AtomicString StyleBuilderConverter::convertFragmentIdentifier(StyleResolverState & state, const CSSValue& value) 97 AtomicString StyleBuilderConverter::convertFragmentIdentifier(StyleResolverState & state, const CSSValue& value)
99 { 98 {
100 if (value.isURIValue()) 99 if (value.isURIValue())
101 return SVGURIReference::fragmentIdentifierFromIRIString(toCSSURIValue(va lue).value(), state.element()->treeScope()); 100 return SVGURIReference::fragmentIdentifierFromIRIString(toCSSURIValue(va lue).value(), state.element()->treeScope());
102 return nullAtom; 101 return nullAtom;
103 } 102 }
104 103
105 LengthBox StyleBuilderConverter::convertClip(StyleResolverState& state, const CS SValue& value) 104 LengthBox StyleBuilderConverter::convertClip(StyleResolverState& state, const CS SValue& value)
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 size_t length = dashes.length(); 844 size_t length = dashes.length();
846 for (size_t i = 0; i < length; ++i) { 845 for (size_t i = 0; i < length; ++i) {
847 array->append(convertLength(state, *toCSSPrimitiveValue(dashes.item(i))) ); 846 array->append(convertLength(state, *toCSSPrimitiveValue(dashes.item(i))) );
848 } 847 }
849 848
850 return array.release(); 849 return array.release();
851 } 850 }
852 851
853 StyleColor StyleBuilderConverter::convertStyleColor(StyleResolverState& state, c onst CSSValue& value, bool forVisitedLink) 852 StyleColor StyleBuilderConverter::convertStyleColor(StyleResolverState& state, c onst CSSValue& value, bool forVisitedLink)
854 { 853 {
855 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 854 if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == C SSValueCurrentcolor)
856 if (primitiveValue.getValueID() == CSSValueCurrentcolor)
857 return StyleColor::currentColor(); 855 return StyleColor::currentColor();
858 return state.document().textLinkColors().colorFromPrimitiveValue(primitiveVa lue, Color(), forVisitedLink); 856 return state.document().textLinkColors().colorFromCSSValue(value, Color(), f orVisitedLink);
859 } 857 }
860 858
861 float StyleBuilderConverter::convertTextStrokeWidth(StyleResolverState& state, c onst CSSValue& value) 859 float StyleBuilderConverter::convertTextStrokeWidth(StyleResolverState& state, c onst CSSValue& value)
862 { 860 {
863 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 861 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
864 if (primitiveValue.getValueID()) { 862 if (primitiveValue.getValueID()) {
865 float multiplier = convertLineWidth<float>(state, value); 863 float multiplier = convertLineWidth<float>(state, value);
866 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::Uni tType::Ems)->computeLength<float>(state.cssToLengthConversionData()); 864 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::Uni tType::Ems)->computeLength<float>(state.cssToLengthConversionData());
867 } 865 }
868 return primitiveValue.computeLength<float>(state.cssToLengthConversionData() ); 866 return primitiveValue.computeLength<float>(state.cssToLengthConversionData() );
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 return ScaleTransformOperation::create(sx, sy, sz, TransformOperation::Scale 3D); 963 return ScaleTransformOperation::create(sx, sy, sz, TransformOperation::Scale 3D);
966 } 964 }
967 965
968 RespectImageOrientationEnum StyleBuilderConverter::convertImageOrientation(Style ResolverState& state, const CSSValue& value) 966 RespectImageOrientationEnum StyleBuilderConverter::convertImageOrientation(Style ResolverState& state, const CSSValue& value)
969 { 967 {
970 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 968 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
971 return primitiveValue.getValueID() == CSSValueFromImage ? RespectImageOrient ation : DoNotRespectImageOrientation; 969 return primitiveValue.getValueID() == CSSValueFromImage ? RespectImageOrient ation : DoNotRespectImageOrientation;
972 } 970 }
973 971
974 } // namespace blink 972 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698