Title: [99241] trunk/Source/WebKit2
Revision
99241
Author
[email protected]
Date
2011-11-03 16:17:34 -0700 (Thu, 03 Nov 2011)

Log Message

Get rid of Plugin::wantsWindowRelativeCoordinates()
https://bugs.webkit.org/show_bug.cgi?id=71504

Reviewed by Darin Adler.

Since all Plugin subclasses now return false for wantsWindowRelativeCoordinates,
we can go ahead and remove it.

* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::paint):
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::snapshot):
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
* WebProcess/Plugins/PDF/BuiltInPDFView.h:
* WebProcess/Plugins/Plugin.h:
* WebProcess/Plugins/PluginProxy.cpp:
* WebProcess/Plugins/PluginProxy.h:
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::paint):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (99240 => 99241)


--- trunk/Source/WebKit2/ChangeLog	2011-11-03 23:17:27 UTC (rev 99240)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-03 23:17:34 UTC (rev 99241)
@@ -1,5 +1,28 @@
 2011-11-03  Anders Carlsson  <[email protected]>
 
+        Get rid of Plugin::wantsWindowRelativeCoordinates()
+        https://bugs.webkit.org/show_bug.cgi?id=71504
+
+        Reviewed by Darin Adler.
+
+        Since all Plugin subclasses now return false for wantsWindowRelativeCoordinates,
+        we can go ahead and remove it.
+
+        * PluginProcess/PluginControllerProxy.cpp:
+        (WebKit::PluginControllerProxy::paint):
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::snapshot):
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+        * WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
+        * WebProcess/Plugins/PDF/BuiltInPDFView.h:
+        * WebProcess/Plugins/Plugin.h:
+        * WebProcess/Plugins/PluginProxy.cpp:
+        * WebProcess/Plugins/PluginProxy.h:
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::paint):
+
+2011-11-03  Anders Carlsson  <[email protected]>
+
         NetscapePlugin::wantsWindowRelativeCoordinates should return false for all ports
         https://bugs.webkit.org/show_bug.cgi?id=71501
 

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp (99240 => 99241)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2011-11-03 23:17:27 UTC (rev 99240)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2011-11-03 23:17:34 UTC (rev 99241)
@@ -172,15 +172,8 @@
     if (m_plugin->isTransparent())
         graphicsContext->clearRect(dirtyRect);
 
-    if (m_plugin->wantsWindowRelativeCoordinates()) {
-        IntRect dirtyRectInWindowCoordinates = dirtyRect;
-        dirtyRectInWindowCoordinates.move(m_frameRectInWindowCoordinates.x(), m_frameRectInWindowCoordinates.y());
-        graphicsContext->translate(-m_frameRectInWindowCoordinates.x(), -m_frameRectInWindowCoordinates.y());
+    m_plugin->paint(graphicsContext.get(), dirtyRect);
 
-        m_plugin->paint(graphicsContext.get(), dirtyRectInWindowCoordinates);
-    } else
-        m_plugin->paint(graphicsContext.get(), dirtyRect);
-
     m_connection->connection()->send(Messages::PluginProxy::Update(dirtyRect), m_pluginInstanceID);
 }
 

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (99240 => 99241)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-11-03 23:17:27 UTC (rev 99240)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-11-03 23:17:34 UTC (rev 99241)
@@ -661,11 +661,7 @@
     // which we currently don't have initiated in the plug-in process.
     context->scale(FloatSize(contentsScaleFactor(), contentsScaleFactor()));
 
-    if (wantsWindowRelativeCoordinates()) {
-        context->translate(-m_frameRectInWindowCoordinates.x(), -m_frameRectInWindowCoordinates.y());
-        platformPaint(context.get(), m_frameRectInWindowCoordinates, true);
-    } else
-        platformPaint(context.get(), IntRect(IntPoint(), m_pluginSize), true);
+    platformPaint(context.get(), IntRect(IntPoint(), m_pluginSize), true);
 
     return bitmap.release();
 }
@@ -933,11 +929,6 @@
     return false;
 }
 
-bool NetscapePlugin::wantsWindowRelativeCoordinates()
-{
-    return false;
-}
-
 Scrollbar* NetscapePlugin::horizontalScrollbar()
 {
     return 0;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (99240 => 99241)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-11-03 23:17:27 UTC (rev 99240)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-11-03 23:17:34 UTC (rev 99241)
@@ -212,7 +212,6 @@
     virtual void privateBrowsingStateChanged(bool);
     virtual bool getFormValue(String& formValue);
     virtual bool handleScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity);
