Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 void WebFrameWidgetImpl::themeChanged() | 309 void WebFrameWidgetImpl::themeChanged() |
| 310 { | 310 { |
| 311 FrameView* view = m_localRoot->frameView(); | 311 FrameView* view = m_localRoot->frameView(); |
| 312 | 312 |
| 313 WebRect damagedRect(0, 0, m_size.width, m_size.height); | 313 WebRect damagedRect(0, 0, m_size.width, m_size.height); |
| 314 view->invalidateRect(damagedRect); | 314 view->invalidateRect(damagedRect); |
| 315 } | 315 } |
| 316 | 316 |
| 317 const WebInputEvent* WebFrameWidgetImpl::m_currentInputEvent = nullptr; | 317 const WebInputEvent* WebFrameWidgetImpl::m_currentInputEvent = nullptr; |
| 318 | 318 |
| 319 bool WebFrameWidgetImpl::handleInputEvent(const WebInputEvent& inputEvent) | 319 WebInputEventResult WebFrameWidgetImpl::handleInputEvent(const WebInputEvent& in putEvent) |
| 320 { | 320 { |
| 321 | 321 |
| 322 TRACE_EVENT1("input", "WebFrameWidgetImpl::handleInputEvent", "type", inputT ypeToName(inputEvent.type)); | 322 TRACE_EVENT1("input", "WebFrameWidgetImpl::handleInputEvent", "type", inputT ypeToName(inputEvent.type)); |
| 323 | 323 |
| 324 // Report the event to be NOT processed by WebKit, so that the browser can h andle it appropriately. | 324 // Report the event to be NOT processed by WebKit, so that the browser can h andle it appropriately. |
| 325 if (m_ignoreInputEvents) | 325 if (m_ignoreInputEvents) |
| 326 return false; | 326 return WebInputEventResult::NotHandled; |
| 327 | 327 |
| 328 // FIXME: pass event to m_localRoot's WebDevToolsAgentImpl once available. | 328 // FIXME: pass event to m_localRoot's WebDevToolsAgentImpl once available. |
| 329 | 329 |
| 330 TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent , &inputEvent); | 330 TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent , &inputEvent); |
| 331 | 331 |
| 332 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type)) { | 332 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type)) { |
| 333 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); | 333 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); |
| 334 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. | 334 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. |
| 335 RefPtrWillBeRawPtr<Node> node = m_mouseCaptureNode; | 335 RefPtrWillBeRawPtr<Node> node = m_mouseCaptureNode; |
| 336 | 336 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 357 eventType = EventTypeNames::mouseup; | 357 eventType = EventTypeNames::mouseup; |
| 358 gestureIndicator = adoptPtr(new UserGestureIndicator(m_mouseCaptureG estureToken.release())); | 358 gestureIndicator = adoptPtr(new UserGestureIndicator(m_mouseCaptureG estureToken.release())); |
| 359 break; | 359 break; |
| 360 default: | 360 default: |
| 361 ASSERT_NOT_REACHED(); | 361 ASSERT_NOT_REACHED(); |
| 362 } | 362 } |
| 363 | 363 |
| 364 node->dispatchMouseEvent( | 364 node->dispatchMouseEvent( |
| 365 PlatformMouseEventBuilder(m_localRoot->frameView(), static_cast<cons t WebMouseEvent&>(inputEvent)), | 365 PlatformMouseEventBuilder(m_localRoot->frameView(), static_cast<cons t WebMouseEvent&>(inputEvent)), |
| 366 eventType, static_cast<const WebMouseEvent&>(inputEvent).clickCount) ; | 366 eventType, static_cast<const WebMouseEvent&>(inputEvent).clickCount) ; |
| 367 return true; | 367 return WebInputEventResult::HandledSystem; |
| 368 } | 368 } |
| 369 | 369 |
| 370 return PageWidgetDelegate::handleInputEvent(*this, inputEvent, m_localRoot-> frame()); | 370 return PageWidgetDelegate::handleInputEvent(*this, inputEvent, m_localRoot-> frame()); |
| 371 } | 371 } |
| 372 | 372 |
| 373 void WebFrameWidgetImpl::setCursorVisibilityState(bool isVisible) | 373 void WebFrameWidgetImpl::setCursorVisibilityState(bool isVisible) |
| 374 { | 374 { |
| 375 page()->setIsCursorVisible(isVisible); | 375 page()->setIsCursorVisible(isVisible); |
| 376 } | 376 } |
| 377 | 377 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 697 PageWidgetEventHandler::handleMouseUp(mainFrame, event); | 697 PageWidgetEventHandler::handleMouseUp(mainFrame, event); |
| 698 | 698 |
| 699 if (page()->settings().showContextMenuOnMouseUp()) { | 699 if (page()->settings().showContextMenuOnMouseUp()) { |
| 700 // Dispatch the contextmenu event regardless of if the click was swallow ed. | 700 // Dispatch the contextmenu event regardless of if the click was swallow ed. |
| 701 // On Mac/Linux, we handle it on mouse down, not up. | 701 // On Mac/Linux, we handle it on mouse down, not up. |
| 702 if (event.button == WebMouseEvent::ButtonRight) | 702 if (event.button == WebMouseEvent::ButtonRight) |
| 703 mouseContextMenu(event); | 703 mouseContextMenu(event); |
| 704 } | 704 } |
| 705 } | 705 } |
| 706 | 706 |
| 707 bool WebFrameWidgetImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseW heelEvent& event) | 707 WebInputEventResult WebFrameWidgetImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEvent& event) |
| 708 { | 708 { |
| 709 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); | 709 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); |
| 710 } | 710 } |
| 711 | 711 |
| 712 bool WebFrameWidgetImpl::handleGestureEvent(const WebGestureEvent& event) | 712 WebInputEventResult WebFrameWidgetImpl::handleGestureEvent(const WebGestureEvent & event) |
| 713 { | 713 { |
| 714 bool eventSwallowed = false; | 714 WebInputEventResult eventResult = WebInputEventResult::NotHandled; |
| 715 bool eventCancelled = false; | 715 bool eventCancelled = false; |
| 716 switch (event.type) { | 716 switch (event.type) { |
| 717 case WebInputEvent::GestureScrollBegin: | 717 case WebInputEvent::GestureScrollBegin: |
| 718 case WebInputEvent::GestureScrollEnd: | 718 case WebInputEvent::GestureScrollEnd: |
| 719 case WebInputEvent::GestureScrollUpdate: | 719 case WebInputEvent::GestureScrollUpdate: |
| 720 case WebInputEvent::GestureTap: | 720 case WebInputEvent::GestureTap: |
| 721 case WebInputEvent::GestureTapUnconfirmed: | 721 case WebInputEvent::GestureTapUnconfirmed: |
| 722 case WebInputEvent::GestureTapDown: | 722 case WebInputEvent::GestureTapDown: |
| 723 case WebInputEvent::GestureShowPress: | 723 case WebInputEvent::GestureShowPress: |
| 724 case WebInputEvent::GestureTapCancel: | 724 case WebInputEvent::GestureTapCancel: |
| 725 case WebInputEvent::GestureDoubleTap: | 725 case WebInputEvent::GestureDoubleTap: |
| 726 case WebInputEvent::GestureTwoFingerTap: | 726 case WebInputEvent::GestureTwoFingerTap: |
| 727 case WebInputEvent::GestureLongPress: | 727 case WebInputEvent::GestureLongPress: |
| 728 case WebInputEvent::GestureLongTap: | 728 case WebInputEvent::GestureLongTap: |
| 729 break; | 729 break; |
| 730 case WebInputEvent::GestureFlingStart: | 730 case WebInputEvent::GestureFlingStart: |
| 731 case WebInputEvent::GestureFlingCancel: | 731 case WebInputEvent::GestureFlingCancel: |
| 732 m_client->didHandleGestureEvent(event, eventCancelled); | 732 m_client->didHandleGestureEvent(event, eventCancelled); |
| 733 return false; | 733 return WebInputEventResult::NotHandled; |
| 734 default: | 734 default: |
| 735 ASSERT_NOT_REACHED(); | 735 ASSERT_NOT_REACHED(); |
| 736 } | 736 } |
| 737 LocalFrame* frame = m_localRoot->frame(); | 737 LocalFrame* frame = m_localRoot->frame(); |
| 738 eventSwallowed = frame->eventHandler().handleGestureEvent(PlatformGestureEve ntBuilder(frame->view(), event)); | 738 eventResult = frame->eventHandler().handleGestureEvent(PlatformGestureEventB uilder(frame->view(), event)); |
| 739 m_client->didHandleGestureEvent(event, eventCancelled); | 739 m_client->didHandleGestureEvent(event, eventCancelled); |
| 740 return eventSwallowed; | 740 return eventResult; |
| 741 } | 741 } |
| 742 | 742 |
| 743 bool WebFrameWidgetImpl::handleKeyEvent(const WebKeyboardEvent& event) | 743 WebInputEventResult WebFrameWidgetImpl::handleKeyEvent(const WebKeyboardEvent& e vent) |
| 744 { | 744 { |
| 745 ASSERT((event.type == WebInputEvent::RawKeyDown) | 745 ASSERT((event.type == WebInputEvent::RawKeyDown) |
| 746 || (event.type == WebInputEvent::KeyDown) | 746 || (event.type == WebInputEvent::KeyDown) |
| 747 || (event.type == WebInputEvent::KeyUp)); | 747 || (event.type == WebInputEvent::KeyUp)); |
| 748 | 748 |
| 749 // Please refer to the comments explaining the m_suppressNextKeypressEvent | 749 // Please refer to the comments explaining the m_suppressNextKeypressEvent |
| 750 // member. | 750 // member. |
| 751 // The m_suppressNextKeypressEvent is set if the KeyDown is handled by | 751 // The m_suppressNextKeypressEvent is set if the KeyDown is handled by |
| 752 // Webkit. A keyDown event is typically associated with a keyPress(char) | 752 // Webkit. A keyDown event is typically associated with a keyPress(char) |
| 753 // event and a keyUp event. We reset this flag here as this is a new keyDown | 753 // event and a keyUp event. We reset this flag here as this is a new keyDown |
| 754 // event. | 754 // event. |
| 755 m_suppressNextKeypressEvent = false; | 755 m_suppressNextKeypressEvent = false; |
| 756 | 756 |
| 757 RefPtrWillBeRawPtr<Frame> focusedFrame = focusedCoreFrame(); | 757 RefPtrWillBeRawPtr<Frame> focusedFrame = focusedCoreFrame(); |
| 758 if (focusedFrame && focusedFrame->isRemoteFrame()) { | 758 if (focusedFrame && focusedFrame->isRemoteFrame()) { |
| 759 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr ame(focusedFrame.get())); | 759 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr ame(focusedFrame.get())); |
| 760 webFrame->client()->forwardInputEvent(&event); | 760 webFrame->client()->forwardInputEvent(&event); |
| 761 return true; | 761 return WebInputEventResult::HandledSystem; |
| 762 } | 762 } |
| 763 | 763 |
| 764 if (!focusedFrame || !focusedFrame->isLocalFrame()) | 764 if (!focusedFrame || !focusedFrame->isLocalFrame()) |
| 765 return false; | 765 return WebInputEventResult::NotHandled; |
| 766 | 766 |
| 767 RefPtrWillBeRawPtr<LocalFrame> frame = toLocalFrame(focusedFrame.get()); | 767 RefPtrWillBeRawPtr<LocalFrame> frame = toLocalFrame(focusedFrame.get()); |
| 768 | 768 |
| 769 PlatformKeyboardEventBuilder evt(event); | 769 PlatformKeyboardEventBuilder evt(event); |
| 770 | 770 |
| 771 if (frame->eventHandler().keyEvent(evt)) { | 771 WebInputEventResult result = frame->eventHandler().keyEvent(evt); |
| 772 if (result != WebInputEventResult::NotHandled) { | |
| 772 if (WebInputEvent::RawKeyDown == event.type) { | 773 if (WebInputEvent::RawKeyDown == event.type) { |
| 773 // Suppress the next keypress event unless the focused node is a plu gin node. | 774 // Suppress the next keypress event unless the focused node is a plu gin node. |
| 774 // (Flash needs these keypress events to handle non-US keyboards.) | 775 // (Flash needs these keypress events to handle non-US keyboards.) |
| 775 Element* element = focusedElement(); | 776 Element* element = focusedElement(); |
| 776 if (!element || !element->layoutObject() || !element->layoutObject() ->isEmbeddedObject()) | 777 if (!element || !element->layoutObject() || !element->layoutObject() ->isEmbeddedObject()) |
| 777 m_suppressNextKeypressEvent = true; | 778 m_suppressNextKeypressEvent = true; |
| 778 } | 779 } |
| 779 return true; | 780 return result; |
| 780 } | 781 } |
| 781 | 782 |
| 782 #if !OS(MACOSX) | 783 #if !OS(MACOSX) |
| 783 const WebInputEvent::Type contextMenuTriggeringEventType = | 784 const WebInputEvent::Type contextMenuTriggeringEventType = |
| 784 #if OS(WIN) | 785 #if OS(WIN) |
| 785 WebInputEvent::KeyUp; | 786 WebInputEvent::KeyUp; |
| 786 #else | 787 #else |
| 787 WebInputEvent::RawKeyDown; | 788 WebInputEvent::RawKeyDown; |
| 788 #endif | 789 #endif |
| 789 | 790 |
| 790 bool isUnmodifiedMenuKey = !(event.modifiers & WebInputEvent::InputModifiers ) && event.windowsKeyCode == VKEY_APPS; | 791 bool isUnmodifiedMenuKey = !(event.modifiers & WebInputEvent::InputModifiers ) && event.windowsKeyCode == VKEY_APPS; |
| 791 bool isShiftF10 = event.modifiers == WebInputEvent::ShiftKey && event.window sKeyCode == VKEY_F10; | 792 bool isShiftF10 = event.modifiers == WebInputEvent::ShiftKey && event.window sKeyCode == VKEY_F10; |
| 792 if ((isUnmodifiedMenuKey || isShiftF10) && event.type == contextMenuTriggeri ngEventType) { | 793 if ((isUnmodifiedMenuKey || isShiftF10) && event.type == contextMenuTriggeri ngEventType) { |
| 793 view()->sendContextMenuEvent(event); | 794 view()->sendContextMenuEvent(event); |
| 794 return true; | 795 return WebInputEventResult::HandledSystem; |
| 795 } | 796 } |
| 796 #endif // !OS(MACOSX) | 797 #endif // !OS(MACOSX) |
| 797 | 798 |
| 798 return keyEventDefault(event); | 799 return keyEventDefault(event); |
| 799 } | 800 } |
| 800 | 801 |
| 801 bool WebFrameWidgetImpl::handleCharEvent(const WebKeyboardEvent& event) | 802 WebInputEventResult WebFrameWidgetImpl::handleCharEvent(const WebKeyboardEvent& event) |
| 802 { | 803 { |
| 803 ASSERT(event.type == WebInputEvent::Char); | 804 ASSERT(event.type == WebInputEvent::Char); |
| 804 | 805 |
| 805 // Please refer to the comments explaining the m_suppressNextKeypressEvent | 806 // Please refer to the comments explaining the m_suppressNextKeypressEvent |
| 806 // member. The m_suppressNextKeypressEvent is set if the KeyDown is | 807 // member. The m_suppressNextKeypressEvent is set if the KeyDown is |
| 807 // handled by Webkit. A keyDown event is typically associated with a | 808 // handled by Webkit. A keyDown event is typically associated with a |
| 808 // keyPress(char) event and a keyUp event. We reset this flag here as it | 809 // keyPress(char) event and a keyUp event. We reset this flag here as it |
| 809 // only applies to the current keyPress event. | 810 // only applies to the current keyPress event. |
| 810 bool suppress = m_suppressNextKeypressEvent; | 811 bool suppress = m_suppressNextKeypressEvent; |
| 811 m_suppressNextKeypressEvent = false; | 812 m_suppressNextKeypressEvent = false; |
| 812 | 813 |
| 813 LocalFrame* frame = toLocalFrame(focusedCoreFrame()); | 814 LocalFrame* frame = toLocalFrame(focusedCoreFrame()); |
| 814 if (!frame) | 815 if (!frame) |
| 815 return suppress; | 816 return suppress ? WebInputEventResult::HandledSuppressed : WebInputEvent Result::NotHandled; |
| 816 | 817 |
| 817 EventHandler& handler = frame->eventHandler(); | 818 EventHandler& handler = frame->eventHandler(); |
| 818 | 819 |
| 819 PlatformKeyboardEventBuilder evt(event); | 820 PlatformKeyboardEventBuilder evt(event); |
| 820 if (!evt.isCharacterKey()) | 821 if (!evt.isCharacterKey()) |
| 821 return true; | 822 return WebInputEventResult::HandledSuppressed; |
| 822 | 823 |
| 823 // Accesskeys are triggered by char events and can't be suppressed. | 824 // Accesskeys are triggered by char events and can't be suppressed. |
| 824 if (handler.handleAccessKey(evt)) | 825 if (handler.handleAccessKey(evt)) |
| 825 return true; | 826 return WebInputEventResult::HandledSystem; |
|
Rick Byers
2015/11/27 21:31:53
since this event never makes it to the application
dtapuska
2015/11/30 16:15:43
I think that would be odd this is UA behaviour; al
Rick Byers
2015/12/02 14:52:10
Ok, so we think it's a bug that we're suppressing
| |
| 826 | 827 |
| 827 // Safari 3.1 does not pass off windows system key messages (WM_SYSCHAR) to | 828 // Safari 3.1 does not pass off windows system key messages (WM_SYSCHAR) to |
| 828 // the eventHandler::keyEvent. We mimic this behavior on all platforms since | 829 // the eventHandler::keyEvent. We mimic this behavior on all platforms since |
| 829 // for now we are converting other platform's key events to windows key | 830 // for now we are converting other platform's key events to windows key |
| 830 // events. | 831 // events. |
| 831 if (evt.isSystemKey()) | 832 if (evt.isSystemKey()) |
| 832 return false; | 833 return WebInputEventResult::NotHandled; |
| 833 | 834 |
| 834 if (!suppress && !handler.keyEvent(evt)) | 835 if (suppress) |
| 835 return keyEventDefault(event); | 836 return WebInputEventResult::HandledSuppressed; |
| 836 | 837 |
| 837 return true; | 838 WebInputEventResult result = handler.keyEvent(evt); |
| 839 if (result != WebInputEventResult::NotHandled) | |
| 840 return result; | |
| 841 | |
| 842 return keyEventDefault(event); | |
| 838 } | 843 } |
| 839 | 844 |
| 840 | 845 WebInputEventResult WebFrameWidgetImpl::keyEventDefault(const WebKeyboardEvent& event) |
| 841 bool WebFrameWidgetImpl::keyEventDefault(const WebKeyboardEvent& event) | |
| 842 { | 846 { |
| 843 LocalFrame* frame = toLocalFrame(focusedCoreFrame()); | 847 LocalFrame* frame = toLocalFrame(focusedCoreFrame()); |
| 844 if (!frame) | 848 if (!frame) |
| 845 return false; | 849 return WebInputEventResult::NotHandled; |
| 846 | 850 |
| 847 switch (event.type) { | 851 switch (event.type) { |
| 848 case WebInputEvent::Char: | 852 case WebInputEvent::Char: |
| 849 if (event.windowsKeyCode == VKEY_SPACE) { | 853 if (event.windowsKeyCode == VKEY_SPACE) { |
| 850 int keyCode = ((event.modifiers & WebInputEvent::ShiftKey) ? VKEY_PR IOR : VKEY_NEXT); | 854 int keyCode = ((event.modifiers & WebInputEvent::ShiftKey) ? VKEY_PR IOR : VKEY_NEXT); |
| 851 return scrollViewWithKeyboard(keyCode, event.modifiers); | 855 return scrollViewWithKeyboard(keyCode, event.modifiers); |
| 852 } | 856 } |
| 853 break; | 857 break; |
| 854 case WebInputEvent::RawKeyDown: | 858 case WebInputEvent::RawKeyDown: |
| 855 if (event.modifiers == WebInputEvent::ControlKey) { | 859 if (event.modifiers == WebInputEvent::ControlKey) { |
| 856 switch (event.windowsKeyCode) { | 860 switch (event.windowsKeyCode) { |
| 857 #if !OS(MACOSX) | 861 #if !OS(MACOSX) |
| 858 case 'A': | 862 case 'A': |
| 859 WebFrame::fromFrame(focusedCoreFrame())->executeCommand(WebStrin g::fromUTF8("SelectAll")); | 863 WebFrame::fromFrame(focusedCoreFrame())->executeCommand(WebStrin g::fromUTF8("SelectAll")); |
| 860 return true; | 864 return WebInputEventResult::HandledSystem; |
| 861 case VKEY_INSERT: | 865 case VKEY_INSERT: |
| 862 case 'C': | 866 case 'C': |
| 863 WebFrame::fromFrame(focusedCoreFrame())->executeCommand(WebStrin g::fromUTF8("Copy")); | 867 WebFrame::fromFrame(focusedCoreFrame())->executeCommand(WebStrin g::fromUTF8("Copy")); |
| 864 return true; | 868 return WebInputEventResult::HandledSystem; |
| 865 #endif | 869 #endif |
| 866 // Match FF behavior in the sense that Ctrl+home/end are the only Ct rl | 870 // Match FF behavior in the sense that Ctrl+home/end are the only Ct rl |
| 867 // key combinations which affect scrolling. Safari is buggy in the | 871 // key combinations which affect scrolling. Safari is buggy in the |
| 868 // sense that it scrolls the page for all Ctrl+scrolling key | 872 // sense that it scrolls the page for all Ctrl+scrolling key |
| 869 // combinations. For e.g. Ctrl+pgup/pgdn/up/down, etc. | 873 // combinations. For e.g. Ctrl+pgup/pgdn/up/down, etc. |
| 870 case VKEY_HOME: | 874 case VKEY_HOME: |
| 871 case VKEY_END: | 875 case VKEY_END: |
| 872 break; | 876 break; |
| 873 default: | 877 default: |
| 874 return false; | 878 return WebInputEventResult::NotHandled; |
| 875 } | 879 } |
| 876 } | 880 } |
| 877 if (!event.isSystemKey && !(event.modifiers & WebInputEvent::ShiftKey)) | 881 if (!event.isSystemKey && !(event.modifiers & WebInputEvent::ShiftKey)) |
| 878 return scrollViewWithKeyboard(event.windowsKeyCode, event.modifiers) ; | 882 return scrollViewWithKeyboard(event.windowsKeyCode, event.modifiers) ; |
| 879 break; | 883 break; |
| 880 default: | 884 default: |
| 881 break; | 885 break; |
| 882 } | 886 } |
| 883 return false; | 887 return WebInputEventResult::NotHandled; |
| 884 } | 888 } |
| 885 | 889 |
| 886 bool WebFrameWidgetImpl::scrollViewWithKeyboard(int keyCode, int modifiers) | 890 WebInputEventResult WebFrameWidgetImpl::scrollViewWithKeyboard(int keyCode, int modifiers) |
| 887 { | 891 { |
| 888 ScrollDirection scrollDirection; | 892 ScrollDirection scrollDirection; |
| 889 ScrollGranularity scrollGranularity; | 893 ScrollGranularity scrollGranularity; |
| 890 #if OS(MACOSX) | 894 #if OS(MACOSX) |
| 891 // Control-Up/Down should be PageUp/Down on Mac. | 895 // Control-Up/Down should be PageUp/Down on Mac. |
| 892 if (modifiers & WebMouseEvent::ControlKey) { | 896 if (modifiers & WebMouseEvent::ControlKey) { |
| 893 if (keyCode == VKEY_UP) | 897 if (keyCode == VKEY_UP) |
| 894 keyCode = VKEY_PRIOR; | 898 keyCode = VKEY_PRIOR; |
| 895 else if (keyCode == VKEY_DOWN) | 899 else if (keyCode == VKEY_DOWN) |
| 896 keyCode = VKEY_NEXT; | 900 keyCode = VKEY_NEXT; |
| 897 } | 901 } |
| 898 #endif | 902 #endif |
| 899 if (!mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) | 903 if (!mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) |
| 900 return false; | 904 return WebInputEventResult::NotHandled; |
| 901 | 905 |
| 902 if (LocalFrame* frame = toLocalFrame(focusedCoreFrame())) | 906 LocalFrame* frame = toLocalFrame(focusedCoreFrame()); |
| 903 return frame->eventHandler().bubblingScroll(scrollDirection, scrollGranu larity); | 907 if (frame && frame->eventHandler().bubblingScroll(scrollDirection, scrollGra nularity)) |
| 904 return false; | 908 return WebInputEventResult::HandledSystem; |
| 909 return WebInputEventResult::NotHandled; | |
| 905 } | 910 } |
| 906 | 911 |
| 907 bool WebFrameWidgetImpl::mapKeyCodeForScroll( | 912 bool WebFrameWidgetImpl::mapKeyCodeForScroll( |
| 908 int keyCode, | 913 int keyCode, |
| 909 ScrollDirection* scrollDirection, | 914 ScrollDirection* scrollDirection, |
| 910 ScrollGranularity* scrollGranularity) | 915 ScrollGranularity* scrollGranularity) |
| 911 { | 916 { |
| 912 switch (keyCode) { | 917 switch (keyCode) { |
| 913 case VKEY_LEFT: | 918 case VKEY_LEFT: |
| 914 *scrollDirection = ScrollLeftIgnoringWritingMode; | 919 *scrollDirection = ScrollLeftIgnoringWritingMode; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1069 | 1074 |
| 1070 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p osInRootFrame) | 1075 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p osInRootFrame) |
| 1071 { | 1076 { |
| 1072 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo tFrame)); | 1077 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo tFrame)); |
| 1073 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); | 1078 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); |
| 1074 result.setToShadowHostIfInUserAgentShadowRoot(); | 1079 result.setToShadowHostIfInUserAgentShadowRoot(); |
| 1075 return result; | 1080 return result; |
| 1076 } | 1081 } |
| 1077 | 1082 |
| 1078 } // namespace blink | 1083 } // namespace blink |
| OLD | NEW |