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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 m_scrollOrigin = origin; | 113 m_scrollOrigin = origin; |
114 m_scrollOriginChanged = true; | 114 m_scrollOriginChanged = true; |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 GraphicsLayer* ScrollableArea::layerForContainer() const | 118 GraphicsLayer* ScrollableArea::layerForContainer() const |
119 { | 119 { |
120 return layerForScrolling() ? layerForScrolling()->parent() : 0; | 120 return layerForScrolling() ? layerForScrolling()->parent() : 0; |
121 } | 121 } |
122 | 122 |
123 bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granula
rity, float delta) | 123 ScrollResultOneDimensional ScrollableArea::scroll(ScrollDirection direction, Scr
ollGranularity granularity, float delta) |
124 { | 124 { |
125 ScrollbarOrientation orientation; | 125 ScrollbarOrientation orientation; |
126 | 126 |
127 if (direction == ScrollUp || direction == ScrollDown) | 127 if (direction == ScrollUp || direction == ScrollDown) |
128 orientation = VerticalScrollbar; | 128 orientation = VerticalScrollbar; |
129 else | 129 else |
130 orientation = HorizontalScrollbar; | 130 orientation = HorizontalScrollbar; |
131 | 131 |
132 if (!userInputScrollable(orientation)) | 132 if (!userInputScrollable(orientation)) |
133 return false; | 133 return ScrollResultOneDimensional(false); |
134 | 134 |
135 cancelProgrammaticScrollAnimation(); | 135 cancelProgrammaticScrollAnimation(); |
136 | 136 |
137 float step = 0; | 137 float step = 0; |
138 switch (granularity) { | 138 switch (granularity) { |
139 case ScrollByLine: | 139 case ScrollByLine: |
140 step = lineStep(orientation); | 140 step = lineStep(orientation); |
141 break; | 141 break; |
142 case ScrollByPage: | 142 case ScrollByPage: |
143 step = pageStep(orientation); | 143 step = pageStep(orientation); |
144 break; | 144 break; |
145 case ScrollByDocument: | 145 case ScrollByDocument: |
146 step = documentStep(orientation); | 146 step = documentStep(orientation); |
147 break; | 147 break; |
148 case ScrollByPixel: | 148 case ScrollByPixel: |
149 case ScrollByPrecisePixel: | 149 case ScrollByPrecisePixel: |
150 step = pixelStep(orientation); | 150 step = pixelStep(orientation); |
151 break; | 151 break; |
152 } | 152 } |
153 | 153 |
154 if (direction == ScrollUp || direction == ScrollLeft) | 154 if (direction == ScrollUp || direction == ScrollLeft) |
155 delta = -delta; | 155 delta = -delta; |
156 | 156 |
157 return scrollAnimator()->scroll(orientation, granularity, step, delta).didSc
roll; | 157 return scrollAnimator()->scroll(orientation, granularity, step, delta); |
158 } | 158 } |
159 | 159 |
160 void ScrollableArea::setScrollPosition(const DoublePoint& position, ScrollBehavi
or behavior) | 160 void ScrollableArea::setScrollPosition(const DoublePoint& position, ScrollBehavi
or behavior) |
161 { | 161 { |
162 // FIXME(417782): This should be unified with LayerScrollableArea::scrollToO
ffset. | 162 // FIXME(417782): This should be unified with LayerScrollableArea::scrollToO
ffset. |
163 ASSERT_NOT_REACHED(); | 163 ASSERT_NOT_REACHED(); |
164 } | 164 } |
165 | 165 |
166 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset, bo
ol cancelProgrammaticAnimations) | 166 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset, bo
ol cancelProgrammaticAnimations) |
167 { | 167 { |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 { | 515 { |
516 return scrollSize(orientation); | 516 return scrollSize(orientation); |
517 } | 517 } |
518 | 518 |
519 float ScrollableArea::pixelStep(ScrollbarOrientation) const | 519 float ScrollableArea::pixelStep(ScrollbarOrientation) const |
520 { | 520 { |
521 return 1; | 521 return 1; |
522 } | 522 } |
523 | 523 |
524 } // namespace blink | 524 } // namespace blink |
OLD | NEW |