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

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: CR Fixes 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 userInputScrollable(ScrollbarOrientation) const OVERRIDE;
53 54
54 virtual void notifyPageThatContentAreaWillPaint() const; 55 virtual void notifyPageThatContentAreaWillPaint() const;
55 56
56 // NOTE: This should only be called by the overriden setScrollOffset from Sc rollableArea. 57 // NOTE: This should only be called by the overriden setScrollOffset from Sc rollableArea.
57 virtual void scrollTo(const IntSize& newOffset); 58 virtual void scrollTo(const IntSize& newOffset);
58 59
59 // The window thats hosts the ScrollView. The ScrollView will communicate sc rolls and repaints to the 60 // 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. 61 // host window in the window's coordinate space.
61 virtual HostWindow* hostWindow() const = 0; 62 virtual HostWindow* hostWindow() const = 0;
62 63
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void setPaintsEntireContents(bool); 107 void setPaintsEntireContents(bool);
107 108
108 // By default, paint events are clipped to the visible area. If set to 109 // 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(). 110 // false, paint events are no longer clipped. paintsEntireContents() implie s !clipsRepaints().
110 bool clipsRepaints() const { return m_clipsRepaints; } 111 bool clipsRepaints() const { return m_clipsRepaints; }
111 void setClipsRepaints(bool); 112 void setClipsRepaints(bool);
112 113
113 // Overridden by FrameView to create custom CSS scrollbars if applicable. 114 // Overridden by FrameView to create custom CSS scrollbars if applicable.
114 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); 115 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
115 116
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 117 // 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). 118 // where it would cause rendering glitches (such as with fixed backgrounds o r when the view is partially transparent).
122 void setCanBlitOnScroll(bool); 119 void setCanBlitOnScroll(bool);
123 bool canBlitOnScroll() const; 120 bool canBlitOnScroll() const;
124 121
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 122 // 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 123 // and height. By default the scrollbars themselves are excluded from this r ectangle, but an optional boolean argument allows them to be
127 // included. 124 // included.
128 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = Ex cludeScrollbars) const OVERRIDE; 125 virtual IntRect visibleContentRect(VisibleContentRectIncludesScrollbars = Ex cludeScrollbars) const OVERRIDE;
129 IntSize visibleSize() const { return visibleContentRect().size(); } 126 IntSize visibleSize() const { return visibleContentRect().size(); }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 300
304 private: 301 private:
305 RefPtr<Scrollbar> m_horizontalScrollbar; 302 RefPtr<Scrollbar> m_horizontalScrollbar;
306 RefPtr<Scrollbar> m_verticalScrollbar; 303 RefPtr<Scrollbar> m_verticalScrollbar;
307 ScrollbarMode m_horizontalScrollbarMode; 304 ScrollbarMode m_horizontalScrollbarMode;
308 ScrollbarMode m_verticalScrollbarMode; 305 ScrollbarMode m_verticalScrollbarMode;
309 306
310 bool m_horizontalScrollbarLock; 307 bool m_horizontalScrollbarLock;
311 bool m_verticalScrollbarLock; 308 bool m_verticalScrollbarLock;
312 309
313 bool m_prohibitsScrolling;
314
315 HashSet<RefPtr<Widget> > m_children; 310 HashSet<RefPtr<Widget> > m_children;
316 311
317 // This bool is unused on Mac OS because we directly ask the platform widget 312 // This bool is unused on Mac OS because we directly ask the platform widget
318 // whether it is safe to blit on scroll. 313 // whether it is safe to blit on scroll.
319 bool m_canBlitOnScroll; 314 bool m_canBlitOnScroll;
320 315
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. 316 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; 317 IntPoint m_cachedScrollPosition;
323 IntSize m_fixedLayoutSize; 318 IntSize m_fixedLayoutSize;
324 IntSize m_contentsSize; 319 IntSize m_contentsSize;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 ASSERT(!widget || widget->isScrollView()); 376 ASSERT(!widget || widget->isScrollView());
382 return static_cast<const ScrollView*>(widget); 377 return static_cast<const ScrollView*>(widget);
383 } 378 }
384 379
385 // This will catch anyone doing an unnecessary cast. 380 // This will catch anyone doing an unnecessary cast.
386 void toScrollView(const ScrollView*); 381 void toScrollView(const ScrollView*);
387 382
388 } // namespace WebCore 383 } // namespace WebCore
389 384
390 #endif // ScrollView_h 385 #endif // ScrollView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698