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

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

Issue 2650403006: Remove PlatformMouseEvent and use WebMouseEvent instead (Closed)
Patch Set: Fix nits 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 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 "public/platform/WebMouseEvent.h" 5 #include "public/platform/WebMouseEvent.h"
6 6
7 #include "public/platform/WebGestureEvent.h"
8
7 namespace blink { 9 namespace blink {
8 10
11 WebMouseEvent::WebMouseEvent(WebInputEvent::Type type,
12 const WebGestureEvent& gestureEvent,
13 Button buttonParam,
14 int clickCountParam,
15 int modifiers,
16 double timeStampSeconds)
17 : WebInputEvent(sizeof(WebMouseEvent), type, modifiers, timeStampSeconds),
18 WebPointerProperties(buttonParam,
19 WebPointerProperties::PointerType::Mouse),
20 x(gestureEvent.x),
21 y(gestureEvent.y),
22 globalX(gestureEvent.globalX),
23 globalY(gestureEvent.globalY),
24 clickCount(clickCountParam) {
25 setFrameScale(gestureEvent.frameScale());
26 setFrameTranslate(gestureEvent.frameTranslate());
27 }
28
9 WebFloatPoint WebMouseEvent::movementInRootFrame() const { 29 WebFloatPoint WebMouseEvent::movementInRootFrame() const {
10 return WebFloatPoint((movementX / m_frameScale), (movementY / m_frameScale)); 30 return WebFloatPoint((movementX / m_frameScale), (movementY / m_frameScale));
11 } 31 }
12 32
13 WebFloatPoint WebMouseEvent::positionInRootFrame() const { 33 WebFloatPoint WebMouseEvent::positionInRootFrame() const {
14 return WebFloatPoint((x / m_frameScale) + m_frameTranslate.x, 34 return WebFloatPoint((x / m_frameScale) + m_frameTranslate.x,
15 (y / m_frameScale) + m_frameTranslate.y); 35 (y / m_frameScale) + m_frameTranslate.y);
16 } 36 }
17 37
38 WebMouseEvent WebMouseEvent::flattenTransform() const {
39 WebMouseEvent result = *this;
40 result.flattenTransformSelf();
41 return result;
42 }
43
18 void WebMouseEvent::flattenTransformSelf() { 44 void WebMouseEvent::flattenTransformSelf() {
19 x = (x / m_frameScale) + m_frameTranslate.x; 45 x = (x / m_frameScale) + m_frameTranslate.x;
20 y = (y / m_frameScale) + m_frameTranslate.y; 46 y = (y / m_frameScale) + m_frameTranslate.y;
21 m_frameTranslate.x = 0; 47 m_frameTranslate.x = 0;
22 m_frameTranslate.y = 0; 48 m_frameTranslate.y = 0;
23 m_frameScale = 1; 49 m_frameScale = 1;
24 } 50 }
25 51
26 } // namespace blink 52 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/PlatformMouseEvent.h ('k') | third_party/WebKit/Source/platform/scroll/Scrollbar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698