OLD | NEW |
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/renderer/render_widget_fullscreen_pepper.h" | 5 #include "content/renderer/render_widget_fullscreen_pepper.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 default: | 93 default: |
94 return WebMouseEvent(); | 94 return WebMouseEvent(); |
95 } | 95 } |
96 | 96 |
97 WebMouseEvent mouse(type, gesture.modifiers() | WebInputEvent::LeftButtonDown, | 97 WebMouseEvent mouse(type, gesture.modifiers() | WebInputEvent::LeftButtonDown, |
98 gesture.timeStampSeconds()); | 98 gesture.timeStampSeconds()); |
99 mouse.button = WebMouseEvent::Button::Left; | 99 mouse.button = WebMouseEvent::Button::Left; |
100 mouse.clickCount = (mouse.type() == WebInputEvent::MouseDown || | 100 mouse.clickCount = (mouse.type() == WebInputEvent::MouseDown || |
101 mouse.type() == WebInputEvent::MouseUp); | 101 mouse.type() == WebInputEvent::MouseUp); |
102 | 102 |
103 mouse.x = gesture.x; | 103 mouse.setPositionInWidget(gesture.x, gesture.y); |
104 mouse.y = gesture.y; | 104 mouse.setPositionInScreen(gesture.globalX, gesture.globalY); |
105 mouse.globalX = gesture.globalX; | |
106 mouse.globalY = gesture.globalY; | |
107 | 105 |
108 return mouse; | 106 return mouse; |
109 } | 107 } |
110 | 108 |
111 FullscreenMouseLockDispatcher::FullscreenMouseLockDispatcher( | 109 FullscreenMouseLockDispatcher::FullscreenMouseLockDispatcher( |
112 RenderWidgetFullscreenPepper* widget) : widget_(widget) { | 110 RenderWidgetFullscreenPepper* widget) : widget_(widget) { |
113 } | 111 } |
114 | 112 |
115 FullscreenMouseLockDispatcher::~FullscreenMouseLockDispatcher() { | 113 FullscreenMouseLockDispatcher::~FullscreenMouseLockDispatcher() { |
116 } | 114 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // mouse events, and then send to the plugin. | 167 // mouse events, and then send to the plugin. |
170 if (WebInputEvent::isGestureEventType(event.type())) { | 168 if (WebInputEvent::isGestureEventType(event.type())) { |
171 bool result = false; | 169 bool result = false; |
172 const WebGestureEvent* gesture_event = | 170 const WebGestureEvent* gesture_event = |
173 static_cast<const WebGestureEvent*>(&event); | 171 static_cast<const WebGestureEvent*>(&event); |
174 switch (event.type()) { | 172 switch (event.type()) { |
175 case WebInputEvent::GestureTap: { | 173 case WebInputEvent::GestureTap: { |
176 WebMouseEvent mouse(WebInputEvent::MouseMove, | 174 WebMouseEvent mouse(WebInputEvent::MouseMove, |
177 gesture_event->modifiers(), | 175 gesture_event->modifiers(), |
178 gesture_event->timeStampSeconds()); | 176 gesture_event->timeStampSeconds()); |
179 mouse.x = gesture_event->x; | 177 mouse.setPositionInWidget(gesture_event->x, gesture_event->y); |
180 mouse.y = gesture_event->y; | 178 mouse.setPositionInScreen(gesture_event->globalX, |
181 mouse.globalX = gesture_event->globalX; | 179 gesture_event->globalY); |
182 mouse.globalY = gesture_event->globalY; | |
183 mouse.movementX = 0; | 180 mouse.movementX = 0; |
184 mouse.movementY = 0; | 181 mouse.movementY = 0; |
185 result |= widget_->plugin()->HandleInputEvent(mouse, &cursor); | 182 result |= widget_->plugin()->HandleInputEvent(mouse, &cursor); |
186 | 183 |
187 mouse.setType(WebInputEvent::MouseDown); | 184 mouse.setType(WebInputEvent::MouseDown); |
188 mouse.button = WebMouseEvent::Button::Left; | 185 mouse.button = WebMouseEvent::Button::Left; |
189 mouse.clickCount = gesture_event->data.tap.tapCount; | 186 mouse.clickCount = gesture_event->data.tap.tapCount; |
190 result |= widget_->plugin()->HandleInputEvent(mouse, &cursor); | 187 result |= widget_->plugin()->HandleInputEvent(mouse, &cursor); |
191 | 188 |
192 mouse.setType(WebInputEvent::MouseUp); | 189 mouse.setType(WebInputEvent::MouseUp); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 GURL RenderWidgetFullscreenPepper::GetURLForGraphicsContext3D() { | 373 GURL RenderWidgetFullscreenPepper::GetURLForGraphicsContext3D() { |
377 return active_url_; | 374 return active_url_; |
378 } | 375 } |
379 | 376 |
380 void RenderWidgetFullscreenPepper::OnDeviceScaleFactorChanged() { | 377 void RenderWidgetFullscreenPepper::OnDeviceScaleFactorChanged() { |
381 if (compositor_) | 378 if (compositor_) |
382 compositor_->setDeviceScaleFactor(device_scale_factor_); | 379 compositor_->setDeviceScaleFactor(device_scale_factor_); |
383 } | 380 } |
384 | 381 |
385 } // namespace content | 382 } // namespace content |
OLD | NEW |