Title: [98923] trunk/Source/WebKit2
Revision
98923
Author
ander...@apple.com
Date
2011-10-31 17:29:03 -0700 (Mon, 31 Oct 2011)

Log Message

PluginControllerProxy should call Plugin::geometryDidChange
https://bugs.webkit.org/show_bug.cgi?id=71255

Reviewed by Sam Weinig.

Pass enough information over in the GeometryDidChange message sent from
PluginProxy to PluginControllerProxy so that PluginControllerProxy can call
Plugin::geometryDidChange.

* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::paint):
(WebKit::PluginControllerProxy::invalidate):
(WebKit::PluginControllerProxy::paintEntirePlugin):
Update for rename from m_frameRect to m_frameRectInWindowCoordinates.

(WebKit::PluginControllerProxy::geometryDidChange):
This now takes the plug-in size and the plug-in to root view transform as well.

* PluginProcess/PluginControllerProxy.h:
Store the plug-in size and rename m_frameRect to m_frameRectInWindowCoordinates.

* PluginProcess/PluginControllerProxy.messages.in:
Update message signature.

* PluginProcess/mac/PluginControllerProxyMac.mm:
(WebKit::PluginControllerProxy::platformGeometryDidChange):
Use the plug-in size instead of the frame rect size.

* Shared/WebCoreArgumentCoders.cpp:
(CoreIPC::::encode):
(CoreIPC::::decode):
* Shared/WebCoreArgumentCoders.h:
Add encoder/decoder for WebCore::AffineTransform.

* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::geometryDidChange):
Compute the frame rect in window coordinates and send it over.

(WebKit::PluginProxy::deprecatedGeometryDidChange):
Move call to geometryDidChange() from here to the new PluginProxy::geometryDidChange.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (98922 => 98923)


--- trunk/Source/WebKit2/ChangeLog	2011-11-01 00:27:50 UTC (rev 98922)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-01 00:29:03 UTC (rev 98923)
@@ -1,5 +1,48 @@
 2011-10-31  Anders Carlsson  <ander...@apple.com>
 
+        PluginControllerProxy should call Plugin::geometryDidChange
+        https://bugs.webkit.org/show_bug.cgi?id=71255
+
+        Reviewed by Sam Weinig.
+
+        Pass enough information over in the GeometryDidChange message sent from
+        PluginProxy to PluginControllerProxy so that PluginControllerProxy can call
+        Plugin::geometryDidChange.
+
+        * PluginProcess/PluginControllerProxy.cpp:
+        (WebKit::PluginControllerProxy::paint):
+        (WebKit::PluginControllerProxy::invalidate):
+        (WebKit::PluginControllerProxy::paintEntirePlugin):
+        Update for rename from m_frameRect to m_frameRectInWindowCoordinates.
+
+        (WebKit::PluginControllerProxy::geometryDidChange):
+        This now takes the plug-in size and the plug-in to root view transform as well.
+
+        * PluginProcess/PluginControllerProxy.h:
+        Store the plug-in size and rename m_frameRect to m_frameRectInWindowCoordinates.
+
+        * PluginProcess/PluginControllerProxy.messages.in:
+        Update message signature.
+
+        * PluginProcess/mac/PluginControllerProxyMac.mm:
+        (WebKit::PluginControllerProxy::platformGeometryDidChange):
+        Use the plug-in size instead of the frame rect size.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (CoreIPC::::encode):
+        (CoreIPC::::decode):
+        * Shared/WebCoreArgumentCoders.h:
+        Add encoder/decoder for WebCore::AffineTransform.
+
+        * WebProcess/Plugins/PluginProxy.cpp:
+        (WebKit::PluginProxy::geometryDidChange):
+        Compute the frame rect in window coordinates and send it over.
+
+        (WebKit::PluginProxy::deprecatedGeometryDidChange):
+        Move call to geometryDidChange() from here to the new PluginProxy::geometryDidChange.
+
+2011-10-31  Anders Carlsson  <ander...@apple.com>
+
         Remove some uses of m_frameRectInWindowCoordinates from PluginProxy
         https://bugs.webkit.org/show_bug.cgi?id=71252
 

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp (98922 => 98923)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2011-11-01 00:27:50 UTC (rev 98922)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2011-11-01 00:29:03 UTC (rev 98923)
@@ -169,7 +169,7 @@
     graphicsContext->scale(FloatSize(m_contentsScaleFactor, m_contentsScaleFactor));
 #endif
 
