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 1d33bea9aeb7eb7194c0c22a783f4460760a5865..a2beded2a5e390a7a02e3d7a89f091f986e6b771 100644 |
--- a/third_party/WebKit/Source/web/DevToolsEmulator.cpp |
+++ b/third_party/WebKit/Source/web/DevToolsEmulator.cpp |
@@ -496,25 +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 = ScaleWebGestureEvent( |
frameView, static_cast<const WebGestureEvent&>(inputEvent)); |
float pageScaleFactor = page->pageScaleFactor(); |
- if (gestureEvent.type() == PlatformEvent::GesturePinchBegin) { |
- m_lastPinchAnchorCss = wrapUnique(new IntPoint(roundedIntPoint( |
- gestureEvent.position() + frameView->scrollOffset()))); |
- m_lastPinchAnchorDip = wrapUnique(new IntPoint(gestureEvent.position())); |
+ if (scaledEvent.type == WebInputEvent::GesturePinchBegin) { |
+ WebFloatPoint gesturePosition = scaledEvent.positionInRootFrame(); |
+ m_lastPinchAnchorCss = wrapUnique(new IntPoint( |
+ roundedIntPoint(gesturePosition + frameView->scrollOffset()))); |
+ m_lastPinchAnchorDip = |
+ 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(); |
} |