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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 227 } |
228 | 228 |
229 void AutoscrollController::animate(double) | 229 void AutoscrollController::animate(double) |
230 { | 230 { |
231 if (!m_autoscrollLayoutObject || !m_autoscrollLayoutObject->frame()) { | 231 if (!m_autoscrollLayoutObject || !m_autoscrollLayoutObject->frame()) { |
232 stopAutoscroll(); | 232 stopAutoscroll(); |
233 return; | 233 return; |
234 } | 234 } |
235 | 235 |
236 EventHandler& eventHandler = m_autoscrollLayoutObject->frame()->eventHandler
(); | 236 EventHandler& eventHandler = m_autoscrollLayoutObject->frame()->eventHandler
(); |
| 237 IntSize offset = m_autoscrollLayoutObject->calculateAutoscrollDirection(even
tHandler.lastKnownMousePosition()); |
| 238 IntPoint selectionPoint = eventHandler.lastKnownMousePosition() + offset; |
237 switch (m_autoscrollType) { | 239 switch (m_autoscrollType) { |
238 case AutoscrollForDragAndDrop: | 240 case AutoscrollForDragAndDrop: |
239 if (WTF::monotonicallyIncreasingTime() - m_dragAndDropAutoscrollStartTim
e > autoscrollDelay) | 241 if (WTF::monotonicallyIncreasingTime() - m_dragAndDropAutoscrollStartTim
e > autoscrollDelay) |
240 m_autoscrollLayoutObject->autoscroll(m_dragAndDropAutoscrollReferenc
ePosition); | 242 m_autoscrollLayoutObject->autoscroll(m_dragAndDropAutoscrollReferenc
ePosition); |
241 break; | 243 break; |
242 case AutoscrollForSelection: | 244 case AutoscrollForSelection: |
243 if (!eventHandler.mousePressed()) { | 245 if (!eventHandler.mousePressed()) { |
244 stopAutoscroll(); | 246 stopAutoscroll(); |
245 return; | 247 return; |
246 } | 248 } |
247 eventHandler.updateSelectionForMouseDrag(); | 249 eventHandler.updateSelectionForMouseDrag(); |
248 m_autoscrollLayoutObject->autoscroll(eventHandler.lastKnownMousePosition
()); | 250 m_autoscrollLayoutObject->autoscroll(selectionPoint); |
249 break; | 251 break; |
250 case NoAutoscroll: | 252 case NoAutoscroll: |
251 break; | 253 break; |
252 case AutoscrollForMiddleClickCanStop: | 254 case AutoscrollForMiddleClickCanStop: |
253 case AutoscrollForMiddleClick: | 255 case AutoscrollForMiddleClick: |
254 DCHECK(RuntimeEnabledFeatures::middleClickAutoscrollEnabled()); | 256 DCHECK(RuntimeEnabledFeatures::middleClickAutoscrollEnabled()); |
255 if (!middleClickAutoscrollInProgress()) { | 257 if (!middleClickAutoscrollInProgress()) { |
256 stopAutoscroll(); | 258 stopAutoscroll(); |
257 return; | 259 return; |
258 } | 260 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } else if (east) { | 302 } else if (east) { |
301 view->setCursor(eastPanningCursor()); | 303 view->setCursor(eastPanningCursor()); |
302 } else if (west) { | 304 } else if (west) { |
303 view->setCursor(westPanningCursor()); | 305 view->setCursor(westPanningCursor()); |
304 } else { | 306 } else { |
305 view->setCursor(middlePanningCursor()); | 307 view->setCursor(middlePanningCursor()); |
306 } | 308 } |
307 } | 309 } |
308 | 310 |
309 } // namespace blink | 311 } // namespace blink |
OLD | NEW |