Fix non-Mac builds and remove #if PLATFORM(MAC) around all contents scale factor...
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Nov 2011 20:57:32 +0000 (20:57 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Nov 2011 20:57:32 +0000 (20:57 +0000)
* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::PluginControllerProxy):
(WebKit::PluginControllerProxy::contentsScaleFactor):
(WebKit::PluginControllerProxy::geometryDidChange):
* PluginProcess/PluginControllerProxy.h:
* PluginProcess/PluginCreationParameters.cpp:
(WebKit::PluginCreationParameters::PluginCreationParameters):
(WebKit::PluginCreationParameters::encode):
(WebKit::PluginCreationParameters::decode):
* PluginProcess/PluginCreationParameters.h:
* PluginProcess/mac/PluginControllerProxyMac.mm:
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::contentsScaleFactor):
(WebKit::NetscapePlugin::getAuthenticationInfo):
(WebKit::NetscapePlugin::snapshot):
(WebKit::NetscapePlugin::contentsScaleFactorChanged):
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
* WebProcess/Plugins/Plugin.h:
* WebProcess/Plugins/PluginController.h:
* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::initialize):
(WebKit::PluginProxy::contentsScaleFactorChanged):
(WebKit::PluginProxy::contentsScaleFactor):
* WebProcess/Plugins/PluginProxy.h:
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::contentsScaleFactor):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@99093 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/PluginProcess/PluginControllerProxy.cpp
Source/WebKit2/PluginProcess/PluginControllerProxy.h
Source/WebKit2/PluginProcess/PluginCreationParameters.cpp
Source/WebKit2/PluginProcess/PluginCreationParameters.h
Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
Source/WebKit2/WebProcess/Plugins/Plugin.h
Source/WebKit2/WebProcess/Plugins/PluginController.h
Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp
Source/WebKit2/WebProcess/Plugins/PluginProxy.h
Source/WebKit2/WebProcess/Plugins/PluginView.cpp

index 86c4e41..6cd7c8e 100644 (file)
@@ -1,5 +1,37 @@
 2011-11-02  Anders Carlsson  <andersca@apple.com>
 
+        Fix non-Mac builds and remove #if PLATFORM(MAC) around all contents scale factor functions.
+
+        * PluginProcess/PluginControllerProxy.cpp:
+        (WebKit::PluginControllerProxy::PluginControllerProxy):
+        (WebKit::PluginControllerProxy::contentsScaleFactor):
+        (WebKit::PluginControllerProxy::geometryDidChange):
+        * PluginProcess/PluginControllerProxy.h:
+        * PluginProcess/PluginCreationParameters.cpp:
+        (WebKit::PluginCreationParameters::PluginCreationParameters):
+        (WebKit::PluginCreationParameters::encode):
+        (WebKit::PluginCreationParameters::decode):
+        * PluginProcess/PluginCreationParameters.h:
+        * PluginProcess/mac/PluginControllerProxyMac.mm:
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::contentsScaleFactor):
+        (WebKit::NetscapePlugin::getAuthenticationInfo):
+        (WebKit::NetscapePlugin::snapshot):
+        (WebKit::NetscapePlugin::contentsScaleFactorChanged):
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+        * WebProcess/Plugins/Plugin.h:
+        * WebProcess/Plugins/PluginController.h:
+        * WebProcess/Plugins/PluginProxy.cpp:
+        (WebKit::PluginProxy::initialize):
+        (WebKit::PluginProxy::contentsScaleFactorChanged):
+        (WebKit::PluginProxy::contentsScaleFactor):
+        * WebProcess/Plugins/PluginProxy.h:
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::contentsScaleFactor):
+
+2011-11-02  Anders Carlsson  <andersca@apple.com>
+
         Use m_pluginSize instead of m_frameRectInWindowCoordinates.size() in NetscapePlugin.
         https://bugs.webkit.org/show_bug.cgi?id=71390
 
