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" | |
30 #include "core/dom/DOMURLUtils.h" | 29 #include "core/dom/DOMURLUtils.h" |
31 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
32 #include "core/html/HTMLElement.h" | 31 #include "core/html/HTMLElement.h" |
33 #include "platform/LinkHash.h" | 32 #include "platform/LinkHash.h" |
34 | 33 |
35 namespace blink { | 34 namespace blink { |
36 | 35 |
37 // Link relation bitmask values. | 36 // Link relation bitmask values. |
38 // FIXME: Uncomment as the various link relations are implemented. | 37 // FIXME: Uncomment as the various link relations are implemented. |
39 enum { | 38 enum { |
(...skipping 10 matching lines...) Expand all Loading... |
50 // RelationNext = 0x00000400, | 49 // RelationNext = 0x00000400, |
51 // RelationNoFolow = 0x00000800, | 50 // RelationNoFolow = 0x00000800, |
52 RelationNoReferrer = 0x00001000, | 51 RelationNoReferrer = 0x00001000, |
53 // RelationPrev = 0x00002000, | 52 // RelationPrev = 0x00002000, |
54 // RelationSearch = 0x00004000, | 53 // RelationSearch = 0x00004000, |
55 // RelationSidebar = 0x00008000, | 54 // RelationSidebar = 0x00008000, |
56 // RelationTag = 0x00010000, | 55 // RelationTag = 0x00010000, |
57 // RelationUp = 0x00020000, | 56 // RelationUp = 0x00020000, |
58 }; | 57 }; |
59 | 58 |
60 class CORE_EXPORT HTMLAnchorElement : public HTMLElement, public DOMURLUtils, pu
blic DOMSettableTokenListObserver { | 59 class CORE_EXPORT HTMLAnchorElement : public HTMLElement, public DOMURLUtils { |
61 DEFINE_WRAPPERTYPEINFO(); | 60 DEFINE_WRAPPERTYPEINFO(); |
62 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLAnchorElement); | |
63 public: | 61 public: |
64 static PassRefPtrWillBeRawPtr<HTMLAnchorElement> create(Document&); | 62 static PassRefPtrWillBeRawPtr<HTMLAnchorElement> create(Document&); |
65 | 63 |
66 ~HTMLAnchorElement() override; | 64 ~HTMLAnchorElement() override; |
67 | 65 |
68 KURL href() const; | 66 KURL href() const; |
69 void setHref(const AtomicString&); | 67 void setHref(const AtomicString&); |
70 | 68 |
71 const AtomicString& name() const; | 69 const AtomicString& name() const; |
72 | 70 |
73 KURL url() const final; | 71 KURL url() const final; |
74 void setURL(const KURL&) final; | 72 void setURL(const KURL&) final; |
75 | 73 |
76 String input() const final; | 74 String input() const final; |
77 void setInput(const String&) final; | 75 void setInput(const String&) final; |
78 | 76 |
79 bool isLiveLink() const final; | 77 bool isLiveLink() const final; |
80 | 78 |
81 bool willRespondToMouseClickEvents() final; | 79 bool willRespondToMouseClickEvents() final; |
82 | 80 |
83 bool hasRel(uint32_t relation) const; | 81 bool hasRel(uint32_t relation) const; |
84 void setRel(const AtomicString&); | 82 void setRel(const AtomicString&); |
85 | 83 |
86 LinkHash visitedLinkHash() const; | 84 LinkHash visitedLinkHash() const; |
87 void invalidateCachedVisitedLinkHash() { m_cachedVisitedLinkHash = 0; } | 85 void invalidateCachedVisitedLinkHash() { m_cachedVisitedLinkHash = 0; } |
88 | 86 |
89 void sendPings(const KURL& destinationURL) const; | 87 void sendPings(const KURL& destinationURL) const; |
90 | 88 |
91 DOMSettableTokenList* ping(); | |
92 | |
93 DECLARE_VIRTUAL_TRACE(); | |
94 | |
95 protected: | 89 protected: |
96 HTMLAnchorElement(const QualifiedName&, Document&); | 90 HTMLAnchorElement(const QualifiedName&, Document&); |
97 | 91 |
98 void attributeWillChange(const QualifiedName&, const AtomicString& oldValue,
const AtomicString& newValue) override; | 92 void attributeWillChange(const QualifiedName&, const AtomicString& oldValue,
const AtomicString& newValue) override; |
99 void parseAttribute(const QualifiedName&, const AtomicString&) override; | 93 void parseAttribute(const QualifiedName&, const AtomicString&) override; |
100 bool supportsFocus() const override; | 94 bool supportsFocus() const override; |
101 | 95 |
102 private: | 96 private: |
103 bool shouldHaveFocusAppearance() const final; | 97 bool shouldHaveFocusAppearance() const final; |
104 void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, InputDevic
eCapabilities* sourceCapabilities) override; | 98 void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, InputDevic
eCapabilities* sourceCapabilities) override; |
105 void dispatchBlurEvent(Element* newFocusedElement, WebFocusType, InputDevice
Capabilities* sourceCapabilities) override; | 99 void dispatchBlurEvent(Element* newFocusedElement, WebFocusType, InputDevice
Capabilities* sourceCapabilities) override; |
106 bool isMouseFocusable() const override; | 100 bool isMouseFocusable() const override; |
107 bool isKeyboardFocusable() const override; | 101 bool isKeyboardFocusable() const override; |
108 void defaultEventHandler(Event*) final; | 102 void defaultEventHandler(Event*) final; |
109 void setActive(bool = true) final; | 103 void setActive(bool = true) final; |
110 void accessKeyAction(bool sendMouseEvents) final; | 104 void accessKeyAction(bool sendMouseEvents) final; |
111 bool isURLAttribute(const Attribute&) const final; | 105 bool isURLAttribute(const Attribute&) const final; |
112 bool hasLegalLinkAttribute(const QualifiedName&) const final; | 106 bool hasLegalLinkAttribute(const QualifiedName&) const final; |
113 bool canStartSelection() const final; | 107 bool canStartSelection() const final; |
114 short tabIndex() const final; | 108 short tabIndex() const final; |
115 bool draggable() const final; | 109 bool draggable() const final; |
116 bool isInteractiveContent() const final; | 110 bool isInteractiveContent() const final; |
117 InsertionNotificationRequest insertedInto(ContainerNode*) override; | 111 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
118 void handleClick(Event*); | 112 void handleClick(Event*); |
119 | 113 |
120 // DOMSettableTokenListObserver | |
121 void valueChanged() override; | |
122 | |
123 uint32_t m_linkRelations; | 114 uint32_t m_linkRelations; |
124 mutable LinkHash m_cachedVisitedLinkHash; | 115 mutable LinkHash m_cachedVisitedLinkHash; |
125 bool m_wasFocusedByMouse; | 116 bool m_wasFocusedByMouse; |
126 RefPtrWillBeMember<DOMSettableTokenList> m_ping; | |
127 }; | 117 }; |
128 | 118 |
129 inline LinkHash HTMLAnchorElement::visitedLinkHash() const | 119 inline LinkHash HTMLAnchorElement::visitedLinkHash() const |
130 { | 120 { |
131 if (!m_cachedVisitedLinkHash) | 121 if (!m_cachedVisitedLinkHash) |
132 m_cachedVisitedLinkHash = blink::visitedLinkHash(document().baseURL(), f
astGetAttribute(HTMLNames::hrefAttr)); | 122 m_cachedVisitedLinkHash = blink::visitedLinkHash(document().baseURL(), f
astGetAttribute(HTMLNames::hrefAttr)); |
133 return m_cachedVisitedLinkHash; | 123 return m_cachedVisitedLinkHash; |
134 } | 124 } |
135 | 125 |
136 // Functions shared with the other anchor elements (i.e., SVG). | 126 // Functions shared with the other anchor elements (i.e., SVG). |
137 | 127 |
138 bool isEnterKeyKeydownEvent(Event*); | 128 bool isEnterKeyKeydownEvent(Event*); |
139 bool isLinkClick(Event*); | 129 bool isLinkClick(Event*); |
140 | 130 |
141 } // namespace blink | 131 } // namespace blink |
142 | 132 |
143 #endif // HTMLAnchorElement_h | 133 #endif // HTMLAnchorElement_h |
OLD | NEW |