OLD | NEW |
---|---|
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 24 matching lines...) Expand all Loading... | |
35 ScrollDown, | 35 ScrollDown, |
36 ScrollLeft, | 36 ScrollLeft, |
37 ScrollRight, | 37 ScrollRight, |
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 ScrollPhysicalUp, |
bokan
2015/05/21 18:54:43
I'd make these ones ScrollUp, ScrollLeft, etc and
| |
47 return direction >= ScrollBlockDirectionBackward; | 47 ScrollPhysicalDown, |
48 } | 48 ScrollPhysicalLeft, |
49 ScrollPhysicalRight, | |
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 ScrollPhysicalUp; |
58 return ScrollDown; | 60 return ScrollPhysicalDown; |
59 } | 61 } |
60 if (!isFlipped) | 62 if (!isFlipped) |
61 return ScrollLeft; | 63 return ScrollPhysicalLeft; |
62 return ScrollRight; | 64 return ScrollPhysicalRight; |
63 } | 65 } |
64 case ScrollBlockDirectionForward: { | 66 case ScrollBlockDirectionForward: { |
65 if (isVertical) { | 67 if (isVertical) { |
66 if (!isFlipped) | 68 if (!isFlipped) |
67 return ScrollDown; | 69 return ScrollPhysicalDown; |
68 return ScrollUp; | 70 return ScrollPhysicalUp; |
69 } | 71 } |
70 if (!isFlipped) | 72 if (!isFlipped) |
71 return ScrollRight; | 73 return ScrollPhysicalRight; |
72 return ScrollLeft; | 74 return ScrollPhysicalLeft; |
73 } | 75 } |
74 case ScrollInlineDirectionBackward: { | 76 case ScrollInlineDirectionBackward: { |
75 if (isVertical) { | 77 if (isVertical) { |
76 if (!isFlipped) | 78 if (!isFlipped) |
77 return ScrollLeft; | 79 return ScrollPhysicalLeft; |
78 return ScrollRight; | 80 return ScrollPhysicalRight; |
79 } | 81 } |
80 if (!isFlipped) | 82 if (!isFlipped) |
81 return ScrollUp; | 83 return ScrollPhysicalUp; |
82 return ScrollDown; | 84 return ScrollPhysicalDown; |
83 } | 85 } |
84 case ScrollInlineDirectionForward: { | 86 case ScrollInlineDirectionForward: { |
85 if (isVertical) { | 87 if (isVertical) { |
86 if (!isFlipped) | 88 if (!isFlipped) |
87 return ScrollRight; | 89 return ScrollPhysicalRight; |
88 return ScrollLeft; | 90 return ScrollPhysicalLeft; |
89 } | 91 } |
90 if (!isFlipped) | 92 if (!isFlipped) |
91 return ScrollDown; | 93 return ScrollPhysicalDown; |
92 return ScrollUp; | 94 return ScrollPhysicalUp; |
93 } | 95 } |
94 // Direction is already physical | 96 // Direction is already physical |
95 case ScrollUp: | 97 case ScrollUp: |
98 return ScrollPhysicalUp; | |
96 case ScrollDown: | 99 case ScrollDown: |
100 return ScrollPhysicalDown; | |
97 case ScrollLeft: | 101 case ScrollLeft: |
102 return ScrollPhysicalLeft; | |
98 case ScrollRight: | 103 case ScrollRight: |
99 return direction; | 104 return ScrollPhysicalRight; |
100 default: | 105 default: |
101 ASSERT_NOT_REACHED(); | 106 ASSERT_NOT_REACHED(); |
102 break; | 107 break; |
103 } | 108 } |
104 return direction; | 109 return ScrollPhysicalUp; |
105 } | 110 } |
106 | 111 |
107 enum ScrollGranularity { | 112 enum ScrollGranularity { |
108 ScrollByLine, | 113 ScrollByLine, |
109 ScrollByPage, | 114 ScrollByPage, |
110 ScrollByDocument, | 115 ScrollByDocument, |
111 ScrollByPixel, | 116 ScrollByPixel, |
112 ScrollByPrecisePixel | 117 ScrollByPrecisePixel |
113 }; | 118 }; |
114 | 119 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 bool didScroll; | 187 bool didScroll; |
183 float unusedScrollDeltaX; | 188 float unusedScrollDeltaX; |
184 float unusedScrollDeltaY; | 189 float unusedScrollDeltaY; |
185 }; | 190 }; |
186 | 191 |
187 typedef unsigned ScrollbarControlPartMask; | 192 typedef unsigned ScrollbarControlPartMask; |
188 | 193 |
189 } | 194 } |
190 | 195 |
191 #endif | 196 #endif |
OLD | NEW |