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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGElement.cpp

Issue 1474263002: Clear SVG Web Animation effects when animations exit their fill phase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_svgPathInterpolationType
Patch Set: Check rare data Created 5 years 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 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org>
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 22 matching lines...) Expand all
33 #include "core/css/CSSCursorImageValue.h" 33 #include "core/css/CSSCursorImageValue.h"
34 #include "core/css/resolver/StyleResolver.h" 34 #include "core/css/resolver/StyleResolver.h"
35 #include "core/dom/Document.h" 35 #include "core/dom/Document.h"
36 #include "core/dom/ElementTraversal.h" 36 #include "core/dom/ElementTraversal.h"
37 #include "core/dom/shadow/ShadowRoot.h" 37 #include "core/dom/shadow/ShadowRoot.h"
38 #include "core/events/Event.h" 38 #include "core/events/Event.h"
39 #include "core/frame/Settings.h" 39 #include "core/frame/Settings.h"
40 #include "core/html/HTMLElement.h" 40 #include "core/html/HTMLElement.h"
41 #include "core/layout/LayoutObject.h" 41 #include "core/layout/LayoutObject.h"
42 #include "core/layout/svg/LayoutSVGResourceContainer.h" 42 #include "core/layout/svg/LayoutSVGResourceContainer.h"
43 #include "core/svg/SVGAnimateElement.h"
43 #include "core/svg/SVGCursorElement.h" 44 #include "core/svg/SVGCursorElement.h"
44 #include "core/svg/SVGDocumentExtensions.h" 45 #include "core/svg/SVGDocumentExtensions.h"
45 #include "core/svg/SVGElementRareData.h" 46 #include "core/svg/SVGElementRareData.h"
46 #include "core/svg/SVGGraphicsElement.h" 47 #include "core/svg/SVGGraphicsElement.h"
47 #include "core/svg/SVGSVGElement.h" 48 #include "core/svg/SVGSVGElement.h"
48 #include "core/svg/SVGTitleElement.h" 49 #include "core/svg/SVGTitleElement.h"
49 #include "core/svg/SVGUseElement.h" 50 #include "core/svg/SVGUseElement.h"
51 #include "core/svg/properties/SVGProperty.h"
50 #include "platform/JSONValues.h" 52 #include "platform/JSONValues.h"
51 #include "wtf/TemporaryChange.h" 53 #include "wtf/TemporaryChange.h"
52 54
53 namespace blink { 55 namespace blink {
54 56
55 using namespace HTMLNames; 57 using namespace HTMLNames;
56 using namespace SVGNames; 58 using namespace SVGNames;
57 59
58 SVGElement::SVGElement(const QualifiedName& tagName, Document& document, Constru ctionType constructionType) 60 SVGElement::SVGElement(const QualifiedName& tagName, Document& document, Constru ctionType constructionType)
59 : Element(tagName, &document, constructionType) 61 : Element(tagName, &document, constructionType)
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 { 235 {
234 if (hasSVGRareData()) 236 if (hasSVGRareData())
235 svgRareData()->setInstanceUpdatesBlocked(value); 237 svgRareData()->setInstanceUpdatesBlocked(value);
236 } 238 }
237 239
238 void SVGElement::setWebAnimationsPending() 240 void SVGElement::setWebAnimationsPending()
239 { 241 {
240 document().accessSVGExtensions().addWebAnimationsPendingSVGElement(*this); 242 document().accessSVGExtensions().addWebAnimationsPendingSVGElement(*this);
241 } 243 }
242 244
245 template<typename T>
246 static void updateInstancesAnimatedAttribute(SVGElement* element, const Qualifie dName& attribute, T callback)
247 {
248 SVGElement::InstanceUpdateBlocker blocker(element);
249 for (SVGElement* instance : SVGAnimateElement::findElementInstances(element) ) {
250 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> animatedProperty = instance- >propertyFromAttribute(attribute);
251 if (animatedProperty) {
252 callback(*animatedProperty);
253 instance->invalidateSVGAttributes();
254 instance->svgAttributeChanged(attribute);
255 }
256 }
257 }
258
259 void SVGElement::setWebAnimatedAttribute(const QualifiedName& attribute, PassRef PtrWillBeRawPtr<SVGPropertyBase> value)
260 {
261 updateInstancesAnimatedAttribute(this, attribute, [&value](SVGAnimatedProper tyBase& animatedProperty) {
262 animatedProperty.setAnimatedValue(value.get());
263 });
264 ensureSVGRareData()->webAnimatedAttributes().add(&attribute);
265 }
266
267 void SVGElement::clearWebAnimatedAttributes()
268 {
269 if (!hasSVGRareData())
270 return;
271 for (const QualifiedName* attribute : svgRareData()->webAnimatedAttributes() ) {
272 updateInstancesAnimatedAttribute(this, *attribute, [](SVGAnimatedPropert yBase& animatedProperty) {
273 animatedProperty.animationEnded();
274 });
275 }
276 svgRareData()->webAnimatedAttributes().clear();
277 }
278
243 AffineTransform SVGElement::localCoordinateSpaceTransform(CTMScope) const 279 AffineTransform SVGElement::localCoordinateSpaceTransform(CTMScope) const
244 { 280 {
245 // To be overriden by SVGGraphicsElement (or as special case SVGTextElement and SVGPatternElement) 281 // To be overriden by SVGGraphicsElement (or as special case SVGTextElement and SVGPatternElement)
246 return AffineTransform(); 282 return AffineTransform();
247 } 283 }
248 284
249 Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootP arent) 285 Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootP arent)
250 { 286 {
251 Element::insertedInto(rootParent); 287 Element::insertedInto(rootParent);
252 updateRelativeLengthsInformation(); 288 updateRelativeLengthsInformation();
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 Element::trace(visitor); 1195 Element::trace(visitor);
1160 } 1196 }
1161 1197
1162 const AtomicString& SVGElement::eventParameterName() 1198 const AtomicString& SVGElement::eventParameterName()
1163 { 1199 {
1164 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral)); 1200 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral));
1165 return evtString; 1201 return evtString;
1166 } 1202 }
1167 1203
1168 } // namespace blink 1204 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGElement.h ('k') | third_party/WebKit/Source/core/svg/SVGElementRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698