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

Unified Diff: third_party/WebKit/Source/web/DevToolsEmulator.cpp

Issue 2539283002: Remove PlatformGestureEvent in favour of using WebGestureEvent (Closed)
Patch Set: Add missing copyright on new file Created 4 years 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
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();
}
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/Scrollbar.cpp ('k') | third_party/WebKit/Source/web/InspectorOverlay.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698