Chromium Code Reviews| Index: Source/platform/scroll/ScrollTypes.h |
| diff --git a/Source/platform/scroll/ScrollTypes.h b/Source/platform/scroll/ScrollTypes.h |
| index 73777d22067a16e4b2b373851c51df1b4581ef3c..1e8a51e2d114ce56f8588f29bffe1d34543e96af 100644 |
| --- a/Source/platform/scroll/ScrollTypes.h |
| +++ b/Source/platform/scroll/ScrollTypes.h |
| @@ -42,66 +42,71 @@ enum ScrollDirection { |
| ScrollInlineDirectionForward |
| }; |
| -inline bool isLogical(ScrollDirection direction) |
| -{ |
| - return direction >= ScrollBlockDirectionBackward; |
| -} |
| +enum ScrollDirectionPhysical { |
| + ScrollPhysicalUp, |
|
bokan
2015/05/21 18:54:43
I'd make these ones ScrollUp, ScrollLeft, etc and
|
| + ScrollPhysicalDown, |
| + ScrollPhysicalLeft, |
| + ScrollPhysicalRight, |
| +}; |
| // Convert logical scroll direction to physical. Physical scroll directions are unaffected. |
| -inline ScrollDirection toPhysicalDirection(ScrollDirection direction, bool isVertical, bool isFlipped) |
| +inline ScrollDirectionPhysical toPhysicalDirection(ScrollDirection direction, bool isVertical, bool isFlipped) |
| { |
| switch (direction) { |
| case ScrollBlockDirectionBackward: { |
| if (isVertical) { |
| if (!isFlipped) |
| - return ScrollUp; |
| - return ScrollDown; |
| + return ScrollPhysicalUp; |
| + return ScrollPhysicalDown; |
| } |
| if (!isFlipped) |
| - return ScrollLeft; |
| - return ScrollRight; |
| + return ScrollPhysicalLeft; |
| + return ScrollPhysicalRight; |
| } |
| case ScrollBlockDirectionForward: { |
| if (isVertical) { |
| if (!isFlipped) |
| - return ScrollDown; |
| - return ScrollUp; |
| + return ScrollPhysicalDown; |
| + return ScrollPhysicalUp; |
| } |
| if (!isFlipped) |
| - return ScrollRight; |
| - return ScrollLeft; |
| + return ScrollPhysicalRight; |
| + return ScrollPhysicalLeft; |
| } |
| case ScrollInlineDirectionBackward: { |
| if (isVertical) { |
| if (!isFlipped) |
| - return ScrollLeft; |
| - return ScrollRight; |
| + return ScrollPhysicalLeft; |
| + return ScrollPhysicalRight; |
| } |
| if (!isFlipped) |
| - return ScrollUp; |
| - return ScrollDown; |
| + return ScrollPhysicalUp; |
| + return ScrollPhysicalDown; |
| } |
| case ScrollInlineDirectionForward: { |
| if (isVertical) { |
| if (!isFlipped) |
| - return ScrollRight; |
| - return ScrollLeft; |
| + return ScrollPhysicalRight; |
| + return ScrollPhysicalLeft; |
| } |
| if (!isFlipped) |
| - return ScrollDown; |
| - return ScrollUp; |
| + return ScrollPhysicalDown; |
| + return ScrollPhysicalUp; |
| } |
| // Direction is already physical |
| case ScrollUp: |
| + return ScrollPhysicalUp; |
| case ScrollDown: |
| + return ScrollPhysicalDown; |
| case ScrollLeft: |
| + return ScrollPhysicalLeft; |
| case ScrollRight: |
| - return direction; |
| + return ScrollPhysicalRight; |
| default: |
| ASSERT_NOT_REACHED(); |
| break; |
| } |
| - return direction; |
| + return ScrollPhysicalUp; |
| } |
| enum ScrollGranularity { |