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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
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 | 174 |
175 virtual void reportMemoryUsage(MemoryObjectInfo*) const; | 175 virtual void reportMemoryUsage(MemoryObjectInfo*) const; |
176 | 176 |
| 177 // Convenience functions |
| 178 int scrollPosition(ScrollbarOrientation orientation) { return orientation ==
HorizontalScrollbar ? scrollPosition().x() : scrollPosition().y(); } |
| 179 int minimumScrollPosition(ScrollbarOrientation orientation) { return orienta
tion == HorizontalScrollbar ? minimumScrollPosition().x() : minimumScrollPositio
n().y(); } |
| 180 int maximumScrollPosition(ScrollbarOrientation orientation) { return orienta
tion == HorizontalScrollbar ? maximumScrollPosition().x() : maximumScrollPositio
n().y(); } |
| 181 int clampScrollPosition(ScrollbarOrientation orientation, int pos) { return
std::max(std::min(pos, maximumScrollPosition(orientation)), minimumScrollPositi
on(orientation)); } |
| 182 |
177 protected: | 183 protected: |
178 ScrollableArea(); | 184 ScrollableArea(); |
179 virtual ~ScrollableArea(); | 185 virtual ~ScrollableArea(); |
180 | 186 |
181 void setScrollOrigin(const IntPoint&); | 187 void setScrollOrigin(const IntPoint&); |
182 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } | 188 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } |
183 | 189 |
184 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0; | 190 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0; |
185 virtual void invalidateScrollCornerRect(const IntRect&) = 0; | 191 virtual void invalidateScrollCornerRect(const IntRect&) = 0; |
186 | 192 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // vertical-lr / ltr NO NO | 235 // vertical-lr / ltr NO NO |
230 // vertical-lr / rtl NO YES | 236 // vertical-lr / rtl NO YES |
231 // vertical-rl / ltr YES NO | 237 // vertical-rl / ltr YES NO |
232 // vertical-rl / rtl YES YES | 238 // vertical-rl / rtl YES YES |
233 IntPoint m_scrollOrigin; | 239 IntPoint m_scrollOrigin; |
234 }; | 240 }; |
235 | 241 |
236 } // namespace WebCore | 242 } // namespace WebCore |
237 | 243 |
238 #endif // ScrollableArea_h | 244 #endif // ScrollableArea_h |
OLD | NEW |