Title: [112338] trunk/Source/WebKit2
Revision
112338
Author
[email protected]
Date
2012-03-27 17:16:52 -0700 (Tue, 27 Mar 2012)

Log Message

Plug-ins using the Core Animation drawing model should work when hosting the layer tree in the window server
https://bugs.webkit.org/show_bug.cgi?id=82387
<rdar://problem/11031942>

Reviewed by Sam Weinig.

* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::PluginControllerProxy):
(WebKit::PluginControllerProxy::initialize):
Remove m_pluginCreationParameters; it was used by the old NPRuntime short-circuit code.
Make platformInitialize take creation parameters.

* PluginProcess/PluginControllerProxy.messages.in:
Add SetLayerHostingMode message.

* PluginProcess/gtk/PluginControllerProxyGtk.cpp:
(WebKit::PluginControllerProxy::platformInitialize):
Make platformInitialize take creation parameters.

* PluginProcess/mac/PluginControllerProxyMac.mm:
(WebKit::PluginControllerProxy::platformInitialize):
Call updateLayerHostingContext.

(WebKit::PluginControllerProxy::setLayerHostingMode):
Call updateLayerHostingContext and send back the new context ID.

(WebKit::PluginControllerProxy::updateLayerHostingContext):
Create a new LayerHostingContext given the layer hosting mode.

* PluginProcess/qt/PluginControllerProxyQt.cpp:
(WebKit::PluginControllerProxy::platformInitialize):
Make platformInitialize take creation parameters.

* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::NetscapePlugin::setLayerHostingMode):
Add stub.

* WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
(WebKit::makeRenderLayer):
Add helper function for creating a new render layer.

(WebKit::PluginProxy::pluginLayer):
Call makeRenderLayer.

(WebKit::PluginProxy::setLayerHostingMode):
Send a message to the plug-in process.

(WebKit::PluginProxy::setLayerHostingContextID):
Update the context ID and make a new render layer.

* WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
(WebKit::BuiltInPDFView::setLayerHostingMode):
Add stub.
* WebProcess/Plugins/PDF/BuiltInPDFView.h:

* WebProcess/Plugins/Plugin.cpp:
(WebKit::Plugin::Parameters::encode):
(WebKit::Plugin::Parameters::decode):
* WebProcess/Plugins/Plugin.h:
Add the layer hosting mode as a parameter. Add a new setLayerHostingMode pure virtual member function.

* WebProcess/Plugins/PluginProxy.messages.in:
Add a SetLayerHostingContextID message.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::setLayerHostingMode):
Call down to the plug-in.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::createPlugin):
Set the layer hosting mode of the page.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
Initialize m_layerHostingMode to false.

* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::layerHostingMode):
Add m_layerHostingMode and a getter.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::setLayerHostingMode):
Call WebPage::setLayerHostingMode.

* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::setLayerHostingMode):
Tell all plug-ins that the layer hosting mode changed.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (112337 => 112338)


