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

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

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Support renderer-less plugin disposal Created 6 years, 2 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 12 matching lines...) Expand all
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #ifndef ScrollView_h 27 #ifndef ScrollView_h
28 #define ScrollView_h 28 #define ScrollView_h
29 29
30 #include "platform/PlatformExport.h" 30 #include "platform/PlatformExport.h"
31 #include "platform/Widget.h" 31 #include "platform/Widget.h"
32 #include "platform/geometry/IntRect.h" 32 #include "platform/geometry/IntRect.h"
33 #include "platform/heap/Handle.h"
33 #include "platform/scroll/ScrollTypes.h" 34 #include "platform/scroll/ScrollTypes.h"
34 #include "platform/scroll/ScrollableArea.h" 35 #include "platform/scroll/ScrollableArea.h"
35 #include "platform/scroll/Scrollbar.h" 36 #include "platform/scroll/Scrollbar.h"
36 37
37 #include "wtf/HashSet.h" 38 #include "wtf/HashSet.h"
38 #include "wtf/TemporaryChange.h" 39 #include "wtf/TemporaryChange.h"
39 40
40 namespace blink { 41 namespace blink {
41 42
42 class Scrollbar; 43 class Scrollbar;
43 44
44 class PLATFORM_EXPORT ScrollView : public Widget, public ScrollableArea { 45 class PLATFORM_EXPORT ScrollView : public Widget, public ScrollableArea {
45 public: 46 public:
46 virtual ~ScrollView(); 47 virtual ~ScrollView();
47 48
49 virtual void trace(Visitor*) OVERRIDE;
50
48 // ScrollableArea functions. 51 // ScrollableArea functions.
49 virtual int scrollSize(ScrollbarOrientation) const override; 52 virtual int scrollSize(ScrollbarOrientation) const override;
50 virtual void setScrollOffset(const IntPoint&) override; 53 virtual void setScrollOffset(const IntPoint&) override;
51 virtual void setScrollOffset(const DoublePoint&) override; 54 virtual void setScrollOffset(const DoublePoint&) override;
52 virtual bool isScrollCornerVisible() const override; 55 virtual bool isScrollCornerVisible() const override;
53 virtual void scrollbarStyleChanged() override; 56 virtual void scrollbarStyleChanged() override;
54 virtual bool userInputScrollable(ScrollbarOrientation) const override; 57 virtual bool userInputScrollable(ScrollbarOrientation) const override;
55 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override; 58 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override;
56 59
57 virtual void notifyPageThatContentAreaWillPaint() const; 60 virtual void notifyPageThatContentAreaWillPaint() const;
58 61
59 // The window that hosts the ScrollView. The ScrollView will communicate scr olls and repaints to the 62 // The window that hosts the ScrollView. The ScrollView will communicate scr olls and repaints to the
60 // host window in the window's coordinate space. 63 // host window in the window's coordinate space.
61 virtual HostWindow* hostWindow() const = 0; 64 virtual HostWindow* hostWindow() const = 0;
62 65
63 // Returns a clip rect in host window coordinates. Used to clip the blit on a scroll. 66 // Returns a clip rect in host window coordinates. Used to clip the blit on a scroll.
64 virtual IntRect windowClipRect(IncludeScrollbarsInRect = ExcludeScrollbars) const = 0; 67 virtual IntRect windowClipRect(IncludeScrollbarsInRect = ExcludeScrollbars) const = 0;
65 68
69 typedef WillBeHeapHashSet<RefPtrWillBeMember<Widget> > ChildrenWidgetSet;
70
66 // Functions for child manipulation and inspection. 71 // Functions for child manipulation and inspection.
67 const HashSet<RefPtr<Widget> >* children() const { return &m_children; } 72 const ChildrenWidgetSet* children() const { return &m_children; }
68 virtual void addChild(PassRefPtr<Widget>); 73 virtual void addChild(PassRefPtrWillBeRawPtr<Widget>);
69 virtual void removeChild(Widget*); 74 virtual void removeChild(Widget*);
70 75
71 // If the scroll view does not use a native widget, then it will have cross- platform Scrollbars. These functions 76 // If the scroll view does not use a native widget, then it will have cross- platform Scrollbars. These functions
72 // can be used to obtain those scrollbars. 77 // can be used to obtain those scrollbars.
73 virtual Scrollbar* horizontalScrollbar() const override { return m_horizonta lScrollbar.get(); } 78 virtual Scrollbar* horizontalScrollbar() const override { return m_horizonta lScrollbar.get(); }
74 virtual Scrollbar* verticalScrollbar() const override { return m_verticalScr ollbar.get(); } 79 virtual Scrollbar* verticalScrollbar() const override { return m_verticalScr ollbar.get(); }
75 virtual bool isScrollViewScrollbar(const Widget* child) const override { ret urn horizontalScrollbar() == child || verticalScrollbar() == child; } 80 virtual bool isScrollViewScrollbar(const Widget* child) const override { ret urn horizontalScrollbar() == child || verticalScrollbar() == child; }
76 81
77 void positionScrollbarLayers(); 82 void positionScrollbarLayers();
78 83
(...skipping 18 matching lines...) Expand all
97 102
98 virtual void setCanHaveScrollbars(bool); 103 virtual void setCanHaveScrollbars(bool);
99 bool canHaveScrollbars() const { return horizontalScrollbarMode() != Scrollb arAlwaysOff || verticalScrollbarMode() != ScrollbarAlwaysOff; } 104 bool canHaveScrollbars() const { return horizontalScrollbarMode() != Scrollb arAlwaysOff || verticalScrollbarMode() != ScrollbarAlwaysOff; }
100 105
101 // 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
102 // false, paint events are no longer clipped. 107 // false, paint events are no longer clipped.
103 bool clipsPaintInvalidations() const { return m_clipsRepaints; } 108 bool clipsPaintInvalidations() const { return m_clipsRepaints; }
104 void setClipsRepaints(bool); 109 void setClipsRepaints(bool);
105 110
106 // Overridden by FrameView to create custom CSS scrollbars if applicable. 111 // Overridden by FrameView to create custom CSS scrollbars if applicable.
107 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); 112 virtual PassRefPtrWillBeRawPtr<Scrollbar> createScrollbar(ScrollbarOrientati on);
108 113
109 // The visible content rect has a location that is the scrolled offset of th e document. The width and height are the viewport width 114 // The visible content rect has a location that is the scrolled offset of th e document. The width and height are the viewport width
110 // and height. By default the scrollbars themselves are excluded from this r ectangle, but an optional boolean argument allows them to be 115 // and height. By default the scrollbars themselves are excluded from this r ectangle, but an optional boolean argument allows them to be
111 // included. 116 // included.
112 virtual IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollba rs) const override; 117 virtual IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollba rs) const override;
113 IntSize visibleSize() const { return visibleContentRect().size(); } 118 IntSize visibleSize() const { return visibleContentRect().size(); }
114 119
115 // visibleContentRect().size() is computed from unscaledVisibleContentSize() divided by the value of visibleContentScaleFactor. 120 // visibleContentRect().size() is computed from unscaledVisibleContentSize() divided by the value of visibleContentScaleFactor.
116 // For the main frame, visibleContentScaleFactor is equal to the page's page ScaleFactor; it's 1 otherwise. 121 // For the main frame, visibleContentScaleFactor is equal to the page's page ScaleFactor; it's 1 otherwise.
117 IntSize unscaledVisibleContentSize(IncludeScrollbarsInRect = ExcludeScrollba rs) const; 122 IntSize unscaledVisibleContentSize(IncludeScrollbarsInRect = ExcludeScrollba rs) const;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 virtual bool scrollbarsDisabled() const { return false; } 311 virtual bool scrollbarsDisabled() const { return false; }
307 312
308 private: 313 private:
309 bool adjustScrollbarExistence(ComputeScrollbarExistenceOption = FirstPass); 314 bool adjustScrollbarExistence(ComputeScrollbarExistenceOption = FirstPass);
310 void adjustScrollbarOpacity(); 315 void adjustScrollbarOpacity();
311 // FIXME(bokan): setScrollOffset, setScrollPosition, scrollTo, scrollToOffse tWithoutAnimation, 316 // FIXME(bokan): setScrollOffset, setScrollPosition, scrollTo, scrollToOffse tWithoutAnimation,
312 // notifyScrollPositionChanged...there's too many ways to scroll this class. This needs 317 // notifyScrollPositionChanged...there's too many ways to scroll this class. This needs
313 // some cleanup. 318 // some cleanup.
314 void setScrollOffsetFromUpdateScrollbars(const IntSize&); 319 void setScrollOffsetFromUpdateScrollbars(const IntSize&);
315 320
316 RefPtr<Scrollbar> m_horizontalScrollbar; 321 RefPtrWillBeMember<Scrollbar> m_horizontalScrollbar;
317 RefPtr<Scrollbar> m_verticalScrollbar; 322 RefPtrWillBeMember<Scrollbar> m_verticalScrollbar;
318 ScrollbarMode m_horizontalScrollbarMode; 323 ScrollbarMode m_horizontalScrollbarMode;
319 ScrollbarMode m_verticalScrollbarMode; 324 ScrollbarMode m_verticalScrollbarMode;
320 325
321 bool m_horizontalScrollbarLock; 326 bool m_horizontalScrollbarLock;
322 bool m_verticalScrollbarLock; 327 bool m_verticalScrollbarLock;
323 328
324 HashSet<RefPtr<Widget> > m_children; 329 ChildrenWidgetSet m_children;
325 330
326 DoubleSize m_pendingScrollDelta; 331 DoubleSize m_pendingScrollDelta;
327 DoublePoint m_scrollPosition; 332 DoublePoint m_scrollPosition;
328 DoublePoint m_cachedScrollPosition; 333 DoublePoint m_cachedScrollPosition;
329 IntSize m_contentsSize; 334 IntSize m_contentsSize;
330 335
331 int m_scrollbarsAvoidingResizer; 336 int m_scrollbarsAvoidingResizer;
332 bool m_scrollbarsSuppressed; 337 bool m_scrollbarsSuppressed;
333 338
334 bool m_inUpdateScrollbars; 339 bool m_inUpdateScrollbars;
(...skipping 10 matching lines...) Expand all
345 350
346 void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntR ect& verticalOverhangRect); 351 void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntR ect& verticalOverhangRect);
347 void updateOverhangAreas(); 352 void updateOverhangAreas();
348 }; // class ScrollView 353 }; // class ScrollView
349 354
350 DEFINE_TYPE_CASTS(ScrollView, Widget, widget, widget->isScrollView(), widget.isS crollView()); 355 DEFINE_TYPE_CASTS(ScrollView, Widget, widget, widget->isScrollView(), widget.isS crollView());
351 356
352 } // namespace blink 357 } // namespace blink
353 358
354 #endif // ScrollView_h 359 #endif // ScrollView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698