Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: Source/core/platform/ScrollView.h

Issue 16982005: Allow objects without scrollbars to be scrollable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Mac Build Fix Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; 49 virtual int scrollPosition(Scrollbar*) const OVERRIDE;
50 virtual void setScrollOffset(const IntPoint&) OVERRIDE; 50 virtual void setScrollOffset(const IntPoint&) OVERRIDE;
51 virtual bool isScrollCornerVisible() const OVERRIDE; 51 virtual bool isScrollCornerVisible() const OVERRIDE;
52 virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) OVERRIDE; 52 virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) OVERRIDE;
53 virtual bool isHorizontallyScrollable() const OVERRIDE;
54 virtual bool isVerticallyScrollable() const OVERRIDE;
53 55
54 virtual void notifyPageThatContentAreaWillPaint() const; 56 virtual void notifyPageThatContentAreaWillPaint() const;
55 57
56 // NOTE: This should only be called by the overriden setScrollOffset from Sc rollableArea. 58 // NOTE: This should only be called by the overriden setScrollOffset from Sc rollableArea.
57 virtual void scrollTo(const IntSize& newOffset); 59 virtual void scrollTo(const IntSize& newOffset);
58 60
59 // The window thats hosts the ScrollView. The ScrollView will communicate sc rolls and repaints to the 61 // 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. 62 // host window in the window's coordinate space.
61 virtual HostWindow* hostWindow() const = 0; 63 virtual HostWindow* hostWindow() const = 0;
62 64
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void setPaintsEntireContents(bool); 108 void setPaintsEntireContents(bool);
107 109
108 // By default, paint events are clipped to the visible area. If set to 110 // 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(). 111 // false, paint events are no longer clipped. paintsEntireContents() implie s !clipsRepaints().
110 bool clipsRepaints() const { return m_clipsRepaints; } 112 bool clipsRepaints() const { return m_clipsRepaints; }
111 void setClipsRepaints(bool); 113 void setClipsRepaints(bool);
112 114
113 // Overridden by FrameView to create custom CSS scrollbars if applicable. 115 // Overridden by FrameView to create custom CSS scrollbars if applicable.
114 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); 116 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
115 117
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 118 // 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). 119 // where it would cause rendering glitches (such as with fixed backgrounds o r when the view is partially transparent).
122 void setCanBlitOnScroll(bool); 120 void setCanBlitOnScroll(bool);
123 bool canBlitOnScroll() const; 121 bool canBlitOnScroll() const;
124 122
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 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
126 // and height. By default the scrollbars themselves are excluded from this r ectangle, but an optional boolean argument allows them to be 124 // and height. By default the scrollbars themselves are excluded from this r ectangle, but an optional boolean argument allows them to be
127 // included. 125 // included.
128 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = Ex cludeScrollbars) const OVERRIDE; 126 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = Ex cludeScrollbars) const OVERRIDE;
129 IntSize visibleSize() const { return visibleContentRect().size(); } 127 IntSize visibleSize() const { return visibleContentRect().size(); }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 301
304 private: 302 private:
305 RefPtr<Scrollbar> m_horizontalScrollbar; 303 RefPtr<Scrollbar> m_horizontalScrollbar;
306 RefPtr<Scrollbar> m_verticalScrollbar; 304 RefPtr<Scrollbar> m_verticalScrollbar;
307 ScrollbarMode m_horizontalScrollbarMode; 305 ScrollbarMode m_horizontalScrollbarMode;
308 ScrollbarMode m_verticalScrollbarMode; 306 ScrollbarMode m_verticalScrollbarMode;
309 307
310 bool m_horizontalScrollbarLock; 308 bool m_horizontalScrollbarLock;
311 bool m_verticalScrollbarLock; 309 bool m_verticalScrollbarLock;
312 310
313 bool m_prohibitsScrolling;
314
315 HashSet<RefPtr<Widget> > m_children; 311 HashSet<RefPtr<Widget> > m_children;
316 312
317 // This bool is unused on Mac OS because we directly ask the platform widget 313 // This bool is unused on Mac OS because we directly ask the platform widget
318 // whether it is safe to blit on scroll. 314 // whether it is safe to blit on scroll.
319 bool m_canBlitOnScroll; 315 bool m_canBlitOnScroll;
320 316
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. 317 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; 318 IntPoint m_cachedScrollPosition;
323 IntSize m_fixedLayoutSize; 319 IntSize m_fixedLayoutSize;
324 IntSize m_contentsSize; 320 IntSize m_contentsSize;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698