OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Simon Hausmann <hausmann@kde.org> | 4 * (C) 2000 Simon Hausmann <hausmann@kde.org> |
5 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 5 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #ifndef HTMLAnchorElement_h | 24 #ifndef HTMLAnchorElement_h |
25 #define HTMLAnchorElement_h | 25 #define HTMLAnchorElement_h |
26 | 26 |
27 #include "core/CoreExport.h" | 27 #include "core/CoreExport.h" |
28 #include "core/HTMLNames.h" | 28 #include "core/HTMLNames.h" |
29 #include "core/dom/DOMSettableTokenList.h" | |
29 #include "core/dom/DOMURLUtils.h" | 30 #include "core/dom/DOMURLUtils.h" |
30 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
31 #include "core/html/HTMLElement.h" | 32 #include "core/html/HTMLElement.h" |
32 #include "platform/LinkHash.h" | 33 #include "platform/LinkHash.h" |
33 | 34 |
34 namespace blink { | 35 namespace blink { |
35 | 36 |
36 // Link relation bitmask values. | 37 // Link relation bitmask values. |
37 // FIXME: Uncomment as the various link relations are implemented. | 38 // FIXME: Uncomment as the various link relations are implemented. |
38 enum { | 39 enum { |
(...skipping 10 matching lines...) Expand all Loading... | |
49 // RelationNext = 0x00000400, | 50 // RelationNext = 0x00000400, |
50 // RelationNoFolow = 0x00000800, | 51 // RelationNoFolow = 0x00000800, |
51 RelationNoReferrer = 0x00001000, | 52 RelationNoReferrer = 0x00001000, |
52 // RelationPrev = 0x00002000, | 53 // RelationPrev = 0x00002000, |
53 // RelationSearch = 0x00004000, | 54 // RelationSearch = 0x00004000, |
54 // RelationSidebar = 0x00008000, | 55 // RelationSidebar = 0x00008000, |
55 // RelationTag = 0x00010000, | 56 // RelationTag = 0x00010000, |
56 // RelationUp = 0x00020000, | 57 // RelationUp = 0x00020000, |
57 }; | 58 }; |
58 | 59 |
59 class CORE_EXPORT HTMLAnchorElement : public HTMLElement, public DOMURLUtils { | 60 #if COMPILER(MSVC) |
61 #pragma warning(disable: 4275) // Disable warning C4275 | |
philipj_slow
2015/10/07 13:02:37
This is done very rarely in Blink. What is the war
| |
62 #endif | |
63 | |
64 class CORE_EXPORT HTMLAnchorElement : public HTMLElement, public DOMURLUtils, pu blic DOMSettableTokenListObserver { | |
60 DEFINE_WRAPPERTYPEINFO(); | 65 DEFINE_WRAPPERTYPEINFO(); |
61 public: | 66 public: |
67 DECLARE_VIRTUAL_TRACE(); | |
62 static PassRefPtrWillBeRawPtr<HTMLAnchorElement> create(Document&); | 68 static PassRefPtrWillBeRawPtr<HTMLAnchorElement> create(Document&); |
63 | 69 |
64 ~HTMLAnchorElement() override; | 70 ~HTMLAnchorElement() override; |
65 | 71 |
66 KURL href() const; | 72 KURL href() const; |
67 void setHref(const AtomicString&); | 73 void setHref(const AtomicString&); |
68 | 74 |
69 const AtomicString& name() const; | 75 const AtomicString& name() const; |
70 | 76 |
71 KURL url() const final; | 77 KURL url() const final; |
72 void setURL(const KURL&) final; | 78 void setURL(const KURL&) final; |
73 | 79 |
74 String input() const final; | 80 String input() const final; |
75 void setInput(const String&) final; | 81 void setInput(const String&) final; |
76 | 82 |
77 bool isLiveLink() const final; | 83 bool isLiveLink() const final; |
78 | 84 |
79 bool willRespondToMouseClickEvents() final; | 85 bool willRespondToMouseClickEvents() final; |
80 | 86 |
81 bool hasRel(uint32_t relation) const; | 87 bool hasRel(uint32_t relation) const; |
82 void setRel(const AtomicString&); | 88 void setRel(const AtomicString&); |
83 | 89 |
84 LinkHash visitedLinkHash() const; | 90 LinkHash visitedLinkHash() const; |
85 void invalidateCachedVisitedLinkHash() { m_cachedVisitedLinkHash = 0; } | 91 void invalidateCachedVisitedLinkHash() { m_cachedVisitedLinkHash = 0; } |
86 | 92 |
87 void sendPings(const KURL& destinationURL) const; | 93 void sendPings(const KURL& destinationURL) const; |
88 | 94 |
95 DOMSettableTokenList* ping(); | |
96 | |
89 protected: | 97 protected: |
90 HTMLAnchorElement(const QualifiedName&, Document&); | 98 HTMLAnchorElement(const QualifiedName&, Document&); |
91 | 99 |
92 void attributeWillChange(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue) override; | 100 void attributeWillChange(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue) override; |
93 void parseAttribute(const QualifiedName&, const AtomicString&) override; | 101 void parseAttribute(const QualifiedName&, const AtomicString&) override; |
94 bool supportsFocus() const override; | 102 bool supportsFocus() const override; |
95 | 103 |
96 private: | 104 private: |
97 bool shouldHaveFocusAppearance() const final; | 105 bool shouldHaveFocusAppearance() const final; |
98 void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, InputDevic eCapabilities* sourceCapabilities) override; | 106 void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, InputDevic eCapabilities* sourceCapabilities) override; |
99 void dispatchBlurEvent(Element* newFocusedElement, WebFocusType, InputDevice Capabilities* sourceCapabilities) override; | 107 void dispatchBlurEvent(Element* newFocusedElement, WebFocusType, InputDevice Capabilities* sourceCapabilities) override; |
100 bool isMouseFocusable() const override; | 108 bool isMouseFocusable() const override; |
101 bool isKeyboardFocusable() const override; | 109 bool isKeyboardFocusable() const override; |
102 void defaultEventHandler(Event*) final; | 110 void defaultEventHandler(Event*) final; |
103 void setActive(bool = true) final; | 111 void setActive(bool = true) final; |
104 void accessKeyAction(bool sendMouseEvents) final; | 112 void accessKeyAction(bool sendMouseEvents) final; |
105 bool isURLAttribute(const Attribute&) const final; | 113 bool isURLAttribute(const Attribute&) const final; |
106 bool hasLegalLinkAttribute(const QualifiedName&) const final; | 114 bool hasLegalLinkAttribute(const QualifiedName&) const final; |
107 bool canStartSelection() const final; | 115 bool canStartSelection() const final; |
108 short tabIndex() const final; | 116 short tabIndex() const final; |
109 bool draggable() const final; | 117 bool draggable() const final; |
110 bool isInteractiveContent() const final; | 118 bool isInteractiveContent() const final; |
111 InsertionNotificationRequest insertedInto(ContainerNode*) override; | 119 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
112 void handleClick(Event*); | 120 void handleClick(Event*); |
113 | 121 |
122 // DOMSettableTokenListObserver | |
123 void valueChanged() override; | |
124 | |
114 uint32_t m_linkRelations; | 125 uint32_t m_linkRelations; |
115 mutable LinkHash m_cachedVisitedLinkHash; | 126 mutable LinkHash m_cachedVisitedLinkHash; |
116 bool m_wasFocusedByMouse; | 127 bool m_wasFocusedByMouse; |
128 RefPtrWillBeMember<DOMSettableTokenList> m_ping; | |
117 }; | 129 }; |
118 | 130 |
119 inline LinkHash HTMLAnchorElement::visitedLinkHash() const | 131 inline LinkHash HTMLAnchorElement::visitedLinkHash() const |
120 { | 132 { |
121 if (!m_cachedVisitedLinkHash) | 133 if (!m_cachedVisitedLinkHash) |
122 m_cachedVisitedLinkHash = blink::visitedLinkHash(document().baseURL(), f astGetAttribute(HTMLNames::hrefAttr)); | 134 m_cachedVisitedLinkHash = blink::visitedLinkHash(document().baseURL(), f astGetAttribute(HTMLNames::hrefAttr)); |
123 return m_cachedVisitedLinkHash; | 135 return m_cachedVisitedLinkHash; |
124 } | 136 } |
125 | 137 |
126 // Functions shared with the other anchor elements (i.e., SVG). | 138 // Functions shared with the other anchor elements (i.e., SVG). |
127 | 139 |
128 bool isEnterKeyKeydownEvent(Event*); | 140 bool isEnterKeyKeydownEvent(Event*); |
129 bool isLinkClick(Event*); | 141 bool isLinkClick(Event*); |
130 | 142 |
131 } // namespace blink | 143 } // namespace blink |
132 | 144 |
133 #endif // HTMLAnchorElement_h | 145 #endif // HTMLAnchorElement_h |
OLD | NEW |