Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 for (const QualifiedName* attribute : ensureSVGRareData()->webAnimatedAttrib utes()) { | |
|
fs
2015/11/27 09:34:36
Use svgRareData (+assert/check) here (and below) i
alancutter (OOO until 2018)
2015/11/30 00:43:30
Done.
| |
| 270 updateInstancesAnimatedAttribute(this, *attribute, [](SVGAnimatedPropert yBase& animatedProperty) { | |
| 271 animatedProperty.animationEnded(); | |
| 272 }); | |
| 273 } | |
| 274 ensureSVGRareData()->webAnimatedAttributes().clear(); | |
| 275 } | |
| 276 | |
| 243 AffineTransform SVGElement::localCoordinateSpaceTransform(CTMScope) const | 277 AffineTransform SVGElement::localCoordinateSpaceTransform(CTMScope) const |
| 244 { | 278 { |
| 245 // To be overriden by SVGGraphicsElement (or as special case SVGTextElement and SVGPatternElement) | 279 // To be overriden by SVGGraphicsElement (or as special case SVGTextElement and SVGPatternElement) |
| 246 return AffineTransform(); | 280 return AffineTransform(); |
| 247 } | 281 } |
| 248 | 282 |
| 249 Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootP arent) | 283 Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootP arent) |
| 250 { | 284 { |
| 251 Element::insertedInto(rootParent); | 285 Element::insertedInto(rootParent); |
| 252 updateRelativeLengthsInformation(); | 286 updateRelativeLengthsInformation(); |
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1159 Element::trace(visitor); | 1193 Element::trace(visitor); |
| 1160 } | 1194 } |
| 1161 | 1195 |
| 1162 const AtomicString& SVGElement::eventParameterName() | 1196 const AtomicString& SVGElement::eventParameterName() |
| 1163 { | 1197 { |
| 1164 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral)); | 1198 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral)); |
| 1165 return evtString; | 1199 return evtString; |
| 1166 } | 1200 } |
| 1167 | 1201 |
| 1168 } // namespace blink | 1202 } // namespace blink |
| OLD | NEW |