| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 void setPaintsEntireContents(bool); | 106 void setPaintsEntireContents(bool); |
| 107 | 107 |
| 108 // By default, paint events are clipped to the visible area. If set to | 108 // By default, paint events are clipped to the visible area. If set to |
| 109 // false, paint events are no longer clipped. paintsEntireContents() implie
s !clipsRepaints(). | 109 // false, paint events are no longer clipped. paintsEntireContents() implie
s !clipsRepaints(). |
| 110 bool clipsRepaints() const { return m_clipsRepaints; } | 110 bool clipsRepaints() const { return m_clipsRepaints; } |
| 111 void setClipsRepaints(bool); | 111 void setClipsRepaints(bool); |
| 112 | 112 |
| 113 // Overridden by FrameView to create custom CSS scrollbars if applicable. | 113 // Overridden by FrameView to create custom CSS scrollbars if applicable. |
| 114 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); | 114 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); |
| 115 | 115 |
| 116 // If the prohibits scrolling flag is set, then all scrolling in the view (e
ven programmatic scrolling) is turned off. | |
| 117 void setProhibitsScrolling(bool b) { m_prohibitsScrolling = b; } | |
| 118 bool prohibitsScrolling() const { return m_prohibitsScrolling; } | |
| 119 | |
| 120 // Whether or not a scroll view will blit visible contents when it is scroll
ed. Blitting is disabled in situations | 116 // Whether or not a scroll view will blit visible contents when it is scroll
ed. Blitting is disabled in situations |
| 121 // where it would cause rendering glitches (such as with fixed backgrounds o
r when the view is partially transparent). | 117 // where it would cause rendering glitches (such as with fixed backgrounds o
r when the view is partially transparent). |
| 122 void setCanBlitOnScroll(bool); | 118 void setCanBlitOnScroll(bool); |
| 123 bool canBlitOnScroll() const; | 119 bool canBlitOnScroll() const; |
| 124 | 120 |
| 125 // The visible content rect has a location that is the scrolled offset of th
e document. The width and height are the viewport width | 121 // The visible content rect has a location that is the scrolled offset of th
e document. The width and height are the viewport width |
| 126 // and height. By default the scrollbars themselves are excluded from this r
ectangle, but an optional boolean argument allows them to be | 122 // and height. By default the scrollbars themselves are excluded from this r
ectangle, but an optional boolean argument allows them to be |
| 127 // included. | 123 // included. |
| 128 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = Ex
cludeScrollbars) const OVERRIDE; | 124 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = Ex
cludeScrollbars) const OVERRIDE; |
| 129 IntSize visibleSize() const { return visibleContentRect().size(); } | 125 IntSize visibleSize() const { return visibleContentRect().size(); } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 299 |
| 304 private: | 300 private: |
| 305 RefPtr<Scrollbar> m_horizontalScrollbar; | 301 RefPtr<Scrollbar> m_horizontalScrollbar; |
| 306 RefPtr<Scrollbar> m_verticalScrollbar; | 302 RefPtr<Scrollbar> m_verticalScrollbar; |
| 307 ScrollbarMode m_horizontalScrollbarMode; | 303 ScrollbarMode m_horizontalScrollbarMode; |
| 308 ScrollbarMode m_verticalScrollbarMode; | 304 ScrollbarMode m_verticalScrollbarMode; |
| 309 | 305 |
| 310 bool m_horizontalScrollbarLock; | 306 bool m_horizontalScrollbarLock; |
| 311 bool m_verticalScrollbarLock; | 307 bool m_verticalScrollbarLock; |
| 312 | 308 |
| 313 bool m_prohibitsScrolling; | |
| 314 | |
| 315 HashSet<RefPtr<Widget> > m_children; | 309 HashSet<RefPtr<Widget> > m_children; |
| 316 | 310 |
| 317 // This bool is unused on Mac OS because we directly ask the platform widget | 311 // This bool is unused on Mac OS because we directly ask the platform widget |
| 318 // whether it is safe to blit on scroll. | 312 // whether it is safe to blit on scroll. |
| 319 bool m_canBlitOnScroll; | 313 bool m_canBlitOnScroll; |
| 320 | 314 |
| 321 IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but
we will wait to make this change until more code is shared. | 315 IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but
we will wait to make this change until more code is shared. |
| 322 IntPoint m_cachedScrollPosition; | 316 IntPoint m_cachedScrollPosition; |
| 323 IntSize m_fixedLayoutSize; | 317 IntSize m_fixedLayoutSize; |
| 324 IntSize m_contentsSize; | 318 IntSize m_contentsSize; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 bool platformScroll(ScrollDirection, ScrollGranularity); | 355 bool platformScroll(ScrollDirection, ScrollGranularity); |
| 362 void platformSetScrollbarsSuppressed(bool repaintOnUnsuppress); | 356 void platformSetScrollbarsSuppressed(bool repaintOnUnsuppress); |
| 363 void platformRepaintContentRectangle(const IntRect&); | 357 void platformRepaintContentRectangle(const IntRect&); |
| 364 bool platformIsOffscreen() const; | 358 bool platformIsOffscreen() const; |
| 365 void platformSetScrollbarOverlayStyle(ScrollbarOverlayStyle); | 359 void platformSetScrollbarOverlayStyle(ScrollbarOverlayStyle); |
| 366 | 360 |
| 367 void platformSetScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool
updatePositionSynchronously); | 361 void platformSetScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool
updatePositionSynchronously); |
| 368 | 362 |
| 369 void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntR
ect& verticalOverhangRect); | 363 void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntR
ect& verticalOverhangRect); |
| 370 void updateOverhangAreas(); | 364 void updateOverhangAreas(); |
| 365 |
| 366 int pageStep(ScrollbarOrientation) const; |
| 371 }; // class ScrollView | 367 }; // class ScrollView |
| 372 | 368 |
| 373 inline ScrollView* toScrollView(Widget* widget) | 369 inline ScrollView* toScrollView(Widget* widget) |
| 374 { | 370 { |
| 375 ASSERT(!widget || widget->isScrollView()); | 371 ASSERT(!widget || widget->isScrollView()); |
| 376 return static_cast<ScrollView*>(widget); | 372 return static_cast<ScrollView*>(widget); |
| 377 } | 373 } |
| 378 | 374 |
| 379 inline const ScrollView* toScrollView(const Widget* widget) | 375 inline const ScrollView* toScrollView(const Widget* widget) |
| 380 { | 376 { |
| 381 ASSERT(!widget || widget->isScrollView()); | 377 ASSERT(!widget || widget->isScrollView()); |
| 382 return static_cast<const ScrollView*>(widget); | 378 return static_cast<const ScrollView*>(widget); |
| 383 } | 379 } |
| 384 | 380 |
| 385 // This will catch anyone doing an unnecessary cast. | 381 // This will catch anyone doing an unnecessary cast. |
| 386 void toScrollView(const ScrollView*); | 382 void toScrollView(const ScrollView*); |
| 387 | 383 |
| 388 } // namespace WebCore | 384 } // namespace WebCore |
| 389 | 385 |
| 390 #endif // ScrollView_h | 386 #endif // ScrollView_h |
| OLD | NEW |