Commit 3ffc4f37 authored by barraclough@apple.com's avatar barraclough@apple.com
Browse files

Change Page, FocusController to use ViewState

https://bugs.webkit.org/show_bug.cgi?id=126533

Reviewed by Tim Horton.

These classes currently maintain a set of separate fields to represent the view state;
combine these into a single field, and allow WebPage to send the combined update rather
than individual changes.

Maintain existing interface for WebKit1 clients.

Source/WebCore: 

* WebCore.exp.in:
    - Added WebCore::setViewState, removed WebCore::setIsVisuallyIdle.
* page/FocusController.cpp:
(WebCore::FocusController::FocusController):
    - Initialize combined m_viewState.
(WebCore::FocusController::setFocused):
    - Calls setViewState.
(WebCore::FocusController::setFocusedInternal):
    - setFocused -> setFocusedInternal.
(WebCore::FocusController::setViewState):
    - Added, update all ViewState flags.
(WebCore::FocusController::setActive):
    - Calls setViewState.
(WebCore::FocusController::setActiveInternal):
    - setActive -> setActiveInternal.
(WebCore::FocusController::setContentIsVisible):
    - Calls setViewState.
(WebCore::FocusController::setContentIsVisibleInternal):
    - setContentIsVisible -> setContentIsVisibleInternal.
* page/FocusController.h:
(WebCore::FocusController::isActive):
(WebCore::FocusController::isFocused):
(WebCore::FocusController::contentIsVisible):
    - Implemented in terms of ViewState.
* page/Page.cpp:
(WebCore::Page::Page):
    - Initialize using PageInitialViewState.
(WebCore::Page::setIsInWindow):
    - Calls setViewState.
(WebCore::Page::setIsInWindowInternal):
    - setIsInWindow -> setIsInWindowInternal.
(WebCore::Page::setIsVisuallyIdleInternal):
    - setIsVisuallyIdle -> setIsVisuallyIdleInternal.
(WebCore::Page::setViewState):
    - Added, update all ViewState flags, including FocusController.
(WebCore::Page::setIsVisible):
    - Calls setViewState.
(WebCore::Page::setIsVisibleInternal):
    - setIsVisible -> setIsVisibleInternal.
(WebCore::Page::visibilityState):
    - m_isVisible -> isVisible()
(WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
    - m_isVisible -> isVisible()
* page/Page.h:
(WebCore::Page::isVisible):
(WebCore::Page::isInWindow):
    - Implemented in terms of ViewState.
(WebCore::Page::scriptedAnimationsSuspended):
    - Combined member fields into ViewState::Flags.

Source/WebKit/mac: 

* WebView/WebView.mm:
(-[WebView _windowWillOrderOnScreen:]):
(-[WebView _windowWillOrderOffScreen:]):
    - remove calls to FocusController::setContentIsVisible, these are redundant
      (this is handled when page visibility is set).

Source/WebKit2: 

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
    - Combined separate calls to Page::setViewState.
(WebKit::WebPage::updateIsInWindow):
    - Simplied from setIsInWindow.
(WebKit::WebPage::setViewState):
    - Combined separate calls to Page::setViewState.
* WebProcess/WebPage/WebPage.h:
    - Declare updateIsInWindow.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162452 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ee418384
2014-01-21 Gavin Barraclough <barraclough@apple.com>
Change Page, FocusController to use ViewState
https://bugs.webkit.org/show_bug.cgi?id=126533
Reviewed by Tim Horton.
These classes currently maintain a set of separate fields to represent the view state;
combine these into a single field, and allow WebPage to send the combined update rather
than individual changes.
Maintain existing interface for WebKit1 clients.
* WebCore.exp.in:
- Added WebCore::setViewState, removed WebCore::setIsVisuallyIdle.
* page/FocusController.cpp:
(WebCore::FocusController::FocusController):
- Initialize combined m_viewState.
(WebCore::FocusController::setFocused):
- Calls setViewState.
(WebCore::FocusController::setFocusedInternal):
- setFocused -> setFocusedInternal.
(WebCore::FocusController::setViewState):
- Added, update all ViewState flags.
(WebCore::FocusController::setActive):
- Calls setViewState.
(WebCore::FocusController::setActiveInternal):
- setActive -> setActiveInternal.
(WebCore::FocusController::setContentIsVisible):
- Calls setViewState.
(WebCore::FocusController::setContentIsVisibleInternal):
- setContentIsVisible -> setContentIsVisibleInternal.
* page/FocusController.h:
(WebCore::FocusController::isActive):
(WebCore::FocusController::isFocused):
(WebCore::FocusController::contentIsVisible):
- Implemented in terms of ViewState.
* page/Page.cpp:
(WebCore::Page::Page):
- Initialize using PageInitialViewState.
(WebCore::Page::setIsInWindow):
- Calls setViewState.
(WebCore::Page::setIsInWindowInternal):
- setIsInWindow -> setIsInWindowInternal.
(WebCore::Page::setIsVisuallyIdleInternal):
- setIsVisuallyIdle -> setIsVisuallyIdleInternal.
(WebCore::Page::setViewState):
- Added, update all ViewState flags, including FocusController.
(WebCore::Page::setIsVisible):
- Calls setViewState.
(WebCore::Page::setIsVisibleInternal):
- setIsVisible -> setIsVisibleInternal.
(WebCore::Page::visibilityState):
- m_isVisible -> isVisible()
(WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
- m_isVisible -> isVisible()
* page/Page.h:
(WebCore::Page::isVisible):
(WebCore::Page::isInWindow):
- Implemented in terms of ViewState.
(WebCore::Page::scriptedAnimationsSuspended):
- Combined member fields into ViewState::Flags.
2014-01-21 Lauro Neto <lauro.neto@openbossa.org>
 
Remove PLATFORM(NIX) from WebCore
......@@ -484,7 +484,6 @@ __ZN7WebCore15FocusController10setFocusedEb
__ZN7WebCore15FocusController15setFocusedFrameEN3WTF10PassRefPtrINS_5FrameEEE
__ZN7WebCore15FocusController15setInitialFocusENS_14FocusDirectionEPNS_13KeyboardEventE
__ZN7WebCore15FocusController17setFocusedElementEPNS_7ElementEN3WTF10PassRefPtrINS_5FrameEEENS_14FocusDirectionE
__ZN7WebCore15FocusController19setContentIsVisibleEb
__ZN7WebCore15FocusController9setActiveEb
__ZN7WebCore15GraphicsContext10strokeRectERKNS_9FloatRectEf
__ZN7WebCore15GraphicsContext11clearShadowEv
......@@ -975,6 +974,7 @@ __ZN7WebCore4Page11PageClientsC1Ev
__ZN7WebCore4Page11PageClientsD1Ev
__ZN7WebCore4Page12setGroupNameERKN3WTF6StringE
__ZN7WebCore4Page12setIsVisibleEbb
__ZN7WebCore4Page12setViewStateEjb
__ZN7WebCore4Page13rangeOfStringERKN3WTF6StringEPNS_5RangeEj
__ZN7WebCore4Page13setIsInWindowEb
__ZN7WebCore4Page13setPaginationERKNS_10PaginationE
......@@ -984,7 +984,6 @@ __ZN7WebCore4Page15addSchedulePairEN3WTF10PassRefPtrINS1_12SchedulePairEEE
__ZN7WebCore4Page16countFindMatchesERKN3WTF6StringEjj
__ZN7WebCore4Page16setCanStartMediaEb
__ZN7WebCore4Page16setDefersLoadingEb
__ZN7WebCore4Page17setIsVisuallyIdleEb
__ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS1_12SchedulePairEEE
__ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE
#if ENABLE(RUBBER_BANDING)
......
......@@ -158,12 +158,10 @@ static inline bool shouldVisit(Element& element, KeyboardEvent& event)
return element.isKeyboardFocusable(&event) || isNonFocusableShadowHost(element, event);
}
FocusController::FocusController(Page& page)
FocusController::FocusController(Page& page, ViewState::Flags viewState)
: m_page(page)
, m_isActive(false)
, m_isFocused(false)
, m_isChangingFocusedFrame(false)
, m_contentIsVisible(false)
, m_viewState(viewState)
{
}
......@@ -205,12 +203,12 @@ Frame& FocusController::focusedOrMainFrame() const
void FocusController::setFocused(bool focused)
{
if (isFocused() == focused)
return;
m_isFocused = focused;
m_page.setViewState(focused ? m_viewState | ViewState::IsFocused : m_viewState & ~ViewState::IsFocused);
}
if (!m_isFocused)
void FocusController::setFocusedInternal(bool focused)
{
if (!isFocused())
focusedOrMainFrame().eventHandler().stopAutoscrollTimer();
if (!m_focusedFrame)
......@@ -635,13 +633,26 @@ bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newF
return true;
}
void FocusController::setActive(bool active)
void FocusController::setViewState(ViewState::Flags viewState)
{
if (m_isActive == active)
return;
ViewState::Flags changed = m_viewState ^ viewState;
m_viewState = viewState;
m_isActive = active;
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);
}
void FocusController::setActiveInternal(bool active)
{
if (FrameView* view = m_page.mainFrame().view()) {
if (!view->platformWidget()) {
view->updateLayoutAndStyleIfNeededRecursive();
......@@ -663,13 +674,8 @@ static void contentAreaDidShowOrHide(ScrollableArea* scrollableArea, bool didSho
scrollableArea->contentAreaDidHide();
}
void FocusController::setContentIsVisible(bool contentIsVisible)
void FocusController::setIsVisibleInternal(bool contentIsVisible)
{
if (m_contentIsVisible == contentIsVisible)
return;
m_contentIsVisible = contentIsVisible;
FrameView* view = m_page.mainFrame().view();
if (!view)
return;
......
......@@ -28,6 +28,7 @@
#include "FocusDirection.h"
#include "LayoutRect.h"
#include "ViewState.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/RefPtr.h>
......@@ -62,7 +63,7 @@ private:
class FocusController {
WTF_MAKE_NONCOPYABLE(FocusController); WTF_MAKE_FAST_ALLOCATED;
public:
explicit FocusController(Page&);
explicit FocusController(Page&, ViewState::Flags);
void setFocusedFrame(PassRefPtr<Frame>);
Frame* focusedFrame() const { return m_focusedFrame.get(); }
......@@ -73,19 +74,25 @@ public:
bool setFocusedElement(Element*, PassRefPtr<Frame>, FocusDirection = FocusDirectionNone);
void setViewState(ViewState::Flags);
void setActive(bool);
bool isActive() const { return m_isActive; }
bool isActive() const { return m_viewState & ViewState::WindowIsActive; }
void setFocused(bool);
bool isFocused() const { return m_isFocused; }
bool isFocused() const { return m_viewState & ViewState::IsFocused; }
void setContentIsVisible(bool);
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*);
private:
void setActiveInternal(bool);
void setFocusedInternal(bool);
void setIsVisibleInternal(bool);
bool advanceFocusDirectionally(FocusDirection, KeyboardEvent*);
bool advanceFocusInDocumentOrder(FocusDirection, KeyboardEvent*, bool initialFocus);
......@@ -111,11 +118,8 @@ private:
Page& m_page;
RefPtr<Frame> m_focusedFrame;
bool m_isActive;
bool m_isFocused;
bool m_isChangingFocusedFrame;
bool m_contentIsVisible;
ViewState::Flags m_viewState;
};
} // namespace WebCore
......
......@@ -124,13 +124,15 @@ 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))
, m_focusController(std::make_unique<FocusController>(*this, PageInitialViewState))
#if ENABLE(CONTEXT_MENUS)
, m_contextMenuController(std::make_unique<ContextMenuController>(*this, *pageClients.contextMenuClient))
#endif
......@@ -172,9 +174,8 @@ 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)
......@@ -881,11 +882,11 @@ unsigned Page::pageCount() const
void Page::setIsInWindow(bool isInWindow)
{
if (m_isInWindow == isInWindow)
return;
m_isInWindow = isInWindow;
setViewState(isInWindow ? m_viewState | ViewState::IsInWindow : m_viewState & ~ViewState::IsInWindow);
}
void Page::setIsInWindowInternal(bool isInWindow)
{
for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
if (FrameView* frameView = frame->view())
frameView->setIsInWindow(isInWindow);
......@@ -913,7 +914,7 @@ void Page::resumeScriptedAnimations()
}
}
void Page::setIsVisuallyIdle(bool isVisuallyIdle)
void Page::setIsVisuallyIdleInternal(bool isVisuallyIdle)
{
m_pageThrottler->setIsVisuallyIdle(isVisuallyIdle);
}
......@@ -1216,15 +1217,37 @@ 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;
......@@ -1286,7 +1309,7 @@ void Page::setIsPrerender()
#if ENABLE(PAGE_VISIBILITY_API)
PageVisibilityState Page::visibilityState() const
{
if (m_isVisible)
if (isVisible())
return PageVisibilityStateVisible;
if (m_isPrerender)
return PageVisibilityStatePrerender;
......@@ -1548,7 +1571,7 @@ void Page::hiddenPageDOMTimerThrottlingStateChanged()
#if (ENABLE_PAGE_VISIBILITY_API)
void Page::hiddenPageCSSAnimationSuspensionStateChanged()
{
if (!m_isVisible) {
if (!isVisible()) {
if (m_settings->hiddenPageCSSAnimationSuspensionEnabled())
mainFrame().animation().suspendAnimations();
else
......
......@@ -31,6 +31,7 @@
#include "PlatformScreen.h"
#include "Region.h"
#include "Supplementable.h"
#include "ViewState.h"
#include "ViewportArguments.h"
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
......@@ -297,18 +298,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_isVisible; }
bool isVisible() const { return m_viewState & ViewState::IsVisible; }
// Notification that this Page was moved into or out of a native window.
void setIsInWindow(bool);
bool isInWindow() const { return m_isInWindow; }
bool isInWindow() const { return m_viewState & ViewState::IsInWindow; }
void suspendScriptedAnimations();
void resumeScriptedAnimations();
bool scriptedAnimationsSuspended() const { return m_scriptedAnimationsSuspended; }
void setIsVisuallyIdle(bool);
void userStyleSheetLocationChanged();
const String& userStyleSheet() const;
......@@ -425,6 +426,10 @@ public:
private:
void initGroup();
void setIsInWindowInternal(bool);
void setIsVisibleInternal(bool isVisible, bool isInitial);
void setIsVisuallyIdleInternal(bool);
#if ASSERT_DISABLED
void checkSubframeCountConsistency() const { }
#else
......@@ -528,9 +533,8 @@ 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 Gavin Barraclough <barraclough@apple.com>
Change Page, FocusController to use ViewState
https://bugs.webkit.org/show_bug.cgi?id=126533
Reviewed by Tim Horton.
These classes currently maintain a set of separate fields to represent the view state;
combine these into a single field, and allow WebPage to send the combined update rather
than individual changes.
Maintain existing interface for WebKit1 clients.
* WebView/WebView.mm:
(-[WebView _windowWillOrderOnScreen:]):
(-[WebView _windowWillOrderOffScreen:]):
- remove calls to FocusController::setContentIsVisible, these are redundant
(this is handled when page visibility is set).
2014-01-20 Jeremy Jones <jeremyj@apple.com>
Add AVKit fullscreen video interface.
......
......@@ -5371,10 +5371,8 @@ 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
......@@ -5384,10 +5382,8 @@ 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 Gavin Barraclough <barraclough@apple.com>
Change Page, FocusController to use ViewState
https://bugs.webkit.org/show_bug.cgi?id=126533
Reviewed by Tim Horton.
These classes currently maintain a set of separate fields to represent the view state;
combine these into a single field, and allow WebPage to send the combined update rather
than individual changes.
Maintain existing interface for WebKit1 clients.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
- Combined separate calls to Page::setViewState.
(WebKit::WebPage::updateIsInWindow):
- Simplied from setIsInWindow.
(WebKit::WebPage::setViewState):
- Combined separate calls to Page::setViewState.
* WebProcess/WebPage/WebPage.h:
- Declare updateIsInWindow.
2014-01-21 Carlos Garcia Campos <cgarcia@igalia.com>
 
[SOUP] Implement CUSTOM PROTOCOLS
......
......@@ -373,17 +373,8 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
setMemoryCacheMessagesEnabled(parameters.areMemoryCacheClientCallsEnabled);
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);
m_page->setViewState(m_viewState, true);
updateIsInWindow(true);
setMinimumLayoutSize(parameters.minimumLayoutSize);
setAutoSizingShouldExpandToViewHeight(parameters.autoSizingShouldExpandToViewHeight);
......@@ -427,9 +418,6 @@ 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)
......@@ -1924,18 +1912,6 @@ 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)
......@@ -1991,11 +1967,6 @@ 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)
......@@ -2050,15 +2021,16 @@ inline bool WebPage::canHandleUserEvents() const
return true;
}
void WebPage::setIsInWindow(bool isInWindow)
void WebPage::updateIsInWindow(bool isInitialState)
{
bool pageWasInWindow = m_page->isInWindow();
bool isInWindow = m_viewState & WebCore::ViewState::IsInWindow;
if (!isInWindow) {
m_setCanStartMediaTimer.stop();
m_page->setCanStartMedia(false);
if (pageWasInWindow)
// The WebProcess does not yet know about this page; no need to tell it we're leaving the window.
if (!isInitialState)
WebProcess::shared().pageWillLeaveWindow(m_pageID);
} else {
// Defer the call to Page::setCanStartMedia() since it ends up sending a synchronous message to the UI process
......@@ -2067,12 +2039,9 @@ void WebPage::setIsInWindow(bool isInWindow)
if (m_mayStartMediaWhenInWindow)
m_setCanStartMediaTimer.startOneShot(0);
if (!pageWasInWindow)
WebProcess::shared().pageDidEnterWindow(m_pageID);
WebProcess::shared().pageDidEnterWindow(m_pageID);
}
m_page->setIsInWindow(isInWindow);
if (isInWindow)
layoutIfNeeded();
}
......@@ -2091,24 +2060,12 @@ void WebPage::setViewStateInternal(ViewState::Flags viewState, bool isInitialSta
m_viewState = viewState;
m_drawingArea->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)
setIsInWindow(viewState & ViewState::IsInWindow);
if (changed & ViewState::IsVisuallyIdle)
setIsVisuallyIdle(viewState & ViewState::IsVisuallyIdle);
m_page->setViewState(viewState, isInitialState);
for (auto* pluginView : m_pluginViews)
pluginView->viewStateDidChange(changed);
if (changed & ViewState::IsInWindow)
updateIsInWindow();
}
void WebPage::setLayerHostingMode(unsigned layerHostingMode)
......@@ -3712,11 +3669,6 @@ void WebPage::setVisibilityStatePrerender()
m_page->setIsPrerender();
}
void WebPage::setIsVisuallyIdle(bool isVisuallyIdle)
{
m_page->setIsVisuallyIdle(isVisuallyIdle);
}
void WebPage::setScrollingPerformanceLoggingEnabled(bool enabled)
{
m_scrollingPerformanceLoggingEnabled = enabled;
......
......@@ -737,8 +737,7 @@ private:
void setViewIsVisible(bool);
void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
void setWindowResizerSize(const WebCore::IntSize&);
void setIsInWindow(bool);
void setIsVisuallyIdle(bool);
void updateIsInWindow(bool isInitialState = false);
void setViewState(WebCore::ViewState::Flags, bool wantsDidUpdateViewState);
void setViewStateInternal(WebCore::ViewState::Flags, bool isInitialState);
void validateCommand(const String&, uint64_t);
......