summaryrefslogtreecommitdiff
path: root/Source/WebCore/page/FocusController.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/page/FocusController.h')
-rw-r--r--Source/WebCore/page/FocusController.h51
1 files changed, 32 insertions, 19 deletions
diff --git a/Source/WebCore/page/FocusController.h b/Source/WebCore/page/FocusController.h
index b991130ae..f80dff4d4 100644
--- a/Source/WebCore/page/FocusController.h
+++ b/Source/WebCore/page/FocusController.h
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -28,6 +28,8 @@
#include "FocusDirection.h"
#include "LayoutRect.h"
+#include "Timer.h"
+#include "ViewState.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/RefPtr.h>
@@ -50,7 +52,7 @@ class FocusNavigationScope {
public:
ContainerNode* rootNode() const;
Element* owner() const;
- static FocusNavigationScope focusNavigationScopeOf(Node*);
+ WEBCORE_EXPORT static FocusNavigationScope focusNavigationScopeOf(Node*);
static FocusNavigationScope focusNavigationScopeOwnedByShadowHost(Node*);
static FocusNavigationScope focusNavigationScopeOwnedByIFrame(HTMLFrameOwnerElement*);
@@ -62,30 +64,39 @@ private:
class FocusController {
WTF_MAKE_NONCOPYABLE(FocusController); WTF_MAKE_FAST_ALLOCATED;
public:
- explicit FocusController(Page&);
+ explicit FocusController(Page&, ViewState::Flags);
- void setFocusedFrame(PassRefPtr<Frame>);
+ WEBCORE_EXPORT void setFocusedFrame(PassRefPtr<Frame>);
Frame* focusedFrame() const { return m_focusedFrame.get(); }
- Frame& focusedOrMainFrame() const;
+ WEBCORE_EXPORT Frame& focusedOrMainFrame() const;
- bool setInitialFocus(FocusDirection, KeyboardEvent*);
+ WEBCORE_EXPORT bool setInitialFocus(FocusDirection, KeyboardEvent*);
bool advanceFocus(FocusDirection, KeyboardEvent*, bool initialFocus = false);
- bool setFocusedElement(Element*, PassRefPtr<Frame>, FocusDirection = FocusDirectionNone);
+ WEBCORE_EXPORT bool setFocusedElement(Element*, PassRefPtr<Frame>, FocusDirection = FocusDirectionNone);
- void setActive(bool);
- bool isActive() const { return m_isActive; }
+ void setViewState(ViewState::Flags);
- void setFocused(bool);
- bool isFocused() const { return m_isFocused; }
+ WEBCORE_EXPORT void setActive(bool);
+ bool isActive() const { return m_viewState & ViewState::WindowIsActive; }
- void setContentIsVisible(bool);
+ WEBCORE_EXPORT void setFocused(bool);
+ bool isFocused() const { return m_viewState & ViewState::IsFocused; }
+
+ bool contentIsVisible() const { return m_viewState & ViewState::IsVisible; }
// These methods are used in WebCore/bindings/objc/DOM.mm.
- Element* nextFocusableElement(FocusNavigationScope, Node* start, KeyboardEvent*);
- Element* previousFocusableElement(FocusNavigationScope, Node* start, KeyboardEvent*);
+ WEBCORE_EXPORT Element* nextFocusableElement(FocusNavigationScope, Node* start, KeyboardEvent*);
+ WEBCORE_EXPORT Element* previousFocusableElement(FocusNavigationScope, Node* start, KeyboardEvent*);
+
+ void setFocusedElementNeedsRepaint();
+ double timeSinceFocusWasSet() const;
private:
+ void setActiveInternal(bool);
+ void setFocusedInternal(bool);
+ void setIsVisibleAndActiveInternal(bool);
+
bool advanceFocusDirectionally(FocusDirection, KeyboardEvent*);
bool advanceFocusInDocumentOrder(FocusDirection, KeyboardEvent*, bool initialFocus);
@@ -107,15 +118,17 @@ private:
Element* findElementWithExactTabIndex(Node* start, int tabIndex, KeyboardEvent*, FocusDirection);
bool advanceFocusDirectionallyInContainer(Node* container, const LayoutRect& startingRect, FocusDirection, KeyboardEvent*);
- void findFocusCandidateInContainer(Node* container, const LayoutRect& startingRect, FocusDirection, KeyboardEvent*, FocusCandidate& closest);
+ void findFocusCandidateInContainer(Node& container, const LayoutRect& startingRect, FocusDirection, KeyboardEvent*, FocusCandidate& closest);
+
+ void focusRepaintTimerFired();
Page& m_page;
RefPtr<Frame> m_focusedFrame;
- bool m_isActive;
- bool m_isFocused;
bool m_isChangingFocusedFrame;
- bool m_contentIsVisible;
+ ViewState::Flags m_viewState;
+ Timer m_focusRepaintTimer;
+ double m_focusSetTime;
};
} // namespace WebCore