| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 static int maxOverlapBetweenPages(); | 58 static int maxOverlapBetweenPages(); |
| 59 | 59 |
| 60 // The window that hosts the ScrollView. The ScrollView will communicate scr
olls and repaints to the | 60 // The window that hosts the ScrollView. The ScrollView will communicate scr
olls and repaints to the |
| 61 // host window in the window's coordinate space. | 61 // host window in the window's coordinate space. |
| 62 virtual HostWindow* hostWindow() const = 0; | 62 virtual HostWindow* hostWindow() const = 0; |
| 63 | 63 |
| 64 bool scroll(ScrollDirection, ScrollGranularity, float delta = 1); | 64 bool scroll(ScrollDirection, ScrollGranularity, float delta = 1); |
| 65 void scrollToOffsetWithoutAnimation(const FloatPoint&); | 65 void scrollToOffsetWithoutAnimation(const FloatPoint&); |
| 66 void scrollToOffsetWithoutAnimation(ScrollbarOrientation, float offset); | 66 void scrollToOffsetWithoutAnimation(ScrollbarOrientation, float offset); |
| 67 | 67 |
| 68 // Should be called when the scroll position changes externally, for example
if the scroll layer position | |
| 69 // is updated on the scrolling thread and we need to notify the main thread. | |
| 70 void notifyScrollPositionChanged(const IntPoint&); | |
| 71 | |
| 72 static bool scrollBehaviorFromString(const String&, ScrollBehavior&); | 68 static bool scrollBehaviorFromString(const String&, ScrollBehavior&); |
| 73 | 69 |
| 74 bool handleWheelEvent(const PlatformWheelEvent&); | 70 bool handleWheelEvent(const PlatformWheelEvent&); |
| 75 | 71 |
| 76 // Functions for controlling if you can scroll past the end of the document. | 72 // Functions for controlling if you can scroll past the end of the document. |
| 77 bool constrainsScrollingToContentEdge() const { return m_constrainsScrolling
ToContentEdge; } | 73 bool constrainsScrollingToContentEdge() const { return m_constrainsScrolling
ToContentEdge; } |
| 78 void setConstrainsScrollingToContentEdge(bool constrainsScrollingToContentEd
ge) { m_constrainsScrollingToContentEdge = constrainsScrollingToContentEdge; } | 74 void setConstrainsScrollingToContentEdge(bool constrainsScrollingToContentEd
ge) { m_constrainsScrollingToContentEdge = constrainsScrollingToContentEdge; } |
| 79 | 75 |
| 80 void setVerticalScrollElasticity(ScrollElasticity scrollElasticity) { m_vert
icalScrollElasticity = scrollElasticity; } | 76 void setVerticalScrollElasticity(ScrollElasticity scrollElasticity) { m_vert
icalScrollElasticity = scrollElasticity; } |
| 81 ScrollElasticity verticalScrollElasticity() const { return static_cast<Scrol
lElasticity>(m_verticalScrollElasticity); } | 77 ScrollElasticity verticalScrollElasticity() const { return static_cast<Scrol
lElasticity>(m_verticalScrollElasticity); } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 92 void contentAreaDidHide() const; | 88 void contentAreaDidHide() const; |
| 93 | 89 |
| 94 void finishCurrentScrollAnimations() const; | 90 void finishCurrentScrollAnimations() const; |
| 95 | 91 |
| 96 void didAddScrollbar(Scrollbar*, ScrollbarOrientation); | 92 void didAddScrollbar(Scrollbar*, ScrollbarOrientation); |
| 97 void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation); | 93 void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation); |
| 98 | 94 |
| 99 void contentsResized(); | 95 void contentsResized(); |
| 100 | 96 |
| 101 bool hasOverlayScrollbars() const; | 97 bool hasOverlayScrollbars() const; |
| 102 void setScrollbarOverlayStyle(ScrollbarOverlayStyle); | |
| 103 ScrollbarOverlayStyle scrollbarOverlayStyle() const { return static_cast<Scr
ollbarOverlayStyle>(m_scrollbarOverlayStyle); } | |
| 104 | 98 |
| 105 // This getter will create a ScrollAnimator if it doesn't already exist. | 99 // This getter will create a ScrollAnimator if it doesn't already exist. |
| 106 ScrollAnimator* scrollAnimator() const; | 100 ScrollAnimator* scrollAnimator() const; |
| 107 | 101 |
| 108 // This getter will return null if the ScrollAnimator hasn't been created ye
t. | 102 // This getter will return null if the ScrollAnimator hasn't been created ye
t. |
| 109 ScrollAnimator* existingScrollAnimator() const { return m_animators ? m_anim
ators->scrollAnimator.get() : 0; } | 103 ScrollAnimator* existingScrollAnimator() const { return m_animators ? m_anim
ators->scrollAnimator.get() : 0; } |
| 110 | 104 |
| 111 const IntPoint& scrollOrigin() const { return m_scrollOrigin; } | 105 const IntPoint& scrollOrigin() const { return m_scrollOrigin; } |
| 112 bool scrollOriginChanged() const { return m_scrollOriginChanged; } | 106 bool scrollOriginChanged() const { return m_scrollOriginChanged; } |
| 113 | 107 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 129 // scrollPosition is relative to the scrollOrigin. i.e. If the page is RTL | 123 // scrollPosition is relative to the scrollOrigin. i.e. If the page is RTL |
| 130 // then scrollPosition will be negative. | 124 // then scrollPosition will be negative. |
| 131 virtual IntPoint scrollPosition() const = 0; | 125 virtual IntPoint scrollPosition() const = 0; |
| 132 virtual IntPoint minimumScrollPosition() const = 0; | 126 virtual IntPoint minimumScrollPosition() const = 0; |
| 133 virtual IntPoint maximumScrollPosition() const = 0; | 127 virtual IntPoint maximumScrollPosition() const = 0; |
| 134 | 128 |
| 135 virtual IntSize contentsSize() const = 0; | 129 virtual IntSize contentsSize() const = 0; |
| 136 | 130 |
| 137 bool shouldSuspendScrollAnimations() const { return true; } | 131 bool shouldSuspendScrollAnimations() const { return true; } |
| 138 | 132 |
| 139 // NOTE: Only called from Internals for testing. | |
| 140 void setScrollOffsetFromInternals(const IntPoint&); | |
| 141 | |
| 142 IntPoint clampScrollPosition(const IntPoint&) const; | 133 IntPoint clampScrollPosition(const IntPoint&) const; |
| 143 | 134 |
| 144 // Let subclasses provide a way of asking for and servicing scroll | 135 // Let subclasses provide a way of asking for and servicing scroll |
| 145 // animations. | 136 // animations. |
| 146 bool scheduleAnimation(); | 137 bool scheduleAnimation(); |
| 147 void serviceScrollAnimations(double monotonicTime); | 138 void serviceScrollAnimations(double monotonicTime); |
| 148 | 139 |
| 149 // Returns true if the GraphicsLayer tree needs to be rebuilt. | 140 // Returns true if the GraphicsLayer tree needs to be rebuilt. |
| 150 virtual bool updateAfterCompositingChange() = 0; | 141 virtual bool updateAfterCompositingChange() = 0; |
| 151 | 142 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 struct ScrollableAreaAnimators { | 174 struct ScrollableAreaAnimators { |
| 184 OwnPtr<ScrollAnimator> scrollAnimator; | 175 OwnPtr<ScrollAnimator> scrollAnimator; |
| 185 }; | 176 }; |
| 186 | 177 |
| 187 mutable OwnPtr<ScrollableAreaAnimators> m_animators; | 178 mutable OwnPtr<ScrollableAreaAnimators> m_animators; |
| 188 unsigned m_constrainsScrollingToContentEdge : 1; | 179 unsigned m_constrainsScrollingToContentEdge : 1; |
| 189 | 180 |
| 190 unsigned m_verticalScrollElasticity : 2; // ScrollElasticity | 181 unsigned m_verticalScrollElasticity : 2; // ScrollElasticity |
| 191 unsigned m_horizontalScrollElasticity : 2; // ScrollElasticity | 182 unsigned m_horizontalScrollElasticity : 2; // ScrollElasticity |
| 192 | 183 |
| 193 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle | |
| 194 | |
| 195 unsigned m_scrollOriginChanged : 1; | 184 unsigned m_scrollOriginChanged : 1; |
| 196 | 185 |
| 197 // There are 8 possible combinations of writing mode and direction. Scroll o
rigin will be non-zero in the x or y axis | 186 // There are 8 possible combinations of writing mode and direction. Scroll o
rigin will be non-zero in the x or y axis |
| 198 // if there is any reversed direction or writing-mode. The combinations are: | 187 // if there is any reversed direction or writing-mode. The combinations are: |
| 199 // writing-mode / direction scrollOrigin.x() set scrollOrigin.y() set | 188 // writing-mode / direction scrollOrigin.x() set scrollOrigin.y() set |
| 200 // horizontal-tb / ltr NO NO | 189 // horizontal-tb / ltr NO NO |
| 201 // horizontal-tb / rtl YES NO | 190 // horizontal-tb / rtl YES NO |
| 202 // horizontal-bt / ltr NO YES | 191 // horizontal-bt / ltr NO YES |
| 203 // horizontal-bt / rtl YES YES | 192 // horizontal-bt / rtl YES YES |
| 204 // vertical-lr / ltr NO NO | 193 // vertical-lr / ltr NO NO |
| 205 // vertical-lr / rtl NO YES | 194 // vertical-lr / rtl NO YES |
| 206 // vertical-rl / ltr YES NO | 195 // vertical-rl / ltr YES NO |
| 207 // vertical-rl / rtl YES YES | 196 // vertical-rl / rtl YES YES |
| 208 IntPoint m_scrollOrigin; | 197 IntPoint m_scrollOrigin; |
| 209 }; | 198 }; |
| 210 | 199 |
| 211 } // namespace blink | 200 } // namespace blink |
| 212 | 201 |
| 213 #endif // SKY_ENGINE_PLATFORM_SCROLL_SCROLLABLEAREA_H_ | 202 #endif // SKY_ENGINE_PLATFORM_SCROLL_SCROLLABLEAREA_H_ |
| OLD | NEW |