WebKit2PlatformTouchEvent(const WebTouchEvent& webEvent) { // PlatformEvent switch (webEvent.type()) { case WebEvent::TouchStart: m_type = WebCore::PlatformEvent::TouchStart; break; case WebEvent::TouchMove: m_type = WebCore::PlatformEvent::TouchMove; break; case WebEvent::TouchEnd: m_type = WebCore::PlatformEvent::TouchEnd; break; case WebEvent::TouchCancel: m_type = WebCore::PlatformEvent::TouchCancel; break; default: ASSERT_NOT_REACHED(); } m_modifiers = 0; if (webEvent.shiftKey()) m_modifiers |= ShiftKey; if (webEvent.controlKey()) m_modifiers |= CtrlKey; if (webEvent.altKey()) m_modifiers |= AltKey; if (webEvent.metaKey()) m_modifiers |= MetaKey; m_timestamp = webEvent.timestamp(); #if PLATFORM(IOS) unsigned touchCount = webEvent.touchPoints().size(); m_touchPoints.reserveInitialCapacity(touchCount); for (unsigned i = 0; i < touchCount; ++i) m_touchPoints.uncheckedAppend(WebKit2PlatformTouchPoint(webEvent.touchPoints().at(i))); m_gestureScale = webEvent.gestureScale(); m_gestureRotation = webEvent.gestureRotation(); m_canPreventNativeGestures = webEvent.canPreventNativeGestures(); m_isGesture = webEvent.isGesture(); m_position = webEvent.position(); m_globalPosition = webEvent.position(); #else // PlatformTouchEvent for (size_t i = 0; i < webEvent.touchPoints().size(); ++i) m_touchPoints.append(WebKit2PlatformTouchPoint(webEvent.touchPoints().at(i))); #endif //PLATFORM(IOS) }
WebKit2PlatformTouchEvent(const WebTouchEvent& webEvent) { // PlatformEvent switch (webEvent.type()) { case WebEvent::TouchStart: m_type = WebCore::PlatformEvent::TouchStart; break; case WebEvent::TouchMove: m_type = WebCore::PlatformEvent::TouchMove; break; case WebEvent::TouchEnd: m_type = WebCore::PlatformEvent::TouchEnd; break; case WebEvent::TouchCancel: m_type = WebCore::PlatformEvent::TouchCancel; break; default: ASSERT_NOT_REACHED(); } m_modifiers = 0; if (webEvent.shiftKey()) m_modifiers |= ShiftKey; if (webEvent.controlKey()) m_modifiers |= CtrlKey; if (webEvent.altKey()) m_modifiers |= AltKey; if (webEvent.metaKey()) m_modifiers |= MetaKey; m_timestamp = webEvent.timestamp(); // PlatformTouchEvent for (int i = 0; i < webEvent.touchPoints().size(); ++i) m_touchPoints.append(WebKit2PlatformTouchPoint(webEvent.touchPoints().at(i))); }
WebKit2PlatformTouchEvent(const WebTouchEvent& webEvent) { switch (webEvent.type()) { case WebEvent::TouchStart: m_type = WebCore::TouchStart; break; case WebEvent::TouchMove: m_type = WebCore::TouchMove; break; case WebEvent::TouchEnd: m_type = WebCore::TouchEnd; break; default: ASSERT_NOT_REACHED(); } for (int i = 0; i < webEvent.touchPoints().size(); ++i) m_touchPoints.append(WebKit2PlatformTouchPoint(webEvent.touchPoints().at(i))); m_ctrlKey = webEvent.controlKey(); m_altKey = webEvent.altKey(); m_shiftKey = webEvent.shiftKey(); m_metaKey = webEvent.metaKey(); }