Commit 4acc4a4b authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

Unreviewed, rolling out r162452.

http://trac.webkit.org/changeset/162452
https://bugs.webkit.org/show_bug.cgi?id=127366

broke a few tests on all Mac WebKit1 bots (Requested by
thorton on #webkit).

Source/WebCore:

* WebCore.exp.in:
* page/FocusController.cpp:
(WebCore::FocusController::FocusController):
(WebCore::FocusController::setFocused):
(WebCore::FocusController::setActive):
(WebCore::FocusController::setContentIsVisible):
* page/FocusController.h:
(WebCore::FocusController::isActive):
(WebCore::FocusController::isFocused):
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::setIsInWindow):
(WebCore::Page::setIsVisuallyIdle):
(WebCore::Page::setIsVisible):
(WebCore::Page::visibilityState):
(WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
* page/Page.h:
(WebCore::Page::isVisible):
(WebCore::Page::isInWindow):

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _windowWillOrderOnScreen:]):
(-[WebView _windowWillOrderOffScreen:]):

Source/WebKit2:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::setActive):
(WebKit::WebPage::setViewIsVisible):
(WebKit::WebPage::setFocused):
(WebKit::WebPage::setIsInWindow):
(WebKit::WebPage::setViewStateInternal):
(WebKit::WebPage::setIsVisuallyIdle):
* WebProcess/WebPage/WebPage.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162467 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8b2c964a
2014-01-21 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r162452.
http://trac.webkit.org/changeset/162452
https://bugs.webkit.org/show_bug.cgi?id=127366
broke a few tests on all Mac WebKit1 bots (Requested by
thorton on #webkit).
* WebCore.exp.in:
* page/FocusController.cpp:
(WebCore::FocusController::FocusController):
(WebCore::FocusController::setFocused):
(WebCore::FocusController::setActive):
(WebCore::FocusController::setContentIsVisible):
* page/FocusController.h:
(WebCore::FocusController::isActive):
(WebCore::FocusController::isFocused):
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::setIsInWindow):
(WebCore::Page::setIsVisuallyIdle):
(WebCore::Page::setIsVisible):
(WebCore::Page::visibilityState):
(WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
* page/Page.h:
(WebCore::Page::isVisible):
(WebCore::Page::isInWindow):
2014-01-21 Chris Fleizach <cfleizach@apple.com>
 
AX: Mac: Expose the visible text of a password field to AX
......@@ -484,6 +484,7 @@ __ZN7WebCore15FocusController10setFocusedEb
__ZN7WebCore15FocusController15setFocusedFrameEN3WTF10PassRefPtrINS_5FrameEEE
__ZN7WebCore15FocusController15setInitialFocusENS_14FocusDirectionEPNS_13KeyboardEventE
__ZN7WebCore15FocusController17setFocusedElementEPNS_7ElementEN3WTF10PassRefPtrINS_5FrameEEENS_14FocusDirectionE
__ZN7WebCore15FocusController19setContentIsVisibleEb
__ZN7WebCore15FocusController9setActiveEb
__ZN7WebCore15GraphicsContext10strokeRectERKNS_9FloatRectEf
__ZN7WebCore15GraphicsContext11clearShadowEv
......@@ -974,7 +975,6 @@ __ZN7WebCore4Page11PageClientsC1Ev
__ZN7WebCore4Page11PageClientsD1Ev
__ZN7WebCore4Page12setGroupNameERKN3WTF6StringE
__ZN7WebCore4Page12setIsVisibleEbb
__ZN7WebCore4Page12setViewStateEjb
__ZN7WebCore4Page13rangeOfStringERKN3WTF6StringEPNS_5RangeEj
__ZN7WebCore4Page13setIsInWindowEb
__ZN7WebCore4Page13setPaginationERKNS_10PaginationE
......@@ -984,6 +984,7 @@ __ZN7WebCore4Page15addSchedulePairEN3WTF10PassRefPtrINS1_12SchedulePairEEE
__ZN7WebCore4Page16countFindMatchesERKN3WTF6StringEjj
__ZN7WebCore4Page16setCanStartMediaEb
__ZN7WebCore4Page16setDefersLoadingEb
__ZN7WebCore4Page17setIsVisuallyIdleEb
__ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS1_12SchedulePairEEE
__ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE
#if ENABLE(RUBBER_BANDING)
......
......@@ -158,10 +158,12 @@ static inline bool shouldVisit(Element& element, KeyboardEvent& event)
return element.isKeyboardFocusable(&event) || isNonFocusableShadowHost(element, event);
}
FocusController::FocusController(Page& page, ViewState::Flags viewState)
FocusController::FocusController(Page& page)
: m_page(page)
, m_isActive(false)
, m_isFocused(false)
, m_isChangingFocusedFrame(false)
, m_viewState(viewState)
, m_contentIsVisible(false)
{
}
......@@ -203,12 +205,12 @@ Frame& FocusController::focusedOrMainFrame() const
void FocusController::setFocused(bool focused)
{
m_page.setViewState(focused ? m_viewState | ViewState::IsFocused : m_viewState & ~ViewState::IsFocused);
}
if (isFocused() == focused)
return;
m_isFocused = focused;
void FocusController::setFocusedInternal(bool focused)
{
if (!isFocused())
if (!m_isFocused)
focusedOrMainFrame().eventHandler().stopAutoscrollTimer();
if (!m_focusedFrame)
......@@ -633,26 +635,13 @@ bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newF
return true;
}
void FocusController::setViewState(ViewState::Flags viewState)
{
ViewState::Flags changed = m_viewState ^ viewState;
m_viewState = viewState;
if (changed & ViewState::IsFocused)
setFocusedInternal(viewState & ViewState::IsFocused);
if (changed & ViewState::WindowIsActive)
setActiveInternal(viewState & ViewState::WindowIsActive);
if (changed & ViewState::IsVisible)
setIsVisibleInternal(viewState & ViewState::IsVisible);
}
void FocusController::setActive(bool active)
{
m_page.setViewState(active ? m_viewState | ViewState::WindowIsActive : m_viewState & ~ViewState::WindowIsActive);
}
if (m_isActive == active)
return;
m_isActive = active;
void FocusController::setActiveInternal(bool active)
{
if (FrameView* view = m_page.mainFrame().view()) {
if (!view->platformWidget()) {
view->updateLayoutAndStyleIfNeededRecursive();
......@@ -674,8 +663,13 @@ static void contentAreaDidShowOrHide(ScrollableArea* scrollableArea, bool didSho
scrollableArea->contentAreaDidHide();
}
void FocusController::setIsVisibleInternal(bool contentIsVisible)
void FocusController::setContentIsVisible(bool contentIsVisible)
{
if (m_contentIsVisible == contentIsVisible)
return;
m_contentIsVisible = contentIsVisible;
FrameView* view = m_page.mainFrame().view();
if (!view)
return;
......
......@@ -28,7 +28,6 @@
#include "FocusDirection.h"
#include "LayoutRect.h"
#include "ViewState.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/RefPtr.h>
......@@ -63,7 +62,7 @@ private:
class FocusController {
WTF_MAKE_NONCOPYABLE(FocusController); WTF_MAKE_FAST_ALLOCATED;
public:
explicit FocusController(Page&, ViewState::Flags);
explicit FocusController(Page&);
void setFocusedFrame(PassRefPtr<Frame>);
Frame* focusedFrame() const { return m_focusedFrame.get(); }
......@@ -74,25 +73,19 @@ public:
bool setFocusedElement(Element*, PassRefPtr<Frame>, FocusDirection = FocusDirectionNone);
void setViewState(ViewState::Flags);
void setActive(bool);
bool isActive() const { return m_viewState & ViewState::WindowIsActive; }
bool isActive() const { return m_isActive; }
void setFocused(bool);
bool isFocused() const { return m_viewState & ViewState::IsFocused; }
bool isFocused() const { return m_isFocused; }
bool contentIsVisible() const { return m_viewState & ViewState::IsVisible; }
void setContentIsVisible(bool);
// These methods are used in WebCore/bindings/objc/DOM.mm.
Element* nextFocusableElement(FocusNavigationScope, Node* start, KeyboardEvent*);
Element* previousFocusableElement(FocusNavigationScope, Node* start, KeyboardEvent*);
private:
void setActiveInternal(bool);
void setFocusedInternal(bool);
void setIsVisibleInternal(bool);
bool advanceFocusDirectionally(FocusDirection, KeyboardEvent*);
bool advanceFocusInDocumentOrder(FocusDirection, KeyboardEvent*, bool initialFocus);
......@@ -118,8 +111,11 @@ private:
Page& m_page;
RefPtr<Frame> m_focusedFrame;
bool m_isActive;
bool m_isFocused;
bool m_isChangingFocusedFrame;
ViewState::Flags m_viewState;
bool m_contentIsVisible;
};
} // namespace WebCore
......
......@@ -124,15 +124,13 @@ float deviceScaleFactor(Frame* frame)
return page->deviceScaleFactor();
}
static const ViewState::Flags PageInitialViewState = ViewState::IsVisible | ViewState::IsInWindow;
Page::Page(PageClients& pageClients)
: m_chrome(std::make_unique<Chrome>(*this, *pageClients.chromeClient))
, m_dragCaretController(std::make_unique<DragCaretController>())
#if ENABLE(DRAG_SUPPORT)
, m_dragController(std::make_unique<DragController>(*this, *pageClients.dragClient))
#endif
, m_focusController(std::make_unique<FocusController>(*this, PageInitialViewState))
, m_focusController(std::make_unique<FocusController>(*this))
#if ENABLE(CONTEXT_MENUS)
, m_contextMenuController(std::make_unique<ContextMenuController>(*this, *pageClients.contextMenuClient))
#endif
......@@ -174,8 +172,9 @@ Page::Page(PageClients& pageClients)
, m_minimumTimerInterval(Settings::defaultMinDOMTimerInterval())
, m_timerAlignmentInterval(Settings::defaultDOMTimerAlignmentInterval())
, m_isEditable(false)
, m_isInWindow(true)
, m_isVisible(true)
, m_isPrerender(false)
, m_viewState(PageInitialViewState)
, m_requestedLayoutMilestones(0)
, m_headerHeight(0)
, m_footerHeight(0)
......@@ -882,11 +881,11 @@ unsigned Page::pageCount() const
void Page::setIsInWindow(bool isInWindow)
{
setViewState(isInWindow ? m_viewState | ViewState::IsInWindow : m_viewState & ~ViewState::IsInWindow);
}
if (m_isInWindow == isInWindow)
return;
m_isInWindow = isInWindow;
void Page::setIsInWindowInternal(bool isInWindow)
{
for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
if (FrameView* frameView = frame->view())
frameView->setIsInWindow(isInWindow);
......@@ -914,7 +913,7 @@ void Page::resumeScriptedAnimations()
}
}
void Page::setIsVisuallyIdleInternal(bool isVisuallyIdle)
void Page::setIsVisuallyIdle(bool isVisuallyIdle)
{
m_pageThrottler->setIsVisuallyIdle(isVisuallyIdle);
}
......@@ -1217,37 +1216,15 @@ void Page::resumeAnimatingImages()
CachedImage::resumeAnimatingImagesForLoader(frame->document()->cachedResourceLoader());
}
void Page::setViewState(ViewState::Flags viewState, bool isInitialState)
{
ViewState::Flags changed = m_viewState ^ viewState;
m_viewState = viewState;
// We want to make sure to update the active state while hidden, so if the view is going
// to be visible then update the focus controller first (it may currently still be hidden).
if (changed && (m_viewState & ViewState::IsVisible))
m_focusController->setViewState(viewState);
if (changed & ViewState::IsVisible)
setIsVisibleInternal(viewState & ViewState::IsVisible, isInitialState);
if (changed & ViewState::IsInWindow)
setIsInWindowInternal(viewState & ViewState::IsInWindow);
if (changed & ViewState::IsVisuallyIdle)
setIsVisuallyIdleInternal(viewState & ViewState::IsVisuallyIdle);
if (changed && !(m_viewState & ViewState::IsVisible))
m_focusController->setViewState(viewState);
}
void Page::setIsVisible(bool isVisible, bool isInitialState)
{
setViewState(isVisible ? m_viewState | ViewState::IsVisible : m_viewState & ~ViewState::IsVisible, isInitialState);
}
void Page::setIsVisibleInternal(bool isVisible, bool isInitialState)
{
// FIXME: The visibility state should be stored on the top-level document.
// https://bugs.webkit.org/show_bug.cgi?id=116769
if (m_isVisible == isVisible)
return;
m_isVisible = isVisible;
if (isVisible) {
m_isPrerender = false;
......@@ -1309,7 +1286,7 @@ void Page::setIsPrerender()
#if ENABLE(PAGE_VISIBILITY_API)
PageVisibilityState Page::visibilityState() const
{
if (isVisible())
if (m_isVisible)
return PageVisibilityStateVisible;
if (m_isPrerender)
return PageVisibilityStatePrerender;
......@@ -1571,7 +1548,7 @@ void Page::hiddenPageDOMTimerThrottlingStateChanged()
#if (ENABLE_PAGE_VISIBILITY_API)
void Page::hiddenPageCSSAnimationSuspensionStateChanged()
{
if (!isVisible()) {
if (!m_isVisible) {
if (m_settings->hiddenPageCSSAnimationSuspensionEnabled())
mainFrame().animation().suspendAnimations();
else
......
......@@ -31,7 +31,6 @@
#include "PlatformScreen.h"
#include "Region.h"
#include "Supplementable.h"
#include "ViewState.h"
#include "ViewportArguments.h"
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
......@@ -298,18 +297,18 @@ public:
unsigned pageCount() const;
// Notifications when the Page starts and stops being presented via a native window.
void setViewState(ViewState::Flags, bool isInitial = false);
void setIsVisible(bool isVisible, bool isInitial);
void setIsPrerender();
bool isVisible() const { return m_viewState & ViewState::IsVisible; }
bool isVisible() const { return m_isVisible; }
// Notification that this Page was moved into or out of a native window.
void setIsInWindow(bool);
bool isInWindow() const { return m_viewState & ViewState::IsInWindow; }
bool isInWindow() const { return m_isInWindow; }
void suspendScriptedAnimations();
void resumeScriptedAnimations();
bool scriptedAnimationsSuspended() const { return m_scriptedAnimationsSuspended; }
void setIsVisuallyIdle(bool);
void userStyleSheetLocationChanged();
const String& userStyleSheet() const;
......@@ -426,10 +425,6 @@ public:
private:
void initGroup();
void setIsInWindowInternal(bool);
void setIsVisibleInternal(bool isVisible, bool isInitial);
void setIsVisuallyIdleInternal(bool);
#if ASSERT_DISABLED
void checkSubframeCountConsistency() const { }
#else
......@@ -533,8 +528,9 @@ private:
double m_timerAlignmentInterval;
bool m_isEditable;
bool m_isInWindow;
bool m_isVisible;
bool m_isPrerender;
ViewState::Flags m_viewState;
LayoutMilestones m_requestedLayoutMilestones;
......
2014-01-21 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r162452.
http://trac.webkit.org/changeset/162452
https://bugs.webkit.org/show_bug.cgi?id=127366
broke a few tests on all Mac WebKit1 bots (Requested by
thorton on #webkit).
* WebView/WebView.mm:
(-[WebView _windowWillOrderOnScreen:]):
(-[WebView _windowWillOrderOffScreen:]):
2014-01-21 Gavin Barraclough <barraclough@apple.com>
Change Page, FocusController to use ViewState
......
......@@ -5371,8 +5371,10 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
// Send a change screen to make sure the initial displayID is set
[self doWindowDidChangeScreen];
if (_private && _private->page)
if (_private && _private->page) {
_private->page->resumeScriptedAnimations();
_private->page->focusController().setContentIsVisible(true);
}
}
- (void)_windowDidChangeScreen:(NSNotification *)notification
......@@ -5382,8 +5384,10 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
- (void)_windowWillOrderOffScreen:(NSNotification *)notification
{
if (_private && _private->page)
if (_private && _private->page) {
_private->page->suspendScriptedAnimations();
_private->page->focusController().setContentIsVisible(false);
}
}
- (void)_windowVisibilityChanged:(NSNotification *)notification
......
2014-01-21 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r162452.
http://trac.webkit.org/changeset/162452
https://bugs.webkit.org/show_bug.cgi?id=127366
broke a few tests on all Mac WebKit1 bots (Requested by
thorton on #webkit).
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::setActive):
(WebKit::WebPage::setViewIsVisible):
(WebKit::WebPage::setFocused):
(WebKit::WebPage::setIsInWindow):
(WebKit::WebPage::setViewStateInternal):
(WebKit::WebPage::setIsVisuallyIdle):
* WebProcess/WebPage/WebPage.h:
2014-01-21 Martin Hock <mhock@apple.com>
 
Trivial Session API cleanup.
......
......@@ -373,8 +373,17 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
setMemoryCacheMessagesEnabled(parameters.areMemoryCacheClientCallsEnabled);
m_page->setViewState(m_viewState, true);
updateIsInWindow(true);
setActive(parameters.viewState & ViewState::WindowIsActive);
setFocused(parameters.viewState & ViewState::IsFocused);
// Page defaults to in-window, but setIsInWindow depends on it being a valid indicator of actually having been put into a window.
bool isInWindow = parameters.viewState & ViewState::IsInWindow;
if (!isInWindow)
m_page->setIsInWindow(false);
else
WebProcess::shared().pageDidEnterWindow(m_pageID);
setIsInWindow(isInWindow);
setMinimumLayoutSize(parameters.minimumLayoutSize);
setAutoSizingShouldExpandToViewHeight(parameters.autoSizingShouldExpandToViewHeight);
......@@ -418,6 +427,9 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
if (m_useAsyncScrolling)
WebProcess::shared().eventDispatcher().addScrollingTreeForPage(this);
#endif
m_page->setIsVisible(m_viewState & ViewState::IsVisible, true);
setIsVisuallyIdle(m_viewState & ViewState::IsVisuallyIdle);
}
void WebPage::reinitializeWebPage(const WebPageCreationParameters& parameters)
......@@ -1912,6 +1924,18 @@ void WebPage::centerSelectionInVisibleArea()
m_findController.showFindIndicatorInSelection();
}
void WebPage::setActive(bool isActive)
{
m_page->focusController().setActive(isActive);
}
void WebPage::setViewIsVisible(bool isVisible)
{
corePage()->focusController().setContentIsVisible(isVisible);
m_page->setIsVisible(m_viewState & ViewState::IsVisible, false);
}
void WebPage::setDrawsBackground(bool drawsBackground)
{
if (m_drawsBackground == drawsBackground)
......@@ -1967,6 +1991,11 @@ void WebPage::viewWillEndLiveResize()
view->willEndLiveResize();
}
void WebPage::setFocused(bool isFocused)
{
m_page->focusController().setFocused(isFocused);
}
void WebPage::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& event)
{
if (!m_page)
......@@ -2021,16 +2050,15 @@ inline bool WebPage::canHandleUserEvents() const
return true;
}
void WebPage::updateIsInWindow(bool isInitialState)
void WebPage::setIsInWindow(bool isInWindow)
{
bool isInWindow = m_viewState & WebCore::ViewState::IsInWindow;
bool pageWasInWindow = m_page->isInWindow();
if (!isInWindow) {
m_setCanStartMediaTimer.stop();
m_page->setCanStartMedia(false);
// The WebProcess does not yet know about this page; no need to tell it we're leaving the window.
if (!isInitialState)
if (pageWasInWindow)
WebProcess::shared().pageWillLeaveWindow(m_pageID);
} else {
// Defer the call to Page::setCanStartMedia() since it ends up sending a synchronous message to the UI process
......@@ -2039,9 +2067,12 @@ void WebPage::updateIsInWindow(bool isInitialState)
if (m_mayStartMediaWhenInWindow)
m_setCanStartMediaTimer.startOneShot(0);
WebProcess::shared().pageDidEnterWindow(m_pageID);
if (!pageWasInWindow)
WebProcess::shared().pageDidEnterWindow(m_pageID);
}
m_page->setIsInWindow(isInWindow);
if (isInWindow)
layoutIfNeeded();
}
......@@ -2060,12 +2091,24 @@ void WebPage::setViewStateInternal(ViewState::Flags viewState, bool isInitialSta
m_viewState = viewState;
m_drawingArea->viewStateDidChange(changed);
m_page->setViewState(viewState, isInitialState);
for (auto* pluginView : m_pluginViews)
pluginView->viewStateDidChange(changed);
// We want to make sure to update the active state while hidden, so if the view is hidden then update the active state
// early (in case it becomes visible), and if the view was visible then update active state later (in case it hides).
if (changed & ViewState::IsFocused)
setFocused(viewState & ViewState::IsFocused);
if (changed & ViewState::WindowIsActive && !(m_viewState & ViewState::IsVisible))
setActive(viewState & ViewState::WindowIsActive);
if (changed & ViewState::IsVisible)
setViewIsVisible(viewState & ViewState::IsVisible);
if (changed & ViewState::WindowIsActive && m_viewState & ViewState::IsVisible)
setActive(viewState & ViewState::WindowIsActive);
if (changed & ViewState::IsInWindow)
updateIsInWindow();
setIsInWindow(viewState & ViewState::IsInWindow);
if (changed & ViewState::IsVisuallyIdle)
setIsVisuallyIdle(viewState & ViewState::IsVisuallyIdle);
for (auto* pluginView : m_pluginViews)
pluginView->viewStateDidChange(changed);
}
void WebPage::setLayerHostingMode(unsigned layerHostingMode)
......@@ -3669,6 +3712,11 @@ void WebPage::setVisibilityStatePrerender()
m_page->setIsPrerender();
}
void WebPage::setIsVisuallyIdle(bool isVisuallyIdle)
{
m_page->setIsVisuallyIdle(isVisuallyIdle);
}
void WebPage::setScrollingPerformanceLoggingEnabled(bool enabled)
{
m_scrollingPerformanceLoggingEnabled = enabled;
......
......@@ -737,7 +737,8 @@ private:
void setViewIsVisible(bool);
void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
void setWindowResizerSize(const WebCore::IntSize&);
void updateIsInWindow(bool isInitialState = false);
void setIsInWindow(bool);
void setIsVisuallyIdle(bool);
void setViewState(WebCore::ViewState::Flags, bool wantsDidUpdateViewState);
void setViewStateInternal(WebCore::ViewState::Flags, bool isInitialState);
void validateCommand(const String&, uint64_t);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment