Title: [102254] branches/safari-534.53-branch

Diff

Modified: branches/safari-534.53-branch/LayoutTests/ChangeLog (102253 => 102254)


--- branches/safari-534.53-branch/LayoutTests/ChangeLog	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/LayoutTests/ChangeLog	2011-12-07 19:19:31 UTC (rev 102254)
@@ -1,5 +1,20 @@
 2011-12-06  Lucas Forschler  <[email protected]>
 
+    Merge 98413
+
+    2011-10-25  Anders Carlsson  <[email protected]>
+
+            Plug-ins have no way to find out when the device scale factor changes
+            https://bugs.webkit.org/show_bug.cgi?id=67226
+
+            Reviewed by Sam Weinig.
+
+            Update test to check that the scale factor is updated correctly.
+
+            * platform/mac-wk2/plugins/contents-scale-factor.html:
+
+2011-12-06  Lucas Forschler  <[email protected]>
+
     Merge 98403
 
     2011-10-25  Anders Carlsson  <[email protected]>

Modified: branches/safari-534.53-branch/LayoutTests/platform/mac-wk2/plugins/contents-scale-factor.html (102253 => 102254)


--- branches/safari-534.53-branch/LayoutTests/platform/mac-wk2/plugins/contents-scale-factor.html	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/LayoutTests/platform/mac-wk2/plugins/contents-scale-factor.html	2011-12-07 19:19:31 UTC (rev 102254)
@@ -28,14 +28,18 @@
     document.body.appendChild(plugin1);
     
     shouldBe("plugin1.contentsScaleFactor", "1.0");
+    shouldBe("plugin1.cachedContentsScaleFactor", "1.0");
 
     // Now change the backing scale factor.
     layoutTestController.setBackingScaleFactor(2, function() {
+        shouldBe("plugin1.contentsScaleFactor", "2.0");
+        shouldBe("plugin1.cachedContentsScaleFactor", "2.0");
     
         plugin2 = createTestPlugin('contents-scale-factor');
         document.body.appendChild(plugin2);
     
         shouldBe("plugin2.contentsScaleFactor", "2.0");
+        shouldBe("plugin2.cachedContentsScaleFactor", "2.0");
 
         layoutTestController.notifyDone();
     });

Modified: branches/safari-534.53-branch/Source/WebKit2/ChangeLog (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-07 19:19:31 UTC (rev 102254)
@@ -1,5 +1,54 @@
 2011-12-06  Lucas Forschler  <[email protected]>
 
+    Merge 98413
+
+    2011-10-25  Anders Carlsson  <[email protected]>
+
+            Plug-ins have no way to find out when the device scale factor changes
+            https://bugs.webkit.org/show_bug.cgi?id=67226
+
+            Reviewed by Sam Weinig.
+
+            * PluginProcess/PluginControllerProxy.cpp:
+            (WebKit::PluginControllerProxy::geometryDidChange):
+            * PluginProcess/PluginControllerProxy.h:
+            This now takes the contentsScaleFactor and calls contentsScaleFactorChanged on its plug-in
+            if the scale factor changes.
+
+            * PluginProcess/PluginControllerProxy.messages.in:
+            GeometryDidChange now takes a contents scale factor parameter.
+
+            * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+            * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+            (WebKit::NetscapePlugin::contentsScaleFactorChanged):
+            Implement contentsScaleFactorChanged and call NPP_SetValue with the new scale factor.
+
+            * WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
+            (WebKit::BuiltInPDFView::contentsScaleFactorChanged):
+            * WebProcess/Plugins/PDF/BuiltInPDFView.h:
+            Add stub.
+
+            * WebProcess/Plugins/Plugin.h:
+            Add pure virtual contentsScaleFactorChanged member function.
+
+            * WebProcess/Plugins/PluginProxy.cpp:
+            (WebKit::PluginProxy::geometryDidChange):
+            Add geometryDidChange overload that doesn't take any parameters. Make it send over the
+            new scale factor to the plug-in process.
+
+            (WebKit::PluginProxy::contentsScaleFactorChanged):
+            Call geometryDidChange.
+
+            * WebProcess/Plugins/PluginView.cpp:
+            (WebKit::PluginView::setDeviceScaleFactor):
+            Call Plugin::contentsScaleFactorChanged.
+
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::setDeviceScaleFactor):
+            Call setDeviceScaleFactor on all registered plug-ins.
+
+2011-12-06  Lucas Forschler  <[email protected]>
+
     Merge 98406
 
     2011-10-25  Beth Dakin  <[email protected]>

Modified: branches/safari-534.53-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2011-12-07 19:19:31 UTC (rev 102254)
@@ -436,13 +436,18 @@
     m_plugin->frameDidFail(requestID, wasCancelled);
 }
 
