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

Side by Side Diff: third_party/WebKit/Source/core/animation/CSSClipInterpolationType.cpp

Issue 2346193002: Split CSSPrimitiveValue into CSSPrimitiveValue and CSSIdentifierValue (Closed)
Patch Set: Rebase please work Created 4 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/animation/CSSClipInterpolationType.h" 5 #include "core/animation/CSSClipInterpolationType.h"
6 6
7 #include "core/animation/LengthInterpolationFunctions.h" 7 #include "core/animation/LengthInterpolationFunctions.h"
8 #include "core/css/CSSIdentifierValue.h"
8 #include "core/css/CSSQuadValue.h" 9 #include "core/css/CSSQuadValue.h"
9 #include "core/css/resolver/StyleResolverState.h" 10 #include "core/css/resolver/StyleResolverState.h"
10 #include "wtf/PtrUtil.h" 11 #include "wtf/PtrUtil.h"
11 #include <memory> 12 #include <memory>
12 13
13 namespace blink { 14 namespace blink {
14 15
15 struct ClipAutos { 16 struct ClipAutos {
16 ClipAutos() 17 ClipAutos()
17 : isAuto(true) 18 : isAuto(true)
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 185
185 InterpolationValue CSSClipInterpolationType::maybeConvertInherit(const StyleReso lverState& state, ConversionCheckers& conversionCheckers) const 186 InterpolationValue CSSClipInterpolationType::maybeConvertInherit(const StyleReso lverState& state, ConversionCheckers& conversionCheckers) const
186 { 187 {
187 ClipAutos parentAutos = getClipAutos(*state.parentStyle()); 188 ClipAutos parentAutos = getClipAutos(*state.parentStyle());
188 conversionCheckers.append(ParentAutosChecker::create(parentAutos)); 189 conversionCheckers.append(ParentAutosChecker::create(parentAutos));
189 if (parentAutos.isAuto) 190 if (parentAutos.isAuto)
190 return nullptr; 191 return nullptr;
191 return createClipValue(state.parentStyle()->clip(), state.parentStyle()->eff ectiveZoom()); 192 return createClipValue(state.parentStyle()->clip(), state.parentStyle()->eff ectiveZoom());
192 } 193 }
193 194
194 static bool isCSSAuto(const CSSPrimitiveValue& value) 195 static bool isCSSAuto(const CSSValue& value)
195 { 196 {
196 return value.getValueID() == CSSValueAuto; 197 return value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueAuto;
197 } 198 }
198 199
199 static std::unique_ptr<InterpolableValue> convertClipComponent(const CSSPrimitiv eValue& length) 200 static std::unique_ptr<InterpolableValue> convertClipComponent(const CSSValue& l ength)
200 { 201 {
201 if (isCSSAuto(length)) 202 if (isCSSAuto(length))
202 return InterpolableList::create(0); 203 return InterpolableList::create(0);
203 return LengthInterpolationFunctions::maybeConvertCSSValue(length).interpolab leValue; 204 return LengthInterpolationFunctions::maybeConvertCSSValue(length).interpolab leValue;
204 } 205 }
205 206
206 InterpolationValue CSSClipInterpolationType::maybeConvertValue(const CSSValue& v alue, const StyleResolverState& state, ConversionCheckers&) const 207 InterpolationValue CSSClipInterpolationType::maybeConvertValue(const CSSValue& v alue, const StyleResolverState& state, ConversionCheckers&) const
207 { 208 {
208 if (!value.isQuadValue()) 209 if (!value.isQuadValue())
209 return nullptr; 210 return nullptr;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 return LengthInterpolationFunctions::createLength(*list.get(index), null ptr, environment.state().cssToLengthConversionData(), ValueRangeAll); 259 return LengthInterpolationFunctions::createLength(*list.get(index), null ptr, environment.state().cssToLengthConversionData(), ValueRangeAll);
259 }; 260 };
260 environment.state().style()->setClip(LengthBox( 261 environment.state().style()->setClip(LengthBox(
261 convertIndex(autos.isTopAuto, ClipTop), 262 convertIndex(autos.isTopAuto, ClipTop),
262 convertIndex(autos.isRightAuto, ClipRight), 263 convertIndex(autos.isRightAuto, ClipRight),
263 convertIndex(autos.isBottomAuto, ClipBottom), 264 convertIndex(autos.isBottomAuto, ClipBottom),
264 convertIndex(autos.isLeftAuto, ClipLeft))); 265 convertIndex(autos.isLeftAuto, ClipLeft)));
265 } 266 }
266 267
267 } // namespace blink 268 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698