| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2009, 2014 Apple Inc. All rights reserved. | 4 * Copyright (C) 2009, 2014 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 class SVGCursorElement; | 43 class SVGCursorElement; |
| 44 class SVGDocumentExtensions; | 44 class SVGDocumentExtensions; |
| 45 class SVGElement; | 45 class SVGElement; |
| 46 class SVGElementRareData; | 46 class SVGElementRareData; |
| 47 class SVGFitToViewBox; | 47 class SVGFitToViewBox; |
| 48 class SVGLength; | 48 class SVGLength; |
| 49 class SVGPropertyBase; | 49 class SVGPropertyBase; |
| 50 class SVGSVGElement; | 50 class SVGSVGElement; |
| 51 class SVGUseElement; | 51 class SVGUseElement; |
| 52 | 52 |
| 53 typedef WillBeHeapHashSet<RawPtrWillBeMember<SVGElement>> SVGElementSet; | 53 typedef HeapHashSet<Member<SVGElement>> SVGElementSet; |
| 54 | 54 |
| 55 class CORE_EXPORT SVGElement : public Element { | 55 class CORE_EXPORT SVGElement : public Element { |
| 56 DEFINE_WRAPPERTYPEINFO(); | 56 DEFINE_WRAPPERTYPEINFO(); |
| 57 public: | 57 public: |
| 58 ~SVGElement() override; | 58 ~SVGElement() override; |
| 59 void attach(const AttachContext&) override; | 59 void attach(const AttachContext&) override; |
| 60 void detach(const AttachContext&) override; | 60 void detach(const AttachContext&) override; |
| 61 | 61 |
| 62 short tabIndex() const override; | 62 short tabIndex() const override; |
| 63 bool supportsFocus() const override { return false; } | 63 bool supportsFocus() const override { return false; } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 80 | 80 |
| 81 bool instanceUpdatesBlocked() const; | 81 bool instanceUpdatesBlocked() const; |
| 82 void setInstanceUpdatesBlocked(bool); | 82 void setInstanceUpdatesBlocked(bool); |
| 83 | 83 |
| 84 // Records the SVG element as having a Web Animation on an SVG attribute tha
t needs applying. | 84 // Records the SVG element as having a Web Animation on an SVG attribute tha
t needs applying. |
| 85 void setWebAnimationsPending(); | 85 void setWebAnimationsPending(); |
| 86 void applyActiveWebAnimations(); | 86 void applyActiveWebAnimations(); |
| 87 | 87 |
| 88 void ensureAttributeAnimValUpdated(); | 88 void ensureAttributeAnimValUpdated(); |
| 89 | 89 |
| 90 void setWebAnimatedAttribute(const QualifiedName& attribute, PassRefPtrWillB
eRawPtr<SVGPropertyBase>); | 90 void setWebAnimatedAttribute(const QualifiedName& attribute, RawPtr<SVGPrope
rtyBase>); |
| 91 void clearWebAnimatedAttributes(); | 91 void clearWebAnimatedAttributes(); |
| 92 | 92 |
| 93 SVGSVGElement* ownerSVGElement() const; | 93 SVGSVGElement* ownerSVGElement() const; |
| 94 SVGElement* viewportElement() const; | 94 SVGElement* viewportElement() const; |
| 95 | 95 |
| 96 SVGDocumentExtensions& accessDocumentSVGExtensions(); | 96 SVGDocumentExtensions& accessDocumentSVGExtensions(); |
| 97 | 97 |
| 98 virtual bool isSVGGeometryElement() const { return false; } | 98 virtual bool isSVGGeometryElement() const { return false; } |
| 99 virtual bool isSVGGraphicsElement() const { return false; } | 99 virtual bool isSVGGraphicsElement() const { return false; } |
| 100 virtual bool isFilterEffect() const { return false; } | 100 virtual bool isFilterEffect() const { return false; } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 112 static AnimatedPropertyType animatedPropertyTypeForCSSAttribute(const Qualif
iedName& attributeName); | 112 static AnimatedPropertyType animatedPropertyTypeForCSSAttribute(const Qualif
iedName& attributeName); |
| 113 | 113 |
| 114 void sendSVGLoadEventToSelfAndAncestorChainIfPossible(); | 114 void sendSVGLoadEventToSelfAndAncestorChainIfPossible(); |
| 115 bool sendSVGLoadEventIfPossible(); | 115 bool sendSVGLoadEventIfPossible(); |
| 116 | 116 |
| 117 virtual AffineTransform* animateMotionTransform() { return nullptr; } | 117 virtual AffineTransform* animateMotionTransform() { return nullptr; } |
| 118 | 118 |
| 119 void invalidateSVGAttributes() { ensureUniqueElementData().m_animatedSVGAttr
ibutesAreDirty = true; } | 119 void invalidateSVGAttributes() { ensureUniqueElementData().m_animatedSVGAttr
ibutesAreDirty = true; } |
| 120 void invalidateSVGPresentationAttributeStyle() { ensureUniqueElementData().m
_presentationAttributeStyleIsDirty = true; } | 120 void invalidateSVGPresentationAttributeStyle() { ensureUniqueElementData().m
_presentationAttributeStyleIsDirty = true; } |
| 121 | 121 |
| 122 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement>>& instancesForEle
ment() const; | 122 const HeapHashSet<WeakMember<SVGElement>>& instancesForElement() const; |
| 123 void mapInstanceToElement(SVGElement*); | 123 void mapInstanceToElement(SVGElement*); |
| 124 void removeInstanceMapping(SVGElement*); | 124 void removeInstanceMapping(SVGElement*); |
| 125 | 125 |
| 126 void setCursorElement(SVGCursorElement*); | 126 void setCursorElement(SVGCursorElement*); |
| 127 void setCursorImageValue(CSSCursorImageValue*); | 127 void setCursorImageValue(CSSCursorImageValue*); |
| 128 | 128 |
| 129 #if !ENABLE(OILPAN) | 129 #if !ENABLE(OILPAN) |
| 130 void cursorElementRemoved(); | 130 void cursorElementRemoved(); |
| 131 void cursorImageValueRemoved(); | 131 void cursorImageValueRemoved(); |
| 132 #endif | 132 #endif |
| (...skipping 11 matching lines...) Expand all Loading... |
| 144 #endif | 144 #endif |
| 145 | 145 |
| 146 MutableStylePropertySet* animatedSMILStyleProperties() const; | 146 MutableStylePropertySet* animatedSMILStyleProperties() const; |
| 147 MutableStylePropertySet* ensureAnimatedSMILStyleProperties(); | 147 MutableStylePropertySet* ensureAnimatedSMILStyleProperties(); |
| 148 void setUseOverrideComputedStyle(bool); | 148 void setUseOverrideComputedStyle(bool); |
| 149 | 149 |
| 150 virtual bool haveLoadedRequiredResources(); | 150 virtual bool haveLoadedRequiredResources(); |
| 151 | 151 |
| 152 void invalidateRelativeLengthClients(SubtreeLayoutScope* = 0); | 152 void invalidateRelativeLengthClients(SubtreeLayoutScope* = 0); |
| 153 | 153 |
| 154 void addToPropertyMap(PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase>); | 154 void addToPropertyMap(RawPtr<SVGAnimatedPropertyBase>); |
| 155 | 155 |
| 156 SVGAnimatedString* className() { return m_className.get(); } | 156 SVGAnimatedString* className() { return m_className.get(); } |
| 157 | 157 |
| 158 bool inUseShadowTree() const; | 158 bool inUseShadowTree() const; |
| 159 | 159 |
| 160 SVGElementSet* setOfIncomingReferences() const; | 160 SVGElementSet* setOfIncomingReferences() const; |
| 161 void addReferenceTo(SVGElement*); | 161 void addReferenceTo(SVGElement*); |
| 162 void rebuildAllIncomingReferences(); | 162 void rebuildAllIncomingReferences(); |
| 163 void removeAllIncomingReferences(); | 163 void removeAllIncomingReferences(); |
| 164 void removeAllOutgoingReferences(); | 164 void removeAllOutgoingReferences(); |
| 165 | 165 |
| 166 class InvalidationGuard { | 166 class InvalidationGuard { |
| 167 STACK_ALLOCATED(); | 167 STACK_ALLOCATED(); |
| 168 WTF_MAKE_NONCOPYABLE(InvalidationGuard); | 168 WTF_MAKE_NONCOPYABLE(InvalidationGuard); |
| 169 public: | 169 public: |
| 170 InvalidationGuard(SVGElement* element) : m_element(element) { } | 170 InvalidationGuard(SVGElement* element) : m_element(element) { } |
| 171 ~InvalidationGuard() { m_element->invalidateInstances(); } | 171 ~InvalidationGuard() { m_element->invalidateInstances(); } |
| 172 | 172 |
| 173 private: | 173 private: |
| 174 RawPtrWillBeMember<SVGElement> m_element; | 174 Member<SVGElement> m_element; |
| 175 }; | 175 }; |
| 176 | 176 |
| 177 class InstanceUpdateBlocker { | 177 class InstanceUpdateBlocker { |
| 178 STACK_ALLOCATED(); | 178 STACK_ALLOCATED(); |
| 179 WTF_MAKE_NONCOPYABLE(InstanceUpdateBlocker); | 179 WTF_MAKE_NONCOPYABLE(InstanceUpdateBlocker); |
| 180 public: | 180 public: |
| 181 InstanceUpdateBlocker(SVGElement* targetElement); | 181 InstanceUpdateBlocker(SVGElement* targetElement); |
| 182 ~InstanceUpdateBlocker(); | 182 ~InstanceUpdateBlocker(); |
| 183 | 183 |
| 184 private: | 184 private: |
| 185 RawPtrWillBeMember<SVGElement> m_targetElement; | 185 Member<SVGElement> m_targetElement; |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 void invalidateInstances(); | 188 void invalidateInstances(); |
| 189 | 189 |
| 190 DECLARE_VIRTUAL_TRACE(); | 190 DECLARE_VIRTUAL_TRACE(); |
| 191 | 191 |
| 192 static const AtomicString& eventParameterName(); | 192 static const AtomicString& eventParameterName(); |
| 193 | 193 |
| 194 bool isPresentationAttribute(const QualifiedName&) const override; | 194 bool isPresentationAttribute(const QualifiedName&) const override; |
| 195 virtual bool isPresentationAttributeWithSVGDOM(const QualifiedName&) const {
return false; } | 195 virtual bool isPresentationAttributeWithSVGDOM(const QualifiedName&) const {
return false; } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 220 { | 220 { |
| 221 ASSERT(m_SVGRareData); | 221 ASSERT(m_SVGRareData); |
| 222 return m_SVGRareData.get(); | 222 return m_SVGRareData.get(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 // SVGFitToViewBox::parseAttribute uses reportAttributeParsingError. | 225 // SVGFitToViewBox::parseAttribute uses reportAttributeParsingError. |
| 226 friend class SVGFitToViewBox; | 226 friend class SVGFitToViewBox; |
| 227 void reportAttributeParsingError(SVGParsingError, const QualifiedName&, cons
t AtomicString&); | 227 void reportAttributeParsingError(SVGParsingError, const QualifiedName&, cons
t AtomicString&); |
| 228 bool hasFocusEventListeners() const; | 228 bool hasFocusEventListeners() const; |
| 229 | 229 |
| 230 bool addEventListenerInternal(const AtomicString& eventType, PassRefPtrWillB
eRawPtr<EventListener>, const EventListenerOptions&) final; | 230 bool addEventListenerInternal(const AtomicString& eventType, RawPtr<EventLis
tener>, const EventListenerOptions&) final; |
| 231 bool removeEventListenerInternal(const AtomicString& eventType, PassRefPtrWi
llBeRawPtr<EventListener>, const EventListenerOptions&) final; | 231 bool removeEventListenerInternal(const AtomicString& eventType, RawPtr<Event
Listener>, const EventListenerOptions&) final; |
| 232 | 232 |
| 233 private: | 233 private: |
| 234 bool isSVGElement() const = delete; // This will catch anyone doing an unnec
essary check. | 234 bool isSVGElement() const = delete; // This will catch anyone doing an unnec
essary check. |
| 235 bool isStyledElement() const = delete; // This will catch anyone doing an un
necessary check. | 235 bool isStyledElement() const = delete; // This will catch anyone doing an un
necessary check. |
| 236 | 236 |
| 237 const ComputedStyle* ensureComputedStyle(PseudoId = PseudoIdNone); | 237 const ComputedStyle* ensureComputedStyle(PseudoId = PseudoIdNone); |
| 238 const ComputedStyle* virtualEnsureComputedStyle(PseudoId pseudoElementSpecif
ier = PseudoIdNone) final { return ensureComputedStyle(pseudoElementSpecifier);
} | 238 const ComputedStyle* virtualEnsureComputedStyle(PseudoId pseudoElementSpecif
ier = PseudoIdNone) final { return ensureComputedStyle(pseudoElementSpecifier);
} |
| 239 void willRecalcStyle(StyleRecalcChange) override; | 239 void willRecalcStyle(StyleRecalcChange) override; |
| 240 | 240 |
| 241 void buildPendingResourcesIfNeeded(); | 241 void buildPendingResourcesIfNeeded(); |
| 242 | 242 |
| 243 WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement>> m_elementsWithRelative
Lengths; | 243 HeapHashSet<WeakMember<SVGElement>> m_elementsWithRelativeLengths; |
| 244 | 244 |
| 245 typedef WillBeHeapHashMap<QualifiedName, RefPtrWillBeMember<SVGAnimatedPrope
rtyBase>> AttributeToPropertyMap; | 245 typedef HeapHashMap<QualifiedName, Member<SVGAnimatedPropertyBase>> Attribut
eToPropertyMap; |
| 246 AttributeToPropertyMap m_attributeToPropertyMap; | 246 AttributeToPropertyMap m_attributeToPropertyMap; |
| 247 | 247 |
| 248 #if ENABLE(ASSERT) | 248 #if ENABLE(ASSERT) |
| 249 bool m_inRelativeLengthClientsInvalidation; | 249 bool m_inRelativeLengthClientsInvalidation; |
| 250 #endif | 250 #endif |
| 251 | 251 |
| 252 OwnPtrWillBeMember<SVGElementRareData> m_SVGRareData; | 252 Member<SVGElementRareData> m_SVGRareData; |
| 253 RefPtrWillBeMember<SVGAnimatedString> m_className; | 253 Member<SVGAnimatedString> m_className; |
| 254 }; | 254 }; |
| 255 | 255 |
| 256 struct SVGAttributeHashTranslator { | 256 struct SVGAttributeHashTranslator { |
| 257 STATIC_ONLY(SVGAttributeHashTranslator); | 257 STATIC_ONLY(SVGAttributeHashTranslator); |
| 258 static unsigned hash(const QualifiedName& key) | 258 static unsigned hash(const QualifiedName& key) |
| 259 { | 259 { |
| 260 if (key.hasPrefix()) { | 260 if (key.hasPrefix()) { |
| 261 QualifiedNameComponents components = { nullAtom.impl(), key.localNam
e().impl(), key.namespaceURI().impl() }; | 261 QualifiedNameComponents components = { nullAtom.impl(), key.localNam
e().impl(), key.namespaceURI().impl() }; |
| 262 return hashComponents(components); | 262 return hashComponents(components); |
| 263 } | 263 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 276 return isSVGElement() && toSVGElement(*this).hasTagName(name); | 276 return isSVGElement() && toSVGElement(*this).hasTagName(name); |
| 277 } | 277 } |
| 278 | 278 |
| 279 // This requires isSVG*Element(const SVGElement&). | 279 // This requires isSVG*Element(const SVGElement&). |
| 280 #define DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \ | 280 #define DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \ |
| 281 inline bool is##thisType(const thisType* element); \ | 281 inline bool is##thisType(const thisType* element); \ |
| 282 inline bool is##thisType(const thisType& element); \ | 282 inline bool is##thisType(const thisType& element); \ |
| 283 inline bool is##thisType(const SVGElement* element) { return element && is##
thisType(*element); } \ | 283 inline bool is##thisType(const SVGElement* element) { return element && is##
thisType(*element); } \ |
| 284 inline bool is##thisType(const Node& node) { return node.isSVGElement() ? is
##thisType(toSVGElement(node)) : false; } \ | 284 inline bool is##thisType(const Node& node) { return node.isSVGElement() ? is
##thisType(toSVGElement(node)) : false; } \ |
| 285 inline bool is##thisType(const Node* node) { return node && is##thisType(*no
de); } \ | 285 inline bool is##thisType(const Node* node) { return node && is##thisType(*no
de); } \ |
| 286 template<typename T> inline bool is##thisType(const PassRefPtrWillBeRawPtr<T
>& node) { return is##thisType(node.get()); } \ | 286 template<typename T> inline bool is##thisType(const RawPtr<T>& node) { retur
n is##thisType(node.get()); } \ |
| 287 template<typename T> inline bool is##thisType(const RefPtrWillBeMember<T>& n
ode) { return is##thisType(node.get()); } \ | 287 template<typename T> inline bool is##thisType(const Member<T>& node) { retur
n is##thisType(node.get()); } \ |
| 288 template <> inline bool isElementOfType<const thisType>(const SVGElement& el
ement) { return is##thisType(element); } \ | 288 template <> inline bool isElementOfType<const thisType>(const SVGElement& el
ement) { return is##thisType(element); } \ |
| 289 DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) | 289 DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) |
| 290 | 290 |
| 291 } // namespace blink | 291 } // namespace blink |
| 292 | 292 |
| 293 #include "core/SVGElementTypeHelpers.h" | 293 #include "core/SVGElementTypeHelpers.h" |
| 294 | 294 |
| 295 #endif // SVGElement_h | 295 #endif // SVGElement_h |
| OLD | NEW |