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

Side by Side Diff: Source/core/dom/Element.h

Issue 455223002: Make anchors mouse-focusable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move m_wasFocusedByMouse to elementData().m_shouldHideFocusRingOnMouseFocus Created 6 years, 4 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) 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) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved. 6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 const QualifiedName& tagQName() const { return m_tagName; } 228 const QualifiedName& tagQName() const { return m_tagName; }
229 String tagName() const { return nodeName(); } 229 String tagName() const { return nodeName(); }
230 230
231 bool hasTagName(const QualifiedName& tagName) const { return m_tagName.match es(tagName); } 231 bool hasTagName(const QualifiedName& tagName) const { return m_tagName.match es(tagName); }
232 bool hasTagName(const HTMLQualifiedName& tagName) const { return ContainerNo de::hasTagName(tagName); } 232 bool hasTagName(const HTMLQualifiedName& tagName) const { return ContainerNo de::hasTagName(tagName); }
233 bool hasTagName(const SVGQualifiedName& tagName) const { return ContainerNod e::hasTagName(tagName); } 233 bool hasTagName(const SVGQualifiedName& tagName) const { return ContainerNod e::hasTagName(tagName); }
234 234
235 // Should be called only by Document::createElementNS to fix up m_tagName im mediately after construction. 235 // Should be called only by Document::createElementNS to fix up m_tagName im mediately after construction.
236 void setTagNameForCreateElementNS(const QualifiedName&); 236 void setTagNameForCreateElementNS(const QualifiedName&);
237 237
238 bool shouldHideFocusRingOnMouseFocus() const;
239
238 // A fast function for checking the local name against another atomic string . 240 // A fast function for checking the local name against another atomic string .
239 bool hasLocalName(const AtomicString& other) const { return m_tagName.localN ame() == other; } 241 bool hasLocalName(const AtomicString& other) const { return m_tagName.localN ame() == other; }
240 242
241 virtual const AtomicString& localName() const OVERRIDE FINAL { return m_tagN ame.localName(); } 243 virtual const AtomicString& localName() const OVERRIDE FINAL { return m_tagN ame.localName(); }
242 const AtomicString& prefix() const { return m_tagName.prefix(); } 244 const AtomicString& prefix() const { return m_tagName.prefix(); }
243 virtual const AtomicString& namespaceURI() const OVERRIDE FINAL { return m_t agName.namespaceURI(); } 245 virtual const AtomicString& namespaceURI() const OVERRIDE FINAL { return m_t agName.namespaceURI(); }
244 246
245 const AtomicString& locateNamespacePrefix(const AtomicString& namespaceURI) const; 247 const AtomicString& locateNamespacePrefix(const AtomicString& namespaceURI) const;
246 248
247 virtual KURL baseURI() const OVERRIDE FINAL; 249 virtual KURL baseURI() const OVERRIDE FINAL;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 virtual Image* imageContents() { return 0; } 366 virtual Image* imageContents() { return 0; }
365 367
366 virtual void focus(bool restorePreviousSelection = true, FocusType = FocusTy peNone); 368 virtual void focus(bool restorePreviousSelection = true, FocusType = FocusTy peNone);
367 virtual void updateFocusAppearance(bool restorePreviousSelection); 369 virtual void updateFocusAppearance(bool restorePreviousSelection);
368 virtual void blur(); 370 virtual void blur();
369 // Whether this element can receive focus at all. Most elements are not 371 // Whether this element can receive focus at all. Most elements are not
370 // focusable but some elements, such as form controls and links, are. Unlike 372 // focusable but some elements, such as form controls and links, are. Unlike
371 // rendererIsFocusable(), this method may be called when layout is not up to 373 // rendererIsFocusable(), this method may be called when layout is not up to
372 // date, so it must not use the renderer to determine focusability. 374 // date, so it must not use the renderer to determine focusability.
373 virtual bool supportsFocus() const; 375 virtual bool supportsFocus() const;
376 virtual bool shouldShowFocusRingOnMouseFocus() const { return true; };
377 virtual bool shouldHaveFocusAppearance() const OVERRIDE FINAL;
374 // Whether the node can actually be focused. 378 // Whether the node can actually be focused.
375 bool isFocusable() const; 379 bool isFocusable() const;
376 virtual bool isKeyboardFocusable() const; 380 virtual bool isKeyboardFocusable() const;
377 virtual bool isMouseFocusable() const; 381 virtual bool isMouseFocusable() const;
382 virtual void willCallDefaultEventHandler(const Event&) OVERRIDE FINAL;
378 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType); 383 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType);
379 virtual void dispatchBlurEvent(Element* newFocusedElement); 384 virtual void dispatchBlurEvent(Element* newFocusedElement);
380 void dispatchFocusInEvent(const AtomicString& eventType, Element* oldFocused Element); 385 void dispatchFocusInEvent(const AtomicString& eventType, Element* oldFocused Element);
381 void dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocuse dElement); 386 void dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocuse dElement);
382 387
383 String innerText(); 388 String innerText();
384 String outerText(); 389 String outerText();
385 String innerHTML() const; 390 String innerHTML() const;
386 String outerHTML() const; 391 String outerHTML() const;
387 void setInnerHTML(const String&, ExceptionState&); 392 void setInnerHTML(const String&, ExceptionState&);
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 } 825 }
821 826
822 inline void Element::setTagNameForCreateElementNS(const QualifiedName& tagName) 827 inline void Element::setTagNameForCreateElementNS(const QualifiedName& tagName)
823 { 828 {
824 // We expect this method to be called only to reset the prefix. 829 // We expect this method to be called only to reset the prefix.
825 ASSERT(tagName.localName() == m_tagName.localName()); 830 ASSERT(tagName.localName() == m_tagName.localName());
826 ASSERT(tagName.namespaceURI() == m_tagName.namespaceURI()); 831 ASSERT(tagName.namespaceURI() == m_tagName.namespaceURI());
827 m_tagName = tagName; 832 m_tagName = tagName;
828 } 833 }
829 834
835 inline bool Element::shouldHideFocusRingOnMouseFocus() const
836 {
837 return elementData() && elementData()->m_shouldHideFocusRingOnMouseFocus;
838 }
839
830 inline bool isShadowHost(const Node* node) 840 inline bool isShadowHost(const Node* node)
831 { 841 {
832 return node && node->isElementNode() && toElement(node)->shadow(); 842 return node && node->isElementNode() && toElement(node)->shadow();
833 } 843 }
834 844
835 inline bool isShadowHost(const Element* element) 845 inline bool isShadowHost(const Element* element)
836 { 846 {
837 return element && element->shadow(); 847 return element && element->shadow();
838 } 848 }
839 849
(...skipping 11 matching lines...) Expand all
851 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) 861 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&)
852 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ 862 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \
853 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \ 863 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \
854 { \ 864 { \
855 return adoptRefWillBeNoop(new T(tagName, document)); \ 865 return adoptRefWillBeNoop(new T(tagName, document)); \
856 } 866 }
857 867
858 } // namespace 868 } // namespace
859 869
860 #endif 870 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698