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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGURIReference.h

Issue 2744613002: Use IdTargetObserver in SVGUseElement (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/SVGURIReference.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2008, 2009 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2008, 2009 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005 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 SVGURIReference_h 21 #ifndef SVGURIReference_h
22 #define SVGURIReference_h 22 #define SVGURIReference_h
23 23
24 #include <memory> 24 #include <memory>
25 #include "core/CoreExport.h" 25 #include "core/CoreExport.h"
26 #include "core/dom/Document.h"
27 #include "core/svg/SVGAnimatedHref.h" 26 #include "core/svg/SVGAnimatedHref.h"
28 #include "platform/heap/Handle.h" 27 #include "platform/heap/Handle.h"
29 #include "wtf/Functional.h" 28 #include "wtf/Functional.h"
30 29
31 namespace blink { 30 namespace blink {
32 31
32 class Document;
33 class Element; 33 class Element;
34 class IdTargetObserver; 34 class IdTargetObserver;
35 35
36 class CORE_EXPORT SVGURIReference : public GarbageCollectedMixin { 36 class CORE_EXPORT SVGURIReference : public GarbageCollectedMixin {
37 public: 37 public:
38 virtual ~SVGURIReference() {} 38 virtual ~SVGURIReference() {}
39 39
40 bool isKnownAttribute(const QualifiedName&); 40 bool isKnownAttribute(const QualifiedName&);
41 41
42 // Use this for accesses to 'href' or 'xlink:href' (in that order) for 42 // Use this for accesses to 'href' or 'xlink:href' (in that order) for
(...skipping 11 matching lines...) Expand all
54 const TreeScope&, 54 const TreeScope&,
55 AtomicString* = nullptr); 55 AtomicString* = nullptr);
56 56
57 const String& hrefString() const { return m_href->currentValue()->value(); } 57 const String& hrefString() const { return m_href->currentValue()->value(); }
58 58
59 // Create an 'id' observer for the href associated with this SVGURIReference 59 // Create an 'id' observer for the href associated with this SVGURIReference
60 // and its corresponding SVGElement (which should be passed as 60 // and its corresponding SVGElement (which should be passed as
61 // |contextElement|.) Will call buildPendingResource() on |contextElement| 61 // |contextElement|.) Will call buildPendingResource() on |contextElement|
62 // when changes to the 'id' are noticed. 62 // when changes to the 'id' are noticed.
63 Element* observeTarget(Member<IdTargetObserver>&, SVGElement&); 63 Element* observeTarget(Member<IdTargetObserver>&, SVGElement&);
64 // Create an 'id' observer for |id| in the specified TreeScope. On changes,
65 // the passed Closure will be called.
66 static Element* observeTarget(Member<IdTargetObserver>&,
67 TreeScope&,
68 const AtomicString& id,
69 std::unique_ptr<WTF::Closure>);
64 // Unregister and destroy the observer. 70 // Unregister and destroy the observer.
65 static void unobserveTarget(Member<IdTargetObserver>&); 71 static void unobserveTarget(Member<IdTargetObserver>&);
66 72
67 // JS API 73 // JS API
68 SVGAnimatedHref* href() const { return m_href.get(); } 74 SVGAnimatedHref* href() const { return m_href.get(); }
69 75
70 DECLARE_VIRTUAL_TRACE(); 76 DECLARE_VIRTUAL_TRACE();
71 77
72 protected: 78 protected:
73 explicit SVGURIReference(SVGElement*); 79 explicit SVGURIReference(SVGElement*);
(...skipping 17 matching lines...) Expand all
91 private: 97 private:
92 const String& m_relativeUrl; 98 const String& m_relativeUrl;
93 Member<const Document> m_document; 99 Member<const Document> m_document;
94 mutable KURL m_absoluteUrl; 100 mutable KURL m_absoluteUrl;
95 bool m_isLocal; 101 bool m_isLocal;
96 }; 102 };
97 103
98 } // namespace blink 104 } // namespace blink
99 105
100 #endif // SVGURIReference_h 106 #endif // SVGURIReference_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/SVGURIReference.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698