| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/input/web_input_event_builders_android.h
" | 5 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
| 6 | 6 |
| 7 #include <android/input.h> | 7 #include <android/input.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/events/android/key_event_utils.h" | 10 #include "ui/events/android/key_event_utils.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // is apparently just how webkit handles it and what it expects. | 105 // is apparently just how webkit handles it and what it expects. |
| 106 result.unmodifiedText[0] = '\r'; | 106 result.unmodifiedText[0] = '\r'; |
| 107 } | 107 } |
| 108 result.text[0] = result.unmodifiedText[0]; | 108 result.text[0] = result.unmodifiedText[0]; |
| 109 result.isSystemKey = is_system_key; | 109 result.isSystemKey = is_system_key; |
| 110 | 110 |
| 111 return result; | 111 return result; |
| 112 } | 112 } |
| 113 | 113 |
| 114 WebMouseEvent WebMouseEventBuilder::Build( | 114 WebMouseEvent WebMouseEventBuilder::Build( |
| 115 WebInputEvent::Type type, | 115 WebInputEvent::Type type, |
| 116 WebMouseEvent::Button button, | 116 double time_sec, |
| 117 double time_sec, | 117 int window_x, |
| 118 int window_x, | 118 int window_y, |
| 119 int window_y, | 119 int modifiers, |
| 120 int modifiers, | 120 int click_count, |
| 121 int click_count, | 121 int pointer_id, |
| 122 WebPointerProperties::PointerType pointer_type) { | 122 float pressure, |
| 123 float orientation_rad, |
| 124 float tilt_rad, |
| 125 int old_button_state, |
| 126 int new_button_state, |
| 127 int tool_type) { |
| 123 | 128 |
| 124 DCHECK(WebInputEvent::isMouseEventType(type)); | 129 DCHECK(WebInputEvent::isMouseEventType(type)); |
| 125 WebMouseEvent result; | 130 WebMouseEvent result; |
| 126 | 131 |
| 127 result.type = type; | 132 result.type = type; |
| 128 result.pointerType = pointer_type; | |
| 129 result.x = window_x; | 133 result.x = window_x; |
| 130 result.y = window_y; | 134 result.y = window_y; |
| 131 result.windowX = window_x; | 135 result.windowX = window_x; |
| 132 result.windowY = window_y; | 136 result.windowY = window_y; |
| 133 result.timeStampSeconds = time_sec; | 137 result.timeStampSeconds = time_sec; |
| 134 result.clickCount = click_count; | 138 result.clickCount = click_count; |
| 135 result.modifiers = modifiers; | 139 result.modifiers = modifiers; |
| 136 | 140 |
| 137 if (type == WebInputEvent::MouseDown || type == WebInputEvent::MouseUp) | 141 int android_buttons_changed = 0; |
| 138 result.button = button; | 142 if (type == WebInputEvent::MouseDown) |
| 139 else | 143 android_buttons_changed = new_button_state & ~old_button_state; |
| 140 result.button = WebMouseEvent::Button::NoButton; | 144 else if (type == WebInputEvent::MouseUp) |
| 145 android_buttons_changed = old_button_state & ~new_button_state; |
| 146 |
| 147 ui::SetWebPointerPropertiesFromMotionEventData( |
| 148 result, |
| 149 pointer_id, |
| 150 pressure, |
| 151 orientation_rad, |
| 152 tilt_rad, |
| 153 android_buttons_changed, |
| 154 tool_type); |
| 141 | 155 |
| 142 return result; | 156 return result; |
| 143 } | 157 } |
| 144 | 158 |
| 145 WebMouseWheelEvent WebMouseWheelEventBuilder::Build(float ticks_x, | 159 WebMouseWheelEvent WebMouseWheelEventBuilder::Build(float ticks_x, |
| 146 float ticks_y, | 160 float ticks_y, |
| 147 float tick_multiplier, | 161 float tick_multiplier, |
| 148 double time_sec, | 162 double time_sec, |
| 149 int window_x, | 163 int window_x, |
| 150 int window_y) { | 164 int window_y) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 176 result.type = type; | 190 result.type = type; |
| 177 result.x = x; | 191 result.x = x; |
| 178 result.y = y; | 192 result.y = y; |
| 179 result.timeStampSeconds = time_sec; | 193 result.timeStampSeconds = time_sec; |
| 180 result.sourceDevice = blink::WebGestureDeviceTouchscreen; | 194 result.sourceDevice = blink::WebGestureDeviceTouchscreen; |
| 181 | 195 |
| 182 return result; | 196 return result; |
| 183 } | 197 } |
| 184 | 198 |
| 185 } // namespace content | 199 } // namespace content |
| OLD | NEW |