index a782842..4f27f05 100644 (file)
@@ -70,8 +70,8 @@ PluginControllerProxy::PluginControllerProxy(WebProcessConnection* connection, c
     , m_pluginCanceledManualStreamLoad(false)
 #if PLATFORM(MAC)
     , m_isComplexTextInputEnabled(false)
-    , m_contentsScaleFactor(creationParameters.contentsScaleFactor)
 #endif
+    , m_contentsScaleFactor(creationParameters.contentsScaleFactor)
     , m_windowNPObject(0)
     , m_pluginElementNPObject(0)
 {
@@ -370,6 +370,11 @@ void PluginControllerProxy::willSendEventToPlugin()
     ASSERT_NOT_REACHED();
 }
 
+float PluginControllerProxy::contentsScaleFactor()
+{
+    return m_contentsScaleFactor;
+}
+
 String PluginControllerProxy::proxiesForURL(const String& urlString)
 {
     String proxyString;
@@ -438,14 +443,10 @@ void PluginControllerProxy::geometryDidChange(const IntSize& pluginSize, const I
     m_pluginSize = pluginSize;
     m_frameRectInWindowCoordinates = frameRectInWindowCoordinates;
 
-#if PLATFORM(MAC)
     if (contentsScaleFactor != m_contentsScaleFactor) {
         m_contentsScaleFactor = contentsScaleFactor;
         m_plugin->contentsScaleFactorChanged(m_contentsScaleFactor);
     }
-#else
-    UNUSED_PARAM(contentsScaleFactor);
-#endif
 
     platformGeometryDidChange();
 
index 84fe436..e384588 100644 (file)
@@ -99,9 +99,9 @@ private:
     virtual void pluginFocusOrWindowFocusChanged(bool);
     virtual void setComplexTextInputState(PluginComplexTextInputState);
     virtual mach_port_t compositingRenderServerPort();
-    virtual float contentsScaleFactor();
 #endif
 
+    virtual float contentsScaleFactor();
     virtual String proxiesForURL(const String&);
     virtual String cookiesForURL(const String&);
     virtual void setCookiesForURL(const String& urlString, const String& cookieString);
index 37a1fbf..e29e974 100644 (file)
@@ -35,13 +35,11 @@ namespace WebKit {
 PluginCreationParameters::PluginCreationParameters()
     : pluginInstanceID(0)
     , windowNPObjectID(0)
+    , contentsScaleFactor(1)
     , isPrivateBrowsingEnabled(false)
 #if USE(ACCELERATED_COMPOSITING)
     , isAcceleratedCompositingEnabled(false)
 #endif
-#if PLATFORM(MAC)
-    , contentsScaleFactor(1)
-#endif
 {
 }
 
@@ -51,15 +49,12 @@ void PluginCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const
     encoder->encode(windowNPObjectID);
     encoder->encode(parameters);
     encoder->encode(userAgent);
+    encoder->encode(contentsScaleFactor);
     encoder->encode(isPrivateBrowsingEnabled);
 
 #if USE(ACCELERATED_COMPOSITING)
     encoder->encode(isAcceleratedCompositingEnabled);
 #endif
-
-#if PLATFORM(MAC)
-    encoder->encode(contentsScaleFactor);
-#endif
 }
 
 bool PluginCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, PluginCreationParameters& result)
@@ -76,6 +71,9 @@ bool PluginCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, PluginC
     if (!decoder->decode(result.userAgent))
         return false;
 
+    if (!decoder->decode(result.contentsScaleFactor))
+        return false;
+
     if (!decoder->decode(result.isPrivateBrowsingEnabled))
         return false;
 
@@ -84,11 +82,6 @@ bool PluginCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, PluginC
         return false;
 #endif
 
-#if PLATFORM(MAC)
-    if (!decoder->decode(result.contentsScaleFactor))
-        return false;
-#endif
-
     return true;
 }
 
index a004030..fcd5349 100644 (file)
@@ -55,6 +55,9 @@ struct PluginCreationParameters {
     // The browser user agent.
     String userAgent;
 
+    // The current contents scale factor that this plug-in should have.
+    float contentsScaleFactor;
+
     // Whether private browsing is enabled at the time of instantiation.
     bool isPrivateBrowsingEnabled;
 
@@ -62,11 +65,6 @@ struct PluginCreationParameters {
     // Whether accelerated compositing is enabled.
     bool isAcceleratedCompositingEnabled;
 #endif
-
-#if PLATFORM(MAC)
-    // The current contents scale factor that this plug-in should have.
-    float contentsScaleFactor;
-#endif
 };
 
 } // namespace WebKit
index 061baee..95feaa5 100644 (file)
@@ -53,11 +53,6 @@ mach_port_t PluginControllerProxy::compositingRenderServerPort()
     return PluginProcess::shared().compositingRenderServerPort();
 }
 
-float PluginControllerProxy::contentsScaleFactor()
-{
-    return m_contentsScaleFactor;
-}
-
 void PluginControllerProxy::platformInitialize()
 {
     CALayer * platformLayer = m_plugin->pluginLayer();
index d0f76ae..acf6544 100644 (file)
@@ -390,6 +390,11 @@ void NetscapePlugin::unscheduleTimer(unsigned timerID)
     timer->stop();
 }
 
