Changeset 39239 in webkit
- Timestamp:
- Dec 12, 2008, 5:49:40 AM (16 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 4 edited
-
Api/qwebpage.cpp (modified) (2 diffs)
-
Api/qwebpage_p.h (modified) (1 diff)
-
ChangeLog (modified) (1 diff)
-
WebCoreSupport/EditorClientQt.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/Api/qwebpage.cpp
r39232 r39239 619 619 620 620 #ifndef QT_NO_SHORTCUT 621 static QWebPage::WebActioneditorActionForKeyEvent(QKeyEvent* event)621 QWebPage::WebAction QWebPagePrivate::editorActionForKeyEvent(QKeyEvent* event) 622 622 { 623 623 static struct { … … 676 676 WebCore::Frame* frame = page->focusController()->focusedOrMainFrame(); 677 677 WebCore::Editor* editor = frame->editor(); 678 #ifndef QT_NO_SHORTCUT 679 if (editor->canEdit()) { 680 QWebPage::WebAction action = editorActionForKeyEvent(ev); 681 if (action != QWebPage::NoWebAction) { 682 q->triggerAction(action); 683 handled = true; 684 } 685 } else { 686 if (ev == QKeySequence::Copy) { 687 q->triggerAction(QWebPage::Copy); 688 handled = true; 689 } 690 } 691 #endif // QT_NO_SHORTCUT 678 // we forward the key event to WebCore first to handle potential DOM 679 // defined event handlers and later on end up in EditorClientQt::handleKeyboardEvent 680 // to trigger editor commands via triggerAction(). 692 681 if (!handled) 693 682 handled = frame->eventHandler()->keyEvent(ev); -
trunk/WebKit/qt/Api/qwebpage_p.h
r37061 r39239 113 113 bool handleScrolling(QKeyEvent*); 114 114 115 #ifndef QT_NO_SHORTCUT 116 static QWebPage::WebAction editorActionForKeyEvent(QKeyEvent* event); 117 #endif 118 115 119 WebCore::ChromeClientQt *chromeClient; 116 120 WebCore::ContextMenuClientQt *contextMenuClient; -
trunk/WebKit/qt/ChangeLog
r39234 r39239 1 2008-12-12 Simon Hausmann <hausmann@webkit.org> 2 3 Reviewed by Tor Arne Vestbø. 4 5 Fix pressing return/enter not triggering any action on web sites 6 that define event handlers, such as the JS console in the web 7 inspector. 8 9 Process the key events in the DOM first and if not handled map them 10 to editor actions. 11 12 * Api/qwebpage.cpp: 13 (QWebPagePrivate::editorActionForKeyEvent): Made a class method. 14 (QWebPagePrivate::keyPressEvent): Pass the key event first to the DOM. 15 * WebCoreSupport/EditorClientQt.cpp: 16 (WebCore::EditorClientQt::handleKeyboardEvent): Map the key event to 17 actions and trigger them. 18 1 19 2008-12-12 Ariya Hidayat <ariya.hidayat@trolltech.com> 2 20 -
trunk/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
r39173 r39239 366 366 // FIXME: refactor all of this to use Actions or something like them 367 367 if (start->isContentEditable()) { 368 #ifndef QT_NO_SHORTCUT 369 QWebPage::WebAction action = QWebPagePrivate::editorActionForKeyEvent(kevent->qtEvent()); 370 if (action != QWebPage::NoWebAction) { 371 m_page->triggerAction(action); 372 } else 373 #endif // QT_NO_SHORTCUT 368 374 switch (kevent->windowsVirtualKeyCode()) { 369 375 #if QT_VERSION < 0x040500 … … 431 437 frame->editor()->command("ToggleBold").execute(); 432 438 break; 433 case VK_C:434 frame->editor()->command("Copy").execute();435 break;436 439 case VK_I: 437 440 frame->editor()->command("ToggleItalic").execute(); 438 break;439 case VK_V:440 frame->editor()->command("Paste").execute();441 break;442 case VK_X:443 frame->editor()->command("Cut").execute();444 break;445 case VK_Y:446 frame->editor()->command("Redo").execute();447 break;448 case VK_Z:449 frame->editor()->command("Undo").execute();450 441 break; 451 442 default: … … 460 451 } 461 452 } else { 453 #ifndef QT_NO_SHORTCUT 454 if (kevent->qtEvent() == QKeySequence::Copy) { 455 m_page->triggerAction(QWebPage::Copy); 456 } else 457 #endif // QT_NO_SHORTCUT 462 458 switch (kevent->windowsVirtualKeyCode()) { 463 459 case VK_UP: … … 487 483 frame->editor()->command("SelectAll").execute(); 488 484 break; 489 case VK_C: case VK_X:490 frame->editor()->command("Copy").execute();491 break;492 485 default: 493 486 return;
Note:
See TracChangeset
for help on using the changeset viewer.