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

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

Issue 1410993004: Make PropertyHandle::svgAttribute() return a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_unCSSInterpolationType
Patch Set: Created 5 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
« no previous file with comments | « third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "core/animation/StringKeyframe.h" 6 #include "core/animation/StringKeyframe.h"
7 7
8 #include "core/animation/AngleSVGInterpolation.h" 8 #include "core/animation/AngleSVGInterpolation.h"
9 #include "core/animation/CSSColorInterpolationType.h" 9 #include "core/animation/CSSColorInterpolationType.h"
10 #include "core/animation/CSSLengthInterpolationType.h" 10 #include "core/animation/CSSLengthInterpolationType.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 { 93 {
94 return adoptRef(new StringKeyframe(*this)); 94 return adoptRef(new StringKeyframe(*this));
95 } 95 }
96 96
97 PassOwnPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::createPropertySpe cificKeyframe(PropertyHandle property) const 97 PassOwnPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::createPropertySpe cificKeyframe(PropertyHandle property) const
98 { 98 {
99 if (property.isCSSProperty()) 99 if (property.isCSSProperty())
100 return adoptPtr(new CSSPropertySpecificKeyframe(offset(), &easing(), css PropertyValue(property.cssProperty()), composite())); 100 return adoptPtr(new CSSPropertySpecificKeyframe(offset(), &easing(), css PropertyValue(property.cssProperty()), composite()));
101 101
102 ASSERT(property.isSVGAttribute()); 102 ASSERT(property.isSVGAttribute());
103 return adoptPtr(new SVGPropertySpecificKeyframe(offset(), &easing(), svgProp ertyValue(*property.svgAttribute()), composite())); 103 return adoptPtr(new SVGPropertySpecificKeyframe(offset(), &easing(), svgProp ertyValue(property.svgAttribute()), composite()));
104 } 104 }
105 105
106 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value, EffectModel::Composi teOperation op) 106 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value, EffectModel::Composi teOperation op)
107 : Keyframe::PropertySpecificKeyframe(offset, easing, op) 107 : Keyframe::PropertySpecificKeyframe(offset, easing, op)
108 , m_value(value) 108 , m_value(value)
109 { } 109 { }
110 110
111 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value) 111 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value)
112 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR eplace) 112 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR eplace)
113 , m_value(value) 113 , m_value(value)
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 return interpolation.release(); 534 return interpolation.release();
535 535
536 return DefaultSVGInterpolation::create(fromValue, toValue, attribute); 536 return DefaultSVGInterpolation::create(fromValue, toValue, attribute);
537 } 537 }
538 538
539 } // namespace 539 } // namespace
540 540
541 PassRefPtr<Interpolation> SVGPropertySpecificKeyframe::maybeCreateInterpolation( PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const 541 PassRefPtr<Interpolation> SVGPropertySpecificKeyframe::maybeCreateInterpolation( PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const
542 { 542 {
543 ASSERT(element); 543 ASSERT(element);
544 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute = toSVGElement(element )->propertyFromAttribute(*propertyHandle.svgAttribute()); 544 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute = toSVGElement(element )->propertyFromAttribute(propertyHandle.svgAttribute());
545 ASSERT(attribute); 545 ASSERT(attribute);
546 546
547 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value); 547 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value);
548 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); 548 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value());
549 549
550 if (!fromValue || !toValue) 550 if (!fromValue || !toValue)
551 return nullptr; 551 return nullptr;
552 552
553 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( )); 553 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( ));
554 } 554 }
555 555
556 } // namespace blink 556 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698