OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. | 3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 m_scrollOrigin = origin; | 115 m_scrollOrigin = origin; |
116 m_scrollOriginChanged = true; | 116 m_scrollOriginChanged = true; |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 GraphicsLayer* ScrollableArea::layerForContainer() const | 120 GraphicsLayer* ScrollableArea::layerForContainer() const |
121 { | 121 { |
122 return layerForScrolling() ? layerForScrolling()->parent() : 0; | 122 return layerForScrolling() ? layerForScrolling()->parent() : 0; |
123 } | 123 } |
124 | 124 |
125 bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granula
rity, float delta) | 125 bool ScrollableArea::scroll(ScrollDirectionPhysical direction, ScrollGranularity
granularity, float delta) |
126 { | 126 { |
127 ASSERT(!isLogical(direction)); | |
128 | |
129 ScrollbarOrientation orientation; | 127 ScrollbarOrientation orientation; |
130 if (direction == ScrollUp || direction == ScrollDown) | 128 if (direction == ScrollPhysicalUp || direction == ScrollPhysicalDown) |
131 orientation = VerticalScrollbar; | 129 orientation = VerticalScrollbar; |
132 else | 130 else |
133 orientation = HorizontalScrollbar; | 131 orientation = HorizontalScrollbar; |
134 | 132 |
135 if (!userInputScrollable(orientation)) | 133 if (!userInputScrollable(orientation)) |
136 return false; | 134 return false; |
137 | 135 |
138 cancelProgrammaticScrollAnimation(); | 136 cancelProgrammaticScrollAnimation(); |
139 | 137 |
140 float step = 0; | 138 float step = 0; |
141 switch (granularity) { | 139 switch (granularity) { |
142 case ScrollByLine: | 140 case ScrollByLine: |
143 step = lineStep(orientation); | 141 step = lineStep(orientation); |
144 break; | 142 break; |
145 case ScrollByPage: | 143 case ScrollByPage: |
146 step = pageStep(orientation); | 144 step = pageStep(orientation); |
147 break; | 145 break; |
148 case ScrollByDocument: | 146 case ScrollByDocument: |
149 step = documentStep(orientation); | 147 step = documentStep(orientation); |
150 break; | 148 break; |
151 case ScrollByPixel: | 149 case ScrollByPixel: |
152 case ScrollByPrecisePixel: | 150 case ScrollByPrecisePixel: |
153 step = pixelStep(orientation); | 151 step = pixelStep(orientation); |
154 break; | 152 break; |
155 } | 153 } |
156 | 154 |
157 if (direction == ScrollUp || direction == ScrollLeft) | 155 if (direction == ScrollPhysicalUp || direction == ScrollPhysicalLeft) |
158 delta = -delta; | 156 delta = -delta; |
159 | 157 |
160 return scrollAnimator()->scroll(orientation, granularity, step, delta).didSc
roll; | 158 return scrollAnimator()->scroll(orientation, granularity, step, delta).didSc
roll; |
161 } | 159 } |
162 | 160 |
163 void ScrollableArea::setScrollPosition(const DoublePoint& position, ScrollBehavi
or behavior) | 161 void ScrollableArea::setScrollPosition(const DoublePoint& position, ScrollBehavi
or behavior) |
164 { | 162 { |
165 // FIXME(417782): This should be unified with LayerScrollableArea::scrollToO
ffset. | 163 // FIXME(417782): This should be unified with LayerScrollableArea::scrollToO
ffset. |
166 ASSERT_NOT_REACHED(); | 164 ASSERT_NOT_REACHED(); |
167 } | 165 } |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 { | 574 { |
577 return scrollSize(orientation); | 575 return scrollSize(orientation); |
578 } | 576 } |
579 | 577 |
580 float ScrollableArea::pixelStep(ScrollbarOrientation) const | 578 float ScrollableArea::pixelStep(ScrollbarOrientation) const |
581 { | 579 { |
582 return 1; | 580 return 1; |
583 } | 581 } |
584 | 582 |
585 } // namespace blink | 583 } // namespace blink |
OLD | NEW |