OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2011 Apple 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 class CompositorAnimationTimeline; | 46 class CompositorAnimationTimeline; |
47 class GraphicsLayer; | 47 class GraphicsLayer; |
48 class LayoutBox; | 48 class LayoutBox; |
49 class LayoutObject; | 49 class LayoutObject; |
50 class PaintLayer; | 50 class PaintLayer; |
51 class PlatformChromeClient; | 51 class PlatformChromeClient; |
52 class ProgrammaticScrollAnimator; | 52 class ProgrammaticScrollAnimator; |
53 struct ScrollAlignment; | 53 struct ScrollAlignment; |
54 class ScrollAnchor; | 54 class ScrollAnchor; |
55 class ScrollAnimatorBase; | 55 class ScrollAnimatorBase; |
| 56 class SmoothScrollSequencer; |
56 class CompositorAnimationTimeline; | 57 class CompositorAnimationTimeline; |
57 | 58 |
58 enum IncludeScrollbarsInRect { | 59 enum IncludeScrollbarsInRect { |
59 kExcludeScrollbars, | 60 kExcludeScrollbars, |
60 kIncludeScrollbars, | 61 kIncludeScrollbars, |
61 }; | 62 }; |
62 | 63 |
63 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin, | 64 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin, |
64 public WebLayerScrollClient { | 65 public WebLayerScrollClient { |
65 WTF_MAKE_NONCOPYABLE(ScrollableArea); | 66 WTF_MAKE_NONCOPYABLE(ScrollableArea); |
66 | 67 |
67 public: | 68 public: |
68 static int PixelsPerLineStep(PlatformChromeClient*); | 69 static int PixelsPerLineStep(PlatformChromeClient*); |
69 static float MinFractionToStepWhenPaging(); | 70 static float MinFractionToStepWhenPaging(); |
70 static int MaxOverlapBetweenPages(); | 71 static int MaxOverlapBetweenPages(); |
71 | 72 |
72 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as | 73 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as |
73 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values. | 74 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values. |
74 static float NormalizeNonFiniteScroll(float value) { | 75 static float NormalizeNonFiniteScroll(float value) { |
75 return std::isfinite(value) ? value : 0.0; | 76 return std::isfinite(value) ? value : 0.0; |
76 } | 77 } |
77 | 78 |
78 virtual PlatformChromeClient* GetChromeClient() const { return 0; } | 79 virtual PlatformChromeClient* GetChromeClient() const { return 0; } |
79 | 80 |
| 81 virtual SmoothScrollSequencer* GetSmoothScrollSequencer() const { |
| 82 return nullptr; |
| 83 } |
| 84 |
80 virtual ScrollResult UserScroll(ScrollGranularity, const ScrollOffset&); | 85 virtual ScrollResult UserScroll(ScrollGranularity, const ScrollOffset&); |
81 | 86 |
82 virtual void SetScrollOffset(const ScrollOffset&, | 87 virtual void SetScrollOffset(const ScrollOffset&, |
83 ScrollType, | 88 ScrollType, |
84 ScrollBehavior = kScrollBehaviorInstant); | 89 ScrollBehavior = kScrollBehaviorInstant); |
85 virtual void ScrollBy(const ScrollOffset&, | 90 virtual void ScrollBy(const ScrollOffset&, |
86 ScrollType, | 91 ScrollType, |
87 ScrollBehavior = kScrollBehaviorInstant); | 92 ScrollBehavior = kScrollBehaviorInstant); |
88 void SetScrollOffsetSingleAxis(ScrollbarOrientation, | 93 void SetScrollOffsetSingleAxis(ScrollbarOrientation, |
89 float, | 94 float, |
90 ScrollType, | 95 ScrollType, |
91 ScrollBehavior = kScrollBehaviorInstant); | 96 ScrollBehavior = kScrollBehaviorInstant); |
92 | 97 |
93 // Scrolls the area so that the given rect, given in the document's content | 98 // Scrolls the area so that the given rect, given in the document's content |
94 // coordinates, such that it's visible in the area. Returns the new location | 99 // coordinates, such that it's visible in the area. Returns the new location |
95 // of the input rect relative once again to the document. | 100 // of the input rect relative once again to the document. |
96 // Note, in the case of a Document container, such as FrameView, the output | 101 // Note, in the case of a Document container, such as FrameView, the output |
97 // will always be the input rect since scrolling it can't change the location | 102 // will always be the input rect since scrolling it can't change the location |
98 // of content relative to the document, unlike an overflowing element. | 103 // of content relative to the document, unlike an overflowing element. |
99 virtual LayoutRect ScrollIntoView(const LayoutRect& rect_in_content, | 104 virtual LayoutRect ScrollIntoView(const LayoutRect& rect_in_content, |
100 const ScrollAlignment& align_x, | 105 const ScrollAlignment& align_x, |
101 const ScrollAlignment& align_y, | 106 const ScrollAlignment& align_y, |
| 107 bool is_smooth, |
102 ScrollType = kProgrammaticScroll); | 108 ScrollType = kProgrammaticScroll); |
103 | 109 |
104 static bool ScrollBehaviorFromString(const String&, ScrollBehavior&); | 110 static bool ScrollBehaviorFromString(const String&, ScrollBehavior&); |
105 | 111 |
106 void ContentAreaWillPaint() const; | 112 void ContentAreaWillPaint() const; |
107 void MouseEnteredContentArea() const; | 113 void MouseEnteredContentArea() const; |
108 void MouseExitedContentArea() const; | 114 void MouseExitedContentArea() const; |
109 void MouseMovedInContentArea() const; | 115 void MouseMovedInContentArea() const; |
110 void MouseEnteredScrollbar(Scrollbar&); | 116 void MouseEnteredScrollbar(Scrollbar&); |
111 void MouseExitedScrollbar(Scrollbar&); | 117 void MouseExitedScrollbar(Scrollbar&); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 411 } |
406 void ShowOverlayScrollbars(); | 412 void ShowOverlayScrollbars(); |
407 | 413 |
408 // Called when scrollbar hides/shows for overlay scrollbars. This callback | 414 // Called when scrollbar hides/shows for overlay scrollbars. This callback |
409 // shouldn't do any significant work as it can be called unexpectadly often | 415 // shouldn't do any significant work as it can be called unexpectadly often |
410 // on Mac. This happens because painting code has to set alpha to 1, paint, | 416 // on Mac. This happens because painting code has to set alpha to 1, paint, |
411 // then reset to alpha, causing spurrious "visibilityChanged" calls. | 417 // then reset to alpha, causing spurrious "visibilityChanged" calls. |
412 virtual void ScrollbarVisibilityChanged() {} | 418 virtual void ScrollbarVisibilityChanged() {} |
413 | 419 |
414 private: | 420 private: |
415 void ProgrammaticScrollHelper(const ScrollOffset&, ScrollBehavior); | 421 void ProgrammaticScrollHelper(const ScrollOffset&, ScrollBehavior, bool); |
416 void UserScrollHelper(const ScrollOffset&, ScrollBehavior); | 422 void UserScrollHelper(const ScrollOffset&, ScrollBehavior); |
417 | 423 |
418 void FadeOverlayScrollbarsTimerFired(TimerBase*); | 424 void FadeOverlayScrollbarsTimerFired(TimerBase*); |
419 | 425 |
420 // This function should be overriden by subclasses to perform the actual | 426 // This function should be overriden by subclasses to perform the actual |
421 // scroll of the content. | 427 // scroll of the content. |
422 virtual void UpdateScrollOffset(const ScrollOffset&, ScrollType) = 0; | 428 virtual void UpdateScrollOffset(const ScrollOffset&, ScrollType) = 0; |
423 | 429 |
424 virtual int LineStep(ScrollbarOrientation) const; | 430 virtual int LineStep(ScrollbarOrientation) const; |
425 virtual int PageStep(ScrollbarOrientation) const; | 431 virtual int PageStep(ScrollbarOrientation) const; |
(...skipping 30 matching lines...) Expand all Loading... |
456 // vertical-lr / ltr NO NO | 462 // vertical-lr / ltr NO NO |
457 // vertical-lr / rtl NO YES | 463 // vertical-lr / rtl NO YES |
458 // vertical-rl / ltr YES NO | 464 // vertical-rl / ltr YES NO |
459 // vertical-rl / rtl YES YES | 465 // vertical-rl / rtl YES YES |
460 IntPoint scroll_origin_; | 466 IntPoint scroll_origin_; |
461 }; | 467 }; |
462 | 468 |
463 } // namespace blink | 469 } // namespace blink |
464 | 470 |
465 #endif // ScrollableArea_h | 471 #endif // ScrollableArea_h |
OLD | NEW |