PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTouchPoint& point) { m_id = point.id; m_state = toPlatformTouchPointState(point.state); m_pos = widget->convertFromContainingWindow(point.position); m_screenPos = point.screenPosition; m_radiusY = point.radiusY; m_radiusX = point.radiusX; m_rotationAngle = point.rotationAngle; m_force = point.force; }
PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTouchPoint& point) { float scale = widgetScaleFactor(widget); m_id = point.id; m_state = toPlatformTouchPointState(point.state); m_pos = widget->convertFromContainingWindow(IntPoint(point.position.x / scale, point.position.y / scale)); m_screenPos = point.screenPosition; m_radiusY = point.radiusY / scale; m_radiusX = point.radiusX / scale; m_rotationAngle = point.rotationAngle; m_force = point.force; }
PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTouchPoint& point) { float scale = widgetInputEventsScaleFactor(widget); IntSize offset = widgetInputEventsOffset(widget); m_id = point.id; m_state = toPlatformTouchPointState(point.state); m_pos = widget->convertFromContainingWindow(IntPoint((point.position.x - offset.width()) / scale, (point.position.y - offset.height()) / scale)); m_screenPos = IntPoint(point.screenPosition.x, point.screenPosition.y); m_radiusY = point.radiusY / scale; m_radiusX = point.radiusX / scale; m_rotationAngle = point.rotationAngle; m_force = point.force; }
// TODO(mustaq): Add tests for this. PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTouchPoint& point) { m_pointerProperties = point; m_state = toPlatformTouchPointState(point.state); // This assumes convertFromRootFrame does only translations, not scales. FloatPoint floatPos = convertHitPointToRootFrame(widget, point.position); IntPoint flooredPoint = flooredIntPoint(floatPos); m_pos = widget->convertFromRootFrame(flooredPoint) + (floatPos - flooredPoint); m_screenPos = FloatPoint(point.screenPosition.x, point.screenPosition.y); m_radius = scaleSizeToWindow(widget, FloatSize(point.radiusX, point.radiusY)); m_rotationAngle = point.rotationAngle; }