Title: [99117] trunk/Source/WebKit2
Revision
99117
Author
[email protected]
Date
2011-11-02 16:14:27 -0700 (Wed, 02 Nov 2011)

Log Message

Allow the various plug-in ports to decide whether NPWindow coordinates should be window-relative
https://bugs.webkit.org/show_bug.cgi?id=71415

Reviewed by Darin Adler.

* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::callSetWindow):
Remove the PLUGIN_ARCHITECTURE(X11) ifdef and set the NPWindow members
based on the return value of wantsWindowRelativeNPWindowCoordinates.

* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::NetscapePlugin::wantsWindowRelativeNPWindowCoordinates):
* WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp:
(WebKit::NetscapePlugin::wantsWindowRelativeNPWindowCoordinates):
* WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
(WebKit::NetscapePlugin::wantsWindowRelativeNPWindowCoordinates):
Add platform specific implementations.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (99116 => 99117)


--- trunk/Source/WebKit2/ChangeLog	2011-11-02 23:02:51 UTC (rev 99116)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-02 23:14:27 UTC (rev 99117)
@@ -1,3 +1,24 @@
+2011-11-02  Anders Carlsson  <[email protected]>
+
+        Allow the various plug-in ports to decide whether NPWindow coordinates should be window-relative
+        https://bugs.webkit.org/show_bug.cgi?id=71415
+
+        Reviewed by Darin Adler.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::callSetWindow):
+        Remove the PLUGIN_ARCHITECTURE(X11) ifdef and set the NPWindow members
+        based on the return value of wantsWindowRelativeNPWindowCoordinates.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+        (WebKit::NetscapePlugin::wantsWindowRelativeNPWindowCoordinates):
+        * WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp:
+        (WebKit::NetscapePlugin::wantsWindowRelativeNPWindowCoordinates):
+        * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
+        (WebKit::NetscapePlugin::wantsWindowRelativeNPWindowCoordinates):
+        Add platform specific implementations.
+
 2011-11-02  Viatcheslav Ostapenko  <[email protected]>
 
         [Qt] [WK] Debug build broken after r99065

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


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-11-02 23:02:51 UTC (rev 99116)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-11-02 23:14:27 UTC (rev 99117)
@@ -483,21 +483,23 @@
 
 void NetscapePlugin::callSetWindow()
 {
-#if PLUGIN_ARCHITECTURE(X11)
-    // We use a backing store as the painting area for the plugin.
-    m_npWindow.x = 0;
-    m_npWindow.y = 0;
-#else
-    m_npWindow.x = m_frameRectInWindowCoordinates.x();
-    m_npWindow.y = m_frameRectInWindowCoordinates.y();
-#endif
-    m_npWindow.width = m_frameRectInWindowCoordinates.width();
-    m_npWindow.height = m_frameRectInWindowCoordinates.height();
-    m_npWindow.clipRect.top = m_clipRectInWindowCoordinates.y();
-    m_npWindow.clipRect.left = m_clipRectInWindowCoordinates.x();
-    m_npWindow.clipRect.bottom = m_clipRectInWindowCoordinates.maxY();
-    m_npWindow.clipRect.right = m_clipRectInWindowCoordinates.maxX();
+    if (wantsWindowRelativeNPWindowCoordinates()) {
+        m_npWindow.x = m_frameRectInWindowCoordinates.x();
+        m_npWindow.y = m_frameRectInWindowCoordinates.y();
+        m_npWindow.clipRect.top = m_clipRectInWindowCoordinates.y();
+        m_npWindow.clipRect.left = m_clipRectInWindowCoordinates.x();
+    } else {
+        m_npWindow.x = 0;
+        m_npWindow.y = 0;
+        m_npWindow.clipRect.top = m_clipRect.y();
+        m_npWindow.clipRect.left = m_clipRect.x();
+    }
 
+    m_npWindow.width = m_pluginSize.width();
+    m_npWindow.height = m_pluginSize.height();
+    m_npWindow.clipRect.right = m_npWindow.clipRect.left + m_clipRect.width();
+    m_npWindow.clipRect.bottom = m_npWindow.clipRect.top + m_clipRect.height();
+
     NPP_SetWindow(&m_npWindow);
 }
 

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


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-11-02 23:02:51 UTC (rev 99116)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-11-02 23:14:27 UTC (rev 99117)
@@ -160,6 +160,8 @@
     bool platformHandleKeyboardEvent(const WebKeyboardEvent&);
     void platformSetFocus(bool);
 
+    static bool wantsWindowRelativeNPWindowCoordinates();
+
     // Plugin
     virtual bool initialize(const Parameters&);
     virtual void destroy();

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm (99116 => 99117)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm	2011-11-02 23:02:51 UTC (rev 99116)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm	2011-11-02 23:14:27 UTC (rev 99117)
@@ -836,6 +836,11 @@
     }
 }
 
+bool NetscapePlugin::wantsWindowRelativeNPWindowCoordinates()
+{
+    return true;
+}
+
 void NetscapePlugin::windowFocusChanged(bool hasFocus)
 {
     m_windowHasFocus = hasFocus;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp (99116 => 99117)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp	2011-11-02 23:02:51 UTC (rev 99116)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/win/NetscapePluginWin.cpp	2011-11-02 23:14:27 UTC (rev 99117)
@@ -322,6 +322,11 @@
     NPP_HandleEvent(&npEvent);
 }
 
+bool NetscapePlugin::wantsWindowRelativeNPWindowCoordinates()
+{
+    return true;
+}
+
 bool NetscapePlugin::platformHandleMouseEnterEvent(const WebMouseEvent& event)
 {
     CurrentPluginSetter setCurrentPlugin(this);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp (99116 => 99117)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2011-11-02 23:02:51 UTC (rev 99116)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2011-11-02 23:14:27 UTC (rev 99117)
@@ -475,6 +475,11 @@
     NPP_HandleEvent(&xEvent);
 }
 
+bool NetscapePlugin::wantsWindowRelativeNPWindowCoordinates()
+{
+    return false;
+}
+
 bool NetscapePlugin::platformHandleMouseEnterEvent(const WebMouseEvent& event)
 {
     if (m_isWindowed)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to