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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 2539283002: Remove PlatformGestureEvent in favour of using WebGestureEvent (Closed)
Patch Set: 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/core/paint/PaintLayerScrollableArea.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
index 3e652471b916f0f0c08489cd8b7847549eee9c9e..5cdf0c9e9229fa6c8551c5898c91b2f7ecce5189 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -75,7 +75,6 @@
#include "core/page/scrolling/ScrollingCoordinator.h"
#include "core/page/scrolling/TopDocumentRootScrollerController.h"
#include "core/paint/PaintLayerFragment.h"
-#include "platform/PlatformGestureEvent.h"
#include "platform/PlatformMouseEvent.h"
#include "platform/graphics/CompositorMutableProperties.h"
#include "platform/graphics/GraphicsLayer.h"
@@ -1507,8 +1506,34 @@ IntSize PaintLayerScrollableArea::offsetFromResizeCorner(
return localPoint - resizerPoint;
}
+void PaintLayerScrollableArea::resize(const WebGestureEvent& evt,
majidvp 2016/12/01 15:46:30 Feels like the two resize method here don't really
dtapuska 2016/12/01 16:26:43 Yes I agree. There are only two calls into resize;
+ const LayoutSize& oldOffset) {
+ if (evt.type == WebInputEvent::GestureScrollUpdate) {
+ IntPoint pos = roundedIntPoint(evt.positionInRootFrame());
+ pos.move(evt.deltaXInRootFrame(), evt.deltaYInRootFrame());
+ resize(pos, oldOffset);
+ } else {
+ NOTREACHED();
+ }
+}
+
void PaintLayerScrollableArea::resize(const PlatformEvent& evt,
const LayoutSize& oldOffset) {
+ if (evt.type() == PlatformEvent::MouseMoved) {
+ const PlatformMouseEvent* mouseMove =
+ static_cast<const PlatformMouseEvent*>(&evt);
+ if ((mouseMove->getModifiers() &
+ (PlatformEvent::LeftButtonDown | PlatformEvent::MiddleButtonDown |
+ PlatformEvent::RightButtonDown)) == 0)
+ return;
+ resize(mouseMove->position(), oldOffset);
+ } else {
+ NOTREACHED();
+ }
+}
+
+void PaintLayerScrollableArea::resize(const IntPoint& pos,
+ const LayoutSize& oldOffset) {
// FIXME: This should be possible on generated content but is not right now.
if (!inResizeMode() || !box().canResize() || !box().node())
return;
@@ -1518,25 +1543,6 @@ void PaintLayerScrollableArea::resize(const PlatformEvent& evt,
Document& document = element->document();
- IntPoint pos;
- const PlatformGestureEvent* gevt = 0;
-
- switch (evt.type()) {
- case PlatformEvent::MouseMoved:
- if (!document.frame()->eventHandler().mousePressed())
- return;
- pos = static_cast<const PlatformMouseEvent*>(&evt)->position();
- break;
- case PlatformEvent::GestureScrollUpdate:
- pos = static_cast<const PlatformGestureEvent*>(&evt)->position();
- gevt = static_cast<const PlatformGestureEvent*>(&evt);
- pos = gevt->position();
- pos.move(gevt->deltaX(), gevt->deltaY());
- break;
- default:
- ASSERT_NOT_REACHED();
- }
-
float zoomFactor = box().style()->effectiveZoom();
IntSize newOffset =

Powered by Google App Engine
This is Rietveld 408576698