Chromium Code Reviews| Index: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp |
| diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp |
| index c8c83ee97ed269bf35badb1874def1fbe770b4e6..25a7d6a50e74906ffa4a4187def506b83071128c 100644 |
| --- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp |
| +++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp |
| @@ -316,14 +316,14 @@ void WebFrameWidgetImpl::themeChanged() |
| const WebInputEvent* WebFrameWidgetImpl::m_currentInputEvent = nullptr; |
| -bool WebFrameWidgetImpl::handleInputEvent(const WebInputEvent& inputEvent) |
| +WebInputEventResult WebFrameWidgetImpl::handleInputEvent(const WebInputEvent& inputEvent) |
| { |
| TRACE_EVENT1("input", "WebFrameWidgetImpl::handleInputEvent", "type", inputTypeToName(inputEvent.type)); |
| // Report the event to be NOT processed by WebKit, so that the browser can handle it appropriately. |
| if (m_ignoreInputEvents) |
| - return false; |
| + return WebInputEventResult::NotHandled; |
| // FIXME: pass event to m_localRoot's WebDevToolsAgentImpl once available. |
| @@ -364,7 +364,7 @@ bool WebFrameWidgetImpl::handleInputEvent(const WebInputEvent& inputEvent) |
| node->dispatchMouseEvent( |
| PlatformMouseEventBuilder(m_localRoot->frameView(), static_cast<const WebMouseEvent&>(inputEvent)), |
| eventType, static_cast<const WebMouseEvent&>(inputEvent).clickCount); |
| - return true; |
| + return WebInputEventResult::HandledSystem; |
| } |
| return PageWidgetDelegate::handleInputEvent(*this, inputEvent, m_localRoot->frame()); |
| @@ -704,14 +704,14 @@ void WebFrameWidgetImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEven |
| } |
| } |
| -bool WebFrameWidgetImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEvent& event) |
| +WebInputEventResult WebFrameWidgetImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEvent& event) |
| { |
| return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); |
| } |
| -bool WebFrameWidgetImpl::handleGestureEvent(const WebGestureEvent& event) |
| +WebInputEventResult WebFrameWidgetImpl::handleGestureEvent(const WebGestureEvent& event) |
| { |
| - bool eventSwallowed = false; |
| + WebInputEventResult eventResult = WebInputEventResult::NotHandled; |
| bool eventCancelled = false; |
| switch (event.type) { |
| case WebInputEvent::GestureScrollBegin: |
| @@ -730,17 +730,17 @@ bool WebFrameWidgetImpl::handleGestureEvent(const WebGestureEvent& event) |
| case WebInputEvent::GestureFlingStart: |
| case WebInputEvent::GestureFlingCancel: |
| m_client->didHandleGestureEvent(event, eventCancelled); |
| - return false; |
| + return WebInputEventResult::NotHandled; |
| default: |
| ASSERT_NOT_REACHED(); |
| } |
| LocalFrame* frame = m_localRoot->frame(); |
| - eventSwallowed = frame->eventHandler().handleGestureEvent(PlatformGestureEventBuilder(frame->view(), event)); |
| + eventResult = frame->eventHandler().handleGestureEvent(PlatformGestureEventBuilder(frame->view(), event)); |
| m_client->didHandleGestureEvent(event, eventCancelled); |
| - return eventSwallowed; |
| + return eventResult; |
| } |
| -bool WebFrameWidgetImpl::handleKeyEvent(const WebKeyboardEvent& event) |
| +WebInputEventResult WebFrameWidgetImpl::handleKeyEvent(const WebKeyboardEvent& event) |
| { |
| ASSERT((event.type == WebInputEvent::RawKeyDown) |
| || (event.type == WebInputEvent::KeyDown) |
| @@ -758,17 +758,18 @@ bool WebFrameWidgetImpl::handleKeyEvent(const WebKeyboardEvent& event) |
| if (focusedFrame && focusedFrame->isRemoteFrame()) { |
| WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFrame(focusedFrame.get())); |
| webFrame->client()->forwardInputEvent(&event); |
| - return true; |
| + return WebInputEventResult::HandledSystem; |
| } |
| if (!focusedFrame || !focusedFrame->isLocalFrame()) |
| - return false; |
| + return WebInputEventResult::NotHandled; |
| RefPtrWillBeRawPtr<LocalFrame> frame = toLocalFrame(focusedFrame.get()); |
| PlatformKeyboardEventBuilder evt(event); |
| - if (frame->eventHandler().keyEvent(evt)) { |
| + WebInputEventResult result = frame->eventHandler().keyEvent(evt); |
| + if (result != WebInputEventResult::NotHandled) { |
| if (WebInputEvent::RawKeyDown == event.type) { |
| // Suppress the next keypress event unless the focused node is a plugin node. |
| // (Flash needs these keypress events to handle non-US keyboards.) |
| @@ -776,7 +777,7 @@ bool WebFrameWidgetImpl::handleKeyEvent(const WebKeyboardEvent& event) |
| if (!element || !element->layoutObject() || !element->layoutObject()->isEmbeddedObject()) |
| m_suppressNextKeypressEvent = true; |
| } |
| - return true; |
| + return result; |
| } |
| #if !OS(MACOSX) |
| @@ -791,14 +792,14 @@ bool WebFrameWidgetImpl::handleKeyEvent(const WebKeyboardEvent& event) |
| bool isShiftF10 = event.modifiers == WebInputEvent::ShiftKey && event.windowsKeyCode == VKEY_F10; |
| if ((isUnmodifiedMenuKey || isShiftF10) && event.type == contextMenuTriggeringEventType) { |
| view()->sendContextMenuEvent(event); |
| - return true; |
| + return WebInputEventResult::HandledSystem; |
| } |
| #endif // !OS(MACOSX) |
| return keyEventDefault(event); |
| } |
| -bool WebFrameWidgetImpl::handleCharEvent(const WebKeyboardEvent& event) |
| +WebInputEventResult WebFrameWidgetImpl::handleCharEvent(const WebKeyboardEvent& event) |
| { |
| ASSERT(event.type == WebInputEvent::Char); |
| @@ -812,37 +813,40 @@ bool WebFrameWidgetImpl::handleCharEvent(const WebKeyboardEvent& event) |
| LocalFrame* frame = toLocalFrame(focusedCoreFrame()); |
| if (!frame) |
| - return suppress; |
| + return suppress ? WebInputEventResult::HandledSuppressed : WebInputEventResult::NotHandled; |
| EventHandler& handler = frame->eventHandler(); |
| PlatformKeyboardEventBuilder evt(event); |
| if (!evt.isCharacterKey()) |
| - return true; |
| + return WebInputEventResult::HandledSuppressed; |
| // Accesskeys are triggered by char events and can't be suppressed. |
| if (handler.handleAccessKey(evt)) |
| - return true; |
| + 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
|
| // Safari 3.1 does not pass off windows system key messages (WM_SYSCHAR) to |
| // the eventHandler::keyEvent. We mimic this behavior on all platforms since |
| // for now we are converting other platform's key events to windows key |
| // events. |
| if (evt.isSystemKey()) |
| - return false; |
| + return WebInputEventResult::NotHandled; |
| - if (!suppress && !handler.keyEvent(evt)) |
| - return keyEventDefault(event); |
| + if (suppress) |
| + return WebInputEventResult::HandledSuppressed; |
| - return true; |
| -} |
| + WebInputEventResult result = handler.keyEvent(evt); |
| + if (result != WebInputEventResult::NotHandled) |
| + return result; |
| + return keyEventDefault(event); |
| +} |
| -bool WebFrameWidgetImpl::keyEventDefault(const WebKeyboardEvent& event) |
| +WebInputEventResult WebFrameWidgetImpl::keyEventDefault(const WebKeyboardEvent& event) |
| { |
| LocalFrame* frame = toLocalFrame(focusedCoreFrame()); |
| if (!frame) |
| - return false; |
| + return WebInputEventResult::NotHandled; |
| switch (event.type) { |
| case WebInputEvent::Char: |
| @@ -857,11 +861,11 @@ bool WebFrameWidgetImpl::keyEventDefault(const WebKeyboardEvent& event) |
| #if !OS(MACOSX) |
| case 'A': |
| WebFrame::fromFrame(focusedCoreFrame())->executeCommand(WebString::fromUTF8("SelectAll")); |
| - return true; |
| + return WebInputEventResult::HandledSystem; |
| case VKEY_INSERT: |
| case 'C': |
| WebFrame::fromFrame(focusedCoreFrame())->executeCommand(WebString::fromUTF8("Copy")); |
| - return true; |
| + return WebInputEventResult::HandledSystem; |
| #endif |
| // Match FF behavior in the sense that Ctrl+home/end are the only Ctrl |
| // key combinations which affect scrolling. Safari is buggy in the |
| @@ -871,7 +875,7 @@ bool WebFrameWidgetImpl::keyEventDefault(const WebKeyboardEvent& event) |
| case VKEY_END: |
| break; |
| default: |
| - return false; |
| + return WebInputEventResult::NotHandled; |
| } |
| } |
| if (!event.isSystemKey && !(event.modifiers & WebInputEvent::ShiftKey)) |
| @@ -880,10 +884,10 @@ bool WebFrameWidgetImpl::keyEventDefault(const WebKeyboardEvent& event) |
| default: |
| break; |
| } |
| - return false; |
| + return WebInputEventResult::NotHandled; |
| } |
| -bool WebFrameWidgetImpl::scrollViewWithKeyboard(int keyCode, int modifiers) |
| +WebInputEventResult WebFrameWidgetImpl::scrollViewWithKeyboard(int keyCode, int modifiers) |
| { |
| ScrollDirection scrollDirection; |
| ScrollGranularity scrollGranularity; |
| @@ -897,11 +901,12 @@ bool WebFrameWidgetImpl::scrollViewWithKeyboard(int keyCode, int modifiers) |
| } |
| #endif |
| if (!mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) |
| - return false; |
| + return WebInputEventResult::NotHandled; |
| - if (LocalFrame* frame = toLocalFrame(focusedCoreFrame())) |
| - return frame->eventHandler().bubblingScroll(scrollDirection, scrollGranularity); |
| - return false; |
| + LocalFrame* frame = toLocalFrame(focusedCoreFrame()); |
| + if (frame && frame->eventHandler().bubblingScroll(scrollDirection, scrollGranularity)) |
| + return WebInputEventResult::HandledSystem; |
| + return WebInputEventResult::NotHandled; |
| } |
| bool WebFrameWidgetImpl::mapKeyCodeForScroll( |