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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollTypes.h

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Created 4 years, 2 months 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/platform/scroll/ScrollTypes.h
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollTypes.h b/third_party/WebKit/Source/platform/scroll/ScrollTypes.h
index 15f40c51b53d23e4c8333df420f680eb0d946bf7..0ad3b86099c2cfb31a523ca6e8cfc426dd8fa8ea 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollTypes.h
+++ b/third_party/WebKit/Source/platform/scroll/ScrollTypes.h
@@ -26,11 +26,17 @@
#ifndef ScrollTypes_h
#define ScrollTypes_h
-#include "platform/geometry/FloatSize.h"
+#include "platform/geometry/FloatPoint.h"
#include "wtf/Assertions.h"
namespace blink {
+typedef FloatSize ScrollOffset;
+
+inline ScrollOffset toScrollOffset(const FloatPoint& p) {
+ return ScrollOffset(p.x(), p.y());
+}
+
enum ScrollDirection {
ScrollUpIgnoringWritingMode,
ScrollDownIgnoringWritingMode,
@@ -195,8 +201,8 @@ struct ScrollResult {
unusedScrollDeltaY(0) {}
ScrollResult(bool didScrollX,
bool didScrollY,
- float unusedScrollDeltaX,
- float unusedScrollDeltaY)
+ double unusedScrollDeltaX,
bokan 2016/10/02 19:47:51 Shouldn't we keep these as float?
szager1 2016/10/05 07:43:36 Whoops, fixed.
+ double unusedScrollDeltaY)
: didScrollX(didScrollX),
didScrollY(didScrollY),
unusedScrollDeltaX(unusedScrollDeltaX),
@@ -208,21 +214,22 @@ struct ScrollResult {
bool didScrollY;
// In pixels.
- float unusedScrollDeltaX;
- float unusedScrollDeltaY;
+ double unusedScrollDeltaX;
+ double unusedScrollDeltaY;
};
-inline FloatSize toScrollDelta(ScrollbarOrientation orientation, float delta) {
- return orientation == HorizontalScrollbar ? FloatSize(delta, 0.0f)
- : FloatSize(0.0f, delta);
+inline ScrollOffset toScrollDelta(ScrollbarOrientation orientation,
+ double delta) {
+ return orientation == HorizontalScrollbar ? ScrollOffset(delta, 0.0f)
+ : ScrollOffset(0.0f, delta);
}
-inline FloatSize toScrollDelta(ScrollDirectionPhysical dir, float delta) {
+inline ScrollOffset toScrollDelta(ScrollDirectionPhysical dir, double delta) {
if (dir == ScrollUp || dir == ScrollLeft)
delta = -delta;
- return (dir == ScrollLeft || dir == ScrollRight) ? FloatSize(delta, 0)
- : FloatSize(0, delta);
+ return (dir == ScrollLeft || dir == ScrollRight) ? ScrollOffset(delta, 0)
+ : ScrollOffset(0, delta);
}
typedef unsigned ScrollbarControlPartMask;

Powered by Google App Engine
This is Rietveld 408576698