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

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: from scratch: put focus logic in Element 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
« no previous file with comments | « LayoutTests/fast/events/resources/focus-anchor-by-mouse.js ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 virtual Image* imageContents() { return 0; } 364 virtual Image* imageContents() { return 0; }
365 365
366 virtual void focus(bool restorePreviousSelection = true, FocusType = FocusTy peNone); 366 virtual void focus(bool restorePreviousSelection = true, FocusType = FocusTy peNone);
367 virtual void updateFocusAppearance(bool restorePreviousSelection); 367 virtual void updateFocusAppearance(bool restorePreviousSelection);
368 virtual void blur(); 368 virtual void blur();
369 // Whether this element can receive focus at all. Most elements are not 369 // 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 370 // 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 371 // rendererIsFocusable(), this method may be called when layout is not up to
372 // date, so it must not use the renderer to determine focusability. 372 // date, so it must not use the renderer to determine focusability.
373 virtual bool supportsFocus() const; 373 virtual bool supportsFocus() const;
374 virtual bool shouldShowFocusRingOnMouseFocus() const { return true; };
375 virtual bool shouldHaveFocusAppearance() const OVERRIDE FINAL;
374 // Whether the node can actually be focused. 376 // Whether the node can actually be focused.
375 bool isFocusable() const; 377 bool isFocusable() const;
376 virtual bool isKeyboardFocusable() const; 378 virtual bool isKeyboardFocusable() const;
377 virtual bool isMouseFocusable() const; 379 virtual bool isMouseFocusable() const;
380 virtual void willCallDefaultEventHandler(const Event&) OVERRIDE FINAL;
378 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType); 381 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType);
379 virtual void dispatchBlurEvent(Element* newFocusedElement); 382 virtual void dispatchBlurEvent(Element* newFocusedElement);
380 void dispatchFocusInEvent(const AtomicString& eventType, Element* oldFocused Element); 383 void dispatchFocusInEvent(const AtomicString& eventType, Element* oldFocused Element);
381 void dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocuse dElement); 384 void dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocuse dElement);
382 385
383 String innerText(); 386 String innerText();
384 String outerText(); 387 String outerText();
385 String innerHTML() const; 388 String innerHTML() const;
386 String outerHTML() const; 389 String outerHTML() const;
387 void setInnerHTML(const String&, ExceptionState&); 390 void setInnerHTML(const String&, ExceptionState&);
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 ElementRareData& ensureElementRareData(); 633 ElementRareData& ensureElementRareData();
631 634
632 WillBeHeapVector<RefPtrWillBeMember<Attr> >& ensureAttrNodeList(); 635 WillBeHeapVector<RefPtrWillBeMember<Attr> >& ensureAttrNodeList();
633 void removeAttrNodeList(); 636 void removeAttrNodeList();
634 void detachAllAttrNodesFromElement(); 637 void detachAllAttrNodesFromElement();
635 void detachAttrNodeFromElementWithValue(Attr*, const AtomicString& value); 638 void detachAttrNodeFromElementWithValue(Attr*, const AtomicString& value);
636 void detachAttrNodeAtIndex(Attr*, size_t index); 639 void detachAttrNodeAtIndex(Attr*, size_t index);
637 640
638 bool isJavaScriptURLAttribute(const Attribute&) const; 641 bool isJavaScriptURLAttribute(const Attribute&) const;
639 642
643 bool m_wasFocusedByMouse;
pdr. 2014/08/25 17:46:18 Should this be put in m_elementData instead?
robwu 2014/08/25 22:40:03 Probably yes. I found it a bit odd that there were
644
640 RefPtrWillBeMember<ElementData> m_elementData; 645 RefPtrWillBeMember<ElementData> m_elementData;
641 }; 646 };
642 647
643 DEFINE_NODE_TYPE_CASTS(Element, isElementNode()); 648 DEFINE_NODE_TYPE_CASTS(Element, isElementNode());
644 template <typename T> bool isElementOfType(const Node&); 649 template <typename T> bool isElementOfType(const Node&);
645 template <> inline bool isElementOfType<const Element>(const Node& node) { retur n node.isElementNode(); } 650 template <> inline bool isElementOfType<const Element>(const Node& node) { retur n node.isElementNode(); }
646 template <typename T> inline bool isElementOfType(const Element& element) { retu rn isElementOfType<T>(static_cast<const Node&>(element)); } 651 template <typename T> inline bool isElementOfType(const Element& element) { retu rn isElementOfType<T>(static_cast<const Node&>(element)); }
647 template <> inline bool isElementOfType<const Element>(const Element&) { return true; } 652 template <> inline bool isElementOfType<const Element>(const Element&) { return true; }
648 653
649 // Type casting. 654 // Type casting.
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) 856 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&)
852 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ 857 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \
853 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \ 858 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \
854 { \ 859 { \
855 return adoptRefWillBeNoop(new T(tagName, document)); \ 860 return adoptRefWillBeNoop(new T(tagName, document)); \
856 } 861 }
857 862
858 } // namespace 863 } // namespace
859 864
860 #endif 865 #endif
OLDNEW
« no previous file with comments | « LayoutTests/fast/events/resources/focus-anchor-by-mouse.js ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698