| 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 | 3 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
| 4 * reserved. | 4 * reserved. |
| 5 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 6 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
| 7 * | 7 * |
| 8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
| 10 * are met: | 10 * are met: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 AutoscrollController* AutoscrollController::create(Page& page) { | 48 AutoscrollController* AutoscrollController::create(Page& page) { |
| 49 return new AutoscrollController(page); | 49 return new AutoscrollController(page); |
| 50 } | 50 } |
| 51 | 51 |
| 52 AutoscrollController::AutoscrollController(Page& page) | 52 AutoscrollController::AutoscrollController(Page& page) |
| 53 : m_page(&page), | 53 : m_page(&page), |
| 54 m_autoscrollLayoutObject(nullptr), | 54 m_autoscrollLayoutObject(nullptr), |
| 55 m_pressedLayoutObject(nullptr), | 55 m_pressedLayoutObject(nullptr), |
| 56 m_autoscrollType(NoAutoscroll), | 56 m_autoscrollType(NoAutoscroll), |
| 57 m_dragAndDropAutoscrollStartTime(0) {} | 57 m_dragAndDropAutoscrollStartTime(0), |
| 58 m_middleClickAutoscrolled(false) {} |
| 58 | 59 |
| 59 DEFINE_TRACE(AutoscrollController) { | 60 DEFINE_TRACE(AutoscrollController) { |
| 60 visitor->trace(m_page); | 61 visitor->trace(m_page); |
| 61 } | 62 } |
| 62 | 63 |
| 63 bool AutoscrollController::autoscrollInProgress() const { | 64 bool AutoscrollController::autoscrollInProgress() const { |
| 64 return m_autoscrollType == AutoscrollForSelection; | 65 return m_autoscrollType == AutoscrollForSelection; |
| 65 } | 66 } |
| 66 | 67 |
| 67 bool AutoscrollController::autoscrollInProgress( | 68 bool AutoscrollController::autoscrollInProgress( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 void AutoscrollController::stopAutoscrollIfNeeded(LayoutObject* layoutObject) { | 114 void AutoscrollController::stopAutoscrollIfNeeded(LayoutObject* layoutObject) { |
| 114 if (m_pressedLayoutObject == layoutObject) | 115 if (m_pressedLayoutObject == layoutObject) |
| 115 m_pressedLayoutObject = nullptr; | 116 m_pressedLayoutObject = nullptr; |
| 116 | 117 |
| 117 if (m_autoscrollLayoutObject != layoutObject) | 118 if (m_autoscrollLayoutObject != layoutObject) |
| 118 return; | 119 return; |
| 119 m_autoscrollLayoutObject = nullptr; | 120 m_autoscrollLayoutObject = nullptr; |
| 120 m_autoscrollType = NoAutoscroll; | 121 m_autoscrollType = NoAutoscroll; |
| 121 } | 122 } |
| 122 | 123 |
| 124 bool AutoscrollController::setMiddleClickAutoscrollLayoutObject( |
| 125 LayoutBox* layoutObject) { |
| 126 if (!m_middleClickAutoscrolled && layoutObject) { |
| 127 m_autoscrollLayoutObject = layoutObject; |
| 128 return true; |
| 129 } |
| 130 return false; |
| 131 } |
| 132 |
| 123 void AutoscrollController::updateAutoscrollLayoutObject() { | 133 void AutoscrollController::updateAutoscrollLayoutObject() { |
| 124 if (!m_autoscrollLayoutObject) | 134 if (!m_autoscrollLayoutObject) |
| 125 return; | 135 return; |
| 126 | 136 |
| 127 LayoutObject* layoutObject = m_autoscrollLayoutObject; | 137 LayoutObject* layoutObject = m_autoscrollLayoutObject; |
| 128 | 138 |
| 129 if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { | 139 if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { |
| 130 HitTestResult hitTest = | 140 HitTestResult hitTest = |
| 131 layoutObject->frame()->eventHandler().hitTestResultAtPoint( | 141 layoutObject->frame()->eventHandler().hitTestResultAtPoint( |
| 132 m_middleClickAutoscrollStartPos, | 142 m_middleClickAutoscrollStartPos, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 const IntPoint& lastKnownMousePosition) { | 237 const IntPoint& lastKnownMousePosition) { |
| 228 DCHECK(RuntimeEnabledFeatures::middleClickAutoscrollEnabled()); | 238 DCHECK(RuntimeEnabledFeatures::middleClickAutoscrollEnabled()); |
| 229 // We don't want to trigger the autoscroll or the middleClickAutoscroll if | 239 // We don't want to trigger the autoscroll or the middleClickAutoscroll if |
| 230 // it's already active. | 240 // it's already active. |
| 231 if (m_autoscrollType != NoAutoscroll) | 241 if (m_autoscrollType != NoAutoscroll) |
| 232 return; | 242 return; |
| 233 | 243 |
| 234 m_autoscrollType = AutoscrollForMiddleClick; | 244 m_autoscrollType = AutoscrollForMiddleClick; |
| 235 m_autoscrollLayoutObject = scrollable; | 245 m_autoscrollLayoutObject = scrollable; |
| 236 m_middleClickAutoscrollStartPos = lastKnownMousePosition; | 246 m_middleClickAutoscrollStartPos = lastKnownMousePosition; |
| 247 m_middleClickAutoscrolled = false; |
| 237 | 248 |
| 238 UseCounter::count(m_page->mainFrame(), | 249 UseCounter::count(m_page->mainFrame(), |
| 239 UseCounter::MiddleClickAutoscrollStart); | 250 UseCounter::MiddleClickAutoscrollStart); |
| 240 startAutoscroll(); | 251 startAutoscroll(); |
| 241 } | 252 } |
| 242 | 253 |
| 243 void AutoscrollController::animate(double) { | 254 void AutoscrollController::animate(double) { |
| 244 if (!m_autoscrollLayoutObject || !m_autoscrollLayoutObject->frame()) { | 255 if (!m_autoscrollLayoutObject || !m_autoscrollLayoutObject->frame()) { |
| 245 stopAutoscroll(); | 256 stopAutoscroll(); |
| 246 return; | 257 return; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 } else if (east) { | 340 } else if (east) { |
| 330 view->setCursor(eastPanningCursor()); | 341 view->setCursor(eastPanningCursor()); |
| 331 } else if (west) { | 342 } else if (west) { |
| 332 view->setCursor(westPanningCursor()); | 343 view->setCursor(westPanningCursor()); |
| 333 } else { | 344 } else { |
| 334 view->setCursor(middlePanningCursor()); | 345 view->setCursor(middlePanningCursor()); |
| 335 } | 346 } |
| 336 } | 347 } |
| 337 | 348 |
| 338 } // namespace blink | 349 } // namespace blink |
| OLD | NEW |