-void PluginControllerProxy::geometryDidChange(const IntRect& frameRect, const IntRect& clipRect, const ShareableBitmap::Handle& backingStoreHandle)
+void PluginControllerProxy::geometryDidChange(const IntRect& frameRect, const IntRect& clipRect, float contentsScaleFactor, const ShareableBitmap::Handle& backingStoreHandle)
 {
     m_frameRect = frameRect;
     m_clipRect = clipRect;
 
     ASSERT(m_plugin);
 
+    if (contentsScaleFactor != m_contentsScaleFactor) {
+        m_contentsScaleFactor = contentsScaleFactor;
+        m_plugin->contentsScaleFactorChanged(m_contentsScaleFactor);
+    }
+
     platformGeometryDidChange();
 
     if (!backingStoreHandle.isNull()) {

Modified: branches/safari-534.53-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.h (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2011-12-07 19:19:31 UTC (rev 102254)
@@ -112,7 +112,7 @@
     // Message handlers.
     void frameDidFinishLoading(uint64_t requestID);
     void frameDidFail(uint64_t requestID, bool wasCancelled);
-    void geometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, const ShareableBitmap::Handle& backingStoreHandle);
+    void geometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, float contentsScaleFactor, const ShareableBitmap::Handle& backingStoreHandle);
     void didEvaluateJavaScript(uint64_t requestID, const String& result);
     void streamDidReceiveResponse(uint64_t streamID, const String& responseURLString, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers);
     void streamDidReceiveData(uint64_t streamID, const CoreIPC::DataReference& data);

Modified: branches/safari-534.53-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in	2011-12-07 19:19:31 UTC (rev 102254)
@@ -24,7 +24,7 @@
 
 messages -> PluginControllerProxy {
     # Sent when the plug-in geometry changes.
-    GeometryDidChange(WebCore::IntRect frameRect, WebCore::IntRect clipRect, WebKit::ShareableBitmap::Handle backingStoreHandle)
+    GeometryDidChange(WebCore::IntRect frameRect, WebCore::IntRect clipRect, float scaleFactor, WebKit::ShareableBitmap::Handle backingStoreHandle)
 
     # Sent when a frame has finished loading.
     FrameDidFinishLoading(uint64_t requestID)

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-12-07 19:19:31 UTC (rev 102254)
@@ -184,6 +184,7 @@
     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);

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm	2011-12-07 19:19:31 UTC (rev 102254)
@@ -901,6 +901,12 @@
     // 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.

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2011-12-07 19:19:31 UTC (rev 102254)
@@ -540,6 +540,10 @@
 {
 }
 
+void BuiltInPDFView::contentsScaleFactorChanged(float)
+{
+}
+
 uint64_t BuiltInPDFView::pluginComplexTextInputIdentifier() const
 {
     return 0;

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-12-07 19:19:31 UTC (rev 102254)
@@ -105,6 +105,7 @@
     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

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h	2011-12-07 19:19:31 UTC (rev 102254)
@@ -176,6 +176,9 @@
     // 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;
 

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-12-07 19:19:31 UTC (rev 102254)
@@ -183,25 +183,25 @@
     return false;
 }
 
-void PluginProxy::geometryDidChange(const IntRect& frameRect, const IntRect& clipRect)
+void PluginProxy::geometryDidChange()
 {
     ASSERT(m_isStarted);
 
-    m_frameRect = frameRect;
+    float contentsScaleFactor = controller()->contentsScaleFactor();
 
     if (m_frameRect.isEmpty() || !needsBackingStore()) {
         ShareableBitmap::Handle pluginBackingStoreHandle;
-        m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(frameRect, clipRect, pluginBackingStoreHandle), m_pluginInstanceID, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply);
+        m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(m_frameRect, m_clipRect, contentsScaleFactor, pluginBackingStoreHandle), m_pluginInstanceID, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply);
         return;
     }
 
     bool didUpdateBackingStore = false;
     if (!m_backingStore) {
-        m_backingStore = ShareableBitmap::create(frameRect.size(), ShareableBitmap::SupportsAlpha);
+        m_backingStore = ShareableBitmap::create(m_frameRect.size(), ShareableBitmap::SupportsAlpha);
         didUpdateBackingStore = true;
-    } else if (frameRect.size() != m_backingStore->size()) {
+    } else if (m_frameRect.size() != m_backingStore->size()) {
         // The backing store already exists, just resize it.
-        if (!m_backingStore->resize(frameRect.size()))
+        if (!m_backingStore->resize(m_frameRect.size()))
             return;
 
         didUpdateBackingStore = true;
@@ -211,7 +211,7 @@
 
     if (didUpdateBackingStore) {
         // Create a new plug-in backing store.
-        m_pluginBackingStore = ShareableBitmap::createShareable(frameRect.size(), ShareableBitmap::SupportsAlpha);
+        m_pluginBackingStore = ShareableBitmap::createShareable(m_frameRect.size(), ShareableBitmap::SupportsAlpha);
         if (!m_pluginBackingStore)
             return;
 
@@ -224,9 +224,17 @@
         m_pluginBackingStoreContainsValidData = false;
     }
 
-    m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(frameRect, clipRect, pluginBackingStoreHandle), m_pluginInstanceID, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply);
+    m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(m_frameRect, m_clipRect, contentsScaleFactor, pluginBackingStoreHandle), m_pluginInstanceID, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply);
 }
 