--- trunk/Source/WebKit2/ChangeLog	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/ChangeLog	2012-03-28 00:16:52 UTC (rev 112338)
@@ -1,3 +1,94 @@
+2012-03-27  Anders Carlsson  <[email protected]>
+
+        Plug-ins using the Core Animation drawing model should work when hosting the layer tree in the window server
+        https://bugs.webkit.org/show_bug.cgi?id=82387
+        <rdar://problem/11031942>
+
+        Reviewed by Sam Weinig.
+
+        * PluginProcess/PluginControllerProxy.cpp:
+        (WebKit::PluginControllerProxy::PluginControllerProxy):
+        (WebKit::PluginControllerProxy::initialize):
+        Remove m_pluginCreationParameters; it was used by the old NPRuntime short-circuit code. 
+        Make platformInitialize take creation parameters.
+
+        * PluginProcess/PluginControllerProxy.messages.in:
+        Add SetLayerHostingMode message.
+
+        * PluginProcess/gtk/PluginControllerProxyGtk.cpp:
+        (WebKit::PluginControllerProxy::platformInitialize):
+        Make platformInitialize take creation parameters.
+
+        * PluginProcess/mac/PluginControllerProxyMac.mm:
+        (WebKit::PluginControllerProxy::platformInitialize):
+        Call updateLayerHostingContext.
+
+        (WebKit::PluginControllerProxy::setLayerHostingMode):
+        Call updateLayerHostingContext and send back the new context ID.
+
+        (WebKit::PluginControllerProxy::updateLayerHostingContext):
+        Create a new LayerHostingContext given the layer hosting mode.
+
+        * PluginProcess/qt/PluginControllerProxyQt.cpp:
+        (WebKit::PluginControllerProxy::platformInitialize):
+        Make platformInitialize take creation parameters.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+        (WebKit::NetscapePlugin::setLayerHostingMode):
+        Add stub.
+
+        * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
+        (WebKit::makeRenderLayer):
+        Add helper function for creating a new render layer.
+
+        (WebKit::PluginProxy::pluginLayer):
+        Call makeRenderLayer.
+
+        (WebKit::PluginProxy::setLayerHostingMode):
+        Send a message to the plug-in process.
+
+        (WebKit::PluginProxy::setLayerHostingContextID):
+        Update the context ID and make a new render layer.
+
+        * WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
+        (WebKit::BuiltInPDFView::setLayerHostingMode):
+        Add stub.
+        * WebProcess/Plugins/PDF/BuiltInPDFView.h:
+
+        * WebProcess/Plugins/Plugin.cpp:
+        (WebKit::Plugin::Parameters::encode):
+        (WebKit::Plugin::Parameters::decode):
+        * WebProcess/Plugins/Plugin.h:
+        Add the layer hosting mode as a parameter. Add a new setLayerHostingMode pure virtual member function.
+
+        * WebProcess/Plugins/PluginProxy.messages.in:
+        Add a SetLayerHostingContextID message.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::setLayerHostingMode):
+        Call down to the plug-in.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::createPlugin):
+        Set the layer hosting mode of the page.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+        Initialize m_layerHostingMode to false.
+
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::layerHostingMode):
+        Add m_layerHostingMode and a getter.
+
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::setLayerHostingMode):
+        Call WebPage::setLayerHostingMode.
+
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::setLayerHostingMode):
+        Tell all plug-ins that the layer hosting mode changed.
+
 2012-03-27  Timothy Hatcher  <[email protected]>
 
         Make WebKit properly load a staged framework when soft linking.

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp (112337 => 112338)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2012-03-28 00:16:52 UTC (rev 112338)
@@ -69,7 +69,6 @@
     , m_paintTimer(RunLoop::main(), this, &PluginControllerProxy::paint)
     , m_pluginDestructionProtectCount(0)
     , m_pluginDestroyTimer(RunLoop::main(), this, &PluginControllerProxy::destroy)
-    , m_pluginCreationParameters(0)
     , m_waitingForDidUpdate(false)
     , m_pluginCanceledManualStreamLoad(false)
 #if PLATFORM(MAC)
@@ -106,9 +105,7 @@
     m_windowNPObject = m_connection->npRemoteObjectMap()->createNPObjectProxy(creationParameters.windowNPObjectID, m_plugin.get());
     ASSERT(m_windowNPObject);
 
-    m_pluginCreationParameters = &creationParameters;
     bool returnValue = m_plugin->initialize(this, creationParameters.parameters);
-    m_pluginCreationParameters = 0;
 
     if (!returnValue) {
         // Get the plug-in so we can pass it to removePluginControllerProxy. The pointer is only
@@ -122,7 +119,7 @@
         return false;
     }
 
-    platformInitialize();
+    platformInitialize(creationParameters);
 
     return true;
 }

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h (112337 => 112338)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2012-03-28 00:16:52 UTC (rev 112338)
@@ -133,14 +133,15 @@
     void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates);
     void windowVisibilityChanged(bool);
     void sendComplexTextInput(const String& textInput);
+    void setLayerHostingMode(uint32_t);
+
+    void updateLayerHostingContext(LayerHostingMode);
 #endif
 
     void privateBrowsingStateChanged(bool);
     void getFormValue(bool& returnValue, String& formValue);
 
