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, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 typedef EventSender<SVGUseElement> SVGUseEventSender; | 34 typedef EventSender<SVGUseElement> SVGUseEventSender; |
35 | 35 |
36 class SVGUseElement final : public SVGGraphicsElement, | 36 class SVGUseElement final : public SVGGraphicsElement, |
37 public SVGURIReference, | 37 public SVGURIReference, |
38 public DocumentResourceClient { | 38 public DocumentResourceClient { |
39 DEFINE_WRAPPERTYPEINFO(); | 39 DEFINE_WRAPPERTYPEINFO(); |
40 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SVGUseElement); | 40 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SVGUseElement); |
41 public: | 41 public: |
42 static PassRefPtrWillBeRawPtr<SVGUseElement> create(Document&); | 42 static PassRefPtrWillBeRawPtr<SVGUseElement> create(Document&); |
43 virtual ~SVGUseElement(); | 43 ~SVGUseElement() override; |
44 | 44 |
45 void invalidateShadowTree(); | 45 void invalidateShadowTree(); |
46 | 46 |
47 // Return the element that should be used for clipping, | 47 // Return the element that should be used for clipping, |
48 // or null if a valid clip element is not directly referenced. | 48 // or null if a valid clip element is not directly referenced. |
49 SVGGraphicsElement* targetGraphicsElementForClipping() const; | 49 SVGGraphicsElement* targetGraphicsElementForClipping() const; |
50 | 50 |
51 SVGAnimatedLength* x() const { return m_x.get(); } | 51 SVGAnimatedLength* x() const { return m_x.get(); } |
52 SVGAnimatedLength* y() const { return m_y.get(); } | 52 SVGAnimatedLength* y() const { return m_y.get(); } |
53 SVGAnimatedLength* width() const { return m_width.get(); } | 53 SVGAnimatedLength* width() const { return m_width.get(); } |
54 SVGAnimatedLength* height() const { return m_height.get(); } | 54 SVGAnimatedLength* height() const { return m_height.get(); } |
55 | 55 |
56 virtual void buildPendingResource() override; | 56 void buildPendingResource() override; |
57 | 57 |
58 void dispatchPendingEvent(SVGUseEventSender*); | 58 void dispatchPendingEvent(SVGUseEventSender*); |
59 void toClipPath(Path&) const; | 59 void toClipPath(Path&) const; |
60 | 60 |
61 DECLARE_VIRTUAL_TRACE(); | 61 DECLARE_VIRTUAL_TRACE(); |
62 | 62 |
63 private: | 63 private: |
64 explicit SVGUseElement(Document&); | 64 explicit SVGUseElement(Document&); |
65 | 65 |
66 virtual bool isPresentationAttribute(const QualifiedName&) const override; | 66 bool isPresentationAttribute(const QualifiedName&) const override; |
67 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons
t AtomicString&, MutableStylePropertySet*) override; | 67 void collectStyleForPresentationAttribute(const QualifiedName&, const Atomic
String&, MutableStylePropertySet*) override; |
68 virtual bool isPresentationAttributeWithSVGDOM(const QualifiedName&) const o
verride; | 68 bool isPresentationAttributeWithSVGDOM(const QualifiedName&) const override; |
69 | 69 |
70 virtual bool isStructurallyExternal() const override { return !hrefString().
isNull() && isExternalURIReference(hrefString(), document()); } | 70 bool isStructurallyExternal() const override { return !hrefString().isNull()
&& isExternalURIReference(hrefString(), document()); } |
71 | 71 |
72 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; | 72 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
73 virtual void removedFrom(ContainerNode*) override; | 73 void removedFrom(ContainerNode*) override; |
74 | 74 |
75 virtual void svgAttributeChanged(const QualifiedName&) override; | 75 void svgAttributeChanged(const QualifiedName&) override; |
76 | 76 |
77 virtual LayoutObject* createLayoutObject(const ComputedStyle&) override; | 77 LayoutObject* createLayoutObject(const ComputedStyle&) override; |
78 | 78 |
79 void clearResourceReferences(); | 79 void clearResourceReferences(); |
80 void buildShadowAndInstanceTree(SVGElement* target); | 80 void buildShadowAndInstanceTree(SVGElement* target); |
81 | 81 |
82 void scheduleShadowTreeRecreation(); | 82 void scheduleShadowTreeRecreation(); |
83 virtual bool haveLoadedRequiredResources() override { return !isStructurally
External() || m_haveFiredLoadEvent; } | 83 bool haveLoadedRequiredResources() override { return !isStructurallyExternal
() || m_haveFiredLoadEvent; } |
84 | 84 |
85 virtual bool selfHasRelativeLengths() const override; | 85 bool selfHasRelativeLengths() const override; |
86 | 86 |
87 // Instance tree handling | 87 // Instance tree handling |
88 bool buildShadowTree(SVGElement* target, SVGElement* targetInstance, bool fo
undUse); | 88 bool buildShadowTree(SVGElement* target, SVGElement* targetInstance, bool fo
undUse); |
89 bool hasCycleUseReferencing(SVGUseElement*, ContainerNode* targetInstance, S
VGElement*& newTarget); | 89 bool hasCycleUseReferencing(SVGUseElement*, ContainerNode* targetInstance, S
VGElement*& newTarget); |
90 bool expandUseElementsInShadowTree(SVGElement*); | 90 bool expandUseElementsInShadowTree(SVGElement*); |
91 void expandSymbolElementsInShadowTree(SVGElement*); | 91 void expandSymbolElementsInShadowTree(SVGElement*); |
92 | 92 |
93 void transferUseAttributesToReplacedElement(SVGElement* from, SVGElement* to
) const; | 93 void transferUseAttributesToReplacedElement(SVGElement* from, SVGElement* to
) const; |
94 | 94 |
95 void invalidateDependentShadowTrees(); | 95 void invalidateDependentShadowTrees(); |
96 | 96 |
97 bool resourceIsStillLoading(); | 97 bool resourceIsStillLoading(); |
98 Document* externalDocument() const; | 98 Document* externalDocument() const; |
99 bool instanceTreeIsLoading(SVGElement*); | 99 bool instanceTreeIsLoading(SVGElement*); |
100 virtual void notifyFinished(Resource*) override; | 100 void notifyFinished(Resource*) override; |
101 TreeScope* referencedScope() const; | 101 TreeScope* referencedScope() const; |
102 void setDocumentResource(ResourcePtr<DocumentResource>); | 102 void setDocumentResource(ResourcePtr<DocumentResource>); |
103 | 103 |
104 RefPtrWillBeMember<SVGAnimatedLength> m_x; | 104 RefPtrWillBeMember<SVGAnimatedLength> m_x; |
105 RefPtrWillBeMember<SVGAnimatedLength> m_y; | 105 RefPtrWillBeMember<SVGAnimatedLength> m_y; |
106 RefPtrWillBeMember<SVGAnimatedLength> m_width; | 106 RefPtrWillBeMember<SVGAnimatedLength> m_width; |
107 RefPtrWillBeMember<SVGAnimatedLength> m_height; | 107 RefPtrWillBeMember<SVGAnimatedLength> m_height; |
108 | 108 |
109 bool m_haveFiredLoadEvent; | 109 bool m_haveFiredLoadEvent; |
110 bool m_needsShadowTreeRecreation; | 110 bool m_needsShadowTreeRecreation; |
111 RefPtrWillBeMember<SVGElement> m_targetElementInstance; | 111 RefPtrWillBeMember<SVGElement> m_targetElementInstance; |
112 ResourcePtr<DocumentResource> m_resource; | 112 ResourcePtr<DocumentResource> m_resource; |
113 }; | 113 }; |
114 | 114 |
115 } // namespace blink | 115 } // namespace blink |
116 | 116 |
117 #endif // SVGUseElement_h | 117 #endif // SVGUseElement_h |
OLD | NEW |