void AutoscrollController::stopAutoscrollTimer(bool rendererIsBeingDestroyed) { RenderBox* scrollable = m_autoscrollRenderer; m_autoscrollTimer.stop(); m_autoscrollRenderer = 0; if (!scrollable) return; Frame& frame = scrollable->frame(); if (autoscrollInProgress() && frame.eventHandler().mouseDownWasInSubframe()) { if (Frame* subframe = frame.eventHandler().subframeForTargetNode(frame.eventHandler().mousePressNode())) subframe->eventHandler().stopAutoscrollTimer(rendererIsBeingDestroyed); return; } if (!rendererIsBeingDestroyed) scrollable->stopAutoscroll(); #if ENABLE(PAN_SCROLLING) if (panScrollInProgress()) { FrameView& frameView = scrollable->view().frameView(); frameView.removePanScrollIcon(); frameView.setCursor(pointerCursor()); } #endif m_autoscrollType = NoAutoscroll; #if ENABLE(PAN_SCROLLING) // If we're not in the top frame we notify it that we are not doing a panScroll any more. if (!frame.isMainFrame()) frame.mainFrame().eventHandler().didPanScrollStop(); #endif }
void AutoscrollController::updateDragAndDrop(Node* dropTargetNode, const IntPoint& eventPosition, double eventTime) { if (!dropTargetNode || !dropTargetNode->renderer()) { stopAutoscroll(); return; } if (m_autoscrollRenderer && m_autoscrollRenderer->frame() != dropTargetNode->renderer()->frame()) return; RenderBox* scrollable = RenderBox::findAutoscrollable(dropTargetNode->renderer()); if (!scrollable) { stopAutoscroll(); return; } Page* page = scrollable->frame() ? scrollable->frame()->page() : 0; if (!page) { stopAutoscroll(); return; } IntSize offset = scrollable->calculateAutoscrollDirection(eventPosition); if (offset.isZero()) { stopAutoscroll(); return; } m_dragAndDropAutoscrollReferencePosition = eventPosition + offset; if (m_autoscrollType == NoAutoscroll) { m_autoscrollType = AutoscrollForDragAndDrop; m_autoscrollRenderer = scrollable; m_dragAndDropAutoscrollStartTime = eventTime; startAutoscroll(); } else if (m_autoscrollRenderer != scrollable) { m_dragAndDropAutoscrollStartTime = eventTime; m_autoscrollRenderer = scrollable; } }
void AutoscrollController::stopAutoscroll() { RenderBox* scrollable = m_autoscrollRenderer; m_autoscrollRenderer = 0; if (!scrollable) return; scrollable->stopAutoscroll(); #if OS(WIN) if (panScrollInProgress()) { if (FrameView* view = scrollable->frame()->view()) { view->removePanScrollIcon(); view->setCursor(pointerCursor()); } } #endif m_autoscrollType = NoAutoscroll; }