-    graphicsContext->translate(-m_frameRect.x(), -m_frameRect.y());
+    graphicsContext->translate(-m_frameRectInWindowCoordinates.x(), -m_frameRectInWindowCoordinates.y());
 
     if (m_plugin->isTransparent())
         graphicsContext->clearRect(dirtyRect);
@@ -211,10 +211,10 @@
 {
     // Convert the dirty rect to window coordinates.
     IntRect dirtyRect = rect;
-    dirtyRect.move(m_frameRect.x(), m_frameRect.y());
+    dirtyRect.move(m_frameRectInWindowCoordinates.x(), m_frameRectInWindowCoordinates.y());
 
     // Make sure that the dirty rect is not greater than the plug-in itself.
-    dirtyRect.intersect(m_frameRect);
+    dirtyRect.intersect(m_frameRectInWindowCoordinates);
 
     m_dirtyRect.unite(dirtyRect);
 
@@ -429,13 +429,13 @@
     m_plugin->frameDidFail(requestID, wasCancelled);
 }
 
-void PluginControllerProxy::geometryDidChange(const IntRect& frameRect, const IntRect& clipRect, float contentsScaleFactor, const ShareableBitmap::Handle& backingStoreHandle)
+void PluginControllerProxy::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform, const IntRect& frameRectInWindowCoordinates, float contentsScaleFactor, const ShareableBitmap::Handle& backingStoreHandle)
 {
-    m_frameRect = frameRect;
-    m_clipRect = clipRect;
-
     ASSERT(m_plugin);
 
+    m_pluginSize = pluginSize;
+    m_frameRectInWindowCoordinates = frameRectInWindowCoordinates;
+
 #if PLATFORM(MAC)
     if (contentsScaleFactor != m_contentsScaleFactor) {
         m_contentsScaleFactor = contentsScaleFactor;
@@ -452,7 +452,7 @@
         m_backingStore = ShareableBitmap::create(backingStoreHandle);
     }
 
-    m_plugin->deprecatedGeometryDidChange(frameRect, clipRect);
+    m_plugin->geometryDidChange(pluginSize, clipRect, pluginToRootViewTransform);
 }
 
 void PluginControllerProxy::didEvaluateJavaScript(uint64_t requestID, const String& result)
@@ -547,10 +547,10 @@
 
 void PluginControllerProxy::paintEntirePlugin()
 {
-    if (m_frameRect.isEmpty())
+    if (m_frameRectInWindowCoordinates.isEmpty())
         return;
 
-    m_dirtyRect = m_frameRect;
+    m_dirtyRect = m_frameRectInWindowCoordinates;
     paint();
 }
 

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h (98922 => 98923)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2011-11-01 00:27:50 UTC (rev 98922)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2011-11-01 00:29:03 UTC (rev 98923)
@@ -113,7 +113,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, float contentsScaleFactor, const ShareableBitmap::Handle& backingStoreHandle);
+    void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform, const WebCore::IntRect& frameRectInWindowCoordinates, 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);
@@ -161,10 +161,12 @@
 
     RefPtr<Plugin> m_plugin;
 
-    // The plug-in rect and clip rect in window coordinates.
-    WebCore::IntRect m_frameRect;
-    WebCore::IntRect m_clipRect;
+    WebCore::IntSize m_pluginSize;
 