-    virtual bool wantsWindowRelativeCoordinates();
     virtual WebCore::Scrollbar* horizontalScrollbar();
     virtual WebCore::Scrollbar* verticalScrollbar();
 

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp (99240 => 99241)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2011-11-03 23:17:27 UTC (rev 99240)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2011-11-03 23:17:34 UTC (rev 99241)
@@ -557,11 +557,6 @@
     return scroll(direction, granularity);
 }
 
-bool BuiltInPDFView::wantsWindowRelativeCoordinates()
-{
-    return false;
-}
-
 Scrollbar* BuiltInPDFView::horizontalScrollbar()
 {
     return m_horizontalScrollbar.get();

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h (99240 => 99241)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-11-03 23:17:27 UTC (rev 99240)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-11-03 23:17:34 UTC (rev 99241)
@@ -110,7 +110,6 @@
     virtual void privateBrowsingStateChanged(bool);
     virtual bool getFormValue(String& formValue);
     virtual bool handleScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity);
-    virtual bool wantsWindowRelativeCoordinates();
     virtual WebCore::Scrollbar* horizontalScrollbar();
     virtual WebCore::Scrollbar* verticalScrollbar();
 

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h (99240 => 99241)


--- trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h	2011-11-03 23:17:27 UTC (rev 99240)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h	2011-11-03 23:17:34 UTC (rev 99241)
@@ -213,10 +213,6 @@
     // Tells the plug-in that it should scroll. The plug-in should return true if it did scroll.
     virtual bool handleScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity) = 0;
 
-    // Whether the plug-in wants its coordinates to be relative to the window.
-    // FIXME: No plug-ins should want window relative coordinates, so we should get rid of this.
-    virtual bool wantsWindowRelativeCoordinates() = 0;
-
     // A plug-in can use WebCore scroll bars. Make them known, so that hit testing can find them.
     // FIXME: This code should be in PluginView or its base class, not in individual plug-ins.
     virtual WebCore::Scrollbar* horizontalScrollbar() = 0;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp (99240 => 99241)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-11-03 23:17:27 UTC (rev 99240)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-11-03 23:17:34 UTC (rev 99241)
@@ -403,11 +403,6 @@
     return false;
 }
 
-bool PluginProxy::wantsWindowRelativeCoordinates()
-{
-    return false;
-}
-
 Scrollbar* PluginProxy::horizontalScrollbar()
 {
     return 0;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h (99240 => 99241)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2011-11-03 23:17:27 UTC (rev 99240)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2011-11-03 23:17:34 UTC (rev 99241)
@@ -106,7 +106,6 @@
     virtual void privateBrowsingStateChanged(bool);
     virtual bool getFormValue(String& formValue);
     virtual bool handleScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity);
-    virtual bool wantsWindowRelativeCoordinates();
     virtual WebCore::Scrollbar* horizontalScrollbar();
     virtual WebCore::Scrollbar* verticalScrollbar();
 

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (99240 => 99241)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-11-03 23:17:27 UTC (rev 99240)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-11-03 23:17:34 UTC (rev 99241)
@@ -576,14 +576,8 @@
         return;
     }
 
-    IntRect paintRect;
-    if (m_plugin->wantsWindowRelativeCoordinates()) {
-        IntRect dirtyRectInWindowCoordinates = parent()->contentsToWindow(dirtyRect);
-        paintRect = intersection(dirtyRectInWindowCoordinates, clipRectInWindowCoordinates());
-    } else {
-        // FIXME: We should try to intersect the dirty rect with the plug-in's clip rect here.
-        paintRect = IntRect(IntPoint(), frameRect().size());
-    }
+    // FIXME: We should try to intersect the dirty rect with the plug-in's clip rect here.
+    IntRect paintRect = IntRect(IntPoint(), frameRect().size());
 
     if (paintRect.isEmpty())
         return;
@@ -595,17 +589,8 @@
     
     GraphicsContextStateSaver stateSaver(*context);
 
-    if (m_plugin->wantsWindowRelativeCoordinates()) {
-        // The plugin is given a frame rect which is parent()->contentsToWindow(frameRect()),
-        // and un-translates by the its origin when painting. The current CTM reflects
-        // this widget's frame is its parent (the document), so we have to offset the CTM by
-        // the document's window coordinates.
-        IntPoint documentOriginInWindowCoordinates = parent()->contentsToWindow(IntPoint());
-        context->translate(-documentOriginInWindowCoordinates.x(), -documentOriginInWindowCoordinates.y());
-    } else {
-        // Translate the coordinate system so that the origin is in the top-left corner of the plug-in.
-        context->translate(frameRect().location().x(), frameRect().location().y());
-    }
+    // Translate the coordinate system so that the origin is in the top-left corner of the plug-in.
+    context->translate(frameRect().location().x(), frameRect().location().y());
 
     m_plugin->paint(context, paintRect);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to