[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andersca at apple.com
andersca at apple.com
Wed Dec 22 14:15:00 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 5cfa68b8022c081a66e078e021cec07533e815ec
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 5 22:49:18 2010 +0000
Send null events and mouse events
https://bugs.webkit.org/show_bug.cgi?id=47223
Reviewed by Sam Weinig.
* WebKit2.xcodeproj/project.pbxproj:
Add "-Wno-deprecated-declarations" to the COMPILER_FLAGS for NetscapePluginMac.mm since
we call Button() which is deprecated.
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::NetscapePlugin):
Initialize the null event timer.
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::NetscapePlugin::platformPostInitialize):
Start the null event timer.
(WebKit::NetscapePlugin::platformDestroy):
Stop the null event timer.
(WebKit::NetscapePlugin::platformHandleMouseEvent):
Initialize the event record and call NPP_HandleEvent.
(WebKit::NetscapePlugin::nullEventTimerFired):
Send a null event with the current mouse position.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69155 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 2dca3cb..1251f91 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,34 @@
Reviewed by Sam Weinig.
+ Send null events and mouse events
+ https://bugs.webkit.org/show_bug.cgi?id=47223
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ Add "-Wno-deprecated-declarations" to the COMPILER_FLAGS for NetscapePluginMac.mm since
+ we call Button() which is deprecated.
+
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ (WebKit::NetscapePlugin::NetscapePlugin):
+ Initialize the null event timer.
+
+ * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+ (WebKit::NetscapePlugin::platformPostInitialize):
+ Start the null event timer.
+
+ (WebKit::NetscapePlugin::platformDestroy):
+ Stop the null event timer.
+
+ (WebKit::NetscapePlugin::platformHandleMouseEvent):
+ Initialize the event record and call NPP_HandleEvent.
+
+ (WebKit::NetscapePlugin::nullEventTimerFired):
+ Send a null event with the current mouse position.
+
+2010-10-05 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
Start sending Carbon plug-in events in th Carbon event model
https://bugs.webkit.org/show_bug.cgi?id=47209
<rdar://problem/8515677>
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index e842727..192dc28 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -130,7 +130,7 @@
1AE4987911FF7FAA0048B464 /* JSNPObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE4987711FF7FAA0048B464 /* JSNPObject.cpp */; };
1AE49A4911FFA8CE0048B464 /* JSNPMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE49A4711FFA8CE0048B464 /* JSNPMethod.h */; };
1AE49A4A11FFA8CE0048B464 /* JSNPMethod.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE49A4811FFA8CE0048B464 /* JSNPMethod.cpp */; };
- 1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */; };
+ 1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
1AEFCC1211D01F96008219D3 /* PluginInfoStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */; };
1AEFCC1311D01F96008219D3 /* PluginInfoStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AEFCC1111D01F96008219D3 /* PluginInfoStore.cpp */; };
1AEFCCBD11D02C5E008219D3 /* PluginInfoStoreMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEFCCBC11D02C5E008219D3 /* PluginInfoStoreMac.mm */; };
@@ -1987,6 +1987,7 @@
isa = PBXProject;
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "WebKit2" */;
compatibilityVersion = "Xcode 3.1";
+ developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
index 18edc38..c32e4a0 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
@@ -57,6 +57,7 @@ NetscapePlugin::NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule)
, m_drawingModel(static_cast<NPDrawingModel>(-1))
, m_eventModel(static_cast<NPEventModel>(-1))
#ifndef NP_NO_CARBON
+ , m_nullEventTimer(RunLoop::main(), this, &NetscapePlugin::nullEventTimerFired)
, m_npCGContext()
#endif
#endif
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index f273755..c9ab440 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -28,6 +28,7 @@
#include "NetscapePluginModule.h"
#include "Plugin.h"
+#include "RunLoop.h"
#include <WebCore/GraphicsLayer.h>
#include <WebCore/IntRect.h>
#include <wtf/HashMap.h>
@@ -190,6 +191,11 @@ private:
NPEventModel m_eventModel;
RetainPtr<PlatformLayer> m_pluginLayer;
#ifndef NP_NO_CARBON
+ void nullEventTimerFired();
+
+ // FIXME: It's a bit wasteful to have one null event timer per plug-in.
+ // We should investigate having one per window.
+ RunLoop::Timer<NetscapePlugin> m_nullEventTimer;
NP_CGContext m_npCGContext;
#endif
#elif PLATFORM(WIN)
diff --git a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
index a970bd4..b44e59f 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
+++ b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
@@ -33,6 +33,11 @@ using namespace WebCore;
namespace WebKit {
+#ifndef NP_NO_QUICKDRAW
+static const double nullEventIntervalActive = 0.02;
+static const double nullEventIntervalNotActive = 0.25;
+#endif
+
NPError NetscapePlugin::setDrawingModel(NPDrawingModel drawingModel)
{
// The drawing model can only be set from NPP_New.
@@ -131,6 +136,10 @@ bool NetscapePlugin::platformPostInitialize()
// FIXME: Disable the backing store.
m_npWindow.window = &m_npCGContext;
+
+ // Start the null event timer.
+ // FIXME: Throttle null events when the plug-in isn't visible on screen.
+ m_nullEventTimer.startRepeating(nullEventIntervalActive);
}
#endif
@@ -144,6 +153,9 @@ void NetscapePlugin::platformDestroy()
// Destroy the fake Carbon window.
ASSERT(m_npCGContext.window);
DisposeWindow(static_cast<WindowRef>(m_npCGContext.window));
+
+ // Stop the null event timer.
+ m_nullEventTimer.stop();
}
#endif
}
@@ -205,7 +217,6 @@ static bool rightMouseButtonIsDown(const WebEvent& event)
return false;
}
-
static EventModifiers modifiersForEvent(const WebEvent& event)
{
EventModifiers modifiers = 0;
@@ -359,8 +370,26 @@ bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& mouseEvent)
#ifndef NP_NO_CARBON
case NPEventModelCarbon: {
- notImplemented();
- return false;
+ EventKind eventKind = nullEvent;
+
+ switch (mouseEvent.type()) {
+ case WebEvent::MouseDown:
+ eventKind = mouseDown;
+ break;
+ case WebEvent::MouseUp:
+ eventKind = mouseUp;
+ break;
+ case WebEvent::MouseMove:
+ eventKind = nullEvent;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ EventRecord event = initializeEventRecord(eventKind);
+ event.where.h = mouseEvent.globalPositionX();
+ event.where.v = mouseEvent.globalPositionY();
+ return NPP_HandleEvent(&event);
}
#endif
@@ -535,7 +564,6 @@ void NetscapePlugin::platformSetFocus(bool hasFocus)
}
}
-#if PLATFORM(MAC)
void NetscapePlugin::windowFocusChanged(bool hasFocus)
{
switch (m_eventModel) {
@@ -578,11 +606,28 @@ void NetscapePlugin::windowVisibilityChanged(bool)
// FIXME: Implement.
}
-#endif
-
PlatformLayer* NetscapePlugin::pluginLayer()
{
return static_cast<PlatformLayer*>(m_pluginLayer.get());
}
+#ifndef NP_NO_CARBON
+void NetscapePlugin::nullEventTimerFired()
+{
+ EventRecord event = initializeEventRecord(nullEvent);
+
+ event.message = 0;
+ CGPoint mousePosition;
+ HIGetMousePosition(kHICoordSpaceScreenPixel, 0, &mousePosition);
+ event.where.h = mousePosition.x;
+ event.where.v = mousePosition.y;
+
+ event.modifiers = GetCurrentKeyModifiers();
+ if (!Button())
+ event.modifiers |= btnState;
+
+ NPP_HandleEvent(&event);
+}
+#endif
+
} // namespace WebKit
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list