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

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

Issue 2812213002: Add CSSInterpolationType specific ConversionChecker (Closed)
Patch Set: rebased Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/CSSShadowListInterpolationType.h" 5 #include "core/animation/CSSShadowListInterpolationType.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "core/animation/ListInterpolationFunctions.h" 8 #include "core/animation/ListInterpolationFunctions.h"
9 #include "core/animation/ShadowInterpolationFunctions.h" 9 #include "core/animation/ShadowInterpolationFunctions.h"
10 #include "core/animation/ShadowListPropertyFunctions.h" 10 #include "core/animation/ShadowListPropertyFunctions.h"
(...skipping 29 matching lines...) Expand all
40 return CreateNeutralValue(); 40 return CreateNeutralValue();
41 } 41 }
42 42
43 InterpolationValue CSSShadowListInterpolationType::MaybeConvertInitial( 43 InterpolationValue CSSShadowListInterpolationType::MaybeConvertInitial(
44 const StyleResolverState&, 44 const StyleResolverState&,
45 ConversionCheckers&) const { 45 ConversionCheckers&) const {
46 return ConvertShadowList( 46 return ConvertShadowList(
47 ShadowListPropertyFunctions::GetInitialShadowList(CssProperty()), 1); 47 ShadowListPropertyFunctions::GetInitialShadowList(CssProperty()), 1);
48 } 48 }
49 49
50 class InheritedShadowListChecker : public InterpolationType::ConversionChecker { 50 class InheritedShadowListChecker
51 : public CSSInterpolationType::CSSConversionChecker {
51 public: 52 public:
52 static std::unique_ptr<InheritedShadowListChecker> Create( 53 static std::unique_ptr<InheritedShadowListChecker> Create(
53 CSSPropertyID property, 54 CSSPropertyID property,
54 PassRefPtr<ShadowList> shadow_list) { 55 PassRefPtr<ShadowList> shadow_list) {
55 return WTF::WrapUnique( 56 return WTF::WrapUnique(
56 new InheritedShadowListChecker(property, std::move(shadow_list))); 57 new InheritedShadowListChecker(property, std::move(shadow_list)));
57 } 58 }
58 59
59 private: 60 private:
60 InheritedShadowListChecker(CSSPropertyID property, 61 InheritedShadowListChecker(CSSPropertyID property,
61 PassRefPtr<ShadowList> shadow_list) 62 PassRefPtr<ShadowList> shadow_list)
62 : property_(property), shadow_list_(std::move(shadow_list)) {} 63 : property_(property), shadow_list_(std::move(shadow_list)) {}
63 64
64 bool IsValid(const InterpolationEnvironment& environment, 65 bool IsValid(const StyleResolverState& state,
65 const InterpolationValue& underlying) const final { 66 const InterpolationValue& underlying) const final {
66 const ShadowList* inherited_shadow_list = 67 const ShadowList* inherited_shadow_list =
67 ShadowListPropertyFunctions::GetShadowList( 68 ShadowListPropertyFunctions::GetShadowList(property_,
68 property_, *environment.GetState().ParentStyle()); 69 *state.ParentStyle());
69 if (!inherited_shadow_list && !shadow_list_) 70 if (!inherited_shadow_list && !shadow_list_)
70 return true; 71 return true;
71 if (!inherited_shadow_list || !shadow_list_) 72 if (!inherited_shadow_list || !shadow_list_)
72 return false; 73 return false;
73 return *inherited_shadow_list == *shadow_list_; 74 return *inherited_shadow_list == *shadow_list_;
74 } 75 }
75 76
76 const CSSPropertyID property_; 77 const CSSPropertyID property_;
77 RefPtr<ShadowList> shadow_list_; 78 RefPtr<ShadowList> shadow_list_;
78 }; 79 };
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 void CSSShadowListInterpolationType::ApplyStandardPropertyValue( 162 void CSSShadowListInterpolationType::ApplyStandardPropertyValue(
162 const InterpolableValue& interpolable_value, 163 const InterpolableValue& interpolable_value,
163 const NonInterpolableValue* non_interpolable_value, 164 const NonInterpolableValue* non_interpolable_value,
164 StyleResolverState& state) const { 165 StyleResolverState& state) const {
165 ShadowListPropertyFunctions::SetShadowList( 166 ShadowListPropertyFunctions::SetShadowList(
166 CssProperty(), *state.Style(), 167 CssProperty(), *state.Style(),
167 CreateShadowList(interpolable_value, non_interpolable_value, state)); 168 CreateShadowList(interpolable_value, non_interpolable_value, state));
168 } 169 }
169 170
170 } // namespace blink 171 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698