| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 class HostWindow; | 40 class HostWindow; |
| 41 class Scrollbar; | 41 class Scrollbar; |
| 42 | 42 |
| 43 class ScrollView : public Widget, public ScrollableArea { | 43 class ScrollView : public Widget, public ScrollableArea { |
| 44 public: | 44 public: |
| 45 ~ScrollView(); | 45 ~ScrollView(); |
| 46 | 46 |
| 47 // ScrollableArea functions. | 47 // ScrollableArea functions. |
| 48 virtual int scrollSize(ScrollbarOrientation) const OVERRIDE; | 48 virtual int scrollSize(ScrollbarOrientation) const OVERRIDE; |
| 49 virtual int scrollPosition(Scrollbar*) const OVERRIDE; | |
| 50 virtual void setScrollOffset(const IntPoint&) OVERRIDE; | 49 virtual void setScrollOffset(const IntPoint&) OVERRIDE; |
| 51 virtual bool isScrollCornerVisible() const OVERRIDE; | 50 virtual bool isScrollCornerVisible() const OVERRIDE; |
| 52 virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) OVERRIDE; | 51 virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) OVERRIDE; |
| 52 virtual bool userInputScrollable(ScrollbarOrientation) const OVERRIDE; |
| 53 | 53 |
| 54 virtual void notifyPageThatContentAreaWillPaint() const; | 54 virtual void notifyPageThatContentAreaWillPaint() const; |
| 55 | 55 |
| 56 // NOTE: This should only be called by the overriden setScrollOffset from Sc
rollableArea. | 56 // NOTE: This should only be called by the overriden setScrollOffset from Sc
rollableArea. |
| 57 virtual void scrollTo(const IntSize& newOffset); | 57 virtual void scrollTo(const IntSize& newOffset); |
| 58 | 58 |
| 59 // The window thats hosts the ScrollView. The ScrollView will communicate sc
rolls and repaints to the | 59 // The window thats hosts the ScrollView. The ScrollView will communicate sc
rolls and repaints to the |
| 60 // host window in the window's coordinate space. | 60 // host window in the window's coordinate space. |
| 61 virtual HostWindow* hostWindow() const = 0; | 61 virtual HostWindow* hostWindow() const = 0; |
| 62 | 62 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 void setPaintsEntireContents(bool); | 104 void setPaintsEntireContents(bool); |
| 105 | 105 |
| 106 // By default, paint events are clipped to the visible area. If set to | 106 // By default, paint events are clipped to the visible area. If set to |
| 107 // false, paint events are no longer clipped. paintsEntireContents() implie
s !clipsRepaints(). | 107 // false, paint events are no longer clipped. paintsEntireContents() implie
s !clipsRepaints(). |
| 108 bool clipsRepaints() const { return m_clipsRepaints; } | 108 bool clipsRepaints() const { return m_clipsRepaints; } |
| 109 void setClipsRepaints(bool); | 109 void setClipsRepaints(bool); |
| 110 | 110 |
| 111 // Overridden by FrameView to create custom CSS scrollbars if applicable. | 111 // Overridden by FrameView to create custom CSS scrollbars if applicable. |
| 112 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); | 112 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); |
| 113 | 113 |
| 114 // If the prohibits scrolling flag is set, then all scrolling in the view (e
ven programmatic scrolling) is turned off. | |
| 115 void setProhibitsScrolling(bool b) { m_prohibitsScrolling = b; } | |
| 116 bool prohibitsScrolling() const { return m_prohibitsScrolling; } | |
| 117 | |
| 118 // Whether or not a scroll view will blit visible contents when it is scroll
ed. Blitting is disabled in situations | 114 // Whether or not a scroll view will blit visible contents when it is scroll
ed. Blitting is disabled in situations |
| 119 // where it would cause rendering glitches (such as with fixed backgrounds o
r when the view is partially transparent). | 115 // where it would cause rendering glitches (such as with fixed backgrounds o
r when the view is partially transparent). |
| 120 void setCanBlitOnScroll(bool); | 116 void setCanBlitOnScroll(bool); |
| 121 bool canBlitOnScroll() const; | 117 bool canBlitOnScroll() const; |
| 122 | 118 |
| 123 // The visible content rect has a location that is the scrolled offset of th
e document. The width and height are the viewport width | 119 // The visible content rect has a location that is the scrolled offset of th
e document. The width and height are the viewport width |
| 124 // and height. By default the scrollbars themselves are excluded from this r
ectangle, but an optional boolean argument allows them to be | 120 // and height. By default the scrollbars themselves are excluded from this r
ectangle, but an optional boolean argument allows them to be |
| 125 // included. | 121 // included. |
| 126 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = Ex
cludeScrollbars) const OVERRIDE; | 122 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = Ex
cludeScrollbars) const OVERRIDE; |
| 127 IntSize visibleSize() const { return visibleContentRect().size(); } | 123 IntSize visibleSize() const { return visibleContentRect().size(); } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 297 |
| 302 private: | 298 private: |
| 303 RefPtr<Scrollbar> m_horizontalScrollbar; | 299 RefPtr<Scrollbar> m_horizontalScrollbar; |
| 304 RefPtr<Scrollbar> m_verticalScrollbar; | 300 RefPtr<Scrollbar> m_verticalScrollbar; |
| 305 ScrollbarMode m_horizontalScrollbarMode; | 301 ScrollbarMode m_horizontalScrollbarMode; |
| 306 ScrollbarMode m_verticalScrollbarMode; | 302 ScrollbarMode m_verticalScrollbarMode; |
| 307 | 303 |
| 308 bool m_horizontalScrollbarLock; | 304 bool m_horizontalScrollbarLock; |
| 309 bool m_verticalScrollbarLock; | 305 bool m_verticalScrollbarLock; |
| 310 | 306 |
| 311 bool m_prohibitsScrolling; | |
| 312 | |
| 313 HashSet<RefPtr<Widget> > m_children; | 307 HashSet<RefPtr<Widget> > m_children; |
| 314 | 308 |
| 315 // This bool is unused on Mac OS because we directly ask the platform widget | 309 // This bool is unused on Mac OS because we directly ask the platform widget |
| 316 // whether it is safe to blit on scroll. | 310 // whether it is safe to blit on scroll. |
| 317 bool m_canBlitOnScroll; | 311 bool m_canBlitOnScroll; |
| 318 | 312 |
| 319 IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but
we will wait to make this change until more code is shared. | 313 IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but
we will wait to make this change until more code is shared. |
| 320 IntPoint m_cachedScrollPosition; | 314 IntPoint m_cachedScrollPosition; |
| 321 IntSize m_fixedLayoutSize; | 315 IntSize m_fixedLayoutSize; |
| 322 IntSize m_contentsSize; | 316 IntSize m_contentsSize; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 338 void destroy(); | 332 void destroy(); |
| 339 | 333 |
| 340 IntRect rectToCopyOnScroll() const; | 334 IntRect rectToCopyOnScroll() const; |
| 341 | 335 |
| 342 // Called when the scroll position within this view changes. FrameView over
rides this to generate repaint invalidations. | 336 // Called when the scroll position within this view changes. FrameView over
rides this to generate repaint invalidations. |
| 343 virtual void repaintFixedElementsAfterScrolling() { } | 337 virtual void repaintFixedElementsAfterScrolling() { } |
| 344 virtual void updateFixedElementsAfterScrolling() { } | 338 virtual void updateFixedElementsAfterScrolling() { } |
| 345 | 339 |
| 346 void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntR
ect& verticalOverhangRect); | 340 void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntR
ect& verticalOverhangRect); |
| 347 void updateOverhangAreas(); | 341 void updateOverhangAreas(); |
| 342 |
| 343 int pageStep(ScrollbarOrientation) const; |
| 348 }; // class ScrollView | 344 }; // class ScrollView |
| 349 | 345 |
| 350 inline ScrollView* toScrollView(Widget* widget) | 346 inline ScrollView* toScrollView(Widget* widget) |
| 351 { | 347 { |
| 352 ASSERT(!widget || widget->isScrollView()); | 348 ASSERT(!widget || widget->isScrollView()); |
| 353 return static_cast<ScrollView*>(widget); | 349 return static_cast<ScrollView*>(widget); |
| 354 } | 350 } |
| 355 | 351 |
| 356 inline const ScrollView* toScrollView(const Widget* widget) | 352 inline const ScrollView* toScrollView(const Widget* widget) |
| 357 { | 353 { |
| 358 ASSERT(!widget || widget->isScrollView()); | 354 ASSERT(!widget || widget->isScrollView()); |
| 359 return static_cast<const ScrollView*>(widget); | 355 return static_cast<const ScrollView*>(widget); |
| 360 } | 356 } |
| 361 | 357 |
| 362 // This will catch anyone doing an unnecessary cast. | 358 // This will catch anyone doing an unnecessary cast. |
| 363 void toScrollView(const ScrollView*); | 359 void toScrollView(const ScrollView*); |
| 364 | 360 |
| 365 } // namespace WebCore | 361 } // namespace WebCore |
| 366 | 362 |
| 367 #endif // ScrollView_h | 363 #endif // ScrollView_h |
| OLD | NEW |