Chromium Code Reviews| 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 class CORE_EXPORT HTMLAnchorElement : public HTMLElement, public DOMURLUtils, pu blic DOMSettableTokenListObserver { |
|
tkent
2015/07/14 00:29:44
should be |private DOMSettableTokenListObserver| b
| |
| 60 DEFINE_WRAPPERTYPEINFO(); | 61 DEFINE_WRAPPERTYPEINFO(); |
| 61 public: | 62 public: |
| 63 DECLARE_VIRTUAL_TRACE(); | |
| 62 static PassRefPtrWillBeRawPtr<HTMLAnchorElement> create(Document&); | 64 static PassRefPtrWillBeRawPtr<HTMLAnchorElement> create(Document&); |
| 63 | 65 |
| 64 ~HTMLAnchorElement() override; | 66 ~HTMLAnchorElement() override; |
| 65 | 67 |
| 66 KURL href() const; | 68 KURL href() const; |
| 67 void setHref(const AtomicString&); | 69 void setHref(const AtomicString&); |
| 68 | 70 |
| 69 const AtomicString& name() const; | 71 const AtomicString& name() const; |
| 70 | 72 |
| 71 KURL url() const final; | 73 KURL url() const final; |
| 72 void setURL(const KURL&) final; | 74 void setURL(const KURL&) final; |
| 73 | 75 |
| 74 String input() const final; | 76 String input() const final; |
| 75 void setInput(const String&) final; | 77 void setInput(const String&) final; |
| 76 | 78 |
| 77 bool isLiveLink() const final; | 79 bool isLiveLink() const final; |
| 78 | 80 |
| 79 bool willRespondToMouseClickEvents() final; | 81 bool willRespondToMouseClickEvents() final; |
| 80 | 82 |
| 81 bool hasRel(uint32_t relation) const; | 83 bool hasRel(uint32_t relation) const; |
| 82 void setRel(const AtomicString&); | 84 void setRel(const AtomicString&); |
| 83 | 85 |
| 84 LinkHash visitedLinkHash() const; | 86 LinkHash visitedLinkHash() const; |
| 85 void invalidateCachedVisitedLinkHash() { m_cachedVisitedLinkHash = 0; } | 87 void invalidateCachedVisitedLinkHash() { m_cachedVisitedLinkHash = 0; } |
| 86 | 88 |
| 87 void sendPings(const KURL& destinationURL) const; | 89 void sendPings(const KURL& destinationURL) const; |
| 88 | 90 |
| 91 DOMSettableTokenList* ping() const; | |
| 92 | |
| 89 protected: | 93 protected: |
| 90 HTMLAnchorElement(const QualifiedName&, Document&); | 94 HTMLAnchorElement(const QualifiedName&, Document&); |
| 91 | 95 |
| 92 void attributeWillChange(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue) override; | 96 void attributeWillChange(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue) override; |
| 93 void parseAttribute(const QualifiedName&, const AtomicString&) override; | 97 void parseAttribute(const QualifiedName&, const AtomicString&) override; |
| 94 bool supportsFocus() const override; | 98 bool supportsFocus() const override; |
| 95 | 99 |
| 96 private: | 100 private: |
| 97 bool shouldHaveFocusAppearance() const final; | 101 bool shouldHaveFocusAppearance() const final; |
| 98 void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType) override; | 102 void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType) override; |
| 99 void dispatchBlurEvent(Element* newFocusedElement, WebFocusType) override; | 103 void dispatchBlurEvent(Element* newFocusedElement, WebFocusType) override; |
| 100 bool isMouseFocusable() const override; | 104 bool isMouseFocusable() const override; |
| 101 bool isKeyboardFocusable() const override; | 105 bool isKeyboardFocusable() const override; |
| 102 void defaultEventHandler(Event*) final; | 106 void defaultEventHandler(Event*) final; |
| 103 void setActive(bool = true) final; | 107 void setActive(bool = true) final; |
| 104 void accessKeyAction(bool sendMouseEvents) final; | 108 void accessKeyAction(bool sendMouseEvents) final; |
| 105 bool isURLAttribute(const Attribute&) const final; | 109 bool isURLAttribute(const Attribute&) const final; |
| 106 bool hasLegalLinkAttribute(const QualifiedName&) const final; | 110 bool hasLegalLinkAttribute(const QualifiedName&) const final; |
| 107 bool canStartSelection() const final; | 111 bool canStartSelection() const final; |
| 108 short tabIndex() const final; | 112 short tabIndex() const final; |
| 109 bool draggable() const final; | 113 bool draggable() const final; |
| 110 bool isInteractiveContent() const final; | 114 bool isInteractiveContent() const final; |
| 111 InsertionNotificationRequest insertedInto(ContainerNode*) override; | 115 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
| 112 void handleClick(Event*); | 116 void handleClick(Event*); |
| 113 | 117 |
| 118 // DOMSettableTokenListObserver | |
| 119 virtual void valueChanged() override; | |
|
tkent
2015/07/14 00:29:44
|virtual| is not necessary.
| |
| 120 | |
| 114 uint32_t m_linkRelations; | 121 uint32_t m_linkRelations; |
| 115 mutable LinkHash m_cachedVisitedLinkHash; | 122 mutable LinkHash m_cachedVisitedLinkHash; |
| 116 bool m_wasFocusedByMouse; | 123 bool m_wasFocusedByMouse; |
| 124 RefPtrWillBeMember<DOMSettableTokenList> m_ping; | |
| 117 }; | 125 }; |
| 118 | 126 |
| 119 inline LinkHash HTMLAnchorElement::visitedLinkHash() const | 127 inline LinkHash HTMLAnchorElement::visitedLinkHash() const |
| 120 { | 128 { |
| 121 if (!m_cachedVisitedLinkHash) | 129 if (!m_cachedVisitedLinkHash) |
| 122 m_cachedVisitedLinkHash = blink::visitedLinkHash(document().baseURL(), f astGetAttribute(HTMLNames::hrefAttr)); | 130 m_cachedVisitedLinkHash = blink::visitedLinkHash(document().baseURL(), f astGetAttribute(HTMLNames::hrefAttr)); |
| 123 return m_cachedVisitedLinkHash; | 131 return m_cachedVisitedLinkHash; |
| 124 } | 132 } |
| 125 | 133 |
| 126 // Functions shared with the other anchor elements (i.e., SVG). | 134 // Functions shared with the other anchor elements (i.e., SVG). |
| 127 | 135 |
| 128 bool isEnterKeyKeydownEvent(Event*); | 136 bool isEnterKeyKeydownEvent(Event*); |
| 129 bool isLinkClick(Event*); | 137 bool isLinkClick(Event*); |
| 130 | 138 |
| 131 } // namespace blink | 139 } // namespace blink |
| 132 | 140 |
| 133 #endif // HTMLAnchorElement_h | 141 #endif // HTMLAnchorElement_h |
| OLD | NEW |