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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_base.cc

Issue 2624783002: Fix movementX/Y attributes for touch pointer events (Closed)
Patch Set: Initialize m_frameScale in PointerEventFactoryTest Created 3 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_base.h" 5 #include "content/browser/renderer_host/render_widget_host_view_base.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/browser/accessibility/browser_accessibility_manager.h" 9 #include "content/browser/accessibility/browser_accessibility_manager.h"
10 #include "content/browser/gpu/gpu_data_manager_impl.h" 10 #include "content/browser/gpu/gpu_data_manager_impl.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 } 500 }
501 501
502 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const { 502 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const {
503 return false; 503 return false;
504 } 504 }
505 505
506 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { 506 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const {
507 return cc::SurfaceId(); 507 return cc::SurfaceId();
508 } 508 }
509 509
510 void RenderWidgetHostViewBase::SetMovementXYForTouchPoints(
511 blink::WebTouchEvent* event) {
512 for (size_t i = 0; i < event->touchesLength; ++i) {
513 auto& touchPoint = event->touches[i];
sadrul 2017/02/07 03:48:30 touch_point Perhaps you could make this a pointer
Navid Zolghadr 2017/02/08 17:18:49 Done.
514 if (touchPoint.state == blink::WebTouchPoint::StateMoved) {
515 gfx::Point& lastPosition = global_touch_position_[touchPoint.id];
sadrul 2017/02/07 03:48:30 const gfx::Point& last_position
Navid Zolghadr 2017/02/08 17:18:49 Done.
516 touchPoint.movementX = touchPoint.screenPosition.x - lastPosition.x();
517 touchPoint.movementY = touchPoint.screenPosition.y - lastPosition.y();
518 global_touch_position_[touchPoint.id].SetPoint(
519 touchPoint.screenPosition.x, touchPoint.screenPosition.y);
520 } else {
521 touchPoint.movementX = 0;
522 touchPoint.movementY = 0;
523 if (event->touches[i].state == blink::WebTouchPoint::StateReleased ||
524 event->touches[i].state == blink::WebTouchPoint::StateCancelled) {
525 global_touch_position_.erase(event->touches[i].id);
526 } else if (event->touches[i].state ==
527 blink::WebTouchPoint::StatePressed) {
528 global_touch_position_[touchPoint.id] = gfx::Point(
529 touchPoint.screenPosition.x, touchPoint.screenPosition.y);
530 }
531 }
532 }
533 }
534
510 } // namespace content 535 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698