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

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

Issue 1500873002: Implement sequential focus navigation for OOPIF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup and test fix Created 5 years 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) 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 28 matching lines...) Expand all
39 struct FocusCandidate; 39 struct FocusCandidate;
40 struct FocusParams; 40 struct FocusParams;
41 class Document; 41 class Document;
42 class Element; 42 class Element;
43 class Frame; 43 class Frame;
44 class HTMLFrameOwnerElement; 44 class HTMLFrameOwnerElement;
45 class InputDeviceCapabilities; 45 class InputDeviceCapabilities;
46 class LocalFrame; 46 class LocalFrame;
47 class Node; 47 class Node;
48 class Page; 48 class Page;
49 class RemoteFrame;
49 50
50 class CORE_EXPORT FocusController final : public NoBaseWillBeGarbageCollectedFin alized<FocusController> { 51 class CORE_EXPORT FocusController final : public NoBaseWillBeGarbageCollectedFin alized<FocusController> {
51 WTF_MAKE_NONCOPYABLE(FocusController); USING_FAST_MALLOC_WILL_BE_REMOVED(Foc usController); 52 WTF_MAKE_NONCOPYABLE(FocusController); USING_FAST_MALLOC_WILL_BE_REMOVED(Foc usController);
52 public: 53 public:
53 static PassOwnPtrWillBeRawPtr<FocusController> create(Page*); 54 static PassOwnPtrWillBeRawPtr<FocusController> create(Page*);
54 55
55 void setFocusedFrame(PassRefPtrWillBeRawPtr<Frame>); 56 void setFocusedFrame(PassRefPtrWillBeRawPtr<Frame>);
56 void focusDocumentView(PassRefPtrWillBeRawPtr<Frame>); 57 void focusDocumentView(PassRefPtrWillBeRawPtr<Frame>);
57 LocalFrame* focusedFrame() const; 58 LocalFrame* focusedFrame() const;
58 Frame* focusedOrMainFrame() const; 59 Frame* focusedOrMainFrame() const;
59 60
60 // Finds the focused HTMLFrameOwnerElement, if any, in the provided frame. 61 // Finds the focused HTMLFrameOwnerElement, if any, in the provided frame.
61 // An HTMLFrameOwnerElement is considered focused if the frame it owns, or 62 // An HTMLFrameOwnerElement is considered focused if the frame it owns, or
62 // one of its descendant frames, is currently focused. 63 // one of its descendant frames, is currently focused.
63 HTMLFrameOwnerElement* focusedFrameOwnerElement(LocalFrame& currentFrame) co nst; 64 HTMLFrameOwnerElement* focusedFrameOwnerElement(LocalFrame& currentFrame) co nst;
64 65
65 // Determines whether the provided Document has focus according to 66 // Determines whether the provided Document has focus according to
66 // http://www.w3.org/TR/html5/editing.html#dom-document-hasfocus 67 // http://www.w3.org/TR/html5/editing.html#dom-document-hasfocus
67 bool isDocumentFocused(const Document&) const; 68 bool isDocumentFocused(const Document&) const;
68 69
69 bool setInitialFocus(WebFocusType); 70 bool setInitialFocus(WebFocusType);
70 bool advanceFocus(WebFocusType type, InputDeviceCapabilities* sourceCapabili ties = nullptr) { return advanceFocus(type, false, sourceCapabilities); } 71 bool advanceFocus(WebFocusType type, InputDeviceCapabilities* sourceCapabili ties = nullptr) { return advanceFocus(type, false, sourceCapabilities); }
72 bool advanceFocusAcrossFrames(WebFocusType, RemoteFrame* from, LocalFrame* t o, InputDeviceCapabilities* sourceCapabilities = nullptr);
71 Element* findFocusableElement(WebFocusType, Node&); 73 Element* findFocusableElement(WebFocusType, Node&);
72 74
73 bool setFocusedElement(Element*, PassRefPtrWillBeRawPtr<Frame>, const FocusP arams&); 75 bool setFocusedElement(Element*, PassRefPtrWillBeRawPtr<Frame>, const FocusP arams&);
74 // |setFocusedElement| variant with SelectionBehaviorOnFocus::None, 76 // |setFocusedElement| variant with SelectionBehaviorOnFocus::None,
75 // |WebFocusTypeNone, and null InputDeviceCapabilities. 77 // |WebFocusTypeNone, and null InputDeviceCapabilities.
76 bool setFocusedElement(Element*, PassRefPtrWillBeRawPtr<Frame>); 78 bool setFocusedElement(Element*, PassRefPtrWillBeRawPtr<Frame>);
77 79
78 void setActive(bool); 80 void setActive(bool);
79 bool isActive() const { return m_isActive; } 81 bool isActive() const { return m_isActive; }
80 82
81 void setFocused(bool); 83 void setFocused(bool);
82 bool isFocused() const { return m_isFocused; } 84 bool isFocused() const { return m_isFocused; }
83 85
84 DECLARE_TRACE(); 86 DECLARE_TRACE();
85 87
86 private: 88 private:
87 explicit FocusController(Page*); 89 explicit FocusController(Page*);
88 90
89 bool advanceFocus(WebFocusType, bool initialFocus, InputDeviceCapabilities* sourceCapabilities = nullptr); 91 bool advanceFocus(WebFocusType, bool initialFocus, InputDeviceCapabilities* sourceCapabilities = nullptr);
90 bool advanceFocusDirectionally(WebFocusType); 92 bool advanceFocusDirectionally(WebFocusType);
91 bool advanceFocusInDocumentOrder(WebFocusType, bool initialFocus, InputDevic eCapabilities* sourceCapabilities); 93 bool advanceFocusInDocumentOrder(LocalFrame*, Node* startingNode, WebFocusTy pe, bool initialFocus, InputDeviceCapabilities* sourceCapabilities);
92 94
93 bool advanceFocusDirectionallyInContainer(Node* container, const LayoutRect& startingRect, WebFocusType); 95 bool advanceFocusDirectionallyInContainer(Node* container, const LayoutRect& startingRect, WebFocusType);
94 void findFocusCandidateInContainer(Node& container, const LayoutRect& starti ngRect, WebFocusType, FocusCandidate& closest); 96 void findFocusCandidateInContainer(Node& container, const LayoutRect& starti ngRect, WebFocusType, FocusCandidate& closest);
95 97
96 RawPtrWillBeMember<Page> m_page; 98 RawPtrWillBeMember<Page> m_page;
97 RefPtrWillBeMember<Frame> m_focusedFrame; 99 RefPtrWillBeMember<Frame> m_focusedFrame;
98 bool m_isActive; 100 bool m_isActive;
99 bool m_isFocused; 101 bool m_isFocused;
100 bool m_isChangingFocusedFrame; 102 bool m_isChangingFocusedFrame;
101 }; 103 };
102 104
103 } // namespace blink 105 } // namespace blink
104 106
105 #endif // FocusController_h 107 #endif // FocusController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698