| OLD | NEW |
| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 static FocusNavigationScope ownedByNonFocusableFocusScopeOwner(Node*); | 56 static FocusNavigationScope ownedByNonFocusableFocusScopeOwner(Node*); |
| 57 static FocusNavigationScope ownedByShadowHost(Node*); | 57 static FocusNavigationScope ownedByShadowHost(Node*); |
| 58 static FocusNavigationScope ownedByShadowInsertionPoint(HTMLShadowElement*); | 58 static FocusNavigationScope ownedByShadowInsertionPoint(HTMLShadowElement*); |
| 59 static FocusNavigationScope ownedByIFrame(HTMLFrameOwnerElement*); | 59 static FocusNavigationScope ownedByIFrame(HTMLFrameOwnerElement*); |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 explicit FocusNavigationScope(TreeScope*); | 62 explicit FocusNavigationScope(TreeScope*); |
| 63 RawPtrWillBeMember<TreeScope> m_rootTreeScope; | 63 RawPtrWillBeMember<TreeScope> m_rootTreeScope; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 class FocusController { | 66 class FocusController FINAL : public NoBaseWillBeGarbageCollectedFinalized<Focus
Controller> { |
| 67 WTF_MAKE_NONCOPYABLE(FocusController); WTF_MAKE_FAST_ALLOCATED; | 67 WTF_MAKE_NONCOPYABLE(FocusController); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOV
ED; |
| 68 public: | 68 public: |
| 69 static PassOwnPtr<FocusController> create(Page*); | 69 static PassOwnPtrWillBeRawPtr<FocusController> create(Page*); |
| 70 | 70 |
| 71 void setFocusedFrame(PassRefPtr<Frame>); | 71 void setFocusedFrame(PassRefPtrWillBeRawPtr<Frame>); |
| 72 void focusDocumentView(PassRefPtr<Frame>); | 72 void focusDocumentView(PassRefPtrWillBeRawPtr<Frame>); |
| 73 Frame* focusedFrame() const { return m_focusedFrame.get(); } | 73 Frame* focusedFrame() const { return m_focusedFrame.get(); } |
| 74 Frame* focusedOrMainFrame() const; | 74 Frame* focusedOrMainFrame() const; |
| 75 | 75 |
| 76 bool setInitialFocus(FocusType); | 76 bool setInitialFocus(FocusType); |
| 77 bool advanceFocus(FocusType type) { return advanceFocus(type, false); } | 77 bool advanceFocus(FocusType type) { return advanceFocus(type, false); } |
| 78 | 78 |
| 79 bool setFocusedElement(Element*, PassRefPtr<Frame>, FocusType = FocusTypeNon
e); | 79 bool setFocusedElement(Element*, PassRefPtrWillBeRawPtr<Frame>, FocusType =
FocusTypeNone); |
| 80 | 80 |
| 81 void setActive(bool); | 81 void setActive(bool); |
| 82 bool isActive() const { return m_isActive; } | 82 bool isActive() const { return m_isActive; } |
| 83 | 83 |
| 84 void setFocused(bool); | 84 void setFocused(bool); |
| 85 bool isFocused() const { return m_isFocused; } | 85 bool isFocused() const { return m_isFocused; } |
| 86 | 86 |
| 87 void trace(Visitor*); |
| 88 |
| 87 private: | 89 private: |
| 88 explicit FocusController(Page*); | 90 explicit FocusController(Page*); |
| 89 | 91 |
| 90 bool advanceFocus(FocusType, bool initialFocus); | 92 bool advanceFocus(FocusType, bool initialFocus); |
| 91 bool advanceFocusDirectionally(FocusType); | 93 bool advanceFocusDirectionally(FocusType); |
| 92 bool advanceFocusInDocumentOrder(FocusType, bool initialFocus); | 94 bool advanceFocusInDocumentOrder(FocusType, bool initialFocus); |
| 93 | 95 |
| 94 Node* findFocusableNodeAcrossFocusScope(FocusType, FocusNavigationScope star
tScope, Node* start); | 96 Node* findFocusableNodeAcrossFocusScope(FocusType, FocusNavigationScope star
tScope, Node* start); |
| 95 Node* findFocusableNodeRecursively(FocusType, FocusNavigationScope, Node* st
art); | 97 Node* findFocusableNodeRecursively(FocusType, FocusNavigationScope, Node* st
art); |
| 96 Node* findFocusableNodeDecendingDownIntoFrameDocument(FocusType, Node*); | 98 Node* findFocusableNodeDecendingDownIntoFrameDocument(FocusType, Node*); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 107 inline Node* findFocusableNode(FocusType, FocusNavigationScope, Node* start)
; | 109 inline Node* findFocusableNode(FocusType, FocusNavigationScope, Node* start)
; |
| 108 | 110 |
| 109 Node* nextFocusableNode(FocusNavigationScope, Node* start); | 111 Node* nextFocusableNode(FocusNavigationScope, Node* start); |
| 110 Node* previousFocusableNode(FocusNavigationScope, Node* start); | 112 Node* previousFocusableNode(FocusNavigationScope, Node* start); |
| 111 | 113 |
| 112 Node* findNodeWithExactTabIndex(Node* start, int tabIndex, FocusType); | 114 Node* findNodeWithExactTabIndex(Node* start, int tabIndex, FocusType); |
| 113 | 115 |
| 114 bool advanceFocusDirectionallyInContainer(Node* container, const LayoutRect&
startingRect, FocusType); | 116 bool advanceFocusDirectionallyInContainer(Node* container, const LayoutRect&
startingRect, FocusType); |
| 115 void findFocusCandidateInContainer(Node& container, const LayoutRect& starti
ngRect, FocusType, FocusCandidate& closest); | 117 void findFocusCandidateInContainer(Node& container, const LayoutRect& starti
ngRect, FocusType, FocusCandidate& closest); |
| 116 | 118 |
| 117 Page* m_page; | 119 RawPtrWillBeMember<Page> m_page; |
| 118 RefPtr<Frame> m_focusedFrame; | 120 RefPtrWillBeMember<Frame> m_focusedFrame; |
| 119 bool m_isActive; | 121 bool m_isActive; |
| 120 bool m_isFocused; | 122 bool m_isFocused; |
| 121 bool m_isChangingFocusedFrame; | 123 bool m_isChangingFocusedFrame; |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 } // namespace blink | 126 } // namespace blink |
| 125 | 127 |
| 126 #endif // FocusController_h | 128 #endif // FocusController_h |
| OLD | NEW |