static PlatformWheelEvent constructRelativeWheelEvent(const PlatformWheelEvent& e, FramelessScrollView* parent, FramelessScrollView* child) { IntPoint pos = parent->convertSelfToChild(child, e.position()); // FIXME: This is a horrible hack since PlatformWheelEvent has no setters for x/y. PlatformWheelEvent relativeEvent = e; IntPoint& relativePos = const_cast<IntPoint&>(relativeEvent.position()); relativePos.setX(pos.x()); relativePos.setY(pos.y()); return relativeEvent; }
bool ScrollingTree::shouldHandleWheelEventSynchronously(const PlatformWheelEvent& wheelEvent) { // This method is invoked by the event handling thread MutexLocker lock(m_mutex); if (m_hasWheelEventHandlers) return true; bool shouldSetLatch = wheelEvent.shouldConsiderLatching(); if (hasLatchedNode() && !shouldSetLatch) return false; if (shouldSetLatch) m_latchedNode = 0; if (!m_nonFastScrollableRegion.isEmpty()) { // FIXME: This is not correct for non-default scroll origins. FloatPoint position = wheelEvent.position(); position.moveBy(m_mainFrameScrollPosition); if (m_nonFastScrollableRegion.contains(roundedIntPoint(position))) return true; } return false; }
// GTK+ must scroll horizontally if the mouse pointer is on top of the // horizontal scrollbar while scrolling with the wheel; we need to // add the deltas and ticks here so that this behavior is consistent // for styled scrollbars. bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result, const PlatformWheelEvent& event) const { FrameView* view = m_frame.view(); Scrollbar* scrollbar = view ? view->scrollbarAtPoint(event.position()) : nullptr; if (!scrollbar) scrollbar = result.scrollbar(); return scrollbar && scrollbar->orientation() == HorizontalScrollbar; }
WheelEventDispatchMediator::WheelEventDispatchMediator(const PlatformWheelEvent& event, PassRefPtr<AbstractView> view) { if (!(event.deltaX() || event.deltaY())) return; setEvent(WheelEvent::create(FloatPoint(event.wheelTicksX(), event.wheelTicksY()), FloatPoint(event.deltaX(), event.deltaY()), deltaMode(event), view, event.globalPosition(), event.position(), event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.directionInvertedFromDevice())); }
PassRefPtrWillBeRawPtr<WheelEvent> WheelEvent::create(const PlatformWheelEvent& event, PassRefPtrWillBeRawPtr<AbstractView> view) { return adoptRefWillBeNoop(new WheelEvent(FloatPoint(event.wheelTicksX(), event.wheelTicksY()), FloatPoint(event.deltaX(), event.deltaY()), convertDeltaMode(event), view, event.globalPosition(), event.position(), event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), MouseEvent::platformModifiersToButtons(event.modifiers()), event.canScroll(), event.hasPreciseScrollingDeltas(), static_cast<Event::RailsMode>(event.railsMode()))); }
bool PopupListBox::handleWheelEvent(const PlatformWheelEvent& event) { if (!isPointInBounds(event.position())) { abandon(); return true; } ScrollableArea::handleWheelEvent(event); return true; }
ScrollingTree::EventResult ScrollingTree::tryToHandleWheelEvent(const PlatformWheelEvent& wheelEvent) { { MutexLocker lock(m_mutex); if (m_hasWheelEventHandlers) return SendToMainThread; if (!m_nonFastScrollableRegion.isEmpty()) { // FIXME: This is not correct for non-default scroll origins. IntPoint position = wheelEvent.position(); position.moveBy(m_mainFrameScrollPosition); if (m_nonFastScrollableRegion.contains(position)) return SendToMainThread; } } if (willWheelEventStartSwipeGesture(wheelEvent)) return DidNotHandleEvent; ScrollingThread::dispatch(bind(&ScrollingTree::handleWheelEvent, this, wheelEvent)); return DidHandleEvent; }
WheelEvent::WheelEvent(const PlatformWheelEvent& event, PassRefPtr<AbstractView> view) : MouseEvent(eventNames().wheelEvent, true, true, event.timestamp(), view, 0, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y() #if ENABLE(POINTER_LOCK) , 0, 0 #endif , event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), 0, 0, 0, 0, false) , m_wheelDelta(event.wheelTicksX() * TickMultiplier, event.wheelTicksY() * TickMultiplier) , m_deltaX(-event.deltaX()) , m_deltaY(-event.deltaY()) , m_deltaZ(0) , m_deltaMode(determineDeltaMode(event)) , m_wheelEvent(event) , m_initializedWithPlatformWheelEvent(true) { }