+double NetscapePlugin::contentsScaleFactor()
+{
+    return controller()->contentsScaleFactor();
+}
+
 String NetscapePlugin::proxiesForURL(const String& urlString)
 {
     return controller()->proxiesForURL(urlString);
@@ -408,7 +413,7 @@ void NetscapePlugin::setCookiesForURL(const String& urlString, const String& coo
 bool NetscapePlugin::getAuthenticationInfo(const ProtectionSpace& protectionSpace, String& username, String& password)
 {
     return controller()->getAuthenticationInfo(protectionSpace, username, password);
-}
+}    
 
 NPError NetscapePlugin::NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* savedData)
 {
@@ -645,18 +650,14 @@ PassRefPtr<ShareableBitmap> NetscapePlugin::snapshot()
     ASSERT(m_isStarted);
 
     IntSize backingStoreSize = m_pluginSize;
-#if PLATFORM(MAC)
     backingStoreSize.scale(contentsScaleFactor());
-#endif
 
     RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(backingStoreSize, ShareableBitmap::SupportsAlpha);
     OwnPtr<GraphicsContext> context = bitmap->createGraphicsContext();
 
-#if PLATFORM(MAC)
     // FIXME: We should really call applyDeviceScaleFactor instead of scale, but that ends up calling into WKSI
     // which we currently don't have initiated in the plug-in process.
     context->scale(FloatSize(contentsScaleFactor(), contentsScaleFactor()));
-#endif
 
     context->translate(-m_frameRectInWindowCoordinates.x(), -m_frameRectInWindowCoordinates.y());
     platformPaint(context.get(), m_frameRectInWindowCoordinates, true);
@@ -890,6 +891,16 @@ NPObject* NetscapePlugin::pluginScriptableNPObject()
     return scriptableNPObject;
 }
 
+void NetscapePlugin::contentsScaleFactorChanged(float scaleFactor)
+{
+    ASSERT(m_isStarted);
+
+#if PLUGIN_ARCHITECTURE(MAC)
+    double contentsScaleFactor = scaleFactor;
+    NPP_SetValue(NPNVcontentsScaleFactor, &contentsScaleFactor);
+#endif
+}
+
 void NetscapePlugin::privateBrowsingStateChanged(bool privateBrowsingEnabled)
 {
     ASSERT(m_isStarted);
index 39105dc..76314a6 100644 (file)
@@ -64,7 +64,6 @@ public:
     bool hasHandledAKeyDownEvent() const { return m_hasHandledAKeyDownEvent; }
 
     mach_port_t compositingRenderServerPort();
-    double contentsScaleFactor();
 
 #ifndef NP_NO_CARBON
     WindowRef windowRef() const;
@@ -116,6 +115,7 @@ public:
     unsigned scheduleTimer(unsigned interval, bool repeat, void (*timerFunc)(NPP, unsigned timerID));
     void unscheduleTimer(unsigned timerID);
 
+    double contentsScaleFactor();
     String proxiesForURL(const String& urlString);
     String cookiesForURL(const String& urlString);
     void setCookiesForURL(const String& urlString, const String& cookieString);
@@ -199,7 +199,6 @@ private:
     virtual void windowFocusChanged(bool);
     virtual void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates);
     virtual void windowVisibilityChanged(bool);
-    virtual void contentsScaleFactorChanged(float);
 
     virtual uint64_t pluginComplexTextInputIdentifier() const;
     virtual void sendComplexTextInput(const String& textInput);
@@ -208,6 +207,7 @@ private:
     void setComplexTextInputEnabled(bool);
 #endif
 
+    virtual void contentsScaleFactorChanged(float);
     virtual void privateBrowsingStateChanged(bool);
     virtual bool getFormValue(String& formValue);
     virtual bool handleScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity);
index 701ba5d..404308c 100644 (file)
@@ -179,11 +179,6 @@ mach_port_t NetscapePlugin::compositingRenderServerPort()
     return controller()->compositingRenderServerPort();
 }
 
-double NetscapePlugin::contentsScaleFactor()
-{
-    return controller()->contentsScaleFactor();
-}
-
 #ifndef NP_NO_CARBON
 typedef HashMap<WindowRef, NetscapePlugin*> WindowMap;
 
@@ -925,12 +920,6 @@ void NetscapePlugin::windowVisibilityChanged(bool)
     // FIXME: Implement.
 }
 
