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

Side by Side Diff: Source/core/page/FocusController.h

Issue 1177373002: Change API name and return type of findFocusableNode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: *recursively Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/input/EventHandler.cpp ('k') | Source/core/page/FocusController.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) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 public: 51 public:
52 static PassOwnPtrWillBeRawPtr<FocusController> create(Page*); 52 static PassOwnPtrWillBeRawPtr<FocusController> create(Page*);
53 53
54 void setFocusedFrame(PassRefPtrWillBeRawPtr<Frame>); 54 void setFocusedFrame(PassRefPtrWillBeRawPtr<Frame>);
55 void focusDocumentView(PassRefPtrWillBeRawPtr<Frame>); 55 void focusDocumentView(PassRefPtrWillBeRawPtr<Frame>);
56 Frame* focusedFrame() const { return m_focusedFrame.get(); } 56 Frame* focusedFrame() const { return m_focusedFrame.get(); }
57 Frame* focusedOrMainFrame() const; 57 Frame* focusedOrMainFrame() const;
58 58
59 bool setInitialFocus(WebFocusType); 59 bool setInitialFocus(WebFocusType);
60 bool advanceFocus(WebFocusType type) { return advanceFocus(type, false); } 60 bool advanceFocus(WebFocusType type) { return advanceFocus(type, false); }
61 Node* findFocusableNode(WebFocusType, Node&); 61 Element* findFocusableElement(WebFocusType, Node&);
62 62
63 bool setFocusedElement(Element*, PassRefPtrWillBeRawPtr<Frame>, WebFocusType = WebFocusTypeNone); 63 bool setFocusedElement(Element*, PassRefPtrWillBeRawPtr<Frame>, WebFocusType = WebFocusTypeNone);
64 64
65 void setActive(bool); 65 void setActive(bool);
66 bool isActive() const { return m_isActive; } 66 bool isActive() const { return m_isActive; }
67 67
68 void setFocused(bool); 68 void setFocused(bool);
69 bool isFocused() const { return m_isFocused; } 69 bool isFocused() const { return m_isFocused; }
70 70
71 DECLARE_TRACE(); 71 DECLARE_TRACE();
72 72
73 private: 73 private:
74 explicit FocusController(Page*); 74 explicit FocusController(Page*);
75 75
76 bool advanceFocus(WebFocusType, bool initialFocus); 76 bool advanceFocus(WebFocusType, bool initialFocus);
77 bool advanceFocusDirectionally(WebFocusType); 77 bool advanceFocusDirectionally(WebFocusType);
78 bool advanceFocusInDocumentOrder(WebFocusType, bool initialFocus); 78 bool advanceFocusInDocumentOrder(WebFocusType, bool initialFocus);
79 79
80 Node* findFocusableNodeAcrossFocusScopes(WebFocusType, const FocusNavigation Scope&, Node*); 80 Node* findFocusableNodeAcrossFocusScopes(WebFocusType, const FocusNavigation Scope&, Node*);
81 Node* findFocusableNodeAcrossFocusScopesForward(const FocusNavigationScope&, Node*); 81 Node* findFocusableNodeAcrossFocusScopesForward(const FocusNavigationScope&, Node*);
82 Node* findFocusableNodeAcrossFocusScopesBackward(const FocusNavigationScope& , Node*); 82 Node* findFocusableNodeAcrossFocusScopesBackward(const FocusNavigationScope& , Node*);
83 83
84 Node* findFocusableNodeRecursively(WebFocusType, const FocusNavigationScope& , Node*); 84 Element* findFocusableElementRecursively(WebFocusType, const FocusNavigation Scope&, Node*);
85 Node* findFocusableNodeRecursivelyForward(const FocusNavigationScope&, Node* ); 85 Element* findFocusableElementRecursivelyForward(const FocusNavigationScope&, Node*);
86 Node* findFocusableNodeRecursivelyBackward(const FocusNavigationScope&, Node *); 86 Element* findFocusableElementRecursivelyBackward(const FocusNavigationScope& , Node*);
87 87
88 Node* findFocusableNodeDecendingDownIntoFrameDocument(WebFocusType, Node*); 88 Node* findFocusableNodeDecendingDownIntoFrameDocument(WebFocusType, Node*);
89 89
90 // Searches through the given tree scope, starting from start node, for the next/previous 90 // Searches through the given tree scope, starting from start node, for the next/previous
91 // selectable element that comes after/before start node. 91 // selectable element that comes after/before start node.
92 // The order followed is as specified in the HTML spec[1], which is elements with tab indexes 92 // The order followed is as specified in the HTML spec[1], which is elements with tab indexes
93 // first (from lowest to highest), and then elements without tab indexes (in document order). 93 // first (from lowest to highest), and then elements without tab indexes (in document order).
94 // The search algorithm also conforms the Shadow DOM spec[2], which inserts sequence in a shadow 94 // The search algorithm also conforms the Shadow DOM spec[2], which inserts sequence in a shadow
95 // tree into its host. 95 // tree into its host.
96 // 96 //
97 // @param start The node from which to start searching. The node after this will be focused. 97 // @param start The node from which to start searching. The node after this will be focused.
98 // May be null. 98 // May be null.
99 // @return The focus node that comes after/before start node. 99 // @return The focus node that comes after/before start node.
100 // 100 //
101 // [1] https://html.spec.whatwg.org/multipage/interaction.html#sequential-fo cus-navigation 101 // [1] https://html.spec.whatwg.org/multipage/interaction.html#sequential-fo cus-navigation
102 // [2] https://w3c.github.io/webcomponents/spec/shadow/#focus-navigation 102 // [2] https://w3c.github.io/webcomponents/spec/shadow/#focus-navigation
103 inline Node* findFocusableNode(WebFocusType, const FocusNavigationScope&, No de* start); 103 inline Element* findFocusableElement(WebFocusType, const FocusNavigationScop e&, Node* start);
104 104
105 bool advanceFocusDirectionallyInContainer(Node* container, const LayoutRect& startingRect, WebFocusType); 105 bool advanceFocusDirectionallyInContainer(Node* container, const LayoutRect& startingRect, WebFocusType);
106 void findFocusCandidateInContainer(Node& container, const LayoutRect& starti ngRect, WebFocusType, FocusCandidate& closest); 106 void findFocusCandidateInContainer(Node& container, const LayoutRect& starti ngRect, WebFocusType, FocusCandidate& closest);
107 107
108 RawPtrWillBeMember<Page> m_page; 108 RawPtrWillBeMember<Page> m_page;
109 RefPtrWillBeMember<Frame> m_focusedFrame; 109 RefPtrWillBeMember<Frame> m_focusedFrame;
110 bool m_isActive; 110 bool m_isActive;
111 bool m_isFocused; 111 bool m_isFocused;
112 bool m_isChangingFocusedFrame; 112 bool m_isChangingFocusedFrame;
113 }; 113 };
114 114
115 } // namespace blink 115 } // namespace blink
116 116
117 #endif // FocusController_h 117 #endif // FocusController_h
OLDNEW
« no previous file with comments | « Source/core/input/EventHandler.cpp ('k') | Source/core/page/FocusController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698