Changeset 83522 in webkit
- Timestamp:
- Apr 11, 2011 3:41:52 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r83521 r83522 1 2011-04-11 Alexey Proskuryakov <ap@apple.com> 2 3 Reviewed by Maciej Stachowiak. 4 5 WebKit2: Cannot use Ctrl-Delete as a custom keyboard shortcut 6 https://bugs.webkit.org/show_bug.cgi?id=58265 7 <rdar://problem/9221468> 8 9 * page/EventHandler.cpp: 10 (WebCore::EventHandler::defaultKeyboardEventHandler): Handle Backspace. 11 (WebCore::EventHandler::defaultSpaceEventHandler): Enabled this on Mac, and added checks for 12 other modifiers - no one wants to scroll on Ctrl+Alt+Space and such. 13 (WebCore::EventHandler::defaultBackspaceEventHandler): Backspace goes back, Shift-backspace 14 goes forward. All browsers do it. 15 (WebCore::EventHandler::defaultArrowEventHandler): Assert that this function was called 16 for a correct event. 17 (WebCore::EventHandler::defaultTabEventHandler): Ditto. 18 19 * page/EventHandler.h: Added defaultBackspaceEventHandler. 20 1 21 2011-04-11 Matthew Delaney <mdelaney@apple.com> 2 22 -
trunk/Source/WebCore/page/EventHandler.cpp
r83414 r83522 2545 2545 if (event->keyIdentifier() == "U+0009") 2546 2546 defaultTabEventHandler(event); 2547 else if (event->keyIdentifier() == "U+0008") 2548 defaultBackspaceEventHandler(event); 2547 2549 else { 2548 2550 FocusDirection direction = focusDirectionForKey(event->keyIdentifier()); … … 2846 2848 } 2847 2849 2848 #if PLATFORM(QT) || PLATFORM(MAC) 2849 2850 // These two platforms handle the space event in the platform-specific WebKit code. 2851 // Eventually it would be good to eliminate that and use the code here instead, but 2852 // the Qt version is inside an ifdef and the Mac version has some extra behavior 2853 // so we can't unify everything yet. 2850 #if PLATFORM(QT) 2851 // Qt handles the space event in platform-specific WebKit code. 2852 // Eventually it would be good to eliminate that and use the code here instead. 2854 2853 void EventHandler::defaultSpaceEventHandler(KeyboardEvent*) 2855 2854 { 2856 2855 } 2857 2858 2856 #else 2859 2857 2860 2858 void EventHandler::defaultSpaceEventHandler(KeyboardEvent* event) 2861 2859 { 2860 ASSERT(event->type() == eventNames().keypressEvent); 2861 2862 if (event->ctrlKey() || event->metaKey() || event->altKey() || event->altGraphKey()) 2863 return; 2864 2862 2865 ScrollLogicalDirection direction = event->shiftKey() ? ScrollBlockDirectionBackward : ScrollBlockDirectionForward; 2863 2866 if (logicalScrollOverflow(direction, ScrollByPage)) { … … 2876 2879 #endif 2877 2880 2881 void EventHandler::defaultBackspaceEventHandler(KeyboardEvent* event) 2882 { 2883 ASSERT(event->type() == eventNames().keydownEvent); 2884 2885 if (event->ctrlKey() || event->metaKey() || event->altKey() || event->altGraphKey()) 2886 return; 2887 2888 Page* page = m_frame->page(); 2889 if (!page) 2890 return; 2891 2892 if (event->shiftKey()) 2893 page->goForward(); 2894 else 2895 page->goBack(); 2896 2897 event->setDefaultHandled(); 2898 } 2899 2900 2878 2901 void EventHandler::defaultArrowEventHandler(FocusDirection focusDirection, KeyboardEvent* event) 2879 2902 { 2903 ASSERT(event->type() == eventNames().keydownEvent); 2904 2880 2905 if (event->ctrlKey() || event->metaKey() || event->altGraphKey() || event->shiftKey()) 2881 2906 return; … … 2899 2924 void EventHandler::defaultTabEventHandler(KeyboardEvent* event) 2900 2925 { 2926 ASSERT(event->type() == eventNames().keydownEvent); 2927 2901 2928 // We should only advance focus on tabs if no special modifier keys are held down. 2902 2929 if (event->ctrlKey() || event->metaKey() || event->altGraphKey()) -
trunk/Source/WebCore/page/EventHandler.h
r83414 r83522 346 346 347 347 void defaultSpaceEventHandler(KeyboardEvent*); 348 void defaultBackspaceEventHandler(KeyboardEvent*); 348 349 void defaultTabEventHandler(KeyboardEvent*); 349 350 void defaultArrowEventHandler(FocusDirection, KeyboardEvent*); -
trunk/Source/WebKit/mac/ChangeLog
r83464 r83522 1 2011-04-11 Alexey Proskuryakov <ap@apple.com> 2 3 Reviewed by Maciej Stachowiak. 4 5 WebKit2: Safari doesn't respect cmd-arrows (and variations) as custom keyboard shortcuts 6 https://bugs.webkit.org/show_bug.cgi?id=58175 7 <rdar://problem/9060555> 8 9 * WebView/WebFrameView.mm: (-[WebFrameView keyDown:]): Added a comment explaining how this 10 should be changed to match WebKit2. 11 1 12 2011-04-06 Timothy Hatcher <timothy@apple.com> 2 13 -
trunk/Source/WebKit/win/ChangeLog
r83113 r83522 1 2011-04-11 Alexey Proskuryakov <ap@apple.com> 2 3 Reviewed by Maciej Stachowiak. 4 5 WebKit2: Cannot use Ctrl-Delete as a custom keyboard shortcut 6 https://bugs.webkit.org/show_bug.cgi?id=58265 7 <rdar://problem/9221468> 8 9 * WebView.cpp: (WebView::keyDown): Removed special handling of Backspace, which is unnecessary 10 now that WebCore implements it. 11 1 12 2011-04-06 Brian Weinstein <bweinstein@apple.com> 2 13 -
trunk/Source/WebKit/win/WebView.cpp
r83113 r83522 1954 1954 } 1955 1955 1956 // We need to handle back/forward using either Backspace(+Shift) or Ctrl+Left/Right Arrow keys. 1957 if ((virtualKeyCode == VK_BACK && keyEvent.shiftKey()) || (virtualKeyCode == VK_RIGHT && keyEvent.ctrlKey())) 1956 // We need to handle back/forward using either Ctrl+Left/Right Arrow keys. 1957 // FIXME: This logic should probably be in EventHandler::defaultArrowEventHandler(). 1958 // FIXME: Should check that other modifiers aren't pressed. 1959 if (virtualKeyCode == VK_RIGHT && keyEvent.ctrlKey()) 1958 1960 return m_page->goForward(); 1959 if (virtualKeyCode == VK_ BACK || (virtualKeyCode == VK_LEFT && keyEvent.ctrlKey()))1961 if (virtualKeyCode == VK_LEFT && keyEvent.ctrlKey()) 1960 1962 return m_page->goBack(); 1961 1963 -
trunk/Source/WebKit2/ChangeLog
r83519 r83522 1 2011-04-11 Alexey Proskuryakov <ap@apple.com> 2 3 Reviewed by Maciej Stachowiak. 4 5 WebKit2: Cannot use Ctrl-Delete as a custom keyboard shortcut 6 https://bugs.webkit.org/show_bug.cgi?id=58265 7 <rdar://problem/9221468> 8 9 * WebProcess/WebPage/WebPage.cpp: 10 (WebKit::WebPage::keyEvent): Added a comment explaining that doing work after DOM event 11 dispatch isn't great. 12 * WebProcess/WebPage/mac/WebPageMac.mm: 13 (WebKit::WebPage::performNonEditingBehaviorForSelector): Added a comment explaining how this 14 might be moved down to WebCore. 15 (WebKit::WebPage::performDefaultBehaviorForKeyEvent): This is now empty, since both Space 16 and Backspace behaviors are implemented in WebCore. 17 1 18 2011-04-11 Anders Carlsson <andersca@apple.com> 2 19 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r83460 r83522 957 957 958 958 bool handled = handleKeyEvent(keyboardEvent, m_page.get()); 959 // FIXME: Platform default behaviors should be performed during normal DOM event dispatch (in most cases, in default keydown event handler). 959 960 if (!handled) 960 961 handled = performDefaultBehaviorForKeyEvent(keyboardEvent); -
trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
r83516 r83522 543 543 bool WebPage::performNonEditingBehaviorForSelector(const String& selector) 544 544 { 545 // FIXME: All these selectors have corresponding Editor commands, but the commands only work in editable content. 546 // Should such non-editing behaviors be implemented in Editor or EventHandler::defaultArrowEventHandler() perhaps? 545 547 if (selector == "moveUp:") 546 548 scroll(m_page.get(), ScrollUp, ScrollByLine); … … 575 577 } 576 578 577 bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboardEvent) 578 { 579 if (keyboardEvent.type() != WebEvent::KeyDown) 580 return false; 581 582 switch (keyboardEvent.windowsVirtualKeyCode()) { 583 case VK_BACK: 584 // FIXME: Handling Backspace here means that a keypress DOM event will be dispatched when focus 585 // is outside editable content, which is likely wrong. It should be moved to performNonEditingBehaviorForSelector(), 586 // which is complicated by the fact that both Backspace and Shift+Backspace get the same command. 587 if (keyboardEvent.shiftKey()) 588 m_page->goForward(); 589 else 590 m_page->goBack(); 591 break; 592 case VK_SPACE: 593 // Space is not translated to a command by key bindings, so we need to handle it here. 594 if (keyboardEvent.shiftKey()) 595 logicalScroll(m_page.get(), ScrollBlockDirectionBackward, ScrollByPage); 596 else 597 logicalScroll(m_page.get(), ScrollBlockDirectionForward, ScrollByPage); 598 break; 599 default: 600 return false; 601 } 602 603 return true; 579 bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&) 580 { 581 return false; 604 582 } 605 583
Note: See TracChangeset
for help on using the changeset viewer.