+void PluginProxy::geometryDidChange(const IntRect& frameRect, const IntRect& clipRect)
+{
+    m_frameRect = frameRect;
+    m_clipRect = clipRect;
+
+    geometryDidChange();
+}
+
 void PluginProxy::visibilityDidChange()
 {
     ASSERT(m_isStarted);
@@ -377,6 +385,11 @@
     m_connection->connection()->send(Messages::PluginControllerProxy::WindowVisibilityChanged(isVisible), m_pluginInstanceID);
 }
 
+void PluginProxy::contentsScaleFactorChanged(float scaleFactor)
+{
+    geometryDidChange();
+}
+
 uint64_t PluginProxy::pluginComplexTextInputIdentifier() const
 {
     return m_pluginInstanceID;

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2011-12-07 19:19:31 UTC (rev 102254)
@@ -97,6 +97,7 @@
     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
@@ -112,6 +113,8 @@
     bool needsBackingStore() const;
     uint64_t windowNPObjectID();
 
+    void geometryDidChange();
+
     // Message handlers.
     void loadURL(uint64_t requestID, const String& method, const String& urlString, const String& target, const WebCore::HTTPHeaderMap& headerFields, const Vector<uint8_t>& httpBody, bool allowPopups);
     void update(const WebCore::IntRect& paintedRect);
@@ -138,6 +141,9 @@
     // The plug-in rect in window coordinates.
     WebCore::IntRect m_frameRect;
 
+    // The plug-in clip rect in window coordinates.
+    WebCore::IntRect m_clipRect;
+
     // This is the backing store that we paint when we're told to paint.
     RefPtr<ShareableBitmap> m_backingStore;
 

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-12-07 19:19:31 UTC (rev 102254)
@@ -403,6 +403,14 @@
     m_plugin->windowFocusChanged(windowIsFocused);    
 }
 
+void PluginView::setDeviceScaleFactor(float scaleFactor)
+{
+    if (!m_isInitialized || !m_plugin)
+        return;
+
+    m_plugin->contentsScaleFactorChanged(scaleFactor);
+}
+
 void PluginView::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates)
 {
     if (!m_isInitialized || !m_plugin)

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginView.h (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginView.h	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginView.h	2011-12-07 19:19:31 UTC (rev 102254)
@@ -63,6 +63,7 @@
 #if PLATFORM(MAC)
     void setWindowIsVisible(bool);
     void setWindowIsFocused(bool);
+    void setDeviceScaleFactor(float);
     void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates);
     bool sendComplexTextInput(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
 #endif

Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (102253 => 102254)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-07 19:19:31 UTC (rev 102254)
@@ -789,6 +789,12 @@
         return;
 
     m_page->setDeviceScaleFactor(scaleFactor);
+
+    // Tell all our plug-in views that the device scale factor changed.
+#if PLATFORM(MAC)
+    for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
+        (*it)->setDeviceScaleFactor(scaleFactor);
+#endif
 }
 
 void WebPage::setUseFixedLayout(bool fixed)

Modified: branches/safari-534.53-branch/Tools/ChangeLog (102253 => 102254)


--- branches/safari-534.53-branch/Tools/ChangeLog	2011-12-07 19:06:27 UTC (rev 102253)
+++ branches/safari-534.53-branch/Tools/ChangeLog	2011-12-07 19:19:31 UTC (rev 102254)
@@ -1,5 +1,26 @@
 2011-12-06  Lucas Forschler  <[email protected]>
 
+    Merge 98413
+
+    2011-10-25  Anders Carlsson  <[email protected]>
+
+            Plug-ins have no way to find out when the device scale factor changes
+            https://bugs.webkit.org/show_bug.cgi?id=67226
+
+            Reviewed by Sam Weinig.
+
+            Keep a cached copy of the contents scale and update it when it changes.
+
+            * DumpRenderTree/TestNetscapePlugIn/Tests/mac/ContentsScaleFactor.cpp:
+            (ContentsScaleFactor::ContentsScaleFactor):
+            (ContentsScaleFactor::cachedContentsScaleFactor):
+            (ContentsScaleFactor::ScriptableObject::hasProperty):
+            (ContentsScaleFactor::ScriptableObject::getProperty):
+            (ContentsScaleFactor::NPP_New):
+            (ContentsScaleFactor::NPP_SetValue):
+
+2011-12-06  Lucas Forschler  <[email protected]>
+
     Merge 98403
 
     2011-10-25  Anders Carlsson  <[email protected]>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to