| 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 19 matching lines...) Expand all Loading... |
| 30 #include "platform/geometry/LayoutRect.h" | 30 #include "platform/geometry/LayoutRect.h" |
| 31 #include "wtf/Forward.h" | 31 #include "wtf/Forward.h" |
| 32 #include "wtf/Noncopyable.h" | 32 #include "wtf/Noncopyable.h" |
| 33 #include "wtf/RefPtr.h" | 33 #include "wtf/RefPtr.h" |
| 34 | 34 |
| 35 namespace WebCore { | 35 namespace WebCore { |
| 36 | 36 |
| 37 struct FocusCandidate; | 37 struct FocusCandidate; |
| 38 class Document; | 38 class Document; |
| 39 class Element; | 39 class Element; |
| 40 class LocalFrame; | 40 class Frame; |
| 41 class HTMLFrameOwnerElement; | 41 class HTMLFrameOwnerElement; |
| 42 class HTMLShadowElement; | 42 class HTMLShadowElement; |
| 43 class IntRect; | 43 class IntRect; |
| 44 class KeyboardEvent; | 44 class KeyboardEvent; |
| 45 class Node; | 45 class Node; |
| 46 class Page; | 46 class Page; |
| 47 class TreeScope; | 47 class TreeScope; |
| 48 | 48 |
| 49 class FocusNavigationScope { | 49 class FocusNavigationScope { |
| 50 public: | 50 public: |
| 51 Node* rootNode() const; | 51 Node* rootNode() const; |
| 52 Element* owner() const; | 52 Element* owner() const; |
| 53 static FocusNavigationScope focusNavigationScopeOf(Node*); | 53 static FocusNavigationScope focusNavigationScopeOf(Node*); |
| 54 static FocusNavigationScope ownedByNonFocusableFocusScopeOwner(Node*); | 54 static FocusNavigationScope ownedByNonFocusableFocusScopeOwner(Node*); |
| 55 static FocusNavigationScope ownedByShadowHost(Node*); | 55 static FocusNavigationScope ownedByShadowHost(Node*); |
| 56 static FocusNavigationScope ownedByShadowInsertionPoint(HTMLShadowElement*); | 56 static FocusNavigationScope ownedByShadowInsertionPoint(HTMLShadowElement*); |
| 57 static FocusNavigationScope ownedByIFrame(HTMLFrameOwnerElement*); | 57 static FocusNavigationScope ownedByIFrame(HTMLFrameOwnerElement*); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 explicit FocusNavigationScope(TreeScope*); | 60 explicit FocusNavigationScope(TreeScope*); |
| 61 TreeScope* m_rootTreeScope; | 61 TreeScope* m_rootTreeScope; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 class FocusController { | 64 class FocusController { |
| 65 WTF_MAKE_NONCOPYABLE(FocusController); WTF_MAKE_FAST_ALLOCATED; | 65 WTF_MAKE_NONCOPYABLE(FocusController); WTF_MAKE_FAST_ALLOCATED; |
| 66 public: | 66 public: |
| 67 static PassOwnPtr<FocusController> create(Page*); | 67 static PassOwnPtr<FocusController> create(Page*); |
| 68 | 68 |
| 69 void setFocusedFrame(PassRefPtr<LocalFrame>); | 69 void setFocusedFrame(PassRefPtr<Frame>); |
| 70 LocalFrame* focusedFrame() const { return m_focusedFrame.get(); } | 70 Frame* focusedFrame() const { return m_focusedFrame.get(); } |
| 71 LocalFrame* focusedOrMainFrame() const; | 71 Frame* focusedOrMainFrame() const; |
| 72 | 72 |
| 73 bool setInitialFocus(FocusType); | 73 bool setInitialFocus(FocusType); |
| 74 bool advanceFocus(FocusType type) { return advanceFocus(type, false); } | 74 bool advanceFocus(FocusType type) { return advanceFocus(type, false); } |
| 75 | 75 |
| 76 bool setFocusedElement(Element*, PassRefPtr<LocalFrame>, FocusType = FocusTy
peNone); | 76 bool setFocusedElement(Element*, PassRefPtr<Frame>, FocusType = FocusTypeNon
e); |
| 77 | 77 |
| 78 void setActive(bool); | 78 void setActive(bool); |
| 79 bool isActive() const { return m_isActive; } | 79 bool isActive() const { return m_isActive; } |
| 80 | 80 |
| 81 void setFocused(bool); | 81 void setFocused(bool); |
| 82 bool isFocused() const { return m_isFocused; } | 82 bool isFocused() const { return m_isFocused; } |
| 83 | 83 |
| 84 void setContainingWindowIsVisible(bool); | 84 void setContainingWindowIsVisible(bool); |
| 85 bool containingWindowIsVisible() const { return m_containingWindowIsVisible;
} | 85 bool containingWindowIsVisible() const { return m_containingWindowIsVisible;
} |
| 86 | 86 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 108 | 108 |
| 109 Node* nextFocusableNode(FocusNavigationScope, Node* start); | 109 Node* nextFocusableNode(FocusNavigationScope, Node* start); |
| 110 Node* previousFocusableNode(FocusNavigationScope, Node* start); | 110 Node* previousFocusableNode(FocusNavigationScope, Node* start); |
| 111 | 111 |
| 112 Node* findNodeWithExactTabIndex(Node* start, int tabIndex, FocusType); | 112 Node* findNodeWithExactTabIndex(Node* start, int tabIndex, FocusType); |
| 113 | 113 |
| 114 bool advanceFocusDirectionallyInContainer(Node* container, const LayoutRect&
startingRect, FocusType); | 114 bool advanceFocusDirectionallyInContainer(Node* container, const LayoutRect&
startingRect, FocusType); |
| 115 void findFocusCandidateInContainer(Node& container, const LayoutRect& starti
ngRect, FocusType, FocusCandidate& closest); | 115 void findFocusCandidateInContainer(Node& container, const LayoutRect& starti
ngRect, FocusType, FocusCandidate& closest); |
| 116 | 116 |
| 117 Page* m_page; | 117 Page* m_page; |
| 118 RefPtr<LocalFrame> m_focusedFrame; | 118 RefPtr<Frame> m_focusedFrame; |
| 119 bool m_isActive; | 119 bool m_isActive; |
| 120 bool m_isFocused; | 120 bool m_isFocused; |
| 121 bool m_isChangingFocusedFrame; | 121 bool m_isChangingFocusedFrame; |
| 122 bool m_containingWindowIsVisible; | 122 bool m_containingWindowIsVisible; |
| 123 | 123 |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 } // namespace WebCore | 126 } // namespace WebCore |
| 127 | 127 |
| 128 #endif // FocusController_h | 128 #endif // FocusController_h |
| OLD | NEW |