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

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: 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
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 {

Powered by Google App Engine
This is Rietveld 408576698