Index: third_party/WebKit/Source/core/page/AutoscrollController.cpp |
diff --git a/third_party/WebKit/Source/core/page/AutoscrollController.cpp b/third_party/WebKit/Source/core/page/AutoscrollController.cpp |
index 0934143858f7592725af5e51b1c6fdde30aaa720..12e75a3b60a3a65912d185a87e4bdb6d5610bcea 100644 |
--- a/third_party/WebKit/Source/core/page/AutoscrollController.cpp |
+++ b/third_party/WebKit/Source/core/page/AutoscrollController.cpp |
@@ -237,26 +237,24 @@ bool AutoscrollController::panScrollInProgress() const |
// of WTF::currentTime(). |
void AutoscrollController::animate(double) |
{ |
- if (!m_autoscrollLayoutObject) { |
+ if (!m_autoscrollLayoutObject || !m_autoscrollLayoutObject->frame()) { |
stopAutoscroll(); |
return; |
} |
+ EventHandler& eventHandler = m_autoscrollLayoutObject->frame()->eventHandler(); |
switch (m_autoscrollType) { |
case AutoscrollForDragAndDrop: |
if (WTF::currentTime() - m_dragAndDropAutoscrollStartTime > autoscrollDelay) |
m_autoscrollLayoutObject->autoscroll(m_dragAndDropAutoscrollReferencePosition); |
break; |
case AutoscrollForSelection: |
- if (LocalFrame* frame = m_autoscrollLayoutObject->frame()) { |
- EventHandler& eventHandler = frame->eventHandler(); |
- if (!eventHandler.mousePressed()) { |
- stopAutoscroll(); |
- return; |
- } |
- eventHandler.updateSelectionForMouseDrag(); |
- m_autoscrollLayoutObject->autoscroll(eventHandler.lastKnownMousePosition()); |
+ if (!eventHandler.mousePressed()) { |
+ stopAutoscroll(); |
+ return; |
} |
+ eventHandler.updateSelectionForMouseDrag(); |
+ m_autoscrollLayoutObject->autoscroll(eventHandler.lastKnownMousePosition()); |
break; |
case NoAutoscroll: |
break; |
@@ -267,12 +265,8 @@ void AutoscrollController::animate(double) |
stopAutoscroll(); |
return; |
} |
- if (LocalFrame* frame = m_autoscrollLayoutObject->frame()) { |
- if (FrameView* view = frame->view()) { |
- EventHandler& eventHandler = frame->eventHandler(); |
- updatePanScrollState(view, eventHandler.lastKnownMousePosition()); |
- } |
- } |
+ if (FrameView* view = m_autoscrollLayoutObject->frame()->view()) |
+ updatePanScrollState(view, eventHandler.lastKnownMousePosition()); |
m_autoscrollLayoutObject->panScroll(m_panScrollStartPos); |
break; |
#endif |