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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollableArea.h

Issue 1511003003: Use refs for non-null GraphicsContext, Scrollbar, etc. in scrollbar related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarRemove
Patch Set: yet another mac fix Created 5 years 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) 2008, 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 static bool scrollBehaviorFromString(const String&, ScrollBehavior&); 99 static bool scrollBehaviorFromString(const String&, ScrollBehavior&);
100 100
101 bool inLiveResize() const { return m_inLiveResize; } 101 bool inLiveResize() const { return m_inLiveResize; }
102 void willStartLiveResize(); 102 void willStartLiveResize();
103 void willEndLiveResize(); 103 void willEndLiveResize();
104 104
105 void contentAreaWillPaint() const; 105 void contentAreaWillPaint() const;
106 void mouseEnteredContentArea() const; 106 void mouseEnteredContentArea() const;
107 void mouseExitedContentArea() const; 107 void mouseExitedContentArea() const;
108 void mouseMovedInContentArea() const; 108 void mouseMovedInContentArea() const;
109 void mouseEnteredScrollbar(Scrollbar*) const; 109 void mouseEnteredScrollbar(Scrollbar&) const;
110 void mouseExitedScrollbar(Scrollbar*) const; 110 void mouseExitedScrollbar(Scrollbar&) const;
111 void contentAreaDidShow() const; 111 void contentAreaDidShow() const;
112 void contentAreaDidHide() const; 112 void contentAreaDidHide() const;
113 113
114 void finishCurrentScrollAnimations() const; 114 void finishCurrentScrollAnimations() const;
115 115
116 virtual void didAddScrollbar(Scrollbar*, ScrollbarOrientation); 116 virtual void didAddScrollbar(Scrollbar&, ScrollbarOrientation);
117 virtual void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation); 117 virtual void willRemoveScrollbar(Scrollbar&, ScrollbarOrientation);
118 118
119 virtual void contentsResized(); 119 virtual void contentsResized();
120 120
121 bool hasOverlayScrollbars() const; 121 bool hasOverlayScrollbars() const;
122 void setScrollbarOverlayStyle(ScrollbarOverlayStyle); 122 void setScrollbarOverlayStyle(ScrollbarOverlayStyle);
123 ScrollbarOverlayStyle scrollbarOverlayStyle() const { return static_cast<Scr ollbarOverlayStyle>(m_scrollbarOverlayStyle); } 123 ScrollbarOverlayStyle scrollbarOverlayStyle() const { return static_cast<Scr ollbarOverlayStyle>(m_scrollbarOverlayStyle); }
124 124
125 // This getter will create a ScrollAnimatorBase if it doesn't already exist. 125 // This getter will create a ScrollAnimatorBase if it doesn't already exist.
126 ScrollAnimatorBase* scrollAnimator() const; 126 ScrollAnimatorBase& scrollAnimator() const;
127 127
128 // This getter will return null if the ScrollAnimatorBase hasn't been create d yet. 128 // This getter will return null if the ScrollAnimatorBase hasn't been create d yet.
129 ScrollAnimatorBase* existingScrollAnimator() const { return m_scrollAnimator .get(); } 129 ScrollAnimatorBase* existingScrollAnimator() const { return m_scrollAnimator .get(); }
130 130
131 ProgrammaticScrollAnimator* programmaticScrollAnimator() const; 131 ProgrammaticScrollAnimator& programmaticScrollAnimator() const;
132 ProgrammaticScrollAnimator* existingProgrammaticScrollAnimator() const { ret urn m_programmaticScrollAnimator.get(); } 132 ProgrammaticScrollAnimator* existingProgrammaticScrollAnimator() const { ret urn m_programmaticScrollAnimator.get(); }
133 133
134 const IntPoint& scrollOrigin() const { return m_scrollOrigin; } 134 const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
135 bool scrollOriginChanged() const { return m_scrollOriginChanged; } 135 bool scrollOriginChanged() const { return m_scrollOriginChanged; }
136 136
137 137
138 // This is used to determine whether the incoming fractional scroll offset s hould 138 // This is used to determine whether the incoming fractional scroll offset s hould
139 // be truncated to integer. Current rule is that if preferCompositingToLCDTe xtEnabled() 139 // be truncated to integer. Current rule is that if preferCompositingToLCDTe xtEnabled()
140 // is disabled (which is true on low-dpi device by default) we should do the truncation. 140 // is disabled (which is true on low-dpi device by default) we should do the truncation.
141 // The justification is that non-composited elements using fractional scroll offsets 141 // The justification is that non-composited elements using fractional scroll offsets
142 // is causing too much nasty bugs but does not add too benefit on low-dpi de vices. 142 // is causing too much nasty bugs but does not add too benefit on low-dpi de vices.
143 virtual bool shouldUseIntegerScrollOffset() const { return !RuntimeEnabledFe atures::fractionalScrollOffsetsEnabled(); } 143 virtual bool shouldUseIntegerScrollOffset() const { return !RuntimeEnabledFe atures::fractionalScrollOffsetsEnabled(); }
144 144
145 virtual bool isActive() const = 0; 145 virtual bool isActive() const = 0;
146 virtual int scrollSize(ScrollbarOrientation) const = 0; 146 virtual int scrollSize(ScrollbarOrientation) const = 0;
147 void setScrollbarNeedsPaintInvalidation(Scrollbar*); 147 void setScrollbarNeedsPaintInvalidation(ScrollbarOrientation);
148 virtual bool isScrollCornerVisible() const = 0; 148 virtual bool isScrollCornerVisible() const = 0;
149 virtual IntRect scrollCornerRect() const = 0; 149 virtual IntRect scrollCornerRect() const = 0;
150 void setScrollCornerNeedsPaintInvalidation(); 150 void setScrollCornerNeedsPaintInvalidation();
151 virtual void getTickmarks(Vector<IntRect>&) const { } 151 virtual void getTickmarks(Vector<IntRect>&) const { }
152 152
153 // Convert points and rects between the scrollbar and its containing Widget. 153 // Convert points and rects between the scrollbar and its containing Widget.
154 // The client needs to implement these in order to be aware of layout effect s 154 // The client needs to implement these in order to be aware of layout effect s
155 // like CSS transforms. 155 // like CSS transforms.
156 virtual IntRect convertFromScrollbarToContainingWidget(const Scrollbar* scro llbar, const IntRect& scrollbarRect) const 156 virtual IntRect convertFromScrollbarToContainingWidget(const Scrollbar& scro llbar, const IntRect& scrollbarRect) const
157 { 157 {
158 return scrollbar->Widget::convertToContainingWidget(scrollbarRect); 158 return scrollbar.Widget::convertToContainingWidget(scrollbarRect);
159 } 159 }
160 virtual IntRect convertFromContainingWidgetToScrollbar(const Scrollbar* scro llbar, const IntRect& parentRect) const 160 virtual IntRect convertFromContainingWidgetToScrollbar(const Scrollbar& scro llbar, const IntRect& parentRect) const
161 { 161 {
162 return scrollbar->Widget::convertFromContainingWidget(parentRect); 162 return scrollbar.Widget::convertFromContainingWidget(parentRect);
163 } 163 }
164 virtual IntPoint convertFromScrollbarToContainingWidget(const Scrollbar* scr ollbar, const IntPoint& scrollbarPoint) const 164 virtual IntPoint convertFromScrollbarToContainingWidget(const Scrollbar& scr ollbar, const IntPoint& scrollbarPoint) const
165 { 165 {
166 return scrollbar->Widget::convertToContainingWidget(scrollbarPoint); 166 return scrollbar.Widget::convertToContainingWidget(scrollbarPoint);
167 } 167 }
168 virtual IntPoint convertFromContainingWidgetToScrollbar(const Scrollbar* scr ollbar, const IntPoint& parentPoint) const 168 virtual IntPoint convertFromContainingWidgetToScrollbar(const Scrollbar& scr ollbar, const IntPoint& parentPoint) const
169 { 169 {
170 return scrollbar->Widget::convertFromContainingWidget(parentPoint); 170 return scrollbar.Widget::convertFromContainingWidget(parentPoint);
171 } 171 }
172 172
173 virtual Scrollbar* horizontalScrollbar() const { return 0; } 173 virtual Scrollbar* horizontalScrollbar() const { return nullptr; }
174 virtual Scrollbar* verticalScrollbar() const { return 0; } 174 virtual Scrollbar* verticalScrollbar() const { return nullptr; }
175 175
176 // scrollPosition is relative to the scrollOrigin. i.e. If the page is RTL 176 // scrollPosition is relative to the scrollOrigin. i.e. If the page is RTL
177 // then scrollPosition will be negative. By default, scrollPositionDouble() 177 // then scrollPosition will be negative. By default, scrollPositionDouble()
178 // just call into scrollPosition(). Subclass can override scrollPositionDoub le() 178 // just call into scrollPosition(). Subclass can override scrollPositionDoub le()
179 // to return floating point precision scrolloffset. 179 // to return floating point precision scrolloffset.
180 // FIXME: Remove scrollPosition(). crbug.com/414283. 180 // FIXME: Remove scrollPosition(). crbug.com/414283.
181 virtual IntPoint scrollPosition() const = 0; 181 virtual IntPoint scrollPosition() const = 0;
182 virtual DoublePoint scrollPositionDouble() const { return DoublePoint(scroll Position()); } 182 virtual DoublePoint scrollPositionDouble() const { return DoublePoint(scroll Position()); }
183 virtual IntPoint minimumScrollPosition() const = 0; 183 virtual IntPoint minimumScrollPosition() const = 0;
184 virtual DoublePoint minimumScrollPositionDouble() const { return DoublePoint (minimumScrollPosition()); } 184 virtual DoublePoint minimumScrollPositionDouble() const { return DoublePoint (minimumScrollPosition()); }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // vertical-lr / ltr NO NO 345 // vertical-lr / ltr NO NO
346 // vertical-lr / rtl NO YES 346 // vertical-lr / rtl NO YES
347 // vertical-rl / ltr YES NO 347 // vertical-rl / ltr YES NO
348 // vertical-rl / rtl YES YES 348 // vertical-rl / rtl YES YES
349 IntPoint m_scrollOrigin; 349 IntPoint m_scrollOrigin;
350 }; 350 };
351 351
352 } // namespace blink 352 } // namespace blink
353 353
354 #endif // ScrollableArea_h 354 #endif // ScrollableArea_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698