-    bool inInitialize() const { return m_pluginCreationParameters; }
-
-    void platformInitialize();
+    void platformInitialize(const PluginCreationParameters&);
     void platformDestroy();
     void platformGeometryDidChange();
 
@@ -168,9 +169,6 @@
     // code is on the stack.
     WebCore::RunLoop::Timer<PluginControllerProxy> m_pluginDestroyTimer;
 
-    // Will point to the plug-in creation parameters of the plug-in we're currently initializing and will be null when we're done initializing.
-    const PluginCreationParameters* m_pluginCreationParameters;
-
     // Whether we're waiting for the plug-in proxy in the web process to draw the contents of its
     // backing store into the web process backing store.
     bool m_waitingForDidUpdate;

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in (112337 => 112338)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in	2012-03-28 00:16:52 UTC (rev 112338)
@@ -98,6 +98,9 @@
 
     # Sent when the containing NSWindow's visibility changes
     WindowVisibilityChanged(bool isVisible)
+
+    # Sent when the containing window's layer hosting mode changes
+    SetLayerHostingMode(uint32_t layerHostingMode)
 #endif
 
     # Return a snapshot of the plugin

Modified: trunk/Source/WebKit2/PluginProcess/gtk/PluginControllerProxyGtk.cpp (112337 => 112338)


--- trunk/Source/WebKit2/PluginProcess/gtk/PluginControllerProxyGtk.cpp	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/PluginProcess/gtk/PluginControllerProxyGtk.cpp	2012-03-28 00:16:52 UTC (rev 112338)
@@ -34,7 +34,7 @@
 
 namespace WebKit {
 
-void PluginControllerProxy::platformInitialize()
+void PluginControllerProxy::platformInitialize(const PluginCreationParameters&)
 {
     notImplemented();
 }

Modified: trunk/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm (112337 => 112338)


--- trunk/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm	2012-03-28 00:16:52 UTC (rev 112338)
@@ -29,6 +29,7 @@
 #if ENABLE(PLUGIN_PROCESS)
 
 #import "LayerHostingContext.h"
+#import "PluginCreationParameters.h"
 #import "PluginProcess.h"
 #import "PluginProxyMessages.h"
 #import "WebProcessConnection.h"
@@ -53,15 +54,10 @@
     return PluginProcess::shared().compositingRenderServerPort();
 }
 
-void PluginControllerProxy::platformInitialize()
+void PluginControllerProxy::platformInitialize(const PluginCreationParameters& creationParameters)
 {
-    CALayer * platformLayer = m_plugin->pluginLayer();
-    if (!platformLayer)
-        return;
-
     ASSERT(!m_layerHostingContext);
-    m_layerHostingContext = LayerHostingContext::createForPort(PluginProcess::shared().compositingRenderServerPort());
-    m_layerHostingContext->setRootLayer(platformLayer);
+    updateLayerHostingContext(creationParameters.parameters.layerHostingMode);
 }
 
 void PluginControllerProxy::platformDestroy()
@@ -112,6 +108,41 @@
     m_plugin->sendComplexTextInput(textInput);
 }
 
+void PluginControllerProxy::setLayerHostingMode(uint32_t opaqueLayerHostingMode)
+{
+    LayerHostingMode layerHostingMode = static_cast<LayerHostingMode>(opaqueLayerHostingMode);
+    updateLayerHostingContext(layerHostingMode);
+
+    m_connection->connection()->send(Messages::PluginProxy::SetLayerHostingContextID(m_layerHostingContext->contextID()), m_pluginInstanceID);
+}
+
+void PluginControllerProxy::updateLayerHostingContext(LayerHostingMode layerHostingMode)
+{
+    CALayer *platformLayer = m_plugin->pluginLayer();
+    if (!platformLayer)
+        return;
+
+    if (m_layerHostingContext) {
+        if (m_layerHostingContext->layerHostingMode() == layerHostingMode)
+            return;
+
+        m_layerHostingContext->invalidate();
+    }
+
+    switch (layerHostingMode) {
+        case LayerHostingModeDefault:
+            m_layerHostingContext = LayerHostingContext::createForPort(PluginProcess::shared().compositingRenderServerPort());
+            break;
+#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
+        case LayerHostingModeInWindowServer:
+            m_layerHostingContext = LayerHostingContext::createForWindowServer();
+            break;
+#endif
+    }
+
+    m_layerHostingContext->setRootLayer(platformLayer);
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(PLUGIN_PROCESS)

Modified: trunk/Source/WebKit2/PluginProcess/qt/PluginControllerProxyQt.cpp (112337 => 112338)


--- trunk/Source/WebKit2/PluginProcess/qt/PluginControllerProxyQt.cpp	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/PluginProcess/qt/PluginControllerProxyQt.cpp	2012-03-28 00:16:52 UTC (rev 112338)
@@ -35,7 +35,7 @@
 
 namespace WebKit {
 
-void PluginControllerProxy::platformInitialize()
+void PluginControllerProxy::platformInitialize(const PluginCreationParameters&)
 {
     notImplemented();
 }

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2012-03-28 00:16:52 UTC (rev 112338)
@@ -205,6 +205,7 @@
 
     virtual uint64_t pluginComplexTextInputIdentifier() const;
     virtual void sendComplexTextInput(const String& textInput);
+    virtual void setLayerHostingMode(LayerHostingMode) OVERRIDE;
 
     void pluginFocusOrWindowFocusChanged();
     void setComplexTextInputEnabled(bool);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm	2012-03-28 00:16:52 UTC (rev 112338)
@@ -1022,6 +1022,10 @@
     }
 }
 
