Commit aecbfa41 authored by barraclough@apple.com's avatar barraclough@apple.com

Move ViewState to WebCore

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

Reviewed by Anders Carlson.

This change also partial reverts handling of LayerHostingMode, making this
a separate message again. With hindsight the new way of doing this wasn't
in all ways simpler, and it won't make sense to move this to WebCore.

Source/WebCore: 

* WebCore.xcodeproj/project.pbxproj:
* page/ViewState.h: Added.
    - Moved from WebKit2, will be used by Page & FocusController.

Source/WebKit2: 

* Shared/ViewState.h: Removed.
    - Moved to WebCore.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
    - Added layerHostingMode.
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::PageClientImpl):
(WebKit::PageClientImpl::viewLayerHostingMode):
* UIProcess/PageClient.h:
(WebKit::PageClient::viewLayerHostingMode):
    - Revert isLayerWindowServerHosted -> viewLayerHostingMode.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
    - Added back m_layerHostingMode.
(WebKit::WebPageProxy::updateViewState):
    - Removed IsLayerWindowServerHosted from ViewState.
(WebKit::WebPageProxy::viewStateDidChange):
    - Added SetLayerHostingMode message.
(WebKit::WebPageProxy::initializeCreationParameters):
    - Pass layerHostingMode.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::isInWindow):
(WebKit::WebPageProxy::isViewVisible):
    - ViewState moved to WebCore.
* WebKit2.xcodeproj/project.pbxproj:
    - Removed ViewState.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::setLayerHostingMode):
(WebKit::PluginView::platformViewStateDidChange):
    - Separated setLayerHostingMode from platformViewStateDidChange.
* WebProcess/Plugins/PluginView.h:
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::viewStateDidChange):
(WebKit::DrawingArea::setLayerHostingMode):
    - Added virtual function, overridden in TiledCoreAnimationDrawingArea.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::setLayerHostingMode):
    - Separated setLayerHostingMode from platformViewStateDidChange.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::isVisible):
(WebKit::WebPage::layerHostingMode):
    - ViewState moved to WebCore.
