| Index: Source/web/WebInputEventConversion.cpp | 
| diff --git a/Source/web/WebInputEventConversion.cpp b/Source/web/WebInputEventConversion.cpp | 
| index 2b383ced828daf5885efe876d5c7e40d91b2cdc2..1b47f4385ecd21294f73e64456a1c24e1ecb1915 100644 | 
| --- a/Source/web/WebInputEventConversion.cpp | 
| +++ b/Source/web/WebInputEventConversion.cpp | 
| @@ -38,6 +38,10 @@ | 
| #include "core/events/MouseEvent.h" | 
| #include "core/events/TouchEvent.h" | 
| #include "core/events/WheelEvent.h" | 
| +#include "core/frame/FrameHost.h" | 
| +#include "core/frame/FrameView.h" | 
| +#include "core/frame/PinchViewport.h" | 
| +#include "core/page/Page.h" | 
| #include "core/rendering/RenderObject.h" | 
| #include "platform/KeyboardCodes.h" | 
| #include "platform/Widget.h" | 
| @@ -72,16 +76,29 @@ static IntSize widgetInputEventsOffset(const Widget* widget) | 
| return rootView->inputEventsOffsetForEmulation(); | 
| } | 
|  | 
| +static IntPoint pinchViewportOffset(const Widget* widget) | 
| +{ | 
| +    // Event position needs to be adjusted by the pinch viewport's offset within the | 
| +    // main frame before being passed into the widget's convertFromContainingWindow. | 
| +    FrameView* rootView = toFrameView(widget->root()); | 
| +    if (!rootView) | 
| +        return IntPoint(); | 
| + | 
| +    return flooredIntPoint(rootView->page()->frameHost().pinchViewport().visibleRect().location()); | 
| +} | 
| + | 
| // MakePlatformMouseEvent ----------------------------------------------------- | 
|  | 
| PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, const WebMouseEvent& e) | 
| { | 
| float scale = widgetInputEventsScaleFactor(widget); | 
| IntSize offset = widgetInputEventsOffset(widget); | 
| +    IntPoint pinchViewport = pinchViewportOffset(widget); | 
|  | 
| // 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(IntPoint((e.x - offset.width()) / scale, (e.y - offset.height()) / scale)); | 
| +    m_position = widget->convertFromContainingWindow( | 
| +        IntPoint((e.x - offset.width()) / scale + pinchViewport.x(), (e.y - offset.height()) / scale + pinchViewport.y())); | 
| m_globalPosition = IntPoint(e.globalX, e.globalY); | 
| m_movementDelta = IntPoint(e.movementX / scale, e.movementY / scale); | 
| m_button = static_cast<MouseButton>(e.button); | 
| @@ -125,8 +142,10 @@ PlatformWheelEventBuilder::PlatformWheelEventBuilder(Widget* widget, const WebMo | 
| { | 
| float scale = widgetInputEventsScaleFactor(widget); | 
| IntSize offset = widgetInputEventsOffset(widget); | 
| +    IntPoint pinchViewport = pinchViewportOffset(widget); | 
|  | 
| -    m_position = widget->convertFromContainingWindow(IntPoint((e.x - offset.width()) / scale, (e.y - offset.height()) / scale)); | 
| +    m_position = widget->convertFromContainingWindow( | 
| +        IntPoint((e.x - offset.width()) / scale + pinchViewport.x(), (e.y - offset.height()) / scale + pinchViewport.y())); | 
| m_globalPosition = IntPoint(e.globalX, e.globalY); | 
| m_deltaX = e.deltaX; | 
| m_deltaY = e.deltaY; | 
| @@ -166,6 +185,7 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W | 
| { | 
| float scale = widgetInputEventsScaleFactor(widget); | 
| IntSize offset = widgetInputEventsOffset(widget); | 
| +    IntPoint pinchViewport = pinchViewportOffset(widget); | 
|  | 
| switch (e.type) { | 
| case WebInputEvent::GestureScrollBegin: | 
| @@ -243,7 +263,8 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W | 
| default: | 
| ASSERT_NOT_REACHED(); | 
| } | 
| -    m_position = widget->convertFromContainingWindow(IntPoint((e.x - offset.width()) / scale, (e.y - offset.height()) / scale)); | 
| +    m_position = widget->convertFromContainingWindow( | 
| +        IntPoint((e.x - offset.width()) / scale + pinchViewport.x(), (e.y - offset.height()) / scale + pinchViewport.y())); | 
| m_globalPosition = IntPoint(e.globalX, e.globalY); | 
| m_timestamp = e.timeStampSeconds; | 
|  | 
| @@ -405,9 +426,12 @@ PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTo | 
| { | 
| float scale = widgetInputEventsScaleFactor(widget); | 
| IntSize offset = widgetInputEventsOffset(widget); | 
| +    IntPoint pinchViewport = pinchViewportOffset(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_pos = widget->convertFromContainingWindow(IntPoint( | 
| +        (point.position.x - offset.width()) / scale + pinchViewport.x(), | 
| +        (point.position.y - offset.height()) / scale + pinchViewport.y())); | 
| m_screenPos = IntPoint(point.screenPosition.x, point.screenPosition.y); | 
| m_radiusY = point.radiusY / scale; | 
| m_radiusX = point.radiusX / scale; | 
|  |