OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 bool AutoscrollController::panScrollInProgress() const | 230 bool AutoscrollController::panScrollInProgress() const |
231 { | 231 { |
232 return false; | 232 return false; |
233 } | 233 } |
234 #endif | 234 #endif |
235 | 235 |
236 // FIXME: This would get get better animation fidelity if it used the monotonicF
rameBeginTime instead | 236 // FIXME: This would get get better animation fidelity if it used the monotonicF
rameBeginTime instead |
237 // of WTF::currentTime(). | 237 // of WTF::currentTime(). |
238 void AutoscrollController::animate(double) | 238 void AutoscrollController::animate(double) |
239 { | 239 { |
240 if (!m_autoscrollLayoutObject) { | 240 if (!m_autoscrollLayoutObject || !m_autoscrollLayoutObject->frame()) { |
241 stopAutoscroll(); | 241 stopAutoscroll(); |
242 return; | 242 return; |
243 } | 243 } |
244 | 244 |
| 245 EventHandler& eventHandler = m_autoscrollLayoutObject->frame()->eventHandler
(); |
245 switch (m_autoscrollType) { | 246 switch (m_autoscrollType) { |
246 case AutoscrollForDragAndDrop: | 247 case AutoscrollForDragAndDrop: |
247 if (WTF::currentTime() - m_dragAndDropAutoscrollStartTime > autoscrollDe
lay) | 248 if (WTF::currentTime() - m_dragAndDropAutoscrollStartTime > autoscrollDe
lay) |
248 m_autoscrollLayoutObject->autoscroll(m_dragAndDropAutoscrollReferenc
ePosition); | 249 m_autoscrollLayoutObject->autoscroll(m_dragAndDropAutoscrollReferenc
ePosition); |
249 break; | 250 break; |
250 case AutoscrollForSelection: | 251 case AutoscrollForSelection: |
251 if (LocalFrame* frame = m_autoscrollLayoutObject->frame()) { | 252 if (!eventHandler.mousePressed()) { |
252 EventHandler& eventHandler = frame->eventHandler(); | 253 stopAutoscroll(); |
253 if (!eventHandler.mousePressed()) { | 254 return; |
254 stopAutoscroll(); | |
255 return; | |
256 } | |
257 eventHandler.updateSelectionForMouseDrag(); | |
258 m_autoscrollLayoutObject->autoscroll(eventHandler.lastKnownMousePosi
tion()); | |
259 } | 255 } |
| 256 eventHandler.updateSelectionForMouseDrag(); |
| 257 m_autoscrollLayoutObject->autoscroll(eventHandler.lastKnownMousePosition
()); |
260 break; | 258 break; |
261 case NoAutoscroll: | 259 case NoAutoscroll: |
262 break; | 260 break; |
263 #if OS(WIN) | 261 #if OS(WIN) |
264 case AutoscrollForPanCanStop: | 262 case AutoscrollForPanCanStop: |
265 case AutoscrollForPan: | 263 case AutoscrollForPan: |
266 if (!panScrollInProgress()) { | 264 if (!panScrollInProgress()) { |
267 stopAutoscroll(); | 265 stopAutoscroll(); |
268 return; | 266 return; |
269 } | 267 } |
270 if (LocalFrame* frame = m_autoscrollLayoutObject->frame()) { | 268 if (FrameView* view = m_autoscrollLayoutObject->frame()->view()) |
271 if (FrameView* view = frame->view()) { | 269 updatePanScrollState(view, eventHandler.lastKnownMousePosition()); |
272 EventHandler& eventHandler = frame->eventHandler(); | |
273 updatePanScrollState(view, eventHandler.lastKnownMousePosition()
); | |
274 } | |
275 } | |
276 m_autoscrollLayoutObject->panScroll(m_panScrollStartPos); | 270 m_autoscrollLayoutObject->panScroll(m_panScrollStartPos); |
277 break; | 271 break; |
278 #endif | 272 #endif |
279 } | 273 } |
280 if (m_autoscrollType != NoAutoscroll && m_autoscrollLayoutObject) | 274 if (m_autoscrollType != NoAutoscroll && m_autoscrollLayoutObject) |
281 m_page->chromeClient().scheduleAnimation(m_autoscrollLayoutObject->frame
()->view()); | 275 m_page->chromeClient().scheduleAnimation(m_autoscrollLayoutObject->frame
()->view()); |
282 } | 276 } |
283 | 277 |
284 void AutoscrollController::startAutoscroll() | 278 void AutoscrollController::startAutoscroll() |
285 { | 279 { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 view->setCursor(eastPanningCursor()); | 311 view->setCursor(eastPanningCursor()); |
318 } else if (west) { | 312 } else if (west) { |
319 view->setCursor(westPanningCursor()); | 313 view->setCursor(westPanningCursor()); |
320 } else { | 314 } else { |
321 view->setCursor(middlePanningCursor()); | 315 view->setCursor(middlePanningCursor()); |
322 } | 316 } |
323 } | 317 } |
324 #endif | 318 #endif |
325 | 319 |
326 } // namespace blink | 320 } // namespace blink |
OLD | NEW |