* WebProcess/WebPage/WebPage.messages.in:
    - Added SetLayerHostingMode message.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::viewStateDidChange):
    - viewStateDidChange no longer calls setLayerHostingMode (this is called by WebPage).



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 752acb36
2014-01-06 Gavin Barraclough <barraclough@apple.com>
Move ViewState to WebCore
https://bugs.webkit.org/show_bug.cgi?id=126488
Reviewed by Anders Carlson.
This change also partial reverts handling of LayerHostingMode, making this
a separate message again. With hindsight the new way of doing this wasn't
in all ways simpler, and it won't make sense to move this to WebCore.
* WebCore.xcodeproj/project.pbxproj:
* page/ViewState.h: Added.
- Moved from WebKit2, will be used by Page & FocusController.
2014-01-06 Martin Robinson <mrobinson@igalia.com>
[CMake] [GTK] Fix the build for the WebKitGTK+ developer configuration
......@@ -2861,6 +2861,7 @@
861C2EA613FB4FFF00062ABB /* ResourceLoadTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 861C2EA513FB4FFF00062ABB /* ResourceLoadTiming.cpp */; };
86512EDE154A2AEF00A90426 /* PerformanceResourceTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86512EDB154A2AEE00A90426 /* PerformanceResourceTiming.cpp */; };
86512EDF154A2AEF00A90426 /* PerformanceResourceTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 86512EDC154A2AEF00A90426 /* PerformanceResourceTiming.h */; };
8678D0BB1878E891003ABDE6 /* ViewState.h in Headers */ = {isa = PBXBuildFile; fileRef = 8678D0BA1878E810003ABDE6 /* ViewState.h */; settings = {ATTRIBUTES = (Private, ); }; };
868160D418766A0A0021E79D /* UserActivity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 868160D1187669C40021E79D /* UserActivity.cpp */; };
868160D518766A0E0021E79D /* UserActivityMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 868160D3187669E70021E79D /* UserActivityMac.mm */; };
868160D618766A130021E79D /* UserActivity.h in Headers */ = {isa = PBXBuildFile; fileRef = 868160D2187669C40021E79D /* UserActivity.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -9653,6 +9654,7 @@
86512EDB154A2AEE00A90426 /* PerformanceResourceTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceResourceTiming.cpp; sourceTree = "<group>"; };
86512EDC154A2AEF00A90426 /* PerformanceResourceTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceResourceTiming.h; sourceTree = "<group>"; };
86512EDD154A2AEF00A90426 /* PerformanceResourceTiming.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PerformanceResourceTiming.idl; sourceTree = "<group>"; };
8678D0BA1878E810003ABDE6 /* ViewState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewState.h; sourceTree = "<group>"; };
868160D1187669C40021E79D /* UserActivity.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UserActivity.cpp; sourceTree = "<group>"; };
868160D2187669C40021E79D /* UserActivity.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserActivity.h; sourceTree = "<group>"; };
868160D3187669E70021E79D /* UserActivityMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UserActivityMac.mm; sourceTree = "<group>"; };
......@@ -15939,6 +15941,7 @@
BC8BF150105813BF00A40A07 /* UserStyleSheet.h */,
BC8BF1591058141800A40A07 /* UserStyleSheetTypes.h */,
F513A3E915FF4841001526DB /* ValidationMessageClient.h */,
8678D0BA1878E810003ABDE6 /* ViewState.h */,
BE983D95052A2E0A00892D85 /* WebCoreKeyboardUIMode.h */,
494BD7930F55C8EE00747828 /* WebKitPoint.h */,
494BD7940F55C8EE00747828 /* WebKitPoint.idl */,
......@@ -22835,6 +22838,7 @@
854075690AD6CBF900620C57 /* DOMHTMLAppletElement.h in Headers */,
855247CF0AD850B80012093B /* DOMHTMLAppletElementInternal.h in Headers */,
85ECBEEB0AA7626900544F0B /* DOMHTMLAreaElement.h in Headers */,
8678D0BB1878E891003ABDE6 /* ViewState.h in Headers */,
85E7119C0AC5D5350053270F /* DOMHTMLAreaElementInternal.h in Headers */,
859A9C470AA5E3BD00B694B2 /* DOMHTMLBaseElement.h in Headers */,
85E7119D0AC5D5350053270F /* DOMHTMLBaseElementInternal.h in Headers */,
......@@ -26,7 +26,7 @@
#ifndef ViewState_h
#define ViewState_h
namespace WebKit {
namespace WebCore {
struct ViewState {
enum {
......@@ -35,15 +35,14 @@ struct ViewState {
IsVisible = 1 << 2,
IsInWindow = 1 << 3,
IsVisuallyIdle = 1 << 4,
IsLayerWindowServerHosted = 1 << 5,
};
typedef unsigned Flags;
static const Flags NoFlags = 0;
static const Flags AllFlags = WindowIsActive | IsFocused | IsVisible | IsInWindow | IsLayerWindowServerHosted | IsVisuallyIdle;
static const Flags AllFlags = WindowIsActive | IsFocused | IsVisible | IsInWindow | IsVisuallyIdle;
};
} // namespace WebKit
} // namespace WebCore
#endif // ViewState_h
2014-01-06 Gavin Barraclough <barraclough@apple.com>
Move ViewState to WebCore
https://bugs.webkit.org/show_bug.cgi?id=126488
Reviewed by Anders Carlson.
This change also partial reverts handling of LayerHostingMode, making this
a separate message again. With hindsight the new way of doing this wasn't
in all ways simpler, and it won't make sense to move this to WebCore.
* Shared/ViewState.h: Removed.
- Moved to WebCore.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
- Added layerHostingMode.
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::PageClientImpl):
(WebKit::PageClientImpl::viewLayerHostingMode):
* UIProcess/PageClient.h:
(WebKit::PageClient::viewLayerHostingMode):
- Revert isLayerWindowServerHosted -> viewLayerHostingMode.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
- Added back m_layerHostingMode.
(WebKit::WebPageProxy::updateViewState):
- Removed IsLayerWindowServerHosted from ViewState.
(WebKit::WebPageProxy::viewStateDidChange):
- Added SetLayerHostingMode message.
(WebKit::WebPageProxy::initializeCreationParameters):
- Pass layerHostingMode.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::isInWindow):
(WebKit::WebPageProxy::isViewVisible):
- ViewState moved to WebCore.
* WebKit2.xcodeproj/project.pbxproj:
- Removed ViewState.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::setLayerHostingMode):
(WebKit::PluginView::platformViewStateDidChange):
- Separated setLayerHostingMode from platformViewStateDidChange.
* WebProcess/Plugins/PluginView.h:
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::viewStateDidChange):
(WebKit::DrawingArea::setLayerHostingMode):
- Added virtual function, overridden in TiledCoreAnimationDrawingArea.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::setLayerHostingMode):
- Separated setLayerHostingMode from platformViewStateDidChange.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::isVisible):
(WebKit::WebPage::layerHostingMode):
- ViewState moved to WebCore.
* WebProcess/WebPage/WebPage.messages.in:
- Added SetLayerHostingMode message.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::viewStateDidChange):
- viewStateDidChange no longer calls setLayerHostingMode (this is called by WebPage).
2014-01-06 Martin Robinson <mrobinson@igalia.com>
[GTK] [CMake] Parallel builds still fail when building WebKit2 GObject API unit tests
......
......@@ -60,6 +60,7 @@ void WebPageCreationParameters::encode(IPC::ArgumentEncoder& encoder) const
encoder << autoSizingShouldExpandToViewHeight;
encoder.encodeEnum(scrollPinningBehavior);
encoder << backgroundExtendsBeyondPage;
encoder.encodeEnum(layerHostingMode);
#if PLATFORM(MAC)
encoder << colorSpace;
......@@ -122,6 +123,8 @@ bool WebPageCreationParameters::decode(IPC::ArgumentDecoder& decoder, WebPageCre
return false;
if (!decoder.decode(parameters.backgroundExtendsBeyondPage))
return false;
if (!decoder.decodeEnum(parameters.layerHostingMode))
return false;
#if PLATFORM(MAC)
if (!decoder.decode(parameters.colorSpace))
......
......@@ -27,8 +27,8 @@
#define WebPageCreationParameters_h
#include "DrawingAreaInfo.h"
#include "LayerTreeContext.h"
#include "SessionState.h"
#include "ViewState.h"
#include "WebCoreArgumentCoders.h"
#include "WebPageGroupData.h"
#include "WebPreferencesStore.h"
......@@ -36,6 +36,7 @@
#include <WebCore/IntSize.h>
#include <WebCore/Pagination.h>
#include <WebCore/ScrollTypes.h>
#include <WebCore/ViewState.h>
#include <wtf/text/WTFString.h>
#if PLATFORM(MAC)
......@@ -55,7 +56,7 @@ struct WebPageCreationParameters {
WebCore::IntSize viewSize;
ViewState::Flags viewState;
WebCore::ViewState::Flags viewState;
WebPreferencesStore store;
DrawingAreaType drawingAreaType;
......@@ -98,6 +99,8 @@ struct WebPageCreationParameters {
bool backgroundExtendsBeyondPage;
LayerHostingMode layerHostingMode;
#if PLATFORM(MAC)
ColorSpaceData colorSpace;
#endif
......
......@@ -66,9 +66,7 @@ private:
virtual bool isViewVisible();
virtual bool isViewInWindow();
virtual bool isVisuallyIdle();
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
virtual bool isLayerWindowServerHosted();
#endif
virtual LayerHostingMode viewLayerHostingMode() OVERRIDE;
virtual ColorSpaceData colorSpace() OVERRIDE;
virtual void setAcceleratedCompositingRootLayer(CALayer *) OVERRIDE;
......@@ -165,9 +163,6 @@ private:
#if USE(DICTATION_ALTERNATIVES)
OwnPtr<WebCore::AlternativeTextUIController> m_alternativeTextUIController;
#endif
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
bool m_isLayerWindowServerHosted;
#endif
};
} // namespace WebKit
......
......@@ -31,7 +31,6 @@
#import "DataReference.h"
#import "DictionaryPopupInfo.h"
#import "FindIndicator.h"
#import "LayerTreeContext.h"
#import "NativeWebKeyboardEvent.h"
#import "StringUtilities.h"
#import "WKAPICast.h"
......@@ -129,9 +128,6 @@ PageClientImpl::PageClientImpl(WKView* wkView)
#if USE(DICTATION_ALTERNATIVES)
, m_alternativeTextUIController(adoptPtr(new AlternativeTextUIController))
#endif
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
, m_isLayerWindowServerHosted(true)
#endif
{
}
......@@ -220,16 +216,14 @@ bool PageClientImpl::isVisuallyIdle()
return WindowServerConnection::shared().applicationWindowModificationsHaveStopped() || !isViewVisible();
}
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
bool PageClientImpl::isLayerWindowServerHosted()
LayerHostingMode PageClientImpl::viewLayerHostingMode()
{
// Only update m_isLayerWindowServerHosted when the view is in a window - otherwise just report the last value.
if ([m_wkView window])
m_isLayerWindowServerHosted = [[m_wkView window] _hostsLayersInWindowServer];
return m_isLayerWindowServerHosted;
}
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
if ([m_wkView window] && [[m_wkView window] _hostsLayersInWindowServer])
return LayerHostingModeInWindowServer;
#endif
return LayerHostingModeDefault;
}
void PageClientImpl::viewWillMoveToAnotherWindow()
{
......
......@@ -111,10 +111,8 @@ public:
// Return whether the view is visually idle.
virtual bool isVisuallyIdle() { return !isViewVisible(); }
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
// Return whether the layer is window server hosted.
virtual bool isLayerWindowServerHosted() = 0;
#endif
// Return the layer hosting mode for the view.
virtual LayerHostingMode viewLayerHostingMode() { return LayerHostingModeDefault; }
virtual void processDidCrash() = 0;
virtual void didRelaunchProcess() = 0;
......
......@@ -245,6 +245,7 @@ WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, Web
, m_pageScaleFactor(1)
, m_intrinsicDeviceScaleFactor(1)
, m_customDeviceScaleFactor(0)
, m_layerHostingMode(LayerHostingModeDefault)
, m_drawsBackground(true)
, m_drawsTransparentBackground(false)
, m_areMemoryCacheClientCallsEnabled(true)
......@@ -311,6 +312,10 @@ WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, Web
{
updateViewState();
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
m_layerHostingMode = m_viewState & ViewState::IsInWindow ? m_pageClient.viewLayerHostingMode() : LayerHostingModeInWindowServer;
#endif
platformInitialize();
#ifndef NDEBUG
......@@ -936,10 +941,6 @@ void WebPageProxy::updateViewState(ViewState::Flags flagsToUpdate)
m_viewState |= ViewState::IsInWindow;
if (flagsToUpdate & ViewState::IsVisuallyIdle && m_pageClient.isVisuallyIdle())
m_viewState |= ViewState::IsVisuallyIdle;
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
if (flagsToUpdate & ViewState::IsLayerWindowServerHosted && m_pageClient.isLayerWindowServerHosted())
m_viewState |= ViewState::IsLayerWindowServerHosted;
#endif
}
void WebPageProxy::viewStateDidChange(ViewState::Flags mayHaveChanged, WantsReplyOrNot wantsReply)
......@@ -947,9 +948,6 @@ void WebPageProxy::viewStateDidChange(ViewState::Flags mayHaveChanged, WantsRepl
if (!isValid())
return;
// If the in-window state may have changed, then so may the layer hosting.
if (mayHaveChanged & ViewState::IsInWindow)
mayHaveChanged |= ViewState::IsLayerWindowServerHosted;
// If the visibility state may have changed, then so may the visually idle.
if (mayHaveChanged & ViewState::IsVisible)
mayHaveChanged |= ViewState::IsVisuallyIdle;
......@@ -966,17 +964,22 @@ void WebPageProxy::viewStateDidChange(ViewState::Flags mayHaveChanged, WantsRepl
if (changed & ViewState::IsVisuallyIdle)
m_process->pageSuppressibilityChanged(this);
if (changed & ViewState::IsVisible) {
if (!isViewVisible()) {
// If we've started the responsiveness timer as part of telling the web process to update the backing store
// state, it might not send back a reply (since it won't paint anything if the web page is hidden) so we
// stop the unresponsiveness timer here.
m_process->responsivenessTimer()->stop();
// If we've started the responsiveness timer as part of telling the web process to update the backing store
// state, it might not send back a reply (since it won't paint anything if the web page is hidden) so we
// stop the unresponsiveness timer here.
if ((changed & ViewState::IsVisible) && !isViewVisible())
m_process->responsivenessTimer()->stop();
if ((mayHaveChanged & ViewState::IsInWindow) && (m_viewState & ViewState::IsInWindow)) {
LayerHostingMode layerHostingMode = m_pageClient.viewLayerHostingMode();
if (m_layerHostingMode != layerHostingMode) {
m_layerHostingMode = layerHostingMode;
m_process->send(Messages::WebPage::SetLayerHostingMode(layerHostingMode), m_pageID);
}
}
#if ENABLE(INPUT_TYPE_COLOR_POPOVER)
if (mayHaveChanged & ViewState::IsInWindow && !(m_viewState & ViewState::IsInWindow)) {
if ((mayHaveChanged & ViewState::IsInWindow) && !(m_viewState & ViewState::IsInWindow)) {
// When leaving the current page, close the popover color well.
if (m_colorPicker)
endColorPicker();
......@@ -3888,6 +3891,7 @@ void WebPageProxy::initializeCreationParameters()
m_creationParameters.autoSizingShouldExpandToViewHeight = m_autoSizingShouldExpandToViewHeight;
m_creationParameters.scrollPinningBehavior = m_scrollPinningBehavior;
m_creationParameters.backgroundExtendsBeyondPage = m_backgroundExtendsBeyondPage;
m_creationParameters.layerHostingMode = m_layerHostingMode;
#if PLATFORM(MAC) && !PLATFORM(IOS)
m_creationParameters.colorSpace = m_pageClient.colorSpace();
......
......@@ -33,13 +33,13 @@
#include "DrawingAreaProxy.h"
#include "EditorState.h"
#include "GeolocationPermissionRequestManagerProxy.h"
#include "LayerTreeContext.h"
#include "MessageSender.h"
#include "NotificationPermissionRequestManagerProxy.h"
#include "PageLoadState.h"
#include "PlatformProcessIdentifier.h"
#include "SandboxExtension.h"
#include "ShareableBitmap.h"
#include "ViewState.h"
#include "WKBase.h"
#include "WKPagePrivate.h"
#include "WebColorPicker.h"
......@@ -67,6 +67,7 @@
#include <WebCore/ScrollTypes.h>
#include <WebCore/TextChecking.h>
#include <WebCore/TextGranularity.h>
#include <WebCore/ViewState.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/OwnPtr.h>
......@@ -418,12 +419,12 @@ public:
void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
enum class WantsReplyOrNot { DoesNotWantReply, DoesWantReply };
void viewStateDidChange(ViewState::Flags mayHaveChanged, WantsReplyOrNot = WantsReplyOrNot::DoesNotWantReply);
bool isInWindow() const { return m_viewState & ViewState::IsInWindow; }
void viewStateDidChange(WebCore::ViewState::Flags mayHaveChanged, WantsReplyOrNot = WantsReplyOrNot::DoesNotWantReply);
bool isInWindow() const { return m_viewState & WebCore::ViewState::IsInWindow; }
void waitForDidUpdateViewState();
WebCore::IntSize viewSize() const;
bool isViewVisible() const { return m_viewState & ViewState::IsVisible; }
bool isViewVisible() const { return m_viewState & WebCore::ViewState::IsVisible; }
bool isViewWindowActive() const;
bool isProcessSuppressible() const;
......@@ -857,7 +858,7 @@ private:
void platformInitialize();
void initializeCreationParameters();
void updateViewState(ViewState::Flags flagsToUpdate = ViewState::AllFlags);
void updateViewState(WebCore::ViewState::Flags flagsToUpdate = WebCore::ViewState::AllFlags);
void resetState();
void resetStateAfterProcessExited();
......@@ -1218,7 +1219,7 @@ private:
GeolocationPermissionRequestManagerProxy m_geolocationPermissionRequestManager;
NotificationPermissionRequestManagerProxy m_notificationPermissionRequestManager;
ViewState::Flags m_viewState;
WebCore::ViewState::Flags m_viewState;
bool m_canGoBack;
bool m_canGoForward;
......@@ -1240,6 +1241,8 @@ private:
float m_intrinsicDeviceScaleFactor;
float m_customDeviceScaleFactor;
LayerHostingMode m_layerHostingMode;
bool m_drawsBackground;
bool m_drawsTransparentBackground;
......
......@@ -782,7 +782,6 @@
7CF47FFE17276AE3008ACB91 /* WKBundlePageBannerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CF47FFC17276AE3008ACB91 /* WKBundlePageBannerMac.mm */; };
7CF47FFF17276AE3008ACB91 /* WKBundlePageBannerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CF47FFD17276AE3008ACB91 /* WKBundlePageBannerMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
84477853176FCC0800CDC7BB /* InjectedBundleHitTestResultMediaType.h in Headers */ = {isa = PBXBuildFile; fileRef = 84477851176FCAC100CDC7BB /* InjectedBundleHitTestResultMediaType.h */; };
865E0485181A094A001F72F2 /* ViewState.h in Headers */ = {isa = PBXBuildFile; fileRef = 865E0484181A090D001F72F2 /* ViewState.h */; };
868160D0187645570021E79D /* WindowServerConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 868160CF187645370021E79D /* WindowServerConnection.mm */; };
8CFECE941490F140002AAA32 /* EditorState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CFECE931490F140002AAA32 /* EditorState.cpp */; };
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
......@@ -2402,7 +2401,6 @@
7CF47FFC17276AE3008ACB91 /* WKBundlePageBannerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKBundlePageBannerMac.mm; sourceTree = "<group>"; };
7CF47FFD17276AE3008ACB91 /* WKBundlePageBannerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePageBannerMac.h; sourceTree = "<group>"; };
84477851176FCAC100CDC7BB /* InjectedBundleHitTestResultMediaType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleHitTestResultMediaType.h; sourceTree = "<group>"; };
865E0484181A090D001F72F2 /* ViewState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewState.h; sourceTree = "<group>"; };
868160CD18763D4B0021E79D /* WindowServerConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WindowServerConnection.h; sourceTree = "<group>"; };
868160CF187645370021E79D /* WindowServerConnection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WindowServerConnection.mm; sourceTree = "<group>"; };
8CFECE931490F140002AAA32 /* EditorState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EditorState.cpp; sourceTree = "<group>"; };
......@@ -3581,7 +3579,6 @@
1AC1336518565B5700F3EC05 /* UserData.cpp */,
1AC1336618565B5700F3EC05 /* UserData.h */,
BCB0B0DF12305AB100B1341E /* UserMessageCoders.h */,
865E0484181A090D001F72F2 /* ViewState.h */,
1A0F29C9120B37160053D1B9 /* VisitedLinkTable.cpp */,
1A0F29CA120B37160053D1B9 /* VisitedLinkTable.h */,
BC329D9916ACCE9900316DE2 /* WebArchive.cpp */,
......@@ -5771,7 +5768,6 @@
515E7730184015800007203F /* UniqueIDBDatabase.h in Headers */,
B878B615133428DC006888E9 /* CorrectionPanel.h in Headers */,
2989A414167D184B004F96D2 /* CustomProtocolManager.h in Headers */,
865E0485181A094A001F72F2 /* ViewState.h in Headers */,
371B32DE184D67490013E2B2 /* WKNSURLProtectionSpace.h in Headers */,
2984F589164BA095004BC0C6 /* CustomProtocolManagerMessages.h in Headers */,
29AD3093164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h in Headers */,
......
......@@ -364,6 +364,21 @@ void PluginView::recreateAndInitialize(PassRefPtr<Plugin> plugin)
initializePlugin();
}
void PluginView::setLayerHostingMode(LayerHostingMode layerHostingMode)
{
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
if (!m_plugin)
return;
if (m_isInitialized)
m_plugin->setLayerHostingMode(layerHostingMode);
else
m_parameters.layerHostingMode = layerHostingMode;
#else
UNUSED_PARAM(layerHostingMode);
#endif
}
Frame* PluginView::frame() const
{
return m_pluginElement->document().frame();
......@@ -491,24 +506,13 @@ void PluginView::viewStateDidChange(ViewState::Flags changed)
#if PLATFORM(MAC)
void PluginView::platformViewStateDidChange(ViewState::Flags changed)
{
if (!m_plugin)
return;
if (!m_isInitialized) {
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
m_parameters.layerHostingMode = m_webPage->layerHostingMode();
#endif
if (!m_plugin || !m_isInitialized)
return;
}
if (changed & ViewState::IsVisible)
m_plugin->windowVisibilityChanged(m_webPage->isVisible());
if (changed & ViewState::WindowIsActive)
m_plugin->windowFocusChanged(m_webPage->windowIsFocused());
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
if (changed & ViewState::IsLayerWindowServerHosted)
m_plugin->setLayerHostingMode(m_webPage->layerHostingMode());
#endif
}
void PluginView::setDeviceScaleFactor(float scaleFactor)
......
......@@ -26,10 +26,10 @@
#ifndef PluginView_h
#define PluginView_h
#include "LayerTreeContext.h"
#include "NPRuntimeObjectMap.h"
#include "Plugin.h"
#include "PluginController.h"
#include "ViewState.h"
#include "WebFrame.h"
#include <WebCore/FindOptions.h>
#include <WebCore/Image.h>
......@@ -38,6 +38,7 @@
#include <WebCore/ResourceError.h>
#include <WebCore/ResourceResponse.h>
#include <WebCore/Timer.h>
#include <WebCore/ViewState.h>
#include <wtf/Deque.h>
#include <wtf/RunLoop.h>
......@@ -69,10 +70,11 @@ public:
void manualLoadDidFinishLoading();
void manualLoadDidFail(const WebCore::ResourceError&);
void viewStateDidChange(ViewState::Flags changed);
void viewStateDidChange(WebCore::ViewState::Flags changed);
void setLayerHostingMode(LayerHostingMode);
#if PLATFORM(MAC)
void platformViewStateDidChange(ViewState::Flags changed);
void platformViewStateDidChange(WebCore::ViewState::Flags changed);
void setDeviceScaleFactor(float);
void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates);
bool sendComplexTextInput(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
......
......@@ -28,9 +28,9 @@
#include "DrawingAreaInfo.h"
#include "LayerTreeContext.h"
#include "ViewState.h"
#include <WebCore/FloatPoint.h>
#include <WebCore/IntRect.h>
#include <WebCore/ViewState.h>
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
......@@ -108,7 +108,8 @@ public:
virtual void dispatchAfterEnsuringUpdatedScrollPosition(const Function<void ()>&);
virtual void viewStateDidChange(ViewState::Flags) { }
virtual void viewStateDidChange(WebCore::ViewState::Flags) { }
virtual void setLayerHostingMode(LayerHostingMode) { }
protected:
DrawingArea(DrawingAreaType, WebPage*);
......
......@@ -241,6 +241,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
, m_numberOfPrimarySnapshotDetectionAttempts(0)
, m_determinePrimarySnapshottedPlugInTimer(RunLoop::main(), this, &WebPage::determinePrimarySnapshottedPlugInTimerFired)
#endif
, m_layerHostingMode(parameters.layerHostingMode)
#if PLATFORM(MAC)
, m_pdfPluginEnabled(false)
, m_hasCachedWindowFrame(false)
......@@ -2092,6 +2093,16 @@ void WebPage::setViewState(ViewState::Flags viewState, bool wantsDidUpdateViewSt
m_sendDidUpdateViewStateTimer.startOneShot(0);
}
void WebPage::setLayerHostingMode(unsigned layerHostingMode)
{
m_layerHostingMode = static_cast<LayerHostingMode>(layerHostingMode);
m_drawingArea->setLayerHostingMode(m_layerHostingMode);
for (auto* pluginView : m_pluginViews)
pluginView->setLayerHostingMode(m_layerHostingMode);
}
void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID)
{
WebFrame* frame = WebProcess::shared().webFrame(frameID);
......
......@@ -45,7 +45,6 @@
#include "Plugin.h"
#include "SandboxExtension.h"
#include "ShareableBitmap.h"
#include "ViewState.h"
#include "WebUndoStep.h"
#include <WebCore/DictationAlternative.h>
#include <WebCore/DragData.h>
......@@ -58,6 +57,7 @@
#include <WebCore/ScrollTypes.h>
#include <WebCore/TextChecking.h>
#include <WebCore/UserActivity.h>
#include <WebCore/ViewState.h>
#include <WebCore/WebCoreKeyboardUIMode.h>
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
......@@ -347,18 +347,12 @@ public:
void addPluginView(PluginView*);
void removePluginView(PluginView*);
bool isVisible() const { return m_viewState & ViewState::IsVisible; }
bool isVisible() const { return m_viewState & WebCore::ViewState::IsVisible; }
#if PLATFORM(MAC)
LayerHostingMode layerHostingMode() const
{
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
return m_viewState & ViewState::IsLayerWindowServerHosted ? LayerHostingModeInWindowServer : LayerHostingModeDefault;
#else
return LayerHostingModeDefault;
#endif
}
LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
void setLayerHostingMode(unsigned);
#if PLATFORM(MAC)
void updatePluginsActiveAndFocusedState();
const WebCore::FloatRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates() const { return m_windowFrameInUnflippedScreenCoordinates; }
......@@ -732,7 +726,7 @@ private:
void setWindowResizerSize(const WebCore::IntSize&);
void setIsInWindow(bool);
void setIsVisuallyIdle(bool);
void setViewState(ViewState::Flags, bool wantsDidUpdateViewState);
void setViewState(WebCore::ViewState::Flags, bool wantsDidUpdateViewState);
void validateCommand(const String&, uint64_t);
void executeEditCommand(const String&);
......@@ -913,6 +907,9 @@ private:
RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
#endif
// The layer hosting mode.
LayerHostingMode m_layerHostingMode;
#if PLATFORM(MAC)
bool m_pdfPluginEnabled;
......@@ -1045,7 +1042,7 @@ private:
bool m_useAsyncScrolling;
ViewState::Flags m_viewState;
WebCore::ViewState::Flags m_viewState;
UserActivity m_processSuppressionDisabledByWebPreference;
};
......
......@@ -23,6 +23,7 @@
messages -> WebPage LegacyReceiver {
SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event)
SetViewState(unsigned viewState, bool wantsDidUpdateViewState)
SetLayerHostingMode(unsigned layerHostingMode)
SetDrawsBackground(bool drawsBackground)
SetDrawsTransparentBackground(bool drawsTransparentBackground)
......
......@@ -55,7 +55,7 @@ public:
TiledCoreAnimationDrawingArea(WebPage*, const WebPageCreationParameters&);
virtual ~TiledCoreAnimationDrawingArea();
virtual void viewStateDidChange(ViewState::Flags changed) OVERRIDE;
virtual void viewStateDidChange(WebCore::ViewState::Flags changed) OVERRIDE;
private:
// DrawingArea
......@@ -102,7 +102,7 @@ private:
virtual void setDeviceScaleFactor(float) OVERRIDE;
void suspendPainting();
void resumePainting();
void setLayerHostingMode(LayerHostingMode);
void setLayerHostingMode(LayerHostingMode) OVERRIDE;
virtual void setColorSpace(const ColorSpaceData&) OVERRIDE;
virtual void adjustTransientZoom(double scale, WebCore::FloatPoint origin) OVERRIDE;
......
......@@ -397,11 +397,6 @@ void TiledCoreAnimationDrawingArea::viewStateDidChange(ViewState::Flags changed)
else
suspendPainting();
}