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

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

Issue 1738243002: Removed main-thread one dimensional scrolling paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@removeStepFromUserScroll
Patch Set: Rebase Created 4 years, 10 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 9dbd7ba4bcf0970a6b5e3103a9c83890d345deeb..2c3c03e12682afeb946e529dc91c7654b781f9b4 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollTypes.h
+++ b/third_party/WebKit/Source/platform/scroll/ScrollTypes.h
@@ -26,6 +26,7 @@
#ifndef ScrollTypes_h
#define ScrollTypes_h
+#include "platform/geometry/FloatSize.h"
#include "wtf/Assertions.h"
namespace blink {
@@ -177,21 +178,7 @@ enum ScrollbarOverlayStyle {
};
// The result of an attempt to scroll. If didScroll is true, then unusedScrollDelta gives
-// the amount of the scroll delta that was not consumed by scrolling. If didScroll is false
-// then unusedScrollDelta is zero.
-struct ScrollResultOneDimensional {
- STACK_ALLOCATED();
- explicit ScrollResultOneDimensional(bool didScroll)
- : didScroll(didScroll)
- , unusedScrollDelta(0) { }
- ScrollResultOneDimensional(bool didScroll, float unusedScrollDelta)
- : didScroll(didScroll)
- , unusedScrollDelta(unusedScrollDelta) { }
-
- bool didScroll;
- float unusedScrollDelta;
-};
-
+// the amount of the scroll delta that was not consumed by scrolling.
struct ScrollResult {
STACK_ALLOCATED();
explicit ScrollResult()
@@ -209,10 +196,25 @@ struct ScrollResult {
bool didScrollX;
bool didScrollY;
+
+ // In pixels.
float unusedScrollDeltaX;
float unusedScrollDeltaY;
};
+inline FloatSize toScrollDelta(ScrollbarOrientation orientation, float delta)
+{
+ return orientation == HorizontalScrollbar ? FloatSize(delta, 0.0f) : FloatSize(0.0f, delta);
+}
+
+inline FloatSize toScrollDelta(ScrollDirectionPhysical dir, float delta)
+{
+ if (dir == ScrollUp || dir == ScrollLeft)
+ delta = -delta;
+
+ return (dir == ScrollLeft || dir == ScrollRight) ? FloatSize(delta, 0) : FloatSize(0, delta);
+}
+
typedef unsigned ScrollbarControlPartMask;
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698