[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 14:12:07 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 70bbac84b6aee3543fceb17684a37adcbc962bf0
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 5 13:28:43 2010 +0000
2010-10-05 Kimmo Kinnunen <kimmo.t.kinnunen at nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Web process crash when pressing modifiers in input field
https://bugs.webkit.org/show_bug.cgi?id=44935
Fix null pointer dereference by not using
PlatformKeyboardEvent::m_qtEvent. This member is not set when
event comes from WebKit2. Unix: Add ASSERTs to plugin related
code. These will fail if WebKit2 is used with plugins, unless code
is not fixed before. Symbian: Add ASSERT to code which uses
qtEvent(). It will fail when WebKit2 is enabled for Symbian, if
code is not fixed before.
* platform/PlatformKeyboardEvent.h:
* platform/qt/PlatformKeyboardEventQt.cpp:
(WebCore::isVirtualKeyCodeRepresentingCharacter): Added.
(WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent): Avoid using m_qtEvent.
(WebCore::PlatformKeyboardEvent::nativeModifiers): Added. Use ASSERT as a reminder.
(WebCore::PlatformKeyboardEvent::nativeScanCode): Added. Use ASSERT as a reminder.
* plugins/qt/PluginViewQt.cpp:
(WebCore::setXKeyEventSpecificFields):
* plugins/symbian/PluginViewSymbian.cpp:
(WebCore::PluginView::handleKeyboardEvent): Add ASSERT as a reminder.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 33c9cf1..499287b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2010-10-05 Kimmo Kinnunen <kimmo.t.kinnunen at nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Web process crash when pressing modifiers in input field
+ https://bugs.webkit.org/show_bug.cgi?id=44935
+
+ Fix null pointer dereference by not using
+ PlatformKeyboardEvent::m_qtEvent. This member is not set when
+ event comes from WebKit2. Unix: Add ASSERTs to plugin related
+ code. These will fail if WebKit2 is used with plugins, unless code
+ is not fixed before. Symbian: Add ASSERT to code which uses
+ qtEvent(). It will fail when WebKit2 is enabled for Symbian, if
+ code is not fixed before.
+
+ * platform/PlatformKeyboardEvent.h:
+ * platform/qt/PlatformKeyboardEventQt.cpp:
+ (WebCore::isVirtualKeyCodeRepresentingCharacter): Added.
+ (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent): Avoid using m_qtEvent.
+ (WebCore::PlatformKeyboardEvent::nativeModifiers): Added. Use ASSERT as a reminder.
+ (WebCore::PlatformKeyboardEvent::nativeScanCode): Added. Use ASSERT as a reminder.
+ * plugins/qt/PluginViewQt.cpp:
+ (WebCore::setXKeyEventSpecificFields):
+ * plugins/symbian/PluginViewSymbian.cpp:
+ (WebCore::PluginView::handleKeyboardEvent): Add ASSERT as a reminder.
+
2010-10-05 Kwang Yul Seo <skyul at company100.net>
Reviewed by Csaba Osztrogonác.
diff --git a/WebCore/platform/PlatformKeyboardEvent.h b/WebCore/platform/PlatformKeyboardEvent.h
index dad2d39..bc28e84 100644
--- a/WebCore/platform/PlatformKeyboardEvent.h
+++ b/WebCore/platform/PlatformKeyboardEvent.h
@@ -179,6 +179,8 @@ namespace WebCore {
#if PLATFORM(QT)
PlatformKeyboardEvent(QKeyEvent*);
QKeyEvent* qtEvent() const { return m_qtEvent; }
+ uint32_t nativeModifiers() const;
+ uint32_t nativeScanCode() const;
#endif
#if PLATFORM(WX)
diff --git a/WebCore/platform/qt/PlatformKeyboardEventQt.cpp b/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
index 33e9552..498bb88 100644
--- a/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
+++ b/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
@@ -505,6 +505,79 @@ int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad)
}
}
+static bool isVirtualKeyCodeRepresentingCharacter(int code)
+{
+ switch (code) {
+ case VK_SPACE:
+ case VK_0:
+ case VK_1:
+ case VK_2:
+ case VK_3:
+ case VK_4:
+ case VK_5:
+ case VK_6:
+ case VK_7:
+ case VK_8:
+ case VK_9:
+ case VK_A:
+ case VK_B:
+ case VK_C:
+ case VK_D:
+ case VK_E:
+ case VK_F:
+ case VK_G:
+ case VK_H:
+ case VK_I:
+ case VK_J:
+ case VK_K:
+ case VK_L:
+ case VK_M:
+ case VK_N:
+ case VK_O:
+ case VK_P:
+ case VK_Q:
+ case VK_R:
+ case VK_S:
+ case VK_T:
+ case VK_U:
+ case VK_V:
+ case VK_W:
+ case VK_X:
+ case VK_Y:
+ case VK_Z:
+ case VK_NUMPAD0:
+ case VK_NUMPAD1:
+ case VK_NUMPAD2:
+ case VK_NUMPAD3:
+ case VK_NUMPAD4:
+ case VK_NUMPAD5:
+ case VK_NUMPAD6:
+ case VK_NUMPAD7:
+ case VK_NUMPAD8:
+ case VK_NUMPAD9:
+ case VK_MULTIPLY:
+ case VK_ADD:
+ case VK_SEPARATOR:
+ case VK_SUBTRACT:
+ case VK_DECIMAL:
+ case VK_DIVIDE:
+ case VK_OEM_1:
+ case VK_OEM_PLUS:
+ case VK_OEM_COMMA:
+ case VK_OEM_MINUS:
+ case VK_OEM_PERIOD:
+ case VK_OEM_2:
+ case VK_OEM_3:
+ case VK_OEM_4:
+ case VK_OEM_5:
+ case VK_OEM_6:
+ case VK_OEM_7:
+ return true;
+ default:
+ return false;
+ }
+}
+
PlatformKeyboardEvent::PlatformKeyboardEvent(QKeyEvent* event)
{
const int state = event->modifiers();
@@ -539,7 +612,7 @@ void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool)
we try to detect this situation and still set the text, to ensure that the
general event handling sends a key press event after this disambiguation.
*/
- if (m_text.isEmpty() && m_windowsVirtualKeyCode && m_qtEvent->key() < Qt::Key_Escape)
+ if (m_text.isEmpty() && m_windowsVirtualKeyCode && isVirtualKeyCodeRepresentingCharacter(m_windowsVirtualKeyCode))
m_text.append(UChar(m_windowsVirtualKeyCode));
m_keyIdentifier = String();
@@ -562,6 +635,18 @@ void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKe
metaKey = false;
}
+uint32_t PlatformKeyboardEvent::nativeModifiers() const
+{
+ ASSERT(m_qtEvent);
+ return m_qtEvent->nativeModifiers();
+}
+
+uint32_t PlatformKeyboardEvent::nativeScanCode() const
+{
+ ASSERT(m_qtEvent);
+ return m_qtEvent->nativeScanCode();
+}
+
}
// vim: ts=4 sw=4 et
diff --git a/WebCore/plugins/qt/PluginViewQt.cpp b/WebCore/plugins/qt/PluginViewQt.cpp
index b7e1268..1256fa4 100644
--- a/WebCore/plugins/qt/PluginViewQt.cpp
+++ b/WebCore/plugins/qt/PluginViewQt.cpp
@@ -372,23 +372,26 @@ void PluginView::initXEvent(XEvent* xEvent)
void setXKeyEventSpecificFields(XEvent* xEvent, KeyboardEvent* event)
{
- QKeyEvent* qKeyEvent = event->keyEvent()->qtEvent();
+ const PlatformKeyboardEvent* keyEvent = event->keyEvent();
xEvent->type = (event->type() == eventNames().keydownEvent) ? 2 : 3; // ints as Qt unsets KeyPress and KeyRelease
xEvent->xkey.root = QX11Info::appRootWindow();
xEvent->xkey.subwindow = 0; // we have no child window
xEvent->xkey.time = event->timeStamp();
- xEvent->xkey.state = qKeyEvent->nativeModifiers();
- xEvent->xkey.keycode = qKeyEvent->nativeScanCode();
+ xEvent->xkey.state = keyEvent->nativeModifiers();
+ xEvent->xkey.keycode = keyEvent->nativeScanCode();
// We may not have a nativeScanCode() if the key event is from DRT's eventsender. In that
// case just populate the XEvent's keycode with the Qt platform-independent keycode. The only
// place this keycode will be used is in webkit_test_plugin_handle_event().
if (QWebPagePrivate::drtRun && !xEvent->xkey.keycode) {
- if (!qKeyEvent->text().isEmpty())
- xEvent->xkey.keycode = int(qKeyEvent->text().at(0).unicode() + qKeyEvent->modifiers());
- else if (qKeyEvent->key() && (qKeyEvent->key() != Qt::Key_unknown))
- xEvent->xkey.keycode = int(qKeyEvent->key() + qKeyEvent->modifiers());
+ if (!keyEvent->text().isEmpty())
+ xEvent->xkey.keycode = int(QString(keyEvent->text()).at(0).unicode() + keyEvent->nativeModifiers());
+ else {
+ QKeyEvent* qKeyEvent = keyEvent->qtEvent();
+ if (qKeyEvent && qKeyEvent->key() && (qKeyEvent->key() != Qt::Key_unknown))
+ xEvent->xkey.keycode = int(qKeyEvent->key() + qKeyEvent->modifiers());
+ }
}
xEvent->xkey.same_screen = true;
diff --git a/WebCore/plugins/symbian/PluginViewSymbian.cpp b/WebCore/plugins/symbian/PluginViewSymbian.cpp
index b9f82ad..edd908d 100644
--- a/WebCore/plugins/symbian/PluginViewSymbian.cpp
+++ b/WebCore/plugins/symbian/PluginViewSymbian.cpp
@@ -180,6 +180,7 @@ void PluginView::handleKeyboardEvent(KeyboardEvent* event)
if (m_isWindowed)
return;
+ ASSERT(event->keyEvent()->qtEvent());
QEvent& npEvent = *(event->keyEvent()->qtEvent());
if (!dispatchNPEvent(npEvent))
event->setDefaultHandled();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list