+void NetscapePlugin::setLayerHostingMode(LayerHostingMode)
+{
+}
+
 void NetscapePlugin::pluginFocusOrWindowFocusChanged()
 {
     bool pluginHasFocusAndWindowHasFocus = m_pluginHasFocus && m_windowHasFocus;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm	2012-03-28 00:16:52 UTC (rev 112338)
@@ -29,22 +29,29 @@
 #if ENABLE(PLUGIN_PROCESS)
 
 #import "PluginController.h"
+#import "PluginControllerProxyMessages.h"
+#import "PluginProcessConnection.h"
 #import <WebKitSystemInterface.h>
 
 namespace WebKit {
 
+static void makeRenderLayer(CALayer *pluginLayer, uint32_t layerHostingContextID)
+{
+    CALayer *renderLayer = WKMakeRenderLayer(layerHostingContextID);
+    [renderLayer setFrame:[pluginLayer bounds]];
+    [renderLayer setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable];
+    [pluginLayer setSublayers:[NSArray arrayWithObject:renderLayer]];
+}
+
 PlatformLayer* PluginProxy::pluginLayer()
 {
     if (!m_pluginLayer && m_remoteLayerClientID) {
-        CALayer *renderLayer = WKMakeRenderLayer(m_remoteLayerClientID);
-
         // Create a layer with flipped geometry and add the real plug-in layer as a sublayer
         // so the coordinate system will match the event coordinate system.
         m_pluginLayer.adoptNS([[CALayer alloc] init]);
         [m_pluginLayer.get() setGeometryFlipped:YES];
-        
-        [renderLayer setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable];
-        [m_pluginLayer.get() addSublayer:renderLayer];
+
+        makeRenderLayer(m_pluginLayer.get(), m_remoteLayerClientID);
     }
 
     return m_pluginLayer.get();
@@ -65,6 +72,20 @@
     controller()->setComplexTextInputState(static_cast<PluginComplexTextInputState>(complexTextInputState));
 }
 
+void PluginProxy::setLayerHostingMode(LayerHostingMode layerHostingMode)
+{
+    m_connection->connection()->send(Messages::PluginControllerProxy::SetLayerHostingMode(layerHostingMode), m_pluginInstanceID);
+}
+
+void PluginProxy::setLayerHostingContextID(uint32_t layerHostingContextID)
+{
+    ASSERT(m_pluginLayer.get());
+
+    m_remoteLayerClientID = layerHostingContextID;
+    makeRenderLayer(m_pluginLayer.get(), m_remoteLayerClientID);
+}
+
+
 } // namespace WebKit
 
 #endif // ENABLE(PLUGIN_PROCESS)

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2012-03-28 00:16:52 UTC (rev 112338)
@@ -640,6 +640,10 @@
 {
 }
 
+void BuiltInPDFView::setLayerHostingMode(LayerHostingMode)
+{
+}
+
 #endif
 
 void BuiltInPDFView::privateBrowsingStateChanged(bool)

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2012-03-28 00:16:52 UTC (rev 112338)
@@ -105,6 +105,7 @@
     virtual void contentsScaleFactorChanged(float);
     virtual uint64_t pluginComplexTextInputIdentifier() const;
     virtual void sendComplexTextInput(const String& textInput);
+    virtual void setLayerHostingMode(LayerHostingMode) OVERRIDE;
 #endif
 
     virtual void privateBrowsingStateChanged(bool);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Plugin.cpp (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/Plugins/Plugin.cpp	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Plugin.cpp	2012-03-28 00:16:52 UTC (rev 112338)
@@ -39,6 +39,9 @@
     encoder->encode(values);
     encoder->encode(mimeType);
     encoder->encode(loadManually);
+#if PLATFORM(MAC)
+    encoder->encodeEnum(layerHostingMode);
+#endif
 }
 
 bool Plugin::Parameters::decode(CoreIPC::ArgumentDecoder* decoder, Parameters& parameters)
@@ -57,7 +60,10 @@
         return false;
     if (!decoder->decode(parameters.loadManually))
         return false;
-
+#if PLATFORM(MAC)
+    if (!decoder->decodeEnum(parameters.layerHostingMode))
+        return false;
+#endif
     if (parameters.names.size() != parameters.values.size()) {
         decoder->markInvalid();
         return false;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h	2012-03-28 00:16:52 UTC (rev 112338)
@@ -33,6 +33,10 @@
 #include <wtf/RetainPtr.h>
 #include <wtf/Vector.h>
 
+#if PLATFORM(MAC)
+#include "LayerHostingContext.h"
+#endif
+
 struct NPObject;
 
 namespace CoreIPC {
@@ -65,6 +69,9 @@
         Vector<String> values;
         String mimeType;
         bool loadManually;
+#if PLATFORM(MAC)
+        LayerHostingMode layerHostingMode;
+#endif
 
         void encode(CoreIPC::ArgumentEncoder*) const;
         static bool decode(CoreIPC::ArgumentDecoder*, Parameters&);
@@ -193,6 +200,9 @@
 
     // Send the complex text input to the plug-in.
     virtual void sendComplexTextInput(const String& textInput) = 0;
+
+    // Tells the plug-in about changes to the layer hosting mode.
+    virtual void setLayerHostingMode(LayerHostingMode) = 0;
 #endif
 
     // Tells the plug-in about scale factor changes.

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2012-03-28 00:16:52 UTC (rev 112338)
@@ -100,6 +100,7 @@
     virtual void windowVisibilityChanged(bool);
     virtual uint64_t pluginComplexTextInputIdentifier() const;
     virtual void sendComplexTextInput(const String& textInput);
+    virtual void setLayerHostingMode(LayerHostingMode) OVERRIDE;
 #endif
 
     virtual void contentsScaleFactorChanged(float);
@@ -132,6 +133,7 @@
 #if PLATFORM(MAC)
     void pluginFocusOrWindowFocusChanged(bool);
     void setComplexTextInputState(uint64_t);
+    void setLayerHostingContextID(uint32_t);
 #endif
 
     String m_pluginPath;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.messages.in (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.messages.in	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.messages.in	2012-03-28 00:16:52 UTC (rev 112338)
@@ -60,8 +60,11 @@
     # Called when the plug-in's focus or its containing window focus changes.
     PluginFocusOrWindowFocusChanged(bool pluginHasFocusAndWindowHasFocus)
 
-    # Change whether complext text input is enabled for this plug-in.
+    # Change whether complex text input is enabled for this plug-in.
     SetComplexTextInputState(uint64_t complexTextInputState)
+
+    # Update the layer hosting context ID. Called whenever the layer hosting state changes.
+    SetLayerHostingContextID(uint32_t layerHostingContextID)
 #endif
 }
 

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-03-28 00:16:52 UTC (rev 112338)
@@ -434,6 +434,14 @@
     return true;
 }
 
+void PluginView::setLayerHostingMode(LayerHostingMode layerHostingMode)
+{
+    if (!m_plugin)
+        return;
+
+    m_plugin->setLayerHostingMode(layerHostingMode);
+}
+
 #endif
 
 void PluginView::initializePlugin()

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h	2012-03-28 00:16:52 UTC (rev 112338)
@@ -65,6 +65,7 @@
     void setDeviceScaleFactor(float);
     void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates);
     bool sendComplexTextInput(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
+    void setLayerHostingMode(LayerHostingMode);
 #endif
 
 #if USE(CG)

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2012-03-28 00:16:52 UTC (rev 112338)
@@ -1267,6 +1267,9 @@
     parameters.values = paramValues;
     parameters.mimeType = mimeType;
     parameters.loadManually = loadManually;
+#if PLATFORM(MAC)
+    parameters.layerHostingMode = webPage->layerHostingMode();
+#endif
 
 #if PLUGIN_ARCHITECTURE(X11)
     // FIXME: This should really be X11-specific plug-in quirks.

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-03-28 00:16:52 UTC (rev 112338)
@@ -188,6 +188,7 @@
 #if PLATFORM(MAC)
     , m_windowIsVisible(false)
     , m_isSmartInsertDeleteEnabled(parameters.isSmartInsertDeleteEnabled)
+    , m_layerHostingMode(LayerHostingModeDefault)
     , m_keyboardEventBeingInterpreted(0)
 #elif PLATFORM(WIN)
     , m_nativeWindow(parameters.nativeWindow)
@@ -2451,7 +2452,6 @@
     for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
         (*it)->windowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates);
 }
