Title: [98416] trunk/Source/WebKit2
Revision
98416
Author
[email protected]
Date
2011-10-25 18:00:14 -0700 (Tue, 25 Oct 2011)

Log Message

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).

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (98415 => 98416)


--- trunk/Source/WebKit2/ChangeLog	2011-10-26 00:56:55 UTC (rev 98415)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-26 01:00:14 UTC (rev 98416)
@@ -1,3 +1,25 @@
+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-10-25  Mark Hahnenberg  <[email protected]>
 
         Remove putVirtual

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp (98415 => 98416)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2011-10-26 00:56:55 UTC (rev 98415)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2011-10-26 01:00:14 UTC (rev 98416)
@@ -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: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp (98415 => 98416)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-10-26 00:56:55 UTC (rev 98415)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-10-26 01:00:14 UTC (rev 98416)
@@ -135,14 +135,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;
     }
@@ -150,7 +153,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;
@@ -188,12 +191,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;
@@ -203,7 +209,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;
 
@@ -524,10 +530,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