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

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

Issue 2737653006: Add a new mechanism for watching SVGElement 'href' targets (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
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 "core/CoreExport.h" 25 #include "core/CoreExport.h"
25 #include "core/dom/Document.h" 26 #include "core/dom/Document.h"
26 #include "core/svg/SVGAnimatedHref.h" 27 #include "core/svg/SVGAnimatedHref.h"
27 #include "platform/heap/Handle.h" 28 #include "platform/heap/Handle.h"
29 #include "wtf/Functional.h"
28 30
29 namespace blink { 31 namespace blink {
30 32
31 class Element; 33 class Element;
34 class IdTargetObserver;
32 35
33 class CORE_EXPORT SVGURIReference : public GarbageCollectedMixin { 36 class CORE_EXPORT SVGURIReference : public GarbageCollectedMixin {
34 public: 37 public:
35 virtual ~SVGURIReference() {} 38 virtual ~SVGURIReference() {}
36 39
37 bool isKnownAttribute(const QualifiedName&); 40 bool isKnownAttribute(const QualifiedName&);
38 41
39 // 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
40 // elements where both are allowed and don't necessarily inherit from 43 // elements where both are allowed and don't necessarily inherit from
41 // SVGURIReference. 44 // SVGURIReference.
42 static const AtomicString& legacyHrefString(const SVGElement&); 45 static const AtomicString& legacyHrefString(const SVGElement&);
43 46
44 // Like above, but for elements that inherit from SVGURIReference. Resolves 47 // Like above, but for elements that inherit from SVGURIReference. Resolves
45 // against the base URL of the passed Document. 48 // against the base URL of the passed Document.
46 KURL legacyHrefURL(const Document&) const; 49 KURL legacyHrefURL(const Document&) const;
47 50
48 static AtomicString fragmentIdentifierFromIRIString(const String&, 51 static AtomicString fragmentIdentifierFromIRIString(const String&,
49 const TreeScope&); 52 const TreeScope&);
50 static Element* targetElementFromIRIString(const String&, 53 static Element* targetElementFromIRIString(const String&,
51 const TreeScope&, 54 const TreeScope&,
52 AtomicString* = nullptr); 55 AtomicString* = nullptr);
53 56
54 const String& hrefString() const { return m_href->currentValue()->value(); } 57 const String& hrefString() const { return m_href->currentValue()->value(); }
55 58
59 // Create an 'id' observer for the href associated with this SVGURIReference
60 // and its corresponding SVGElement (which should be passed as
61 // |contextElement|.) Will call buildPendingResource() on |contextElement|
62 // when changes to the 'id' are noticed.
63 Element* observeTarget(Member<IdTargetObserver>&, SVGElement&);
64 // Unregister and destroy the observer.
65 static void unobserveTarget(Member<IdTargetObserver>&);
66
56 // JS API 67 // JS API
57 SVGAnimatedHref* href() const { return m_href.get(); } 68 SVGAnimatedHref* href() const { return m_href.get(); }
58 69
59 DECLARE_VIRTUAL_TRACE(); 70 DECLARE_VIRTUAL_TRACE();
60 71
61 protected: 72 protected:
62 explicit SVGURIReference(SVGElement*); 73 explicit SVGURIReference(SVGElement*);
63 74
64 private: 75 private:
65 Member<SVGAnimatedHref> m_href; 76 Member<SVGAnimatedHref> m_href;
(...skipping 14 matching lines...) Expand all
80 private: 91 private:
81 const String& m_relativeUrl; 92 const String& m_relativeUrl;
82 Member<const Document> m_document; 93 Member<const Document> m_document;
83 mutable KURL m_absoluteUrl; 94 mutable KURL m_absoluteUrl;
84 bool m_isLocal; 95 bool m_isLocal;
85 }; 96 };
86 97
87 } // namespace blink 98 } // namespace blink
88 99
89 #endif // SVGURIReference_h 100 #endif // SVGURIReference_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp ('k') | third_party/WebKit/Source/core/svg/SVGURIReference.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698