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

Side by Side Diff: third_party/WebKit/Source/core/animation/animatable/AnimatableUnknown.h

Issue 2723883005: Add registered custom property wrapping support to CSSAnimatableValueFactory (Closed)
Patch Set: Rebased Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/css/CSSAnimatableValueFactory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 23 matching lines...) Expand all
34 #include "core/CSSValueKeywords.h" 34 #include "core/CSSValueKeywords.h"
35 #include "core/animation/animatable/AnimatableValue.h" 35 #include "core/animation/animatable/AnimatableValue.h"
36 #include "core/css/CSSIdentifierValue.h" 36 #include "core/css/CSSIdentifierValue.h"
37 37
38 namespace blink { 38 namespace blink {
39 39
40 class AnimatableUnknown final : public AnimatableValue { 40 class AnimatableUnknown final : public AnimatableValue {
41 public: 41 public:
42 ~AnimatableUnknown() override {} 42 ~AnimatableUnknown() override {}
43 43
44 static PassRefPtr<AnimatableUnknown> create(CSSValue* value) { 44 static PassRefPtr<AnimatableUnknown> create(const CSSValue* value) {
45 return adoptRef(new AnimatableUnknown(value)); 45 return adoptRef(new AnimatableUnknown(value));
46 } 46 }
47 static PassRefPtr<AnimatableUnknown> create(CSSValueID value) { 47 static PassRefPtr<AnimatableUnknown> create(CSSValueID value) {
48 return adoptRef(new AnimatableUnknown(CSSIdentifierValue::create(value))); 48 return adoptRef(new AnimatableUnknown(CSSIdentifierValue::create(value)));
49 } 49 }
50 50
51 CSSValue* toCSSValue() const { return m_value; } 51 const CSSValue* toCSSValue() const { return m_value; }
52 CSSValueID toCSSValueID() const { 52 CSSValueID toCSSValueID() const {
53 return toCSSIdentifierValue(m_value.get())->getValueID(); 53 return toCSSIdentifierValue(m_value.get())->getValueID();
54 } 54 }
55 55
56 protected: 56 protected:
57 PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue* value, 57 PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue* value,
58 double fraction) const override { 58 double fraction) const override {
59 return defaultInterpolateTo(this, value, fraction); 59 return defaultInterpolateTo(this, value, fraction);
60 } 60 }
61 61
62 bool usesDefaultInterpolationWith(const AnimatableValue*) const override; 62 bool usesDefaultInterpolationWith(const AnimatableValue*) const override;
63 63
64 private: 64 private:
65 explicit AnimatableUnknown(CSSValue* value) : m_value(value) { 65 explicit AnimatableUnknown(const CSSValue* value) : m_value(value) {}
66 DCHECK(m_value);
67 }
68 AnimatableType type() const override { return TypeUnknown; } 66 AnimatableType type() const override { return TypeUnknown; }
69 bool equalTo(const AnimatableValue*) const override; 67 bool equalTo(const AnimatableValue*) const override;
70 68
71 const Persistent<CSSValue> m_value; 69 const Persistent<const CSSValue> m_value;
72 }; 70 };
73 71
74 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableUnknown, isUnknown()); 72 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableUnknown, isUnknown());
75 73
76 inline bool AnimatableUnknown::equalTo(const AnimatableValue* value) const { 74 inline bool AnimatableUnknown::equalTo(const AnimatableValue* value) const {
77 const AnimatableUnknown* unknown = toAnimatableUnknown(value); 75 const AnimatableUnknown* unknown = toAnimatableUnknown(value);
78 return m_value == unknown->m_value || m_value->equals(*unknown->m_value); 76 return compareCSSValuePtr(m_value.get(), unknown->m_value.get());
79 } 77 }
80 78
81 inline bool AnimatableUnknown::usesDefaultInterpolationWith( 79 inline bool AnimatableUnknown::usesDefaultInterpolationWith(
82 const AnimatableValue* value) const { 80 const AnimatableValue* value) const {
83 const AnimatableUnknown& unknown = toAnimatableUnknown(*value); 81 return equalTo(value);
Eric Willigers 2017/03/04 04:16:31 Why the change from not equals to equals?
alancutter (OOO until 2018) 2017/03/05 23:23:57 Whoops, fixed.
84 return !m_value->equals(*unknown.m_value);
85 } 82 }
86 83
87 } // namespace blink 84 } // namespace blink
88 85
89 #endif // AnimatableUnknown_h 86 #endif // AnimatableUnknown_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/css/CSSAnimatableValueFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698