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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 return scrollbar->Widget::convertToContainingView(scrollbarPoint); | 125 return scrollbar->Widget::convertToContainingView(scrollbarPoint); |
126 } | 126 } |
127 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar* scrol lbar, const IntPoint& parentPoint) const | 127 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar* scrol lbar, const IntPoint& parentPoint) const |
128 { | 128 { |
129 return scrollbar->Widget::convertFromContainingView(parentPoint); | 129 return scrollbar->Widget::convertFromContainingView(parentPoint); |
130 } | 130 } |
131 | 131 |
132 virtual Scrollbar* horizontalScrollbar() const { return 0; } | 132 virtual Scrollbar* horizontalScrollbar() const { return 0; } |
133 virtual Scrollbar* verticalScrollbar() const { return 0; } | 133 virtual Scrollbar* verticalScrollbar() const { return 0; } |
134 | 134 |
135 virtual IntPoint scrollPosition() const; | 135 virtual IntPoint scrollPosition() const = 0; |
136 virtual IntPoint minimumScrollPosition() const; | 136 virtual IntPoint minimumScrollPosition() const; |
137 virtual IntPoint maximumScrollPosition() const; | 137 virtual IntPoint maximumScrollPosition() const; |
138 | 138 |
139 enum VisibleContentRectIncludesScrollbars { ExcludeScrollbars, IncludeScroll bars }; | 139 enum VisibleContentRectIncludesScrollbars { ExcludeScrollbars, IncludeScroll bars }; |
140 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = Ex cludeScrollbars) const; | 140 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = Ex cludeScrollbars) const; |
141 virtual int visibleHeight() const = 0; | 141 virtual int visibleHeight() const = 0; |
142 virtual int visibleWidth() const = 0; | 142 virtual int visibleWidth() const = 0; |
143 virtual IntSize contentsSize() const = 0; | 143 virtual IntSize contentsSize() const = 0; |
144 virtual IntSize overhangAmount() const { return IntSize(); } | 144 virtual IntSize overhangAmount() const { return IntSize(); } |
145 virtual IntPoint lastKnownMousePosition() const { return IntPoint(); } | 145 virtual IntPoint lastKnownMousePosition() const { return IntPoint(); } |
(...skipping 22 matching lines...) Expand all Loading... | |
168 // Let subclasses provide a way of asking for and servicing scroll | 168 // Let subclasses provide a way of asking for and servicing scroll |
169 // animations. | 169 // animations. |
170 virtual bool scheduleAnimation() { return false; } | 170 virtual bool scheduleAnimation() { return false; } |
171 void serviceScrollAnimations(); | 171 void serviceScrollAnimations(); |
172 | 172 |
173 virtual bool usesCompositedScrolling() const { return false; } | 173 virtual bool usesCompositedScrolling() const { return false; } |
174 virtual void updateNeedsCompositedScrolling() { } | 174 virtual void updateNeedsCompositedScrolling() { } |
175 | 175 |
176 virtual void reportMemoryUsage(MemoryObjectInfo*) const; | 176 virtual void reportMemoryUsage(MemoryObjectInfo*) const; |
177 | 177 |
178 virtual bool isHorizontallyScrollable() const = 0; | |
aelias_OOO_until_Jul13
2013/06/18 00:54:47
Instead of making each subclass implement this, ho
bokan
2013/06/18 23:03:27
The meaning of this method is more "is the object
aelias_OOO_until_Jul13
2013/06/19 02:55:24
So it really means scrollable by user input events
bokan
2013/06/19 18:57:00
Done.
| |
179 virtual bool isVerticallyScrollable() const = 0; | |
180 | |
178 // Convenience functions | 181 // Convenience functions |
179 int scrollPosition(ScrollbarOrientation orientation) { return orientation == HorizontalScrollbar ? scrollPosition().x() : scrollPosition().y(); } | 182 int scrollPosition(ScrollbarOrientation orientation) { return orientation == HorizontalScrollbar ? scrollPosition().x() : scrollPosition().y(); } |
180 int minimumScrollPosition(ScrollbarOrientation orientation) { return orienta tion == HorizontalScrollbar ? minimumScrollPosition().x() : minimumScrollPositio n().y(); } | 183 int minimumScrollPosition(ScrollbarOrientation orientation) { return orienta tion == HorizontalScrollbar ? minimumScrollPosition().x() : minimumScrollPositio n().y(); } |
181 int maximumScrollPosition(ScrollbarOrientation orientation) { return orienta tion == HorizontalScrollbar ? maximumScrollPosition().x() : maximumScrollPositio n().y(); } | 184 int maximumScrollPosition(ScrollbarOrientation orientation) { return orienta tion == HorizontalScrollbar ? maximumScrollPosition().x() : maximumScrollPositio n().y(); } |
182 int clampScrollPosition(ScrollbarOrientation orientation, int pos) { return std::max(std::min(pos, maximumScrollPosition(orientation)), minimumScrollPositi on(orientation)); } | 185 int clampScrollPosition(ScrollbarOrientation orientation, int pos) { return std::max(std::min(pos, maximumScrollPosition(orientation)), minimumScrollPositi on(orientation)); } |
183 | 186 |
184 protected: | 187 protected: |
185 ScrollableArea(); | 188 ScrollableArea(); |
186 virtual ~ScrollableArea(); | 189 virtual ~ScrollableArea(); |
187 | 190 |
(...skipping 10 matching lines...) Expand all Loading... | |
198 virtual GraphicsLayer* layerForScrollCorner() const { return 0; } | 201 virtual GraphicsLayer* layerForScrollCorner() const { return 0; } |
199 #if ENABLE(RUBBER_BANDING) | 202 #if ENABLE(RUBBER_BANDING) |
200 virtual GraphicsLayer* layerForOverhangAreas() const { return 0; } | 203 virtual GraphicsLayer* layerForOverhangAreas() const { return 0; } |
201 #endif | 204 #endif |
202 bool hasLayerForHorizontalScrollbar() const; | 205 bool hasLayerForHorizontalScrollbar() const; |
203 bool hasLayerForVerticalScrollbar() const; | 206 bool hasLayerForVerticalScrollbar() const; |
204 bool hasLayerForScrollCorner() const; | 207 bool hasLayerForScrollCorner() const; |
205 | 208 |
206 private: | 209 private: |
207 void scrollPositionChanged(const IntPoint&); | 210 void scrollPositionChanged(const IntPoint&); |
211 | |
212 bool isScrollable(ScrollbarOrientation orientation) const { return orientati on == HorizontalScrollbar ? isHorizontallyScrollable() : isVerticallyScrollable( ); } | |
208 | 213 |
209 // NOTE: Only called from the ScrollAnimator. | 214 // NOTE: Only called from the ScrollAnimator. |
210 friend class ScrollAnimator; | 215 friend class ScrollAnimator; |
211 void setScrollOffsetFromAnimation(const IntPoint&); | 216 void setScrollOffsetFromAnimation(const IntPoint&); |
212 | 217 |
213 // This function should be overriden by subclasses to perform the actual | 218 // This function should be overriden by subclasses to perform the actual |
214 // scroll of the content. | 219 // scroll of the content. |
215 virtual void setScrollOffset(const IntPoint&) = 0; | 220 virtual void setScrollOffset(const IntPoint&) = 0; |
216 | 221 |
217 mutable OwnPtr<ScrollAnimator> m_scrollAnimator; | 222 mutable OwnPtr<ScrollAnimator> m_scrollAnimator; |
(...skipping 18 matching lines...) Expand all Loading... | |
236 // vertical-lr / ltr NO NO | 241 // vertical-lr / ltr NO NO |
237 // vertical-lr / rtl NO YES | 242 // vertical-lr / rtl NO YES |
238 // vertical-rl / ltr YES NO | 243 // vertical-rl / ltr YES NO |
239 // vertical-rl / rtl YES YES | 244 // vertical-rl / rtl YES YES |
240 IntPoint m_scrollOrigin; | 245 IntPoint m_scrollOrigin; |
241 }; | 246 }; |
242 | 247 |
243 } // namespace WebCore | 248 } // namespace WebCore |
244 | 249 |
245 #endif // ScrollableArea_h | 250 #endif // ScrollableArea_h |
OLD | NEW |