| 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 19 matching lines...) Expand all Loading... |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #include "platform/scroll/ScrollableArea.h" | 32 #include "platform/scroll/ScrollableArea.h" |
| 33 | 33 |
| 34 #include "platform/PlatformChromeClient.h" | 34 #include "platform/PlatformChromeClient.h" |
| 35 #include "platform/graphics/GraphicsLayer.h" | 35 #include "platform/graphics/GraphicsLayer.h" |
| 36 #include "platform/instrumentation/tracing/TraceEvent.h" | 36 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 37 #include "platform/scroll/MainThreadScrollingReason.h" | 37 #include "platform/scroll/MainThreadScrollingReason.h" |
| 38 #include "platform/scroll/ProgrammaticScrollAnimator.h" | 38 #include "platform/scroll/ProgrammaticScrollAnimator.h" |
| 39 #include "platform/scroll/ScrollbarTheme.h" | 39 #include "platform/scroll/ScrollbarTheme.h" |
| 40 #include "platform/scroll/SmoothScrollSequencer.h" |
| 40 | 41 |
| 41 static const int kPixelsPerLineStep = 40; | 42 static const int kPixelsPerLineStep = 40; |
| 42 static const float kMinFractionToStepWhenPaging = 0.875f; | 43 static const float kMinFractionToStepWhenPaging = 0.875f; |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 | 46 |
| 46 int ScrollableArea::PixelsPerLineStep(PlatformChromeClient* host) { | 47 int ScrollableArea::PixelsPerLineStep(PlatformChromeClient* host) { |
| 47 if (!host) | 48 if (!host) |
| 48 return kPixelsPerLineStep; | 49 return kPixelsPerLineStep; |
| 49 return host->WindowToViewportScalar(kPixelsPerLineStep); | 50 return host->WindowToViewportScalar(kPixelsPerLineStep); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // TODO(bokan): The userScroll method should probably be modified to call this | 249 // TODO(bokan): The userScroll method should probably be modified to call this |
| 249 // method and ScrollAnimatorBase to have a simpler | 250 // method and ScrollAnimatorBase to have a simpler |
| 250 // animateToOffset method like the ProgrammaticScrollAnimator. | 251 // animateToOffset method like the ProgrammaticScrollAnimator. |
| 251 DCHECK_EQ(scroll_behavior, kScrollBehaviorInstant); | 252 DCHECK_EQ(scroll_behavior, kScrollBehaviorInstant); |
| 252 GetScrollAnimator().ScrollToOffsetWithoutAnimation(ScrollOffset(x, y)); | 253 GetScrollAnimator().ScrollToOffsetWithoutAnimation(ScrollOffset(x, y)); |
| 253 } | 254 } |
| 254 | 255 |
| 255 LayoutRect ScrollableArea::ScrollIntoView(const LayoutRect& rect_in_content, | 256 LayoutRect ScrollableArea::ScrollIntoView(const LayoutRect& rect_in_content, |
| 256 const ScrollAlignment& align_x, | 257 const ScrollAlignment& align_x, |
| 257 const ScrollAlignment& align_y, | 258 const ScrollAlignment& align_y, |
| 259 bool is_smooth, |
| 258 ScrollType) { | 260 ScrollType) { |
| 259 // TODO(bokan): This should really be implemented here but ScrollAlignment is | 261 // TODO(bokan): This should really be implemented here but ScrollAlignment is |
| 260 // in Core which is a dependency violation. | 262 // in Core which is a dependency violation. |
| 261 NOTREACHED(); | 263 NOTREACHED(); |
| 262 return LayoutRect(); | 264 return LayoutRect(); |
| 263 } | 265 } |
| 264 | 266 |
| 265 void ScrollableArea::ScrollOffsetChanged(const ScrollOffset& offset, | 267 void ScrollableArea::ScrollOffsetChanged(const ScrollOffset& offset, |
| 266 ScrollType scroll_type) { | 268 ScrollType scroll_type) { |
| 267 TRACE_EVENT0("blink", "ScrollableArea::scrollOffsetChanged"); | 269 TRACE_EVENT0("blink", "ScrollableArea::scrollOffsetChanged"); |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 offset.y() - ScrollOrigin().Y()); | 673 offset.y() - ScrollOrigin().Y()); |
| 672 SetScrollOffset(new_offset, kCompositorScroll); | 674 SetScrollOffset(new_offset, kCompositorScroll); |
| 673 } | 675 } |
| 674 | 676 |
| 675 DEFINE_TRACE(ScrollableArea) { | 677 DEFINE_TRACE(ScrollableArea) { |
| 676 visitor->Trace(scroll_animator_); | 678 visitor->Trace(scroll_animator_); |
| 677 visitor->Trace(programmatic_scroll_animator_); | 679 visitor->Trace(programmatic_scroll_animator_); |
| 678 } | 680 } |
| 679 | 681 |
| 680 } // namespace blink | 682 } // namespace blink |
| OLD | NEW |