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

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

Issue 1147283002: Add ScrollDirectionPhysical enum in Scroll types. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed a conflict on EventHandler Created 5 years, 7 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
« no previous file with comments | « Source/core/page/EventHandler.cpp ('k') | Source/platform/scroll/ScrollableArea.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/scroll/ScrollTypes.h
diff --git a/Source/platform/scroll/ScrollTypes.h b/Source/platform/scroll/ScrollTypes.h
index 73777d22067a16e4b2b373851c51df1b4581ef3c..ab1cd234d43aff3976204adccee2fd50c28715af 100644
--- a/Source/platform/scroll/ScrollTypes.h
+++ b/Source/platform/scroll/ScrollTypes.h
@@ -31,10 +31,10 @@
namespace blink {
enum ScrollDirection {
- ScrollUp,
- ScrollDown,
- ScrollLeft,
- ScrollRight,
+ ScrollUpIgnoringWritingMode,
+ ScrollDownIgnoringWritingMode,
+ ScrollLeftIgnoringWritingMode,
+ ScrollRightIgnoringWritingMode,
ScrollBlockDirectionBackward,
ScrollBlockDirectionForward,
@@ -42,13 +42,15 @@ enum ScrollDirection {
ScrollInlineDirectionForward
};
-inline bool isLogical(ScrollDirection direction)
-{
- return direction >= ScrollBlockDirectionBackward;
-}
+enum ScrollDirectionPhysical {
+ ScrollUp,
+ ScrollDown,
+ ScrollLeft,
+ ScrollRight
+};
// 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: {
@@ -92,16 +94,37 @@ inline ScrollDirection toPhysicalDirection(ScrollDirection direction, bool isVer
return ScrollUp;
}
// Direction is already physical
+ case ScrollUpIgnoringWritingMode:
+ return ScrollUp;
+ case ScrollDownIgnoringWritingMode:
+ return ScrollDown;
+ case ScrollLeftIgnoringWritingMode:
+ return ScrollLeft;
+ case ScrollRightIgnoringWritingMode:
+ return ScrollRight;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ return ScrollUp;
+}
+
+inline ScrollDirection toScrollDirection(ScrollDirectionPhysical direction)
+{
+ switch (direction) {
case ScrollUp:
+ return ScrollUpIgnoringWritingMode;
case ScrollDown:
+ return ScrollDownIgnoringWritingMode;
case ScrollLeft:
+ return ScrollLeftIgnoringWritingMode;
case ScrollRight:
- return direction;
+ return ScrollRightIgnoringWritingMode;
default:
ASSERT_NOT_REACHED();
break;
}
- return direction;
+ return ScrollUpIgnoringWritingMode;
}
enum ScrollGranularity {
« no previous file with comments | « Source/core/page/EventHandler.cpp ('k') | Source/platform/scroll/ScrollableArea.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698