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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/core/page/EventHandler.cpp ('k') | Source/platform/scroll/ScrollableArea.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #ifndef ScrollTypes_h 26 #ifndef ScrollTypes_h
27 #define ScrollTypes_h 27 #define ScrollTypes_h
28 28
29 #include "wtf/Assertions.h" 29 #include "wtf/Assertions.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 enum ScrollDirection { 33 enum ScrollDirection {
34 ScrollUp, 34 ScrollUpIgnoringWritingMode,
35 ScrollDown, 35 ScrollDownIgnoringWritingMode,
36 ScrollLeft, 36 ScrollLeftIgnoringWritingMode,
37 ScrollRight, 37 ScrollRightIgnoringWritingMode,
38 38
39 ScrollBlockDirectionBackward, 39 ScrollBlockDirectionBackward,
40 ScrollBlockDirectionForward, 40 ScrollBlockDirectionForward,
41 ScrollInlineDirectionBackward, 41 ScrollInlineDirectionBackward,
42 ScrollInlineDirectionForward 42 ScrollInlineDirectionForward
43 }; 43 };
44 44
45 inline bool isLogical(ScrollDirection direction) 45 enum ScrollDirectionPhysical {
46 { 46 ScrollUp,
47 return direction >= ScrollBlockDirectionBackward; 47 ScrollDown,
48 } 48 ScrollLeft,
49 ScrollRight
50 };
49 51
50 // Convert logical scroll direction to physical. Physical scroll directions are unaffected. 52 // Convert logical scroll direction to physical. Physical scroll directions are unaffected.
51 inline ScrollDirection toPhysicalDirection(ScrollDirection direction, bool isVer tical, bool isFlipped) 53 inline ScrollDirectionPhysical toPhysicalDirection(ScrollDirection direction, bo ol isVertical, bool isFlipped)
52 { 54 {
53 switch (direction) { 55 switch (direction) {
54 case ScrollBlockDirectionBackward: { 56 case ScrollBlockDirectionBackward: {
55 if (isVertical) { 57 if (isVertical) {
56 if (!isFlipped) 58 if (!isFlipped)
57 return ScrollUp; 59 return ScrollUp;
58 return ScrollDown; 60 return ScrollDown;
59 } 61 }
60 if (!isFlipped) 62 if (!isFlipped)
61 return ScrollLeft; 63 return ScrollLeft;
(...skipping 23 matching lines...) Expand all
85 if (isVertical) { 87 if (isVertical) {
86 if (!isFlipped) 88 if (!isFlipped)
87 return ScrollRight; 89 return ScrollRight;
88 return ScrollLeft; 90 return ScrollLeft;
89 } 91 }
90 if (!isFlipped) 92 if (!isFlipped)
91 return ScrollDown; 93 return ScrollDown;
92 return ScrollUp; 94 return ScrollUp;
93 } 95 }
94 // Direction is already physical 96 // Direction is already physical
95 case ScrollUp: 97 case ScrollUpIgnoringWritingMode:
96 case ScrollDown: 98 return ScrollUp;
97 case ScrollLeft: 99 case ScrollDownIgnoringWritingMode:
98 case ScrollRight: 100 return ScrollDown;
99 return direction; 101 case ScrollLeftIgnoringWritingMode:
102 return ScrollLeft;
103 case ScrollRightIgnoringWritingMode:
104 return ScrollRight;
100 default: 105 default:
101 ASSERT_NOT_REACHED(); 106 ASSERT_NOT_REACHED();
102 break; 107 break;
103 } 108 }
104 return direction; 109 return ScrollUp;
110 }
111
112 inline ScrollDirection toScrollDirection(ScrollDirectionPhysical direction)
113 {
114 switch (direction) {
115 case ScrollUp:
116 return ScrollUpIgnoringWritingMode;
117 case ScrollDown:
118 return ScrollDownIgnoringWritingMode;
119 case ScrollLeft:
120 return ScrollLeftIgnoringWritingMode;
121 case ScrollRight:
122 return ScrollRightIgnoringWritingMode;
123 default:
124 ASSERT_NOT_REACHED();
125 break;
126 }
127 return ScrollUpIgnoringWritingMode;
105 } 128 }
106 129
107 enum ScrollGranularity { 130 enum ScrollGranularity {
108 ScrollByLine, 131 ScrollByLine,
109 ScrollByPage, 132 ScrollByPage,
110 ScrollByDocument, 133 ScrollByDocument,
111 ScrollByPixel, 134 ScrollByPixel,
112 ScrollByPrecisePixel 135 ScrollByPrecisePixel
113 }; 136 };
114 137
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 bool didScroll; 205 bool didScroll;
183 float unusedScrollDeltaX; 206 float unusedScrollDeltaX;
184 float unusedScrollDeltaY; 207 float unusedScrollDeltaY;
185 }; 208 };
186 209
187 typedef unsigned ScrollbarControlPartMask; 210 typedef unsigned ScrollbarControlPartMask;
188 211
189 } 212 }
190 213
191 #endif 214 #endif
OLDNEW
« 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