Changeset 69105 in webkit
- Timestamp:
- Oct 5, 2010 6:28:43 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r69101 r69105 1 2010-10-05 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [Qt] Web process crash when pressing modifiers in input field 6 https://bugs.webkit.org/show_bug.cgi?id=44935 7 8 Fix null pointer dereference by not using 9 PlatformKeyboardEvent::m_qtEvent. This member is not set when 10 event comes from WebKit2. Unix: Add ASSERTs to plugin related 11 code. These will fail if WebKit2 is used with plugins, unless code 12 is not fixed before. Symbian: Add ASSERT to code which uses 13 qtEvent(). It will fail when WebKit2 is enabled for Symbian, if 14 code is not fixed before. 15 16 * platform/PlatformKeyboardEvent.h: 17 * platform/qt/PlatformKeyboardEventQt.cpp: 18 (WebCore::isVirtualKeyCodeRepresentingCharacter): Added. 19 (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent): Avoid using m_qtEvent. 20 (WebCore::PlatformKeyboardEvent::nativeModifiers): Added. Use ASSERT as a reminder. 21 (WebCore::PlatformKeyboardEvent::nativeScanCode): Added. Use ASSERT as a reminder. 22 * plugins/qt/PluginViewQt.cpp: 23 (WebCore::setXKeyEventSpecificFields): 24 * plugins/symbian/PluginViewSymbian.cpp: 25 (WebCore::PluginView::handleKeyboardEvent): Add ASSERT as a reminder. 26 1 27 2010-10-05 Kwang Yul Seo <skyul@company100.net> 2 28 -
trunk/WebCore/platform/PlatformKeyboardEvent.h
r62654 r69105 180 180 PlatformKeyboardEvent(QKeyEvent*); 181 181 QKeyEvent* qtEvent() const { return m_qtEvent; } 182 uint32_t nativeModifiers() const; 183 uint32_t nativeScanCode() const; 182 184 #endif 183 185 -
trunk/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
r67483 r69105 506 506 } 507 507 508 static bool isVirtualKeyCodeRepresentingCharacter(int code) 509 { 510 switch (code) { 511 case VK_SPACE: 512 case VK_0: 513 case VK_1: 514 case VK_2: 515 case VK_3: 516 case VK_4: 517 case VK_5: 518 case VK_6: 519 case VK_7: 520 case VK_8: 521 case VK_9: 522 case VK_A: 523 case VK_B: 524 case VK_C: 525 case VK_D: 526 case VK_E: 527 case VK_F: 528 case VK_G: 529 case VK_H: 530 case VK_I: 531 case VK_J: 532 case VK_K: 533 case VK_L: 534 case VK_M: 535 case VK_N: 536 case VK_O: 537 case VK_P: 538 case VK_Q: 539 case VK_R: 540 case VK_S: 541 case VK_T: 542 case VK_U: 543 case VK_V: 544 case VK_W: 545 case VK_X: 546 case VK_Y: 547 case VK_Z: 548 case VK_NUMPAD0: 549 case VK_NUMPAD1: 550 case VK_NUMPAD2: 551 case VK_NUMPAD3: 552 case VK_NUMPAD4: 553 case VK_NUMPAD5: 554 case VK_NUMPAD6: 555 case VK_NUMPAD7: 556 case VK_NUMPAD8: 557 case VK_NUMPAD9: 558 case VK_MULTIPLY: 559 case VK_ADD: 560 case VK_SEPARATOR: 561 case VK_SUBTRACT: 562 case VK_DECIMAL: 563 case VK_DIVIDE: 564 case VK_OEM_1: 565 case VK_OEM_PLUS: 566 case VK_OEM_COMMA: 567 case VK_OEM_MINUS: 568 case VK_OEM_PERIOD: 569 case VK_OEM_2: 570 case VK_OEM_3: 571 case VK_OEM_4: 572 case VK_OEM_5: 573 case VK_OEM_6: 574 case VK_OEM_7: 575 return true; 576 default: 577 return false; 578 } 579 } 580 508 581 PlatformKeyboardEvent::PlatformKeyboardEvent(QKeyEvent* event) 509 582 { … … 540 613 general event handling sends a key press event after this disambiguation. 541 614 */ 542 if (m_text.isEmpty() && m_windowsVirtualKeyCode && m_qtEvent->key() < Qt::Key_Escape)615 if (m_text.isEmpty() && m_windowsVirtualKeyCode && isVirtualKeyCodeRepresentingCharacter(m_windowsVirtualKeyCode)) 543 616 m_text.append(UChar(m_windowsVirtualKeyCode)); 544 617 … … 563 636 } 564 637 638 uint32_t PlatformKeyboardEvent::nativeModifiers() const 639 { 640 ASSERT(m_qtEvent); 641 return m_qtEvent->nativeModifiers(); 642 } 643 644 uint32_t PlatformKeyboardEvent::nativeScanCode() const 645 { 646 ASSERT(m_qtEvent); 647 return m_qtEvent->nativeScanCode(); 648 } 649 565 650 } 566 651 -
trunk/WebCore/plugins/qt/PluginViewQt.cpp
r68390 r69105 373 373 void setXKeyEventSpecificFields(XEvent* xEvent, KeyboardEvent* event) 374 374 { 375 QKeyEvent* qKeyEvent = event->keyEvent()->qtEvent();375 const PlatformKeyboardEvent* keyEvent = event->keyEvent(); 376 376 377 377 xEvent->type = (event->type() == eventNames().keydownEvent) ? 2 : 3; // ints as Qt unsets KeyPress and KeyRelease … … 379 379 xEvent->xkey.subwindow = 0; // we have no child window 380 380 xEvent->xkey.time = event->timeStamp(); 381 xEvent->xkey.state = qKeyEvent->nativeModifiers();382 xEvent->xkey.keycode = qKeyEvent->nativeScanCode();381 xEvent->xkey.state = keyEvent->nativeModifiers(); 382 xEvent->xkey.keycode = keyEvent->nativeScanCode(); 383 383 384 384 // We may not have a nativeScanCode() if the key event is from DRT's eventsender. In that … … 386 386 // place this keycode will be used is in webkit_test_plugin_handle_event(). 387 387 if (QWebPagePrivate::drtRun && !xEvent->xkey.keycode) { 388 if (!qKeyEvent->text().isEmpty()) 389 xEvent->xkey.keycode = int(qKeyEvent->text().at(0).unicode() + qKeyEvent->modifiers()); 390 else if (qKeyEvent->key() && (qKeyEvent->key() != Qt::Key_unknown)) 391 xEvent->xkey.keycode = int(qKeyEvent->key() + qKeyEvent->modifiers()); 388 if (!keyEvent->text().isEmpty()) 389 xEvent->xkey.keycode = int(QString(keyEvent->text()).at(0).unicode() + keyEvent->nativeModifiers()); 390 else { 391 QKeyEvent* qKeyEvent = keyEvent->qtEvent(); 392 if (qKeyEvent && qKeyEvent->key() && (qKeyEvent->key() != Qt::Key_unknown)) 393 xEvent->xkey.keycode = int(qKeyEvent->key() + qKeyEvent->modifiers()); 394 } 392 395 } 393 396 -
trunk/WebCore/plugins/symbian/PluginViewSymbian.cpp
r65249 r69105 181 181 return; 182 182 183 ASSERT(event->keyEvent()->qtEvent()); 183 184 QEvent& npEvent = *(event->keyEvent()->qtEvent()); 184 185 if (!dispatchNPEvent(npEvent))
Note: See TracChangeset
for help on using the changeset viewer.