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

Side by Side Diff: Source/core/svg/SVGUseElement.h

Issue 1150623003: Revamp asynchronous (load) event dispatching for SVG elements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
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, 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,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #ifndef SVGUseElement_h 21 #ifndef SVGUseElement_h
22 #define SVGUseElement_h 22 #define SVGUseElement_h
23 23
24 #include "core/SVGNames.h" 24 #include "core/events/EventSender.h"
25 #include "core/fetch/DocumentResource.h" 25 #include "core/fetch/DocumentResource.h"
26 #include "core/svg/SVGAnimatedBoolean.h"
27 #include "core/svg/SVGAnimatedLength.h" 26 #include "core/svg/SVGAnimatedLength.h"
28 #include "core/svg/SVGGraphicsElement.h" 27 #include "core/svg/SVGGraphicsElement.h"
29 #include "core/svg/SVGURIReference.h" 28 #include "core/svg/SVGURIReference.h"
30 #include "platform/heap/Handle.h" 29 #include "platform/heap/Handle.h"
31 30
32 namespace blink { 31 namespace blink {
33 32
34 class DocumentResource; 33 typedef EventSender<SVGUseElement> SVGUseEventSender;
35 34
36 class SVGUseElement final : public SVGGraphicsElement, 35 class SVGUseElement final : public SVGGraphicsElement,
37 public SVGURIReference, 36 public SVGURIReference,
38 public DocumentResourceClient { 37 public DocumentResourceClient {
39 DEFINE_WRAPPERTYPEINFO(); 38 DEFINE_WRAPPERTYPEINFO();
40 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SVGUseElement); 39 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SVGUseElement);
41 public: 40 public:
42 static PassRefPtrWillBeRawPtr<SVGUseElement> create(Document&); 41 static PassRefPtrWillBeRawPtr<SVGUseElement> create(Document&);
43 virtual ~SVGUseElement(); 42 virtual ~SVGUseElement();
44 43
45 void invalidateShadowTree(); 44 void invalidateShadowTree();
46 45
47 LayoutObject* layoutObjectClipChild() const; 46 LayoutObject* layoutObjectClipChild() const;
48 47
49 SVGAnimatedLength* x() const { return m_x.get(); } 48 SVGAnimatedLength* x() const { return m_x.get(); }
50 SVGAnimatedLength* y() const { return m_y.get(); } 49 SVGAnimatedLength* y() const { return m_y.get(); }
51 SVGAnimatedLength* width() const { return m_width.get(); } 50 SVGAnimatedLength* width() const { return m_width.get(); }
52 SVGAnimatedLength* height() const { return m_height.get(); } 51 SVGAnimatedLength* height() const { return m_height.get(); }
53 52
54 virtual void buildPendingResource() override; 53 virtual void buildPendingResource() override;
55 54
55 void dispatchPendingEvent(SVGUseEventSender*);
56
56 DECLARE_VIRTUAL_TRACE(); 57 DECLARE_VIRTUAL_TRACE();
57 58
58 private: 59 private:
59 explicit SVGUseElement(Document&); 60 explicit SVGUseElement(Document&);
60 61
61 virtual bool isPresentationAttribute(const QualifiedName&) const override; 62 virtual bool isPresentationAttribute(const QualifiedName&) const override;
62 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) override; 63 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) override;
63 virtual bool isPresentationAttributeWithSVGDOM(const QualifiedName&) const o verride; 64 virtual bool isPresentationAttributeWithSVGDOM(const QualifiedName&) const o verride;
64 65
65 virtual bool isStructurallyExternal() const override { return !hrefString(). isNull() && isExternalURIReference(hrefString(), document()); } 66 virtual bool isStructurallyExternal() const override { return !hrefString(). isNull() && isExternalURIReference(hrefString(), document()); }
(...skipping 24 matching lines...) Expand all
90 91
91 void invalidateDependentShadowTrees(); 92 void invalidateDependentShadowTrees();
92 93
93 bool resourceIsStillLoading(); 94 bool resourceIsStillLoading();
94 Document* externalDocument() const; 95 Document* externalDocument() const;
95 bool instanceTreeIsLoading(SVGElement*); 96 bool instanceTreeIsLoading(SVGElement*);
96 virtual void notifyFinished(Resource*) override; 97 virtual void notifyFinished(Resource*) override;
97 TreeScope* referencedScope() const; 98 TreeScope* referencedScope() const;
98 void setDocumentResource(ResourcePtr<DocumentResource>); 99 void setDocumentResource(ResourcePtr<DocumentResource>);
99 100
100 virtual Timer<SVGElement>* svgLoadEventTimer() override { return &m_svgLoadE ventTimer; }
101
102 RefPtrWillBeMember<SVGAnimatedLength> m_x; 101 RefPtrWillBeMember<SVGAnimatedLength> m_x;
103 RefPtrWillBeMember<SVGAnimatedLength> m_y; 102 RefPtrWillBeMember<SVGAnimatedLength> m_y;
104 RefPtrWillBeMember<SVGAnimatedLength> m_width; 103 RefPtrWillBeMember<SVGAnimatedLength> m_width;
105 RefPtrWillBeMember<SVGAnimatedLength> m_height; 104 RefPtrWillBeMember<SVGAnimatedLength> m_height;
106 105
107 bool m_haveFiredLoadEvent; 106 bool m_haveFiredLoadEvent;
108 bool m_needsShadowTreeRecreation; 107 bool m_needsShadowTreeRecreation;
109 RefPtrWillBeMember<SVGElement> m_targetElementInstance; 108 RefPtrWillBeMember<SVGElement> m_targetElementInstance;
110 ResourcePtr<DocumentResource> m_resource; 109 ResourcePtr<DocumentResource> m_resource;
111 Timer<SVGElement> m_svgLoadEventTimer;
112 }; 110 };
113 111
114 } // namespace blink 112 } // namespace blink
115 113
116 #endif // SVGUseElement_h 114 #endif // SVGUseElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698