OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Holger Hans Peter Freyther | 3 * Copyright (C) 2009 Holger Hans Peter Freyther |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Functions for getting/setting the size of the document contained inside t
he ScrollView (as an IntSize or as individual width and height | 137 // Functions for getting/setting the size of the document contained inside t
he ScrollView (as an IntSize or as individual width and height |
138 // values). | 138 // values). |
139 virtual IntSize contentsSize() const OVERRIDE; // Always at least as big as
the visibleWidth()/visibleHeight(). | 139 virtual IntSize contentsSize() const OVERRIDE; // Always at least as big as
the visibleWidth()/visibleHeight(). |
140 int contentsWidth() const { return contentsSize().width(); } | 140 int contentsWidth() const { return contentsSize().width(); } |
141 int contentsHeight() const { return contentsSize().height(); } | 141 int contentsHeight() const { return contentsSize().height(); } |
142 virtual void setContentsSize(const IntSize&); | 142 virtual void setContentsSize(const IntSize&); |
143 | 143 |
144 // Functions for querying the current scrolled position (both as a point, a
size, or as individual X and Y values). | 144 // Functions for querying the current scrolled position (both as a point, a
size, or as individual X and Y values). |
145 virtual IntPoint scrollPosition() const OVERRIDE { return visibleContentRect
().location(); } | 145 virtual IntPoint scrollPosition() const OVERRIDE { return visibleContentRect
().location(); } |
146 IntSize scrollOffset() const { return toIntSize(visibleContentRect().locatio
n()); } // Gets the scrolled position as an IntSize. Convenient for adding to ot
her sizes. | 146 IntSize scrollOffset() const { return toIntSize(visibleContentRect().locatio
n()); } // Gets the scrolled position as an IntSize. Convenient for adding to ot
her sizes. |
| 147 IntSize pendingScrollDelta() const { return m_pendingScrollDelta; } |
147 virtual IntPoint maximumScrollPosition() const OVERRIDE; // The maximum posi
tion we can be scrolled to. | 148 virtual IntPoint maximumScrollPosition() const OVERRIDE; // The maximum posi
tion we can be scrolled to. |
148 virtual IntPoint minimumScrollPosition() const OVERRIDE; // The minimum posi
tion we can be scrolled to. | 149 virtual IntPoint minimumScrollPosition() const OVERRIDE; // The minimum posi
tion we can be scrolled to. |
149 // Adjust the passed in scroll position to keep it between the minimum and m
aximum positions. | 150 // Adjust the passed in scroll position to keep it between the minimum and m
aximum positions. |
150 IntPoint adjustScrollPositionWithinRange(const IntPoint&) const; | 151 IntPoint adjustScrollPositionWithinRange(const IntPoint&) const; |
151 int scrollX() const { return scrollPosition().x(); } | 152 int scrollX() const { return scrollPosition().x(); } |
152 int scrollY() const { return scrollPosition().y(); } | 153 int scrollY() const { return scrollPosition().y(); } |
153 | 154 |
154 virtual IntSize overhangAmount() const OVERRIDE; | 155 virtual IntSize overhangAmount() const OVERRIDE; |
155 | 156 |
156 void cacheCurrentScrollPosition() { m_cachedScrollPosition = scrollPosition(
); } | 157 void cacheCurrentScrollPosition() { m_cachedScrollPosition = scrollPosition(
); } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalO
verhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect); | 262 virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalO
verhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect); |
262 | 263 |
263 virtual void scrollbarExistenceDidChange() = 0; | 264 virtual void scrollbarExistenceDidChange() = 0; |
264 // These functions are used to create/destroy scrollbars. | 265 // These functions are used to create/destroy scrollbars. |
265 void setHasHorizontalScrollbar(bool); | 266 void setHasHorizontalScrollbar(bool); |
266 void setHasVerticalScrollbar(bool); | 267 void setHasVerticalScrollbar(bool); |
267 | 268 |
268 virtual void updateScrollCorner(); | 269 virtual void updateScrollCorner(); |
269 virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE; | 270 virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE; |
270 | 271 |
| 272 virtual void scrollContentsIfNeeded(); |
271 // Scroll the content by blitting the pixels. | 273 // Scroll the content by blitting the pixels. |
272 virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRec
t& rectToScroll, const IntRect& clipRect); | 274 virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRec
t& rectToScroll, const IntRect& clipRect); |
273 // Scroll the content by invalidating everything. | 275 // Scroll the content by invalidating everything. |
274 virtual void scrollContentsSlowPath(const IntRect& updateRect); | 276 virtual void scrollContentsSlowPath(const IntRect& updateRect); |
275 | 277 |
276 void setScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updateP
ositionSynchronously); | 278 void setScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updateP
ositionSynchronously); |
277 | 279 |
278 // Subclassed by FrameView to check the writing-mode of the document. | 280 // Subclassed by FrameView to check the writing-mode of the document. |
279 virtual bool isVerticalDocument() const { return true; } | 281 virtual bool isVerticalDocument() const { return true; } |
280 virtual bool isFlippedDocument() const { return false; } | 282 virtual bool isFlippedDocument() const { return false; } |
281 | 283 |
282 // Called to update the scrollbars to accurately reflect the state of the vi
ew. | 284 // Called to update the scrollbars to accurately reflect the state of the vi
ew. |
283 void updateScrollbars(const IntSize& desiredOffset); | 285 void updateScrollbars(const IntSize& desiredOffset); |
284 | 286 |
285 IntSize excludeScrollbars(const IntSize&) const; | 287 IntSize excludeScrollbars(const IntSize&) const; |
286 | 288 |
287 private: | 289 private: |
288 RefPtr<Scrollbar> m_horizontalScrollbar; | 290 RefPtr<Scrollbar> m_horizontalScrollbar; |
289 RefPtr<Scrollbar> m_verticalScrollbar; | 291 RefPtr<Scrollbar> m_verticalScrollbar; |
290 ScrollbarMode m_horizontalScrollbarMode; | 292 ScrollbarMode m_horizontalScrollbarMode; |
291 ScrollbarMode m_verticalScrollbarMode; | 293 ScrollbarMode m_verticalScrollbarMode; |
292 | 294 |
293 bool m_horizontalScrollbarLock; | 295 bool m_horizontalScrollbarLock; |
294 bool m_verticalScrollbarLock; | 296 bool m_verticalScrollbarLock; |
295 | 297 |
296 HashSet<RefPtr<Widget> > m_children; | 298 HashSet<RefPtr<Widget> > m_children; |
297 | 299 |
| 300 IntSize m_pendingScrollDelta; |
298 IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but
we will wait to make this change until more code is shared. | 301 IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but
we will wait to make this change until more code is shared. |
299 IntPoint m_cachedScrollPosition; | 302 IntPoint m_cachedScrollPosition; |
300 IntSize m_contentsSize; | 303 IntSize m_contentsSize; |
301 | 304 |
302 int m_scrollbarsAvoidingResizer; | 305 int m_scrollbarsAvoidingResizer; |
303 bool m_scrollbarsSuppressed; | 306 bool m_scrollbarsSuppressed; |
304 | 307 |
305 bool m_inUpdateScrollbars; | 308 bool m_inUpdateScrollbars; |
306 unsigned m_updateScrollbarsPass; | 309 unsigned m_updateScrollbarsPass; |
307 | 310 |
308 IntPoint m_panScrollIconPoint; | 311 IntPoint m_panScrollIconPoint; |
309 bool m_drawPanScrollIcon; | 312 bool m_drawPanScrollIcon; |
310 | 313 |
311 bool m_paintsEntireContents; | 314 bool m_paintsEntireContents; |
312 bool m_clipsRepaints; | 315 bool m_clipsRepaints; |
313 | 316 |
314 void init(); | 317 void init(); |
315 void destroy(); | 318 void destroy(); |
316 | 319 |
317 IntRect rectToCopyOnScroll() const; | 320 IntRect rectToCopyOnScroll() const; |
318 | 321 |
319 // Called when the scroll position within this view changes. FrameView over
rides this to generate repaint invalidations. | |
320 virtual void repaintFixedElementsAfterScrolling() { } | |
321 virtual void updateFixedElementsAfterScrolling() { } | |
322 | |
323 void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntR
ect& verticalOverhangRect); | 322 void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntR
ect& verticalOverhangRect); |
324 void updateOverhangAreas(); | 323 void updateOverhangAreas(); |
325 | 324 |
326 virtual int pageStep(ScrollbarOrientation) const OVERRIDE; | 325 virtual int pageStep(ScrollbarOrientation) const OVERRIDE; |
327 }; // class ScrollView | 326 }; // class ScrollView |
328 | 327 |
329 DEFINE_TYPE_CASTS(ScrollView, Widget, widget, widget->isScrollView(), widget.isS
crollView()); | 328 DEFINE_TYPE_CASTS(ScrollView, Widget, widget, widget->isScrollView(), widget.isS
crollView()); |
330 | 329 |
331 } // namespace WebCore | 330 } // namespace WebCore |
332 | 331 |
333 #endif // ScrollView_h | 332 #endif // ScrollView_h |
OLD | NEW |