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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 if (scrollBehavior == ScrollBehaviorSmooth) | 206 if (scrollBehavior == ScrollBehaviorSmooth) |
207 programmaticScrollAnimator()->animateToOffset(toFloatPoint(position)); | 207 programmaticScrollAnimator()->animateToOffset(toFloatPoint(position)); |
208 else | 208 else |
209 programmaticScrollAnimator()->scrollToOffsetWithoutAnimation(toFloatPoin
t(position)); | 209 programmaticScrollAnimator()->scrollToOffsetWithoutAnimation(toFloatPoin
t(position)); |
210 } | 210 } |
211 | 211 |
212 void ScrollableArea::userScrollHelper(const DoublePoint& position, ScrollBehavio
r scrollBehavior) | 212 void ScrollableArea::userScrollHelper(const DoublePoint& position, ScrollBehavio
r scrollBehavior) |
213 { | 213 { |
214 cancelProgrammaticScrollAnimation(); | 214 cancelProgrammaticScrollAnimation(); |
215 | 215 |
| 216 double x = userInputScrollable(HorizontalScrollbar) ? position.x() : scrollA
nimator()->currentPosition().x(); |
| 217 double y = userInputScrollable(VerticalScrollbar) ? position.y() : scrollAni
mator()->currentPosition().y(); |
| 218 |
216 // Smooth user scrolls (keyboard, wheel clicks) are handled via the userScro
ll method. | 219 // Smooth user scrolls (keyboard, wheel clicks) are handled via the userScro
ll method. |
217 // TODO(bokan): The userScroll method should probably be modified to call th
is method | 220 // TODO(bokan): The userScroll method should probably be modified to call th
is method |
218 // and ScrollAnimator to have a simpler animateToOffset method
like the | 221 // and ScrollAnimator to have a simpler animateToOffset method
like the |
219 // ProgrammaticScrollAnimator. | 222 // ProgrammaticScrollAnimator. |
220 ASSERT(scrollBehavior == ScrollBehaviorInstant); | 223 ASSERT(scrollBehavior == ScrollBehaviorInstant); |
221 scrollAnimator()->scrollToOffsetWithoutAnimation(toFloatPoint(position)); | 224 scrollAnimator()->scrollToOffsetWithoutAnimation(FloatPoint(x, y)); |
222 } | 225 } |
223 | 226 |
224 LayoutRect ScrollableArea::scrollIntoView(const LayoutRect& rectInContent, const
ScrollAlignment& alignX, const ScrollAlignment& alignY) | 227 LayoutRect ScrollableArea::scrollIntoView(const LayoutRect& rectInContent, const
ScrollAlignment& alignX, const ScrollAlignment& alignY, ScrollType) |
225 { | 228 { |
226 // TODO(bokan): This should really be implemented here but ScrollAlignment i
s in Core which is a dependency violation. | 229 // TODO(bokan): This should really be implemented here but ScrollAlignment i
s in Core which is a dependency violation. |
227 ASSERT_NOT_REACHED(); | 230 ASSERT_NOT_REACHED(); |
228 return LayoutRect(); | 231 return LayoutRect(); |
229 } | 232 } |
230 | 233 |
231 void ScrollableArea::scrollPositionChanged(const DoublePoint& position, ScrollTy
pe scrollType) | 234 void ScrollableArea::scrollPositionChanged(const DoublePoint& position, ScrollTy
pe scrollType) |
232 { | 235 { |
233 TRACE_EVENT0("blink", "ScrollableArea::scrollPositionChanged"); | 236 TRACE_EVENT0("blink", "ScrollableArea::scrollPositionChanged"); |
234 | 237 |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBa
r->width() : 0; | 582 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBa
r->width() : 0; |
580 if (Scrollbar* horizontalBar = horizontalScrollbar()) | 583 if (Scrollbar* horizontalBar = horizontalScrollbar()) |
581 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horiz
ontalBar->height() : 0; | 584 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horiz
ontalBar->height() : 0; |
582 | 585 |
583 return IntSize(std::max(0, size.width() - verticalScrollbarWidth), | 586 return IntSize(std::max(0, size.width() - verticalScrollbarWidth), |
584 std::max(0, size.height() - horizontalScrollbarHeight)); | 587 std::max(0, size.height() - horizontalScrollbarHeight)); |
585 | 588 |
586 } | 589 } |
587 | 590 |
588 } // namespace blink | 591 } // namespace blink |
OLD | NEW |