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

Side by Side Diff: third_party/WebKit/Source/platform/WebPointerEvent.cpp

Issue 2860663006: Remove WebTouchEvent from TouchEventManager APIs (Closed)
Patch Set: Fix more tests Created 3 years, 6 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "public/platform/WebPointerEvent.h"
6
7 #include "public/platform/WebFloatPoint.h"
8
9 namespace blink {
10
11 namespace {
12
13 WebInputEvent::Type PointerEventActionForTouchPointState(
mustaq 2017/06/08 20:02:52 Again, why "Action" instead of "Type"?
Navid Zolghadr 2017/06/08 21:18:41 I wanted to avoid the confusion with PointerType (
14 WebTouchPoint::State state) {
15 switch (state) {
16 case WebTouchPoint::kStateReleased:
17 return WebInputEvent::Type::kPointerUp;
18 case WebTouchPoint::kStateCancelled:
19 return WebInputEvent::Type::kPointerCancel;
20 case WebTouchPoint::kStatePressed:
21 return WebInputEvent::Type::kPointerDown;
22 case WebTouchPoint::kStateMoved:
23 return WebInputEvent::Type::kPointerMove;
24 case WebTouchPoint::kStateStationary:
25 default:
26 NOTREACHED();
27 return WebInputEvent::Type::kUndefined;
28 }
29 }
30 }
31
32 WebPointerEvent::WebPointerEvent(const WebTouchEvent& touch_event,
33 const WebTouchPoint& touch_point)
34 : WebInputEvent(sizeof(WebPointerEvent)),
35 WebPointerProperties(touch_point),
36 width(touch_point.radius_x),
mustaq 2017/06/08 20:02:52 Width/height should be radius*2.
Navid Zolghadr 2017/06/08 21:18:41 I commented about this in another reply. Let me kn
37 height(touch_point.radius_y) {
38 // WebInutEvent attributes
39 SetFrameScale(touch_event.FrameScale());
40 SetFrameTranslate(touch_event.FrameTranslate());
41 SetTimeStampSeconds(touch_event.TimeStampSeconds());
42 SetType(PointerEventActionForTouchPointState(touch_point.state));
43 SetModifiers(touch_event.GetModifiers());
44 // WebTouchEvent attributes
45 dispatch_type = touch_event.dispatch_type;
46 moved_beyond_slop_region = touch_event.moved_beyond_slop_region;
47 touch_start_or_first_touch_move = touch_event.touch_start_or_first_touch_move;
48 // WebTouchPoint attributes
49 rotation_angle = touch_point.rotation_angle;
50 }
51
52 WebPointerEvent WebPointerEvent::WebPointerEventInRootFrame() const {
53 WebPointerEvent transformed_event = *this;
54 transformed_event.width /= frame_scale_;
55 transformed_event.height /= frame_scale_;
56 transformed_event.movement_x /= frame_scale_;
57 transformed_event.movement_y /= frame_scale_;
58 transformed_event.position_in_widget_ =
59 WebFloatPoint((transformed_event.PositionInWidget().x / frame_scale_) +
60 frame_translate_.x,
61 (transformed_event.PositionInWidget().y / frame_scale_) +
62 frame_translate_.y);
63 return transformed_event;
64 }
65
66 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698