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

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

Issue 1249553002: CSSValue Immediates: Add move operators to CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_3_tagged_ptrs_with_copy_ops_mv_operators_ref_primvalue
Patch Set: Rebase Created 5 years, 4 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 static LengthPoint convertPerspectiveOrigin(StyleResolverState&, const CSSVa lue&); 82 static LengthPoint convertPerspectiveOrigin(StyleResolverState&, const CSSVa lue&);
83 static Length convertQuirkyLength(StyleResolverState&, const CSSValue&); 83 static Length convertQuirkyLength(StyleResolverState&, const CSSValue&);
84 static PassRefPtr<QuotesData> convertQuotes(StyleResolverState&, const CSSVa lue&); 84 static PassRefPtr<QuotesData> convertQuotes(StyleResolverState&, const CSSVa lue&);
85 static LengthSize convertRadius(StyleResolverState&, const CSSValue&); 85 static LengthSize convertRadius(StyleResolverState&, const CSSValue&);
86 static EPaintOrder convertPaintOrder(StyleResolverState&, const CSSValue&); 86 static EPaintOrder convertPaintOrder(StyleResolverState&, const CSSValue&);
87 static PassRefPtr<ShadowList> convertShadow(StyleResolverState&, const CSSVa lue&); 87 static PassRefPtr<ShadowList> convertShadow(StyleResolverState&, const CSSVa lue&);
88 static PassRefPtr<ShapeValue> convertShapeValue(StyleResolverState&, const C SSValue&); 88 static PassRefPtr<ShapeValue> convertShapeValue(StyleResolverState&, const C SSValue&);
89 static float convertSpacing(StyleResolverState&, const CSSValue&); 89 static float convertSpacing(StyleResolverState&, const CSSValue&);
90 template <CSSValueID IdForNone> static AtomicString convertString(StyleResol verState&, const CSSValue&); 90 template <CSSValueID IdForNone> static AtomicString convertString(StyleResol verState&, const CSSValue&);
91 static PassRefPtr<SVGDashArray> convertStrokeDasharray(StyleResolverState&, const CSSValue&); 91 static PassRefPtr<SVGDashArray> convertStrokeDasharray(StyleResolverState&, const CSSValue&);
92 static StyleColor convertStyleColor(StyleResolverState&, CSSValue, bool forV isitedLink = false); 92 static StyleColor convertStyleColor(StyleResolverState&, const CSSValue&, bo ol forVisitedLink = false);
93 static float convertTextStrokeWidth(StyleResolverState&, const CSSValue&); 93 static float convertTextStrokeWidth(StyleResolverState&, const CSSValue&);
94 static TransformOrigin convertTransformOrigin(StyleResolverState&, const CSS Value&); 94 static TransformOrigin convertTransformOrigin(StyleResolverState&, const CSS Value&);
95 95
96 static bool convertGridTrackList(CSSValue, Vector<GridTrackSize>&, NamedGrid LinesMap&, OrderedNamedGridLines&, StyleResolverState&); 96 static bool convertGridTrackList(const CSSValue&, Vector<GridTrackSize>&, Na medGridLinesMap&, OrderedNamedGridLines&, StyleResolverState&);
97 static void createImplicitNamedGridLinesFromGridArea(const NamedGridAreaMap& , NamedGridLinesMap&, GridTrackSizingDirection); 97 static void createImplicitNamedGridLinesFromGridArea(const NamedGridAreaMap& , NamedGridLinesMap&, GridTrackSizingDirection);
98 static void convertOrderedNamedGridLinesMapToNamedGridLinesMap(const Ordered NamedGridLines&, NamedGridLinesMap&); 98 static void convertOrderedNamedGridLinesMapToNamedGridLinesMap(const Ordered NamedGridLines&, NamedGridLinesMap&);
99 99
100 static ScrollSnapPoints convertSnapPoints(StyleResolverState&, const CSSValu e&); 100 static ScrollSnapPoints convertSnapPoints(StyleResolverState&, const CSSValu e&);
101 static Vector<LengthPoint> convertSnapCoordinates(StyleResolverState&, const CSSValue&); 101 static Vector<LengthPoint> convertSnapCoordinates(StyleResolverState&, const CSSValue&);
102 static LengthPoint convertSnapDestination(StyleResolverState&, const CSSValu e&); 102 static LengthPoint convertSnapDestination(StyleResolverState&, const CSSValu e&);
103 static PassRefPtr<TranslateTransformOperation> convertTranslate(StyleResolve rState&, const CSSValue&); 103 static PassRefPtr<TranslateTransformOperation> convertTranslate(StyleResolve rState&, const CSSValue&);
104 static PassRefPtr<RotateTransformOperation> convertRotate(StyleResolverState &, const CSSValue&); 104 static PassRefPtr<RotateTransformOperation> convertRotate(StyleResolverState &, const CSSValue&);
105 static PassRefPtr<ScaleTransformOperation> convertScale(StyleResolverState&, const CSSValue&); 105 static PassRefPtr<ScaleTransformOperation> convertScale(StyleResolverState&, const CSSValue&);
106 }; 106 };
(...skipping 11 matching lines...) Expand all
118 if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == C SSValueNone) 118 if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == C SSValueNone)
119 return flags; 119 return flags;
120 for (auto& flagValue : toCSSValueList(value)) 120 for (auto& flagValue : toCSSValueList(value))
121 flags |= toCSSPrimitiveValue(flagValue); 121 flags |= toCSSPrimitiveValue(flagValue);
122 return flags; 122 return flags;
123 } 123 }
124 124
125 template <typename T> 125 template <typename T>
126 T StyleBuilderConverter::convertLineWidth(StyleResolverState& state, const CSSVa lue& value) 126 T StyleBuilderConverter::convertLineWidth(StyleResolverState& state, const CSSVa lue& value)
127 { 127 {
128 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 128 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
129 CSSValueID valueID = primitiveValue.getValueID(); 129 CSSValueID valueID = primitiveValue.getValueID();
130 if (valueID == CSSValueThin) 130 if (valueID == CSSValueThin)
131 return 1; 131 return 1;
132 if (valueID == CSSValueMedium) 132 if (valueID == CSSValueMedium)
133 return 3; 133 return 3;
134 if (valueID == CSSValueThick) 134 if (valueID == CSSValueThick)
135 return 5; 135 return 5;
136 if (valueID == CSSValueInvalid) { 136 if (valueID == CSSValueInvalid) {
137 // Any original result that was >= 1 should not be allowed to fall below 1. 137 // Any original result that was >= 1 should not be allowed to fall below 1.
138 // This keeps border lines from vanishing. 138 // This keeps border lines from vanishing.
139 T result = primitiveValue.computeLength<T>(state.cssToLengthConversionDa ta()); 139 T result = primitiveValue.computeLength<T>(state.cssToLengthConversionDa ta());
140 if (state.style()->effectiveZoom() < 1.0f && result < 1.0) { 140 if (state.style()->effectiveZoom() < 1.0f && result < 1.0) {
141 T originalLength = primitiveValue.computeLength<T>(state.cssToLength ConversionData().copyWithAdjustedZoom(1.0)); 141 T originalLength = primitiveValue.computeLength<T>(state.cssToLength ConversionData().copyWithAdjustedZoom(1.0));
142 if (originalLength >= 1.0) 142 if (originalLength >= 1.0)
143 return 1.0; 143 return 1.0;
144 } 144 }
145 return result; 145 return result;
146 } 146 }
147 ASSERT_NOT_REACHED(); 147 ASSERT_NOT_REACHED();
148 return 0; 148 return 0;
149 } 149 }
150 150
151 template <CSSValueID IdForNone> 151 template <CSSValueID IdForNone>
152 AtomicString StyleBuilderConverter::convertString(StyleResolverState&, const CSS Value& value) 152 AtomicString StyleBuilderConverter::convertString(StyleResolverState&, const CSS Value& value)
153 { 153 {
154 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 154 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
155 if (primitiveValue.getValueID() == IdForNone) 155 if (primitiveValue.getValueID() == IdForNone)
156 return nullAtom; 156 return nullAtom;
157 return AtomicString(primitiveValue.getStringValue()); 157 return AtomicString(primitiveValue.getStringValue());
158 } 158 }
159 159
160 } // namespace blink 160 } // namespace blink
161 161
162 #endif 162 #endif
OLDNEW
« no previous file with comments | « Source/core/css/resolver/FilterOperationResolver.cpp ('k') | Source/core/css/resolver/StyleBuilderConverter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698