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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: rebase 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 cf6930baca7d512cf22a42e4c9a8437eb9a8b9f8..aed3a91d00a2af42be89c4c0efc3a5c2ebba2b38 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollTypes.h
+++ b/third_party/WebKit/Source/platform/scroll/ScrollTypes.h
@@ -26,11 +26,18 @@
#ifndef ScrollTypes_h
#define ScrollTypes_h
-#include "platform/geometry/FloatSize.h"
+#include "platform/geometry/FloatPoint.h"
#include "wtf/Assertions.h"
namespace blink {
+typedef float ScrollUnit;
skobes 2016/10/05 21:19:28 I'm not sure we get much value from this. Even if
szager1 2016/10/06 00:11:57 Yeah, I tend to agree. I'll back this bit out and
+typedef FloatSize ScrollOffset;
skobes 2016/10/05 21:19:28 Let's add a comment here about what ScrollOffset m
szager1 2016/10/06 00:11:57 Done.
+
+inline ScrollOffset toScrollOffset(const FloatPoint& p) {
+ return ScrollOffset(p.x(), p.y());
+}
+
enum ScrollDirection {
ScrollUpIgnoringWritingMode,
ScrollDownIgnoringWritingMode,
@@ -214,17 +221,18 @@ struct ScrollResult {
float unusedScrollDeltaY;
};
-inline FloatSize toScrollDelta(ScrollbarOrientation orientation, float delta) {
- return orientation == HorizontalScrollbar ? FloatSize(delta, 0.0f)
- : FloatSize(0.0f, delta);
+inline ScrollOffset toScrollDelta(ScrollbarOrientation orientation,
+ float delta) {
+ return orientation == HorizontalScrollbar ? ScrollOffset(delta, 0.0f)
+ : ScrollOffset(0.0f, delta);
}
-inline FloatSize toScrollDelta(ScrollDirectionPhysical dir, float delta) {
+inline ScrollOffset toScrollDelta(ScrollDirectionPhysical dir, float 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