Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Side by Side Diff: third_party/WebKit/Source/core/input/PointerEventManager.cpp

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: tweaks and docs Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/PointerEventManager.h" 5 #include "core/input/PointerEventManager.h"
6 6
7 #include "core/dom/ElementTraversal.h" 7 #include "core/dom/ElementTraversal.h"
8 #include "core/dom/shadow/FlatTreeTraversal.h" 8 #include "core/dom/shadow/FlatTreeTraversal.h"
9 #include "core/events/MouseEvent.h" 9 #include "core/events/MouseEvent.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 touchInfo.targetFrame = touchInfo.touchNode->document().frame(); 363 touchInfo.targetFrame = touchInfo.touchNode->document().frame();
364 } 364 }
365 365
366 // Do not send pointer events for stationary touches or null targetFrame 366 // Do not send pointer events for stationary touches or null targetFrame
367 if (touchInfo.touchNode && touchInfo.targetFrame && 367 if (touchInfo.touchNode && touchInfo.targetFrame &&
368 touchPoint.state() != PlatformTouchPoint::TouchStationary && 368 touchPoint.state() != PlatformTouchPoint::TouchStationary &&
369 !m_inCanceledStateForPointerTypeTouch) { 369 !m_inCanceledStateForPointerTypeTouch) {
370 FloatPoint pagePoint = touchInfo.targetFrame->view()->rootFrameToContents( 370 FloatPoint pagePoint = touchInfo.targetFrame->view()->rootFrameToContents(
371 touchInfo.point.pos()); 371 touchInfo.point.pos());
372 float scaleFactor = 1.0f / touchInfo.targetFrame->pageZoomFactor(); 372 float scaleFactor = 1.0f / touchInfo.targetFrame->pageZoomFactor();
373 FloatPoint scrollPosition = 373 FloatPoint scrollPosition(touchInfo.targetFrame->view()->scrollOffset());
374 touchInfo.targetFrame->view()->scrollPosition();
375 FloatPoint framePoint = pagePoint.scaledBy(scaleFactor); 374 FloatPoint framePoint = pagePoint.scaledBy(scaleFactor);
376 framePoint.moveBy(scrollPosition.scaledBy(-scaleFactor)); 375 framePoint.moveBy(scrollPosition.scaledBy(-scaleFactor));
377 PointerEvent* pointerEvent = m_pointerEventFactory.create( 376 PointerEvent* pointerEvent = m_pointerEventFactory.create(
378 pointerEventNameForTouchPointState(touchPoint.state()), touchPoint, 377 pointerEventNameForTouchPointState(touchPoint.state()), touchPoint,
379 event.getModifiers(), touchPoint.radius().scaledBy(scaleFactor), 378 event.getModifiers(), touchPoint.radius().scaledBy(scaleFactor),
380 framePoint, 379 framePoint,
381 touchInfo.touchNode ? touchInfo.touchNode->document().domWindow() 380 touchInfo.touchNode ? touchInfo.touchNode->document().domWindow()
382 : nullptr); 381 : nullptr);
383 382
384 WebInputEventResult result = 383 WebInputEventResult result =
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 return true; 672 return true;
674 } 673 }
675 return false; 674 return false;
676 } 675 }
677 676
678 EventTarget* PointerEventManager::getMouseCapturingNode() { 677 EventTarget* PointerEventManager::getMouseCapturingNode() {
679 return getCapturingNode(PointerEventFactory::s_mouseId); 678 return getCapturingNode(PointerEventFactory::s_mouseId);
680 } 679 }
681 680
682 } // namespace blink 681 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698