Title: [102256] branches/safari-534.53-branch/Source/WebKit2

Diff

Modified: branches/safari-534.53-branch/Source/WebKit2/ChangeLog (102255 => 102256)


--- branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-07 19:21:45 UTC (rev 102255)
+++ branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-07 19:29:44 UTC (rev 102256)
@@ -1,3 +1,29 @@
+2011-12-07  Lucas Forschler  <[email protected]>
+
+    Merge 98416
+
+    2011-10-25  Anders Carlsson  <[email protected]>
+
+            CG plug-ins are always given a context with a scale factor of 1, even when the device scale factor is something else
+            https://bugs.webkit.org/show_bug.cgi?id=67227
+            <rdar://problem/10048319>
+
+            Reviewed by Sam Weinig.
+
+            * PluginProcess/PluginControllerProxy.cpp:
+            (WebKit::PluginControllerProxy::paint):
+            Apply the scale factor when painting.
+
+            * WebProcess/Plugins/PluginProxy.cpp:
+            (WebKit::PluginProxy::paint):
+            Apply the scale factor when painting.
+
+            (WebKit::PluginProxy::geometryDidChange):
+            Make sure to apply the contents scale factor to the backing store size.
+
+            (WebKit::PluginProxy::update):
+            Apply the scale factor (when painting).
+
 2011-12-06  Lucas Forschler  <[email protected]>
 
     Merge 98413

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


--- branches/safari-534.53-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2011-12-07 19:21:45 UTC (rev 102255)
+++ branches/safari-534.53-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2011-12-07 19:29:44 UTC (rev 102256)
@@ -163,6 +163,10 @@
     // Create a graphics context.
     OwnPtr<GraphicsContext> graphicsContext = m_backingStore->createGraphicsContext();
 
+    // 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.
+    graphicsContext->scale(FloatSize(m_contentsScaleFactor, m_contentsScaleFactor));
+
     graphicsContext->translate(-m_frameRect.x(), -m_frameRect.y());
 
     if (m_plugin->isTransparent())

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


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-12-07 19:21:45 UTC (rev 102255)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-12-07 19:29:44 UTC (rev 102256)
@@ -143,14 +143,17 @@
     if (!needsBackingStore() || !m_backingStore)
         return;
 
+    float contentsScaleFactor = controller()->contentsScaleFactor();
+
     if (!m_pluginBackingStoreContainsValidData) {
         m_connection->connection()->sendSync(Messages::PluginControllerProxy::PaintEntirePlugin(), Messages::PluginControllerProxy::PaintEntirePlugin::Reply(), m_pluginInstanceID);
     
         // Blit the plug-in backing store into our own backing store.
         OwnPtr<WebCore::GraphicsContext> graphicsContext = m_backingStore->createGraphicsContext();
+        graphicsContext->applyDeviceScaleFactor(contentsScaleFactor);
         graphicsContext->setCompositeOperation(CompositeCopy);
 
-        m_pluginBackingStore->paint(*graphicsContext, IntPoint(), IntRect(0, 0, m_frameRect.width(), m_frameRect.height()));
+        m_pluginBackingStore->paint(*graphicsContext, contentsScaleFactor, IntPoint(), IntRect(0, 0, m_frameRect.width(), m_frameRect.height()));
 
         m_pluginBackingStoreContainsValidData = true;
     }
@@ -158,7 +161,7 @@
     IntRect dirtyRectInPluginCoordinates = dirtyRect;
     dirtyRectInPluginCoordinates.move(-m_frameRect.x(), -m_frameRect.y());
 
-    m_backingStore->paint(*graphicsContext, dirtyRect.location(), dirtyRectInPluginCoordinates);
+    m_backingStore->paint(*graphicsContext, contentsScaleFactor, dirtyRect.location(), dirtyRectInPluginCoordinates);
 
     if (m_waitingForPaintInResponseToUpdate) {
         m_waitingForPaintInResponseToUpdate = false;
@@ -196,12 +199,15 @@
     }
 
     bool didUpdateBackingStore = false;
+    IntSize backingStoreSize = m_frameRect.size();
+    backingStoreSize.scale(contentsScaleFactor);
+
     if (!m_backingStore) {
-        m_backingStore = ShareableBitmap::create(m_frameRect.size(), ShareableBitmap::SupportsAlpha);
+        m_backingStore = ShareableBitmap::create(backingStoreSize, ShareableBitmap::SupportsAlpha);
         didUpdateBackingStore = true;
-    } else if (m_frameRect.size() != m_backingStore->size()) {
+    } else if (backingStoreSize != m_backingStore->size()) {
         // The backing store already exists, just resize it.
-        if (!m_backingStore->resize(m_frameRect.size()))
+        if (!m_backingStore->resize(backingStoreSize))
             return;
 
         didUpdateBackingStore = true;
@@ -211,7 +217,7 @@
 
     if (didUpdateBackingStore) {
         // Create a new plug-in backing store.
-        m_pluginBackingStore = ShareableBitmap::createShareable(m_frameRect.size(), ShareableBitmap::SupportsAlpha);
+        m_pluginBackingStore = ShareableBitmap::createShareable(backingStoreSize, ShareableBitmap::SupportsAlpha);
         if (!m_pluginBackingStore)
             return;
 
@@ -535,10 +541,13 @@
     paintedRectPluginCoordinates.move(-m_frameRect.x(), -m_frameRect.y());
 
     if (m_backingStore) {
+        float contentsScaleFactor = controller()->contentsScaleFactor();
+
         // Blit the plug-in backing store into our own backing store.
         OwnPtr<GraphicsContext> graphicsContext = m_backingStore->createGraphicsContext();
+        graphicsContext->applyDeviceScaleFactor(contentsScaleFactor);
         graphicsContext->setCompositeOperation(CompositeCopy);
-        m_pluginBackingStore->paint(*graphicsContext, paintedRectPluginCoordinates.location(), 
+        m_pluginBackingStore->paint(*graphicsContext, contentsScaleFactor, paintedRectPluginCoordinates.location(), 
                                     paintedRectPluginCoordinates);
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to