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

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 into subclasses. Created 6 years, 3 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Whether the node can actually be focused. 374 // Whether the node can actually be focused.
375 bool isFocusable() const; 375 bool isFocusable() const;
376 virtual bool isKeyboardFocusable() const; 376 virtual bool isKeyboardFocusable() const;
377 virtual bool isMouseFocusable() const; 377 virtual bool isMouseFocusable() const;
378 virtual void willCallDefaultEventHandler(const Event&) OVERRIDE FINAL;
378 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType); 379 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType);
379 virtual void dispatchBlurEvent(Element* newFocusedElement); 380 virtual void dispatchBlurEvent(Element* newFocusedElement);
380 void dispatchFocusInEvent(const AtomicString& eventType, Element* oldFocused Element); 381 void dispatchFocusInEvent(const AtomicString& eventType, Element* oldFocused Element);
381 void dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocuse dElement); 382 void dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocuse dElement);
382 383
383 String innerText(); 384 String innerText();
384 String outerText(); 385 String outerText();
385 String innerHTML() const; 386 String innerHTML() const;
386 String outerHTML() const; 387 String outerHTML() const;
387 void setInnerHTML(const String&, ExceptionState&); 388 void setInnerHTML(const String&, ExceptionState&);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 524
524 void clearTabIndexExplicitlyIfNeeded(); 525 void clearTabIndexExplicitlyIfNeeded();
525 void setTabIndexExplicitly(short); 526 void setTabIndexExplicitly(short);
526 // Subclasses may override this method to affect focusability. Unlike 527 // Subclasses may override this method to affect focusability. Unlike
527 // supportsFocus, this method must be called on an up-to-date layout, so it 528 // supportsFocus, this method must be called on an up-to-date layout, so it
528 // may use the renderer to reason about focusability. This method cannot be 529 // may use the renderer to reason about focusability. This method cannot be
529 // moved to RenderObject because some focusable nodes don't have renderers, 530 // moved to RenderObject because some focusable nodes don't have renderers,
530 // e.g., HTMLOptionElement. 531 // e.g., HTMLOptionElement.
531 virtual bool rendererIsFocusable() const; 532 virtual bool rendererIsFocusable() const;
532 533
534 // These methods are overridden by subclasses whose default focus appearance should not remain hidden on mouse focus.
535 virtual bool wasFocusedByMouse() const { return false; }
536 virtual void setWasFocusedByMouse(bool) { }
537
533 // classAttributeChanged() exists to share code between 538 // classAttributeChanged() exists to share code between
534 // parseAttribute (called via setAttribute()) and 539 // parseAttribute (called via setAttribute()) and
535 // svgAttributeChanged (called when element.className.baseValue is set) 540 // svgAttributeChanged (called when element.className.baseValue is set)
536 void classAttributeChanged(const AtomicString& newClassString); 541 void classAttributeChanged(const AtomicString& newClassString);
537 542
538 PassRefPtr<RenderStyle> originalStyleForRenderer(); 543 PassRefPtr<RenderStyle> originalStyleForRenderer();
539 544
540 Node* insertAdjacent(const String& where, Node* newChild, ExceptionState&); 545 Node* insertAdjacent(const String& where, Node* newChild, ExceptionState&);
541 546
542 private: 547 private:
(...skipping 308 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