-void NetscapePlugin::contentsScaleFactorChanged(float scaleFactor)
-{
-    double contentsScaleFactor = scaleFactor;
-    NPP_SetValue(NPNVcontentsScaleFactor, &contentsScaleFactor);
-}
-
 uint64_t NetscapePlugin::pluginComplexTextInputIdentifier() const
 {
     // Just return a dummy value; this is only called for in-process plug-ins, which we don't support on Mac.
index e1351df..878d245 100644 (file)
@@ -197,9 +197,6 @@ public:
     // Tells the plug-in about window visibility changes.
     virtual void windowVisibilityChanged(bool) = 0;
 
-    // Tells the plug-in about scale factor changes.
-    virtual void contentsScaleFactorChanged(float) = 0;
-
     // Get the per complex text input identifier.
     virtual uint64_t pluginComplexTextInputIdentifier() const = 0;
 
@@ -207,6 +204,9 @@ public:
     virtual void sendComplexTextInput(const String& textInput) = 0;
 #endif
 
+    // Tells the plug-in about scale factor changes.
+    virtual void contentsScaleFactorChanged(float) = 0;
+
     // Called when the private browsing state for this plug-in changes.
     virtual void privateBrowsingStateChanged(bool) = 0;
 
index 8008a56..da48eb6 100644 (file)
@@ -120,10 +120,10 @@ public:
 
     // Returns the mach port of the compositing render server.
     virtual mach_port_t compositingRenderServerPort() = 0;
+#endif
 
     // Returns the contents scale factor.
     virtual float contentsScaleFactor() = 0;
-#endif
 
     // Returns the proxies for the given URL or null on failure.
     virtual String proxiesForURL(const String&) = 0;
index 931277f..8ec22be 100644 (file)
@@ -97,13 +97,11 @@ bool PluginProxy::initialize(const Parameters& parameters)
     creationParameters.windowNPObjectID = windowNPObjectID();
     creationParameters.parameters = parameters;
     creationParameters.userAgent = controller()->userAgent();
+    creationParameters.contentsScaleFactor = contentsScaleFactor();
     creationParameters.isPrivateBrowsingEnabled = controller()->isPrivateBrowsingEnabled();
 #if USE(ACCELERATED_COMPOSITING)
     creationParameters.isAcceleratedCompositingEnabled = controller()->isAcceleratedCompositingEnabled();
 #endif
-#if PLATFORM(MAC)
-    creationParameters.contentsScaleFactor = contentsScaleFactor();
-#endif
 
     bool result = false;
     uint32_t remoteLayerClientID = 0;
@@ -375,11 +373,6 @@ void PluginProxy::windowVisibilityChanged(bool isVisible)
     m_connection->connection()->send(Messages::PluginControllerProxy::WindowVisibilityChanged(isVisible), m_pluginInstanceID);
 }
 
-void PluginProxy::contentsScaleFactorChanged(float scaleFactor)
-{
-    geometryDidChange();
-}
-
 uint64_t PluginProxy::pluginComplexTextInputIdentifier() const
 {
     return m_pluginInstanceID;
@@ -391,6 +384,11 @@ void PluginProxy::sendComplexTextInput(const String& textInput)
 }
 #endif
 
+void PluginProxy::contentsScaleFactorChanged(float scaleFactor)
+{
+    geometryDidChange();
+}
+
 void PluginProxy::privateBrowsingStateChanged(bool isPrivateBrowsingEnabled)
 {
     m_connection->connection()->send(Messages::PluginControllerProxy::PrivateBrowsingStateChanged(isPrivateBrowsingEnabled), m_pluginInstanceID);
@@ -452,11 +450,7 @@ void PluginProxy::getAuthenticationInfo(const ProtectionSpace& protectionSpace,
 
 float PluginProxy::contentsScaleFactor()
 {
-#if PLATFORM(MAC)
     return controller()->contentsScaleFactor();
-#else
-    return 1;
-#endif
 }
 
 bool PluginProxy::updateBackingStore()
index 64e28f6..8abb7aa 100644 (file)
@@ -99,11 +99,11 @@ private:
     virtual void windowFocusChanged(bool);
     virtual void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates);
     virtual void windowVisibilityChanged(bool);
-    virtual void contentsScaleFactorChanged(float);
     virtual uint64_t pluginComplexTextInputIdentifier() const;
     virtual void sendComplexTextInput(const String& textInput);
 #endif
 
+    virtual void contentsScaleFactorChanged(float);
     virtual void privateBrowsingStateChanged(bool);
     virtual bool getFormValue(String& formValue);
     virtual bool handleScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity);
index 9761bbb..060946c 100644 (file)
@@ -1150,6 +1150,7 @@ mach_port_t PluginView::compositingRenderServerPort()
 {
     return WebProcess::shared().compositingRenderServerPort();
 }
+#endif
 
 float PluginView::contentsScaleFactor()
 {
@@ -1158,7 +1159,6 @@ float PluginView::contentsScaleFactor()
         
     return 1;
 }
-#endif
     
 String PluginView::proxiesForURL(const String& urlString)
 {