-
 #endif
 
 bool WebPage::windowIsFocused() const

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2012-03-28 00:16:52 UTC (rev 112338)
@@ -81,6 +81,7 @@
 
 #if PLATFORM(MAC)
 #include "DictionaryPopupInfo.h"
+#include "LayerHostingContext.h"
 #include <wtf/RetainPtr.h>
 OBJC_CLASS NSDictionary;
 OBJC_CLASS NSObject;
@@ -299,6 +300,9 @@
     void addPluginView(PluginView*);
     void removePluginView(PluginView*);
 
+    LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
+    void setLayerHostingMode(LayerHostingMode);
+
     bool windowIsVisible() const { return m_windowIsVisible; }
     const WebCore::IntRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
     const WebCore::IntRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
@@ -700,6 +704,9 @@
     // All plug-in views on this web page.
     HashSet<PluginView*> m_pluginViews;
 
+    // The layer hosting mode.
+    LayerHostingMode m_layerHostingMode;
+
     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
 
     WebCore::KeyboardEvent* m_keyboardEventBeingInterpreted;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2012-03-28 00:16:52 UTC (rev 112338)
@@ -323,6 +323,8 @@
 
         m_layerHostingContext->setRootLayer(m_rootLayer.get());
 
+        m_webPage->setLayerHostingMode(layerHostingMode);
+
         // Finally, inform the UIProcess that the context has changed.
         LayerTreeContext layerTreeContext;
         layerTreeContext.contextID = m_layerHostingContext->contextID();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (112337 => 112338)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2012-03-28 00:12:57 UTC (rev 112337)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2012-03-28 00:16:52 UTC (rev 112338)
@@ -711,4 +711,12 @@
         result = !!hitResult.scrollbar();
 }
 
+void WebPage::setLayerHostingMode(LayerHostingMode layerHostingMode)
+{
+    m_layerHostingMode = layerHostingMode;
+
+    for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
+        (*it)->setLayerHostingMode(layerHostingMode);
+}
+
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to