[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
andersca at apple.com
andersca at apple.com
Wed Dec 22 18:04:07 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 9c17491ba2dfdc75b81ea646239170fd6c84f235
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Dec 6 20:34:47 2010 +0000
Add a shim for IsWindowActive
https://bugs.webkit.org/show_bug.cgi?id=50582
Reviewed by Adam Roben.
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::isWindowActive):
Get the NetscapePlugin from the WindowRef and check if the plug-in's window is active.
(WebKit::PluginProcess::initializeShim):
* PluginProcess/mac/PluginProcessShim.cpp
(WebKit::shimIsWindowActive):
Call isWindowActive. If it returns true, return the result value. Otherwise, call the real
IsWindowActive function.
* PluginProcess/mac/PluginProcessShim.h:
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::NetscapePlugin):
Initialize m_isWindowactive.
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
(WebKit::NetscapePlugin::isWindowActive):
Return whether the window is active.
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::windowMap):
(WebKit::NetscapePlugin::platformPostInitialize):
(WebKit::NetscapePlugin::platformDestroy):
(WebKit::NetscapePlugin::netscapePluginFromWindow):
Add a mapping between windows and the corresponding NetscapePlugin objects.
(WebKit::NetscapePlugin::windowFocusChanged):
Update the window focus member variable.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73387 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 06898d6..3e4196c 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,41 @@
2010-12-06 Anders Carlsson <andersca at apple.com>
+ Reviewed by Adam Roben.
+
+ Add a shim for IsWindowActive
+ https://bugs.webkit.org/show_bug.cgi?id=50582
+
+ * PluginProcess/mac/PluginProcessMac.mm:
+ (WebKit::isWindowActive):
+ Get the NetscapePlugin from the WindowRef and check if the plug-in's window is active.
+
+ (WebKit::PluginProcess::initializeShim):
+ * PluginProcess/mac/PluginProcessShim.cpp
+ (WebKit::shimIsWindowActive):
+ Call isWindowActive. If it returns true, return the result value. Otherwise, call the real
+ IsWindowActive function.
+
+ * PluginProcess/mac/PluginProcessShim.h:
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ (WebKit::NetscapePlugin::NetscapePlugin):
+ Initialize m_isWindowactive.
+
+ * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+ (WebKit::NetscapePlugin::isWindowActive):
+ Return whether the window is active.
+
+ * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+ (WebKit::windowMap):
+ (WebKit::NetscapePlugin::platformPostInitialize):
+ (WebKit::NetscapePlugin::platformDestroy):
+ (WebKit::NetscapePlugin::netscapePluginFromWindow):
+ Add a mapping between windows and the corresponding NetscapePlugin objects.
+
+ (WebKit::NetscapePlugin::windowFocusChanged):
+ Update the window focus member variable.
+
+2010-12-06 Anders Carlsson <andersca at apple.com>
+
Reviewed by Dan Bernstein.
REGERSSION (r73310?): Contents of <select> popup menus are upside-down on Windows
diff --git a/WebKit2/PluginProcess/mac/PluginProcessMac.mm b/WebKit2/PluginProcess/mac/PluginProcessMac.mm
index d9b3b9c..01f0fd4 100644
--- a/WebKit2/PluginProcess/mac/PluginProcessMac.mm
+++ b/WebKit2/PluginProcess/mac/PluginProcessMac.mm
@@ -27,6 +27,7 @@
#include "PluginProcess.h"
+#include "NetscapePlugin.h"
#include "PluginProcessShim.h"
#include <dlfcn.h>
@@ -49,11 +50,23 @@ static bool shouldCallRealDebugger()
return isUserbreakSet;
}
-
+
+static bool isWindowActive(WindowRef windowRef, bool& result)
+{
+#ifndef NP_NO_CARBON
+ if (NetscapePlugin* plugin = NetscapePlugin::netscapePluginFromWindow(windowRef)) {
+ result = plugin->isWindowActive();
+ return true;
+ }
+#endif
+ return false;
+}
+
void PluginProcess::initializeShim()
{
const PluginProcessShimCallbacks callbacks = {
shouldCallRealDebugger,
+ isWindowActive,
};
PluginProcessShimInitializeFunc initFunc = reinterpret_cast<PluginProcessShimInitializeFunc>(dlsym(RTLD_DEFAULT, "WebKitPluginProcessShimInitialize"));
diff --git a/WebKit2/PluginProcess/mac/PluginProcessShim.cpp b/WebKit2/PluginProcess/mac/PluginProcessShim.cpp
index 3a64701..13fb7ce 100644
--- a/WebKit2/PluginProcess/mac/PluginProcessShim.cpp
+++ b/WebKit2/PluginProcess/mac/PluginProcessShim.cpp
@@ -53,7 +53,18 @@ static void shimDebugger(void)
Debugger();
}
+static Boolean shimIsWindowActive(WindowRef window)
+{
+ bool result;
+ if (pluginProcessShimCallbacks.isWindowActive(window, result))
+ return result;
+
+ return IsWindowActive(window);
+}
+
DYLD_INTERPOSE(shimDebugger, Debugger);
+DYLD_INTERPOSE(shimIsWindowActive, IsWindowActive);
+
#endif
} // namespace WebKit
diff --git a/WebKit2/PluginProcess/mac/PluginProcessShim.h b/WebKit2/PluginProcess/mac/PluginProcessShim.h
index 3736c55..33ad443 100644
--- a/WebKit2/PluginProcess/mac/PluginProcessShim.h
+++ b/WebKit2/PluginProcess/mac/PluginProcessShim.h
@@ -26,10 +26,13 @@
#ifndef PluginProcessShim_h
#define PluginProcessShim_h
+#include <Carbon/Carbon.h>
+
namespace WebKit {
struct PluginProcessShimCallbacks {
bool (*shouldCallRealDebugger)();
+ bool (*isWindowActive)(WindowRef, bool& result);
};
typedef void (*PluginProcessShimInitializeFunc)(const PluginProcessShimCallbacks&);
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
index 29095e6..aba4eac 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
@@ -42,7 +42,7 @@ namespace WebKit {
// The plug-in that we're currently calling NPP_New for.
static NetscapePlugin* currentNPPNewPlugin;
-
+
NetscapePlugin::NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule)
: m_pluginController(0)
, m_nextRequestID(0)
@@ -62,6 +62,7 @@ NetscapePlugin::NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule)
#ifndef NP_NO_CARBON
, m_nullEventTimer(RunLoop::main(), this, &NetscapePlugin::nullEventTimerFired)
, m_npCGContext()
+ , m_isWindowActive(false)
#endif
#endif
{
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index fc2d6c7..e85660d 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -58,6 +58,9 @@ public:
NPError setEventModel(NPEventModel);
#ifndef NP_NO_CARBON
WindowRef windowRef() const;
+ bool isWindowActive() const { return m_isWindowActive; }
+
+ static NetscapePlugin* netscapePluginFromWindow(WindowRef);
#endif
#elif PLATFORM(WIN)
HWND containingWindow() const;
@@ -200,6 +203,7 @@ private:
// We should investigate having one per window.
RunLoop::Timer<NetscapePlugin> m_nullEventTimer;
NP_CGContext m_npCGContext;
+ bool m_isWindowActive;
#endif
#elif PLATFORM(WIN)
HWND m_window;
diff --git a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
index 6f5ebee..8caf77b 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
+++ b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
@@ -32,7 +32,7 @@ using namespace WebCore;
namespace WebKit {
-#ifndef NP_NO_QUICKDRAW
+#ifndef NP_NO_CARBON
static const double nullEventIntervalActive = 0.02;
static const double nullEventIntervalNotActive = 0.25;
#endif
@@ -80,6 +80,17 @@ NPError NetscapePlugin::setEventModel(NPEventModel eventModel)
return NPERR_NO_ERROR;
}
+#ifndef NP_NO_CARBON
+typedef HashMap<WindowRef, NetscapePlugin*> WindowMap;
+
+static WindowMap& windowMap()
+{
+ DEFINE_STATIC_LOCAL(WindowMap, windowMap, ());
+
+ return windowMap;
+}
+#endif
+
bool NetscapePlugin::platformPostInitialize()
{
if (m_drawingModel == static_cast<NPDrawingModel>(-1)) {
@@ -137,6 +148,9 @@ bool NetscapePlugin::platformPostInitialize()
m_npWindow.window = &m_npCGContext;
+ ASSERT(!windowMap().contains(windowRef()));
+ windowMap().set(windowRef(), this);
+
// Start the null event timer.
// FIXME: Throttle null events when the plug-in isn't visible on screen.
m_nullEventTimer.startRepeating(nullEventIntervalActive);
@@ -154,6 +168,9 @@ void NetscapePlugin::platformDestroy()
if (m_npCGContext.window)
DisposeWindow(static_cast<WindowRef>(m_npCGContext.window));
+ ASSERT(windowMap().contains(windowRef()));
+ windowMap().remove(windowRef());
+
// Stop the null event timer.
m_nullEventTimer.stop();
}
@@ -180,6 +197,11 @@ static inline NPCocoaEvent initializeEvent(NPCocoaEventType type)
}
#ifndef NP_NO_CARBON
+NetscapePlugin* NetscapePlugin::netscapePluginFromWindow(WindowRef windowRef)
+{
+ return windowMap().get(windowRef);
+}
+
WindowRef NetscapePlugin::windowRef() const
{
ASSERT(m_eventModel == NPEventModelCarbon);
@@ -602,6 +624,8 @@ void NetscapePlugin::windowFocusChanged(bool hasFocus)
#ifndef NP_NO_CARBON
case NPEventModelCarbon: {
+ m_isWindowActive = hasFocus;
+
HiliteWindow(windowRef(), hasFocus);
if (hasFocus)
SetUserFocusWindow(windowRef());
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list