+    // The plug-in frame rect in window coordinates.
+    // FIXME: Remove this.
+    WebCore::IntRect m_frameRectInWindowCoordinates;
+
     // The dirty rect in plug-in coordinates.
     WebCore::IntRect m_dirtyRect;
 

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in (98922 => 98923)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in	2011-11-01 00:27:50 UTC (rev 98922)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in	2011-11-01 00:29:03 UTC (rev 98923)
@@ -24,7 +24,7 @@
 
 messages -> PluginControllerProxy {
     # Sent when the plug-in geometry changes.
-    GeometryDidChange(WebCore::IntRect frameRect, WebCore::IntRect clipRect, float scaleFactor, WebKit::ShareableBitmap::Handle backingStoreHandle)
+    GeometryDidChange(WebCore::IntSize pluginSize, WebCore::IntRect clipRect, WebCore::AffineTransform pluginToRootViewTransform, WebCore::IntRect frameRectInWindowCoordinates, float scaleFactor, WebKit::ShareableBitmap::Handle backingStoreHandle)
 
     # Sent when a frame has finished loading.
     FrameDidFinishLoading(uint64_t requestID)

Modified: trunk/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm (98922 => 98923)


--- trunk/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm	2011-11-01 00:27:50 UTC (rev 98922)
+++ trunk/Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm	2011-11-01 00:29:03 UTC (rev 98923)
@@ -96,7 +96,7 @@
     // We don't want to animate to the new size so we disable actions for this transaction.
     [CATransaction begin];
     [CATransaction setValue:[NSNumber numberWithBool:YES] forKey:kCATransactionDisableActions];
-    [pluginLayer setFrame:CGRectMake(0, 0, m_frameRect.width(), m_frameRect.height())];
+    [pluginLayer setFrame:CGRectMake(0, 0, m_pluginSize.width(), m_pluginSize.height())];
     [CATransaction commit];
 }
 

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (98922 => 98923)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2011-11-01 00:27:50 UTC (rev 98922)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2011-11-01 00:29:03 UTC (rev 98923)
@@ -63,6 +63,17 @@
 
 namespace CoreIPC {
 
+void ArgumentCoder<AffineTransform>::encode(ArgumentEncoder* encoder, const AffineTransform& affineTransform)
+{
+    SimpleArgumentCoder<AffineTransform>::encode(encoder, affineTransform);
+}
+
+bool ArgumentCoder<AffineTransform>::decode(ArgumentDecoder* decoder, AffineTransform& affineTransform)
+{
+    return SimpleArgumentCoder<AffineTransform>::decode(decoder, affineTransform);
+}
+
+
 void ArgumentCoder<FloatPoint>::encode(ArgumentEncoder* encoder, const FloatPoint& floatPoint)
 {
     SimpleArgumentCoder<FloatPoint>::encode(encoder, floatPoint);

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (98922 => 98923)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2011-11-01 00:27:50 UTC (rev 98922)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2011-11-01 00:29:03 UTC (rev 98923)
@@ -29,6 +29,7 @@
 #include "ArgumentCoders.h"
 
 namespace WebCore {
+    class AffineTransform;
     class AuthenticationChallenge;
     class Color;
     class Credential;
@@ -82,6 +83,11 @@
 
 namespace CoreIPC {
 
+template<> struct ArgumentCoder<WebCore::AffineTransform> {
+    static void encode(ArgumentEncoder*, const WebCore::AffineTransform&);
+    static bool decode(ArgumentDecoder*, WebCore::AffineTransform&);
+};
+
 template<> struct ArgumentCoder<WebCore::FloatPoint> {
     static void encode(ArgumentEncoder*, const WebCore::FloatPoint&);
     static bool decode(ArgumentDecoder*, WebCore::FloatPoint&);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp (98922 => 98923)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-11-01 00:27:50 UTC (rev 98922)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-11-01 00:29:03 UTC (rev 98923)
@@ -180,9 +180,12 @@
 {
     ASSERT(m_isStarted);
 
+    IntPoint frameRectLocationInWindowCoordinates = m_pluginToRootViewTransform.mapPoint(IntPoint());
+    IntRect frameRectInWindowCoordinates = IntRect(frameRectLocationInWindowCoordinates, m_pluginSize);
+
     if (m_pluginSize.isEmpty() || !needsBackingStore()) {
         ShareableBitmap::Handle pluginBackingStoreHandle;
-        m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(m_frameRectInWindowCoordinates, m_clipRectInWindowCoordinates, contentsScaleFactor(), pluginBackingStoreHandle), m_pluginInstanceID, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply);
+        m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(m_pluginSize, m_clipRect, m_pluginToRootViewTransform, frameRectInWindowCoordinates, contentsScaleFactor(), pluginBackingStoreHandle), m_pluginInstanceID, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply);
         return;
     }
 
@@ -203,15 +206,13 @@
         m_pluginBackingStoreContainsValidData = false;
     }
 
-    m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(m_frameRectInWindowCoordinates, m_frameRectInWindowCoordinates, contentsScaleFactor(), pluginBackingStoreHandle), m_pluginInstanceID, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply);
+    m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(m_pluginSize, m_clipRect, m_pluginToRootViewTransform, frameRectInWindowCoordinates, contentsScaleFactor(), pluginBackingStoreHandle), m_pluginInstanceID, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply);
 }
 
 void PluginProxy::deprecatedGeometryDidChange(const IntRect& frameRectInWindowCoordinates, const IntRect& clipRectInWindowCoordinates)
 {
     m_frameRectInWindowCoordinates = frameRectInWindowCoordinates;
     m_clipRectInWindowCoordinates = clipRectInWindowCoordinates;
-
-    geometryDidChange();
 }
 
 void PluginProxy::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform)
@@ -224,6 +225,8 @@
     m_pluginSize = pluginSize;
     m_clipRect = clipRect;
     m_pluginToRootViewTransform = pluginToRootViewTransform;
+
+    geometryDidChange();
 }
 
 void PluginProxy::visibilityDidChange()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to