Title: [93887] trunk/Source/WebKit2
- Revision
- 93887
- Author
- [email protected]
- Date
- 2011-08-26 10:45:49 -0700 (Fri, 26 Aug 2011)
Log Message
Fix handling of keyup events in the new Cocoa text input model
https://bugs.webkit.org/show_bug.cgi?id=67045
Reviewed by Sam Weinig.
Use a counter instead of a boolean for deciding when to ignore keyup events, because
if multiple keys are pressed simultaneously then we need to ignore more than one keyup event in a row.
Also if a keyboard event is an autorepeating event we won't get a keyup event so don't increment the counter
in that case.
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::NetscapePlugin):
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::NetscapePlugin::platformHandleKeyboardEvent):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (93886 => 93887)
--- trunk/Source/WebKit2/ChangeLog 2011-08-26 17:41:25 UTC (rev 93886)
+++ trunk/Source/WebKit2/ChangeLog 2011-08-26 17:45:49 UTC (rev 93887)
@@ -1,3 +1,22 @@
+2011-08-26 Anders Carlsson <[email protected]>
+
+ Fix handling of keyup events in the new Cocoa text input model
+ https://bugs.webkit.org/show_bug.cgi?id=67045
+
+ Reviewed by Sam Weinig.
+
+ Use a counter instead of a boolean for deciding when to ignore keyup events, because
+ if multiple keys are pressed simultaneously then we need to ignore more than one keyup event in a row.
+
+ Also if a keyboard event is an autorepeating event we won't get a keyup event so don't increment the counter
+ in that case.
+
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ (WebKit::NetscapePlugin::NetscapePlugin):
+ * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+ * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+ (WebKit::NetscapePlugin::platformHandleKeyboardEvent):
+
2011-08-26 Jessie Berlin <[email protected]>
Gut WKPageCreateSnapshotOfVisibleContent so that it can be removed later.
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (93886 => 93887)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2011-08-26 17:41:25 UTC (rev 93886)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2011-08-26 17:45:49 UTC (rev 93887)
@@ -78,7 +78,7 @@
, m_pluginWantsLegacyCocoaTextInput(true)
, m_isComplexTextInputEnabled(false)
, m_hasHandledAKeyDownEvent(false)
- , m_ignoreNextKeyUpEvent(false)
+ , m_ignoreNextKeyUpEventCounter(0)
#ifndef NP_NO_CARBON
, m_nullEventTimer(RunLoop::main(), this, &NetscapePlugin::nullEventTimerFired)
, m_npCGContext()
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (93886 => 93887)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h 2011-08-26 17:41:25 UTC (rev 93886)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h 2011-08-26 17:45:49 UTC (rev 93887)
@@ -257,8 +257,8 @@
// if we can tell the plug-in that we support the updated Cocoa text input specification.
bool m_hasHandledAKeyDownEvent;
- // Whether the next NPCocoaEventKeyUp event should be ignored.
- bool m_ignoreNextKeyUpEvent;
+ // The number of NPCocoaEventKeyUp events that should be ignored.
+ unsigned m_ignoreNextKeyUpEventCounter;
WebCore::IntRect m_windowFrameInScreenCoordinates;
WebCore::IntRect m_viewFrameInWindowCoordinates;
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm (93886 => 93887)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm 2011-08-26 17:41:25 UTC (rev 93886)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm 2011-08-26 17:45:49 UTC (rev 93887)
@@ -740,14 +740,14 @@
if (keyboardEvent.type() == WebEvent::KeyDown) {
m_hasHandledAKeyDownEvent = true;
- if (!m_pluginWantsLegacyCocoaTextInput && m_isComplexTextInputEnabled) {
+ if (!m_pluginWantsLegacyCocoaTextInput && m_isComplexTextInputEnabled && !keyboardEvent.isAutoRepeat()) {
// When complex text is enabled in the new model, the plug-in should never
// receive any key down or key up events until the composition is complete.
- m_ignoreNextKeyUpEvent = true;
+ m_ignoreNextKeyUpEventCounter++;
return true;
}
- } else if (keyboardEvent.type() == WebEvent::KeyUp && m_ignoreNextKeyUpEvent) {
- m_ignoreNextKeyUpEvent = false;
+ } else if (keyboardEvent.type() == WebEvent::KeyUp && m_ignoreNextKeyUpEventCounter) {
+ m_ignoreNextKeyUpEventCounter--;
return true;
}
@@ -757,7 +757,8 @@
if (!m_pluginWantsLegacyCocoaTextInput) {
if (event.type == NPCocoaEventKeyDown && returnValue == kNPEventStartIME) {
- m_ignoreNextKeyUpEvent = true;
+ if (!keyboardEvent.isAutoRepeat())
+ m_ignoreNextKeyUpEventCounter++;
setComplexTextInputEnabled(true);
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes