Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: sky/engine/web/WebInputEventConversion.cpp

Issue 684353002: Remove more stuff from Widget. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« sky/engine/core/frame/FrameView.h ('K') | « sky/engine/web/WebElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/web/WebInputEventConversion.cpp
diff --git a/sky/engine/web/WebInputEventConversion.cpp b/sky/engine/web/WebInputEventConversion.cpp
index f0ffcbeb77c0f251635e2efc916573643442d269..92dffa8017c4ce8fbf1d34ef3cf2a900f64baa59 100644
--- a/sky/engine/web/WebInputEventConversion.cpp
+++ b/sky/engine/web/WebInputEventConversion.cpp
@@ -81,7 +81,7 @@ PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, const WebMo
// FIXME: Widget is always toplevel, unless it's a popup. We may be able
// to get rid of this once we abstract popups into a WebKit API.
- m_position = widget->convertFromContainingWindow(
+ m_position = widget->convertFromContainingView(
IntPoint((e.x - offset.width()) / scale, (e.y - offset.height()) / scale));
m_globalPosition = IntPoint(e.globalX, e.globalY);
m_movementDelta = IntPoint(e.movementX / scale, e.movementY / scale);
@@ -127,7 +127,7 @@ PlatformWheelEventBuilder::PlatformWheelEventBuilder(Widget* widget, const WebMo
float scale = widgetInputEventsScaleFactor(widget);
IntSize offset = widgetInputEventsOffset(widget);
- m_position = widget->convertFromContainingWindow(
+ m_position = widget->convertFromContainingView(
IntPoint((e.x - offset.width()) / scale, (e.y - offset.height()) / scale));
m_globalPosition = IntPoint(e.globalX, e.globalY);
m_deltaX = e.deltaX;
@@ -245,7 +245,7 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W
default:
ASSERT_NOT_REACHED();
}
- m_position = widget->convertFromContainingWindow(
+ m_position = widget->convertFromContainingView(
IntPoint((e.x - offset.width()) / scale, (e.y - offset.height()) / scale));
m_globalPosition = IntPoint(e.globalX, e.globalY);
m_timestamp = e.timeStampSeconds;
@@ -412,8 +412,8 @@ PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTo
m_state = toPlatformTouchPointState(point.state);
FloatPoint pos = (point.position - offset).scaledBy(scale);
IntPoint flooredPoint = flooredIntPoint(pos);
- // This assumes convertFromContainingWindow does only translations, not scales.
- m_pos = widget->convertFromContainingWindow(flooredPoint) + (pos - flooredPoint);
+ // This assumes convertFromContainingView does only translations, not scales.
+ m_pos = widget->convertFromContainingView(flooredPoint) + (pos - flooredPoint);
m_screenPos = FloatPoint(point.screenPosition.x, point.screenPosition.y);
m_radius = FloatSize(point.radiusX, point.radiusY).scaledBy(scale);
m_rotationAngle = point.rotationAngle;
@@ -471,10 +471,8 @@ static void updateWebMouseEventFromCoreMouseEvent(const MouseRelatedEvent& event
webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond;
webEvent.modifiers = getWebInputModifiers(event);
- FrameView* view = toFrameView(widget.parent());
IntPoint windowPoint = IntPoint(event.absoluteLocation().x(), event.absoluteLocation().y());
- if (view)
- windowPoint = view->contentsToWindow(windowPoint);
+ windowPoint = widget.convertToContainingView(windowPoint);
webEvent.globalX = event.screenX();
webEvent.globalY = event.screenY();
webEvent.windowX = windowPoint.x();
@@ -559,10 +557,8 @@ WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const RenderObj
modifiers = getWebInputModifiers(event);
// The mouse event co-ordinates should be generated from the co-ordinates of the touch point.
- FrameView* view = toFrameView(widget->parent());
IntPoint windowPoint = roundedIntPoint(touch->absoluteLocation());
- if (view)
- windowPoint = view->contentsToWindow(windowPoint);
+ windowPoint = widget->convertToContainingView(windowPoint);
IntPoint screenPoint = roundedIntPoint(touch->screenLocation());
globalX = screenPoint.x();
globalY = screenPoint.y();
@@ -608,9 +604,7 @@ WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const PlatformM
timeStampSeconds = event.timestamp();
- // FIXME: Widget is always toplevel, unless it's a popup. We may be able
- // to get rid of this once we abstract popups into a WebKit API.
- IntPoint position = widget->convertToContainingWindow(event.position());
+ IntPoint position = event.position();
float scale = widgetInputEventsScaleFactor(widget);
position.scale(scale, scale);
x = position.x();
« sky/engine/core/frame/FrameView.h ('K') | « sky/engine/web/WebElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698