bool InspectorOverlay::handleMouseMove(const PlatformMouseEvent& event) { if (!shouldSearchForNode()) return false; LocalFrame* frame = m_webViewImpl->mainFrameImpl()->frame(); if (!frame->view() || !frame->contentLayoutObject()) return false; Node* node = hoveredNodeForEvent(frame, event, event.shiftKey()); // Do not highlight within user agent shadow root unless requested. if (m_inspectMode != InspectorDOMAgent::SearchingForUAShadow) { ShadowRoot* shadowRoot = InspectorDOMAgent::userAgentShadowRoot(node); if (shadowRoot) node = shadowRoot->host(); } // Shadow roots don't have boxes - use host element instead. if (node && node->isShadowRoot()) node = node->parentOrShadowHostNode(); if (!node) return true; Node* eventTarget = event.shiftKey() ? hoveredNodeForEvent(m_webViewImpl->mainFrameImpl()->frame(), event, false) : nullptr; if (eventTarget == node) eventTarget = nullptr; if (node && m_inspectModeHighlightConfig) { m_hoveredNodeForInspectMode = node; m_domAgent->nodeHighlightedInOverlay(node); highlightNode(node, eventTarget, *m_inspectModeHighlightConfig, event.ctrlKey() || event.metaKey()); } return true; }
PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtr<Node> relatedTarget) { ASSERT(event.eventType() == MouseEventMoved || event.button() != NoButton); bool isCancelable = eventType != eventNames().mousemoveEvent; return MouseEvent::create(eventType, true, isCancelable, view, detail, event.globalX(), event.globalY(), event.x(), event.y(), event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(), relatedTarget, 0, false); }
PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtr<Node> relatedTarget) { ASSERT(event.type() == PlatformEvent::MouseMoved || event.button() != NoButton); bool isMouseEnterOrLeave = eventType == EventTypeNames::mouseenter || eventType == EventTypeNames::mouseleave; bool isCancelable = !isMouseEnterOrLeave; bool isBubbling = !isMouseEnterOrLeave; return MouseEvent::create(eventType, isBubbling, isCancelable, view, detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(), event.movementDelta().x(), event.movementDelta().y(), event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(), relatedTarget, nullptr, false); }
Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, AbstractView* view, const PlatformMouseEvent& event, int detail, PassRefPtr<Node> relatedTarget) { bool isMouseEnterOrLeave = eventType == eventNames().mouseenterEvent || eventType == eventNames().mouseleaveEvent; bool isCancelable = eventType != eventNames().mousemoveEvent && !isMouseEnterOrLeave; bool canBubble = !isMouseEnterOrLeave; return MouseEvent::create(eventType, canBubble, isCancelable, event.timestamp(), view, detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(), #if ENABLE(POINTER_LOCK) event.movementDelta().x(), event.movementDelta().y(), #endif event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(), relatedTarget, event.force(), event.syntheticClickType()); }
bool EventTargetNode::dispatchMouseEvent(const PlatformMouseEvent& _mouse, const AtomicString& eventType, int detail, Node* relatedTarget) { assert(!eventDispatchForbidden()); IntPoint contentsPos; if (FrameView* view = document()->view()) contentsPos = view->viewportToContents(_mouse.pos()); return dispatchMouseEvent(eventType, _mouse.button(), detail, contentsPos.x(), contentsPos.y(), _mouse.globalX(), _mouse.globalY(), _mouse.ctrlKey(), _mouse.altKey(), _mouse.shiftKey(), _mouse.metaKey(), false, relatedTarget); }
PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtr<Node> relatedTarget) { ASSERT(event.type() == PlatformEvent::MouseMoved || event.button() != NoButton); bool isCancelable = eventType != eventNames().mousemoveEvent; return MouseEvent::create(eventType, true, isCancelable, view, detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(), #if ENABLE(POINTER_LOCK) event.movementDelta().x(), event.movementDelta().y(), #endif event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(), relatedTarget, 0, false); }
bool EventTargetNode::dispatchMouseEvent(const PlatformMouseEvent& event, const AtomicString& eventType, int detail, Node* relatedTarget) { ASSERT(!eventDispatchForbidden()); IntPoint contentsPos; if (FrameView* view = document()->view()) contentsPos = view->windowToContents(event.pos()); short button = event.button(); ASSERT(event.eventType() == MouseEventMoved || button != NoButton); return dispatchMouseEvent(eventType, button, detail, contentsPos.x(), contentsPos.y(), event.globalX(), event.globalY(), event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), false, relatedTarget); }
bool ScrollbarTheme::shouldCenterOnThumb(const ScrollbarThemeClient* scrollbar, const PlatformMouseEvent& evt) { return Platform::current()->scrollbarBehavior()->shouldCenterOnThumb(static_cast<WebScrollbarBehavior::Button>(evt.button()), evt.shiftKey(), evt.altKey()); }
bool ScrollbarThemeChromiumLinux::shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent& evt) { return (evt.shiftKey() && evt.button() == LeftButton) || (evt.button() == MiddleButton); }
bool ScrollbarThemeWin::shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent& evt) { return evt.shiftKey() && evt.button() == LeftButton; }
bool ScrollbarThemeGtk::shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent& event) { return (event.shiftKey() && event.button() == LeftButton) || (event.button() == MiddleButton); }
bool ScrollbarTheme::shouldCenterOnThumb(const ScrollbarThemeClient& scrollbar, const PlatformMouseEvent& evt) { return Platform::current()->scrollbarBehavior()->shouldCenterOnThumb( evt.pointerProperties().button, evt.shiftKey(), evt.altKey()); }