Chromium Code Reviews| 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) |
| +{ |
|
tdresser
2016/02/29 14:53:43
I think this would be clearer if you just explicit
|
| + if (dir == ScrollUp || dir == ScrollLeft) |
| + delta = -delta; |
| + |
| + return (dir == ScrollLeft || dir == ScrollRight) ? FloatSize(delta, 0) : FloatSize(0, delta); |
| +} |
| + |
| typedef unsigned ScrollbarControlPartMask; |
| } // namespace blink |