Index: third_party/WebKit/Source/web/DevToolsEmulator.cpp |
diff --git a/third_party/WebKit/Source/web/DevToolsEmulator.cpp b/third_party/WebKit/Source/web/DevToolsEmulator.cpp |
index cb59bd0892dfe2ed841326ec0fe7cd32f6171b16..ace9c84a72fc9585413748598f6b7269bd9ac890 100644 |
--- a/third_party/WebKit/Source/web/DevToolsEmulator.cpp |
+++ b/third_party/WebKit/Source/web/DevToolsEmulator.cpp |
@@ -496,26 +496,27 @@ bool DevToolsEmulator::handleInputEvent(const WebInputEvent& inputEvent) { |
inputEvent.type == WebInputEvent::GesturePinchEnd; |
if (isPinch && m_touchEventEmulationEnabled) { |
FrameView* frameView = page->deprecatedLocalMainFrame()->view(); |
- PlatformGestureEventBuilder gestureEvent( |
+ WebGestureEvent scaledEvent = TransformWebGestureEvent( |
frameView, static_cast<const WebGestureEvent&>(inputEvent)); |
float pageScaleFactor = page->pageScaleFactor(); |
- if (gestureEvent.type() == PlatformEvent::GesturePinchBegin) { |
- m_lastPinchAnchorCss = WTF::wrapUnique(new IntPoint(roundedIntPoint( |
- gestureEvent.position() + frameView->getScrollOffset()))); |
+ if (scaledEvent.type == WebInputEvent::GesturePinchBegin) { |
+ WebFloatPoint gesturePosition = scaledEvent.positionInRootFrame(); |
+ m_lastPinchAnchorCss = WTF::wrapUnique(new IntPoint( |
+ roundedIntPoint(gesturePosition + frameView->getScrollOffset()))); |
m_lastPinchAnchorDip = |
- WTF::wrapUnique(new IntPoint(gestureEvent.position())); |
+ WTF::wrapUnique(new IntPoint(flooredIntPoint(gesturePosition))); |
m_lastPinchAnchorDip->scale(pageScaleFactor, pageScaleFactor); |
} |
- if (gestureEvent.type() == PlatformEvent::GesturePinchUpdate && |
+ if (scaledEvent.type == WebInputEvent::GesturePinchUpdate && |
m_lastPinchAnchorCss) { |
- float newPageScaleFactor = pageScaleFactor * gestureEvent.scale(); |
+ float newPageScaleFactor = pageScaleFactor * scaledEvent.pinchScale(); |
IntPoint anchorCss(*m_lastPinchAnchorDip.get()); |
anchorCss.scale(1.f / newPageScaleFactor, 1.f / newPageScaleFactor); |
m_webViewImpl->setPageScaleFactor(newPageScaleFactor); |
m_webViewImpl->mainFrame()->setScrollOffset( |
toIntSize(*m_lastPinchAnchorCss.get() - toIntSize(anchorCss))); |
} |
- if (gestureEvent.type() == PlatformEvent::GesturePinchEnd) { |
+ if (scaledEvent.type == WebInputEvent::GesturePinchEnd) { |
m_lastPinchAnchorCss.reset(); |
m_lastPinchAnchorDip.reset(); |
} |