bool InspectorOverlay::handleInputEvent(const WebInputEvent& inputEvent) { bool handled = false; if (isEmpty()) return false; if (WebInputEvent::isGestureEventType(inputEvent.type) && inputEvent.type == WebInputEvent::GestureTap) { // Only let GestureTab in (we only need it and we know PlatformGestureEventBuilder supports it). PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder(m_webViewImpl->mainFrameImpl()->frameView(), static_cast<const WebGestureEvent&>(inputEvent)); handled = handleGestureEvent(gestureEvent); if (handled) return true; overlayMainFrame()->eventHandler().handleGestureEvent(gestureEvent); } if (WebInputEvent::isMouseEventType(inputEvent.type) && inputEvent.type != WebInputEvent::MouseEnter) { // PlatformMouseEventBuilder does not work with MouseEnter type, so we filter it out manually. PlatformMouseEvent mouseEvent = PlatformMouseEventBuilder(m_webViewImpl->mainFrameImpl()->frameView(), static_cast<const WebMouseEvent&>(inputEvent)); if (mouseEvent.type() == PlatformEvent::MouseMoved) handled = handleMouseMove(mouseEvent); else if (mouseEvent.type() == PlatformEvent::MousePressed) handled = handleMousePress(); if (handled) return true; if (mouseEvent.type() == PlatformEvent::MouseMoved) handled = overlayMainFrame()->eventHandler().handleMouseMoveEvent(mouseEvent) != WebInputEventResult::NotHandled; if (mouseEvent.type() == PlatformEvent::MousePressed) handled = overlayMainFrame()->eventHandler().handleMousePressEvent(mouseEvent) != WebInputEventResult::NotHandled; if (mouseEvent.type() == PlatformEvent::MouseReleased) handled = overlayMainFrame()->eventHandler().handleMouseReleaseEvent(mouseEvent) != WebInputEventResult::NotHandled; } if (WebInputEvent::isTouchEventType(inputEvent.type)) { PlatformTouchEvent touchEvent = PlatformTouchEventBuilder(m_webViewImpl->mainFrameImpl()->frameView(), static_cast<const WebTouchEvent&>(inputEvent)); handled = handleTouchEvent(touchEvent); if (handled) return true; overlayMainFrame()->eventHandler().handleTouchEvent(touchEvent); } if (WebInputEvent::isKeyboardEventType(inputEvent.type)) { PlatformKeyboardEvent keyboardEvent = PlatformKeyboardEventBuilder(static_cast<const WebKeyboardEvent&>(inputEvent)); overlayMainFrame()->eventHandler().keyEvent(keyboardEvent); } if (inputEvent.type == WebInputEvent::MouseWheel) { PlatformWheelEvent wheelEvent = PlatformWheelEventBuilder(m_webViewImpl->mainFrameImpl()->frameView(), static_cast<const WebMouseWheelEvent&>(inputEvent)); handled = overlayMainFrame()->eventHandler().handleWheelEvent(wheelEvent) != WebInputEventResult::NotHandled; } return handled; }
void WebPopupMenuImpl::handleMouseWheel(const WebMouseWheelEvent& event) { m_widget->handleWheelEvent(PlatformWheelEventBuilder(m_widget, event)); }
bool PageWidgetEventHandler::handleMouseWheel(Frame& mainFrame, const WebMouseWheelEvent& event) { return mainFrame.eventHandler()->handleWheelEvent(PlatformWheelEventBuilder(mainFrame.view(), event)); }