OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/input/MouseEventManager.h" | 5 #include "core/input/MouseEventManager.h" |
6 | 6 |
7 #include "core/clipboard/DataObject.h" | 7 #include "core/clipboard/DataObject.h" |
8 #include "core/clipboard/DataTransfer.h" | 8 #include "core/clipboard/DataTransfer.h" |
9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
10 #include "core/dom/ElementTraversal.h" | 10 #include "core/dom/ElementTraversal.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 276 } |
277 } | 277 } |
278 return clickEventResult; | 278 return clickEventResult; |
279 } | 279 } |
280 | 280 |
281 void MouseEventManager::fakeMouseMoveEventTimerFired(TimerBase* timer) { | 281 void MouseEventManager::fakeMouseMoveEventTimerFired(TimerBase* timer) { |
282 TRACE_EVENT0("input", "MouseEventManager::fakeMouseMoveEventTimerFired"); | 282 TRACE_EVENT0("input", "MouseEventManager::fakeMouseMoveEventTimerFired"); |
283 DCHECK(timer == &m_fakeMouseMoveEventTimer); | 283 DCHECK(timer == &m_fakeMouseMoveEventTimer); |
284 DCHECK(!m_mousePressed); | 284 DCHECK(!m_mousePressed); |
285 | 285 |
286 Settings* settings = m_frame->settings(); | 286 if (m_isMousePositionUnknown) |
287 if (settings && !settings->deviceSupportsMouse()) | |
288 return; | 287 return; |
289 | 288 |
290 FrameView* view = m_frame->view(); | 289 FrameView* view = m_frame->view(); |
291 if (!view) | 290 if (!view) |
292 return; | 291 return; |
293 | 292 |
294 if (!m_frame->page() || !m_frame->page()->focusController().isActive()) | 293 if (!m_frame->page() || !m_frame->page()->focusController().isActive()) |
295 return; | 294 return; |
296 | 295 |
297 // Don't dispatch a synthetic mouse move event if the mouse cursor is not | 296 // Don't dispatch a synthetic mouse move event if the mouse cursor is not |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 m_lastKnownMouseGlobalPosition = event.globalPosition(); | 522 m_lastKnownMouseGlobalPosition = event.globalPosition(); |
524 } | 523 } |
525 | 524 |
526 void MouseEventManager::dispatchFakeMouseMoveEventSoon() { | 525 void MouseEventManager::dispatchFakeMouseMoveEventSoon() { |
527 if (m_mousePressed) | 526 if (m_mousePressed) |
528 return; | 527 return; |
529 | 528 |
530 if (m_isMousePositionUnknown) | 529 if (m_isMousePositionUnknown) |
531 return; | 530 return; |
532 | 531 |
533 Settings* settings = m_frame->settings(); | |
534 if (settings && !settings->deviceSupportsMouse()) | |
535 return; | |
536 | |
537 // Reschedule the timer, to prevent dispatching mouse move events | 532 // Reschedule the timer, to prevent dispatching mouse move events |
538 // during a scroll. This avoids a potential source of scroll jank. | 533 // during a scroll. This avoids a potential source of scroll jank. |
539 m_fakeMouseMoveEventTimer.startOneShot(kFakeMouseMoveInterval, | 534 m_fakeMouseMoveEventTimer.startOneShot(kFakeMouseMoveInterval, |
540 BLINK_FROM_HERE); | 535 BLINK_FROM_HERE); |
541 } | 536 } |
542 | 537 |
543 void MouseEventManager::dispatchFakeMouseMoveEventSoonInQuad( | 538 void MouseEventManager::dispatchFakeMouseMoveEventSoonInQuad( |
544 const FloatQuad& quad) { | 539 const FloatQuad& quad) { |
545 FrameView* view = m_frame->view(); | 540 FrameView* view = m_frame->view(); |
546 if (!view) | 541 if (!view) |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 | 986 |
992 void MouseEventManager::setClickCount(int clickCount) { | 987 void MouseEventManager::setClickCount(int clickCount) { |
993 m_clickCount = clickCount; | 988 m_clickCount = clickCount; |
994 } | 989 } |
995 | 990 |
996 bool MouseEventManager::mouseDownMayStartDrag() { | 991 bool MouseEventManager::mouseDownMayStartDrag() { |
997 return m_mouseDownMayStartDrag; | 992 return m_mouseDownMayStartDrag; |
998 } | 993 } |
999 | 994 |
1000 } // namespace blink | 995 } // namespace blink |
OLD | NEW |