Chromium Code Reviews| 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 HostWindow; | 48 class HostWindow; |
| 49 class LayoutBox; | 49 class LayoutBox; |
| 50 class LayoutObject; | 50 class LayoutObject; |
| 51 class PaintLayer; | 51 class PaintLayer; |
| 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 ExcludeScrollbars, | 60 ExcludeScrollbars, |
| 60 IncludeScrollbars, | 61 IncludeScrollbars, |
| 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(HostWindow*); | 69 static int pixelsPerLineStep(HostWindow*); |
| 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 // The window that hosts the ScrollableArea. The ScrollableArea will | 79 // The window that hosts the ScrollableArea. The ScrollableArea will |
| 79 // communicate scrolls and repaints to the host window in the window's | 80 // communicate scrolls and repaints to the host window in the window's |
| 80 // coordinate space. | 81 // coordinate space. |
| 81 virtual HostWindow* getHostWindow() const { return 0; } | 82 virtual HostWindow* getHostWindow() const { return 0; } |
| 82 | 83 |
| 84 virtual SmoothScrollSequencer* getSmoothScrollSequencer() const { return 0; } | |
|
bokan
2017/04/07 15:56:52
nit: return nullptr
sunyunjia
2017/05/12 18:40:25
Done.
| |
| 85 | |
| 83 virtual ScrollResult userScroll(ScrollGranularity, const ScrollOffset&); | 86 virtual ScrollResult userScroll(ScrollGranularity, const ScrollOffset&); |
| 84 | 87 |
| 85 virtual void setScrollOffset(const ScrollOffset&, | 88 virtual void setScrollOffset(const ScrollOffset&, |
| 86 ScrollType, | 89 ScrollType, |
| 87 ScrollBehavior = ScrollBehaviorInstant); | 90 ScrollBehavior = ScrollBehaviorInstant); |
| 88 virtual void scrollBy(const ScrollOffset&, | 91 virtual void scrollBy(const ScrollOffset&, |
| 89 ScrollType, | 92 ScrollType, |
| 90 ScrollBehavior = ScrollBehaviorInstant); | 93 ScrollBehavior = ScrollBehaviorInstant); |
| 91 void setScrollOffsetSingleAxis(ScrollbarOrientation, | 94 void setScrollOffsetSingleAxis(ScrollbarOrientation, |
| 92 float, | 95 float, |
| 93 ScrollType, | 96 ScrollType, |
| 94 ScrollBehavior = ScrollBehaviorInstant); | 97 ScrollBehavior = ScrollBehaviorInstant); |
| 95 | 98 |
| 96 // Scrolls the area so that the given rect, given in the document's content | 99 // Scrolls the area so that the given rect, given in the document's content |
| 97 // coordinates, such that it's visible in the area. Returns the new location | 100 // coordinates, such that it's visible in the area. Returns the new location |
| 98 // of the input rect relative once again to the document. | 101 // of the input rect relative once again to the document. |
| 99 // Note, in the case of a Document container, such as FrameView, the output | 102 // Note, in the case of a Document container, such as FrameView, the output |
| 100 // will always be the input rect since scrolling it can't change the location | 103 // will always be the input rect since scrolling it can't change the location |
| 101 // of content relative to the document, unlike an overflowing element. | 104 // of content relative to the document, unlike an overflowing element. |
| 102 virtual LayoutRect scrollIntoView(const LayoutRect& rectInContent, | 105 virtual LayoutRect scrollIntoView(const LayoutRect& rectInContent, |
| 103 const ScrollAlignment& alignX, | 106 const ScrollAlignment& alignX, |
| 104 const ScrollAlignment& alignY, | 107 const ScrollAlignment& alignY, |
| 105 ScrollType = ProgrammaticScroll); | 108 ScrollType = ProgrammaticScroll, |
| 109 bool isSmooth = false); | |
| 106 | 110 |
| 107 static bool scrollBehaviorFromString(const String&, ScrollBehavior&); | 111 static bool scrollBehaviorFromString(const String&, ScrollBehavior&); |
| 108 | 112 |
| 109 void contentAreaWillPaint() const; | 113 void contentAreaWillPaint() const; |
| 110 void mouseEnteredContentArea() const; | 114 void mouseEnteredContentArea() const; |
| 111 void mouseExitedContentArea() const; | 115 void mouseExitedContentArea() const; |
| 112 void mouseMovedInContentArea() const; | 116 void mouseMovedInContentArea() const; |
| 113 void mouseEnteredScrollbar(Scrollbar&); | 117 void mouseEnteredScrollbar(Scrollbar&); |
| 114 void mouseExitedScrollbar(Scrollbar&); | 118 void mouseExitedScrollbar(Scrollbar&); |
| 115 void mouseCapturedScrollbar(); | 119 void mouseCapturedScrollbar(); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 // vertical-lr / ltr NO NO | 465 // vertical-lr / ltr NO NO |
| 462 // vertical-lr / rtl NO YES | 466 // vertical-lr / rtl NO YES |
| 463 // vertical-rl / ltr YES NO | 467 // vertical-rl / ltr YES NO |
| 464 // vertical-rl / rtl YES YES | 468 // vertical-rl / rtl YES YES |
| 465 IntPoint m_scrollOrigin; | 469 IntPoint m_scrollOrigin; |
| 466 }; | 470 }; |
| 467 | 471 |
| 468 } // namespace blink | 472 } // namespace blink |
| 469 | 473 |
| 470 #endif // ScrollableArea_h | 474 #endif // ScrollableArea_h |
| OLD | NEW |