| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 void SendUnlockMouseRequest() override; | 58 void SendUnlockMouseRequest() override; |
| 59 | 59 |
| 60 RenderWidgetFullscreenPepper* widget_; | 60 RenderWidgetFullscreenPepper* widget_; |
| 61 | 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(FullscreenMouseLockDispatcher); | 62 DISALLOW_COPY_AND_ASSIGN(FullscreenMouseLockDispatcher); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 WebMouseEvent WebMouseEventFromGestureEvent(const WebGestureEvent& gesture) { | 65 WebMouseEvent WebMouseEventFromGestureEvent(const WebGestureEvent& gesture) { |
| 66 WebMouseEvent mouse; | 66 WebMouseEvent mouse; |
| 67 | 67 |
| 68 // Only convert touch screen gesture events, do not convert |
| 69 // touchpad/mouse wheel gesture events. (crbug.com/620974) |
| 70 if (gesture.sourceDevice != blink::WebGestureDeviceTouchscreen) |
| 71 return mouse; |
| 72 |
| 68 switch (gesture.type) { | 73 switch (gesture.type) { |
| 69 case WebInputEvent::GestureScrollBegin: | 74 case WebInputEvent::GestureScrollBegin: |
| 70 mouse.type = WebInputEvent::MouseDown; | 75 mouse.type = WebInputEvent::MouseDown; |
| 71 break; | 76 break; |
| 72 | |
| 73 case WebInputEvent::GestureScrollUpdate: | 77 case WebInputEvent::GestureScrollUpdate: |
| 74 mouse.type = WebInputEvent::MouseMove; | 78 mouse.type = WebInputEvent::MouseMove; |
| 75 break; | 79 break; |
| 76 | |
| 77 case WebInputEvent::GestureFlingStart: | 80 case WebInputEvent::GestureFlingStart: |
| 78 if (gesture.sourceDevice == blink::WebGestureDeviceTouchscreen) { | 81 // A scroll gesture on the touchscreen may end with a GestureScrollEnd |
| 79 // A scroll gesture on the touchscreen may end with a GestureScrollEnd | 82 // when there is no velocity, or a GestureFlingStart when it has a |
| 80 // when there is no velocity, or a GestureFlingStart when it has a | 83 // velocity. In both cases, it should end the drag that was initiated by |
| 81 // velocity. In both cases, it should end the drag that was initiated by | 84 // the GestureScrollBegin (and subsequent GestureScrollUpdate) events. |
| 82 // the GestureScrollBegin (and subsequent GestureScrollUpdate) events. | 85 mouse.type = WebInputEvent::MouseUp; |
| 83 mouse.type = WebInputEvent::MouseUp; | |
| 84 break; | |
| 85 } else { | |
| 86 return mouse; | |
| 87 } | |
| 88 case WebInputEvent::GestureScrollEnd: | 86 case WebInputEvent::GestureScrollEnd: |
| 89 mouse.type = WebInputEvent::MouseUp; | 87 mouse.type = WebInputEvent::MouseUp; |
| 90 break; | 88 break; |
| 91 | |
| 92 default: | 89 default: |
| 93 break; | 90 return mouse; |
| 94 } | 91 } |
| 95 | 92 |
| 96 if (mouse.type == WebInputEvent::Undefined) | |
| 97 return mouse; | |
| 98 | |
| 99 mouse.timeStampSeconds = gesture.timeStampSeconds; | 93 mouse.timeStampSeconds = gesture.timeStampSeconds; |
| 100 mouse.modifiers = gesture.modifiers | WebInputEvent::LeftButtonDown; | 94 mouse.modifiers = gesture.modifiers | WebInputEvent::LeftButtonDown; |
| 101 mouse.button = WebMouseEvent::ButtonLeft; | 95 mouse.button = WebMouseEvent::ButtonLeft; |
| 102 mouse.clickCount = (mouse.type == WebInputEvent::MouseDown || | 96 mouse.clickCount = (mouse.type == WebInputEvent::MouseDown || |
| 103 mouse.type == WebInputEvent::MouseUp); | 97 mouse.type == WebInputEvent::MouseUp); |
| 104 | 98 |
| 105 mouse.x = gesture.x; | 99 mouse.x = gesture.x; |
| 106 mouse.y = gesture.y; | 100 mouse.y = gesture.y; |
| 107 mouse.windowX = gesture.x; | 101 mouse.windowX = gesture.x; |
| 108 mouse.windowY = gesture.y; | 102 mouse.windowY = gesture.y; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 GURL RenderWidgetFullscreenPepper::GetURLForGraphicsContext3D() { | 375 GURL RenderWidgetFullscreenPepper::GetURLForGraphicsContext3D() { |
| 382 return active_url_; | 376 return active_url_; |
| 383 } | 377 } |
| 384 | 378 |
| 385 void RenderWidgetFullscreenPepper::OnDeviceScaleFactorChanged() { | 379 void RenderWidgetFullscreenPepper::OnDeviceScaleFactorChanged() { |
| 386 if (compositor_) | 380 if (compositor_) |
| 387 compositor_->setDeviceScaleFactor(device_scale_factor_); | 381 compositor_->setDeviceScaleFactor(device_scale_factor_); |
| 388 } | 382 } |
| 389 | 383 |
| 390 } // namespace content | 384 } // namespace content |
| OLD | NEW |