| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 void InspectorInputAgent::dispatchTouchEvent(ErrorString* error, const String& t
ype, PassOwnPtr<protocol::Array<protocol::Input::TouchPoint>> touchPoints, const
protocol::Maybe<int>& modifiers, const protocol::Maybe<double>& timestamp) | 121 void InspectorInputAgent::dispatchTouchEvent(ErrorString* error, const String& t
ype, PassOwnPtr<protocol::Array<protocol::Input::TouchPoint>> touchPoints, const
protocol::Maybe<int>& modifiers, const protocol::Maybe<double>& timestamp) |
| 122 { | 122 { |
| 123 PlatformEvent::EventType convertedType; | 123 PlatformEvent::EventType convertedType; |
| 124 if (type == "touchStart") { | 124 if (type == "touchStart") { |
| 125 convertedType = PlatformEvent::TouchStart; | 125 convertedType = PlatformEvent::TouchStart; |
| 126 } else if (type == "touchEnd") { | 126 } else if (type == "touchEnd") { |
| 127 convertedType = PlatformEvent::TouchEnd; | 127 convertedType = PlatformEvent::TouchEnd; |
| 128 } else if (type == "touchMove") { | 128 } else if (type == "touchMove") { |
| 129 convertedType = PlatformEvent::TouchMove; | 129 convertedType = PlatformEvent::TouchMove; |
| 130 } else { | 130 } else { |
| 131 *error = "Unrecognized type: " + type; | 131 *error = String("Unrecognized type: " + type); |
| 132 return; | 132 return; |
| 133 } | 133 } |
| 134 | 134 |
| 135 unsigned convertedModifiers = GetEventModifiers(modifiers.fromMaybe(0)); | 135 unsigned convertedModifiers = GetEventModifiers(modifiers.fromMaybe(0)); |
| 136 | 136 |
| 137 SyntheticInspectorTouchEvent event(convertedType, convertedModifiers, timest
amp.fromMaybe(currentTime())); | 137 SyntheticInspectorTouchEvent event(convertedType, convertedModifiers, timest
amp.fromMaybe(currentTime())); |
| 138 | 138 |
| 139 int autoId = 0; | 139 int autoId = 0; |
| 140 for (size_t i = 0; i < touchPoints->length(); ++i) { | 140 for (size_t i = 0; i < touchPoints->length(); ++i) { |
| 141 protocol::Input::TouchPoint* point = touchPoints->get(i); | 141 protocol::Input::TouchPoint* point = touchPoints->get(i); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 164 convertedState = PlatformTouchPoint::TouchPressed; | 164 convertedState = PlatformTouchPoint::TouchPressed; |
| 165 } else if (state == "touchReleased") { | 165 } else if (state == "touchReleased") { |
| 166 convertedState = PlatformTouchPoint::TouchReleased; | 166 convertedState = PlatformTouchPoint::TouchReleased; |
| 167 } else if (state == "touchMoved") { | 167 } else if (state == "touchMoved") { |
| 168 convertedState = PlatformTouchPoint::TouchMoved; | 168 convertedState = PlatformTouchPoint::TouchMoved; |
| 169 } else if (state == "touchStationary") { | 169 } else if (state == "touchStationary") { |
| 170 convertedState = PlatformTouchPoint::TouchStationary; | 170 convertedState = PlatformTouchPoint::TouchStationary; |
| 171 } else if (state == "touchCancelled") { | 171 } else if (state == "touchCancelled") { |
| 172 convertedState = PlatformTouchPoint::TouchCancelled; | 172 convertedState = PlatformTouchPoint::TouchCancelled; |
| 173 } else { | 173 } else { |
| 174 *error = "Unrecognized state: " + state; | 174 *error = String("Unrecognized state: " + state); |
| 175 return; | 175 return; |
| 176 } | 176 } |
| 177 | 177 |
| 178 // Some platforms may have flipped coordinate systems, but the given coo
rdinates | 178 // Some platforms may have flipped coordinate systems, but the given coo
rdinates |
| 179 // assume the origin is in the top-left of the window. Convert. | 179 // assume the origin is in the top-left of the window. Convert. |
| 180 IntPoint convertedPoint, globalPoint; | 180 IntPoint convertedPoint, globalPoint; |
| 181 ConvertInspectorPoint(m_inspectedFrames->root(), IntPoint(point->getX(),
point->getY()), &convertedPoint, &globalPoint); | 181 ConvertInspectorPoint(m_inspectedFrames->root(), IntPoint(point->getX(),
point->getY()), &convertedPoint, &globalPoint); |
| 182 | 182 |
| 183 SyntheticInspectorTouchPoint touchPoint(id++, convertedState, globalPoin
t, convertedPoint, radiusX, radiusY, rotationAngle, force); | 183 SyntheticInspectorTouchPoint touchPoint(id++, convertedState, globalPoin
t, convertedPoint, radiusX, radiusY, rotationAngle, force); |
| 184 event.append(touchPoint); | 184 event.append(touchPoint); |
| 185 } | 185 } |
| 186 | 186 |
| 187 m_inspectedFrames->root()->eventHandler().handleTouchEvent(event); | 187 m_inspectedFrames->root()->eventHandler().handleTouchEvent(event); |
| 188 } | 188 } |
| 189 | 189 |
| 190 DEFINE_TRACE(InspectorInputAgent) | 190 DEFINE_TRACE(InspectorInputAgent) |
| 191 { | 191 { |
| 192 visitor->trace(m_inspectedFrames); | 192 visitor->trace(m_inspectedFrames); |
| 193 InspectorBaseAgent::trace(visitor); | 193 InspectorBaseAgent::trace(visitor); |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace blink | 196 } // namespace blink |
| OLD | NEW |