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

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

Issue 2044023005: Make PropertyReference value() return a const CSSValue& (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_remove_style_property_set_mutable_overload
Patch Set: Rebase Created 4 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/StringKeyframe.h" 5 #include "core/animation/StringKeyframe.h"
6 6
7 #include "core/StylePropertyShorthand.h" 7 #include "core/StylePropertyShorthand.h"
8 #include "core/animation/css/CSSAnimations.h" 8 #include "core/animation/css/CSSAnimations.h"
9 #include "core/css/CSSPropertyMetadata.h" 9 #include "core/css/CSSPropertyMetadata.h"
10 #include "core/css/resolver/StyleResolver.h" 10 #include "core/css/resolver/StyleResolver.h"
(...skipping 11 matching lines...) Expand all
22 { 22 {
23 } 23 }
24 24
25 void StringKeyframe::setCSSPropertyValue(CSSPropertyID property, const String& v alue, Element* element, StyleSheetContents* styleSheetContents) 25 void StringKeyframe::setCSSPropertyValue(CSSPropertyID property, const String& v alue, Element* element, StyleSheetContents* styleSheetContents)
26 { 26 {
27 ASSERT(property != CSSPropertyInvalid); 27 ASSERT(property != CSSPropertyInvalid);
28 if (CSSAnimations::isAnimatableProperty(property)) 28 if (CSSAnimations::isAnimatableProperty(property))
29 m_cssPropertyMap->setProperty(property, value, false, styleSheetContents ); 29 m_cssPropertyMap->setProperty(property, value, false, styleSheetContents );
30 } 30 }
31 31
32 void StringKeyframe::setCSSPropertyValue(CSSPropertyID property, const CSSValue* value) 32 void StringKeyframe::setCSSPropertyValue(CSSPropertyID property, const CSSValue& value)
33 { 33 {
34 ASSERT(property != CSSPropertyInvalid); 34 ASSERT(property != CSSPropertyInvalid);
35 ASSERT(CSSAnimations::isAnimatableProperty(property)); 35 ASSERT(CSSAnimations::isAnimatableProperty(property));
36 m_cssPropertyMap->setProperty(property, value, false); 36 m_cssPropertyMap->setProperty(property, &value, false);
37 } 37 }
38 38
39 void StringKeyframe::setPresentationAttributeValue(CSSPropertyID property, const String& value, Element* element, StyleSheetContents* styleSheetContents) 39 void StringKeyframe::setPresentationAttributeValue(CSSPropertyID property, const String& value, Element* element, StyleSheetContents* styleSheetContents)
40 { 40 {
41 ASSERT(property != CSSPropertyInvalid); 41 ASSERT(property != CSSPropertyInvalid);
42 if (CSSAnimations::isAnimatableProperty(property)) 42 if (CSSAnimations::isAnimatableProperty(property))
43 m_presentationAttributeMap->setProperty(property, value, false, styleShe etContents); 43 m_presentationAttributeMap->setProperty(property, value, false, styleShe etContents);
44 } 44 }
45 45
46 void StringKeyframe::setSVGAttributeValue(const QualifiedName& attributeName, co nst String& value) 46 void StringKeyframe::setSVGAttributeValue(const QualifiedName& attributeName, co nst String& value)
47 { 47 {
48 m_svgAttributeMap.set(&attributeName, value); 48 m_svgAttributeMap.set(&attributeName, value);
49 } 49 }
50 50
51 PropertyHandleSet StringKeyframe::properties() const 51 PropertyHandleSet StringKeyframe::properties() const
52 { 52 {
53 // This is not used in time-critical code, so we probably don't need to 53 // This is not used in time-critical code, so we probably don't need to
54 // worry about caching this result. 54 // worry about caching this result.
55 PropertyHandleSet properties; 55 PropertyHandleSet properties;
56 for (unsigned i = 0; i < m_cssPropertyMap->propertyCount(); ++i) { 56 for (unsigned i = 0; i < m_cssPropertyMap->propertyCount(); ++i) {
57 StylePropertySet::PropertyReference propertyReference = m_cssPropertyMap ->propertyAt(i); 57 StylePropertySet::PropertyReference propertyReference = m_cssPropertyMap ->propertyAt(i);
58 DCHECK( 58 DCHECK(
59 !isShorthandProperty(propertyReference.id()) || propertyReference.va lue()->isVariableReferenceValue()) 59 !isShorthandProperty(propertyReference.id()) || propertyReference.va lue().isVariableReferenceValue())
60 << "Web Animations: Encountered unexpanded shorthand CSS property (" << propertyReference.id() << ")."; 60 << "Web Animations: Encountered unexpanded shorthand CSS property (" << propertyReference.id() << ").";
61 properties.add(PropertyHandle(propertyReference.id(), false)); 61 properties.add(PropertyHandle(propertyReference.id(), false));
62 } 62 }
63 63
64 for (unsigned i = 0; i < m_presentationAttributeMap->propertyCount(); ++i) 64 for (unsigned i = 0; i < m_presentationAttributeMap->propertyCount(); ++i)
65 properties.add(PropertyHandle(m_presentationAttributeMap->propertyAt(i). id(), true)); 65 properties.add(PropertyHandle(m_presentationAttributeMap->propertyAt(i). id(), true));
66 66
67 for (const auto& key: m_svgAttributeMap.keys()) 67 for (const auto& key: m_svgAttributeMap.keys())
68 properties.add(PropertyHandle(*key)); 68 properties.add(PropertyHandle(*key));
69 69
70 return properties; 70 return properties;
71 } 71 }
72 72
73 PassRefPtr<Keyframe> StringKeyframe::clone() const 73 PassRefPtr<Keyframe> StringKeyframe::clone() const
74 { 74 {
75 return adoptRef(new StringKeyframe(*this)); 75 return adoptRef(new StringKeyframe(*this));
76 } 76 }
77 77
78 PassRefPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::createPropertySpe cificKeyframe(PropertyHandle property) const 78 PassRefPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::createPropertySpe cificKeyframe(PropertyHandle property) const
79 { 79 {
80 if (property.isCSSProperty()) 80 if (property.isCSSProperty())
81 return CSSPropertySpecificKeyframe::create(offset(), &easing(), cssPrope rtyValue(property.cssProperty()), composite()); 81 return CSSPropertySpecificKeyframe::create(offset(), &easing(), &cssProp ertyValue(property.cssProperty()), composite());
82 82
83 if (property.isPresentationAttribute()) 83 if (property.isPresentationAttribute())
84 return CSSPropertySpecificKeyframe::create(offset(), &easing(), presenta tionAttributeValue(property.presentationAttribute()), composite()); 84 return CSSPropertySpecificKeyframe::create(offset(), &easing(), &present ationAttributeValue(property.presentationAttribute()), composite());
85 85
86 ASSERT(property.isSVGAttribute()); 86 ASSERT(property.isSVGAttribute());
87 return SVGPropertySpecificKeyframe::create(offset(), &easing(), svgPropertyV alue(property.svgAttribute()), composite()); 87 return SVGPropertySpecificKeyframe::create(offset(), &easing(), svgPropertyV alue(property.svgAttribute()), composite());
88 } 88 }
89 89
90 bool StringKeyframe::CSSPropertySpecificKeyframe::populateAnimatableValue(CSSPro pertyID property, Element& element, const ComputedStyle& baseStyle, const Comput edStyle* parentStyle) const 90 bool StringKeyframe::CSSPropertySpecificKeyframe::populateAnimatableValue(CSSPro pertyID property, Element& element, const ComputedStyle& baseStyle, const Comput edStyle* parentStyle) const
91 { 91 {
92 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(elemen t, baseStyle, parentStyle, property, m_value.get()); 92 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(elemen t, baseStyle, parentStyle, property, m_value.get());
93 return true; 93 return true;
94 } 94 }
(...skipping 14 matching lines...) Expand all
109 { 109 {
110 return create(offset, m_easing, m_value, m_composite); 110 return create(offset, m_easing, m_value, m_composite);
111 } 111 }
112 112
113 PassRefPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::neut ralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const 113 PassRefPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::neut ralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const
114 { 114 {
115 return create(offset, easing, String(), EffectModel::CompositeAdd); 115 return create(offset, easing, String(), EffectModel::CompositeAdd);
116 } 116 }
117 117
118 } // namespace blink 118 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698