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

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

Issue 2454913003: MainFrame scrollbars should work with RFV instead of FV (Closed)
Patch Set: Fix VisualViewportTest Created 4 years, 1 month 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Returns a rect, in the space of the area's backing graphics layer, that 102 // Returns a rect, in the space of the area's backing graphics layer, that
103 // contains the visual region of all scrollbar parts. 103 // contains the visual region of all scrollbar parts.
104 virtual LayoutRect visualRectForScrollbarParts() const = 0; 104 virtual LayoutRect visualRectForScrollbarParts() const = 0;
105 105
106 static bool scrollBehaviorFromString(const String&, ScrollBehavior&); 106 static bool scrollBehaviorFromString(const String&, ScrollBehavior&);
107 107
108 void contentAreaWillPaint() const; 108 void contentAreaWillPaint() const;
109 void mouseEnteredContentArea() const; 109 void mouseEnteredContentArea() const;
110 void mouseExitedContentArea() const; 110 void mouseExitedContentArea() const;
111 void mouseMovedInContentArea() const; 111 void mouseMovedInContentArea() const;
112 void mouseEnteredScrollbar(Scrollbar&) const; 112 virtual void mouseEnteredScrollbar(Scrollbar&) const;
113 void mouseExitedScrollbar(Scrollbar&) const; 113 virtual void mouseExitedScrollbar(Scrollbar&) const;
114 void contentAreaDidShow() const; 114 void contentAreaDidShow() const;
115 void contentAreaDidHide() const; 115 void contentAreaDidHide() const;
116 116
117 void finishCurrentScrollAnimations() const; 117 void finishCurrentScrollAnimations() const;
118 118
119 virtual void didAddScrollbar(Scrollbar&, ScrollbarOrientation); 119 virtual void didAddScrollbar(Scrollbar&, ScrollbarOrientation);
120 virtual void willRemoveScrollbar(Scrollbar&, ScrollbarOrientation); 120 virtual void willRemoveScrollbar(Scrollbar&, ScrollbarOrientation);
121 121
122 virtual void contentsResized(); 122 virtual void contentsResized();
123 123
124 bool hasOverlayScrollbars() const; 124 virtual bool hasOverlayScrollbars() const;
125 void setScrollbarOverlayColorTheme(ScrollbarOverlayColorTheme); 125 void setScrollbarOverlayColorTheme(ScrollbarOverlayColorTheme);
126 void recalculateScrollbarOverlayColorTheme(Color); 126 void recalculateScrollbarOverlayColorTheme(Color);
127 ScrollbarOverlayColorTheme getScrollbarOverlayColorTheme() const { 127 virtual ScrollbarOverlayColorTheme getScrollbarOverlayColorTheme() const {
128 return static_cast<ScrollbarOverlayColorTheme>( 128 return static_cast<ScrollbarOverlayColorTheme>(
129 m_scrollbarOverlayColorTheme); 129 m_scrollbarOverlayColorTheme);
130 } 130 }
131 131
132 // This getter will create a ScrollAnimatorBase if it doesn't already exist. 132 // This getter will create a ScrollAnimatorBase if it doesn't already exist.
133 ScrollAnimatorBase& scrollAnimator() const; 133 ScrollAnimatorBase& scrollAnimator() const;
134 134
135 // This getter will return null if the ScrollAnimatorBase hasn't been created 135 // This getter will return null if the ScrollAnimatorBase hasn't been created
136 // yet. 136 // yet.
137 ScrollAnimatorBase* existingScrollAnimator() const { 137 ScrollAnimatorBase* existingScrollAnimator() const {
(...skipping 20 matching lines...) Expand all
158 // non-composited elements using fractional scroll offsets is causing too much 158 // non-composited elements using fractional scroll offsets is causing too much
159 // nasty bugs but does not add too benefit on low-dpi devices. 159 // nasty bugs but does not add too benefit on low-dpi devices.
160 // TODO(szager): Now that scroll offsets are floats everywhere, can we get rid 160 // TODO(szager): Now that scroll offsets are floats everywhere, can we get rid
161 // of this? 161 // of this?
162 virtual bool shouldUseIntegerScrollOffset() const { 162 virtual bool shouldUseIntegerScrollOffset() const {
163 return !RuntimeEnabledFeatures::fractionalScrollOffsetsEnabled(); 163 return !RuntimeEnabledFeatures::fractionalScrollOffsetsEnabled();
164 } 164 }
165 165
166 virtual bool isActive() const = 0; 166 virtual bool isActive() const = 0;
167 virtual int scrollSize(ScrollbarOrientation) const = 0; 167 virtual int scrollSize(ScrollbarOrientation) const = 0;
168 void setScrollbarNeedsPaintInvalidation(ScrollbarOrientation); 168 virtual void setScrollbarNeedsPaintInvalidation(ScrollbarOrientation);
169 virtual bool isScrollCornerVisible() const = 0; 169 virtual bool isScrollCornerVisible() const = 0;
170 virtual IntRect scrollCornerRect() const = 0; 170 virtual IntRect scrollCornerRect() const = 0;
171 void setScrollCornerNeedsPaintInvalidation(); 171 virtual void setScrollCornerNeedsPaintInvalidation();
172 virtual void getTickmarks(Vector<IntRect>&) const {} 172 virtual void getTickmarks(Vector<IntRect>&) const {}
173 173
174 // Convert points and rects between the scrollbar and its containing Widget. 174 // Convert points and rects between the scrollbar and its containing Widget.
175 // The client needs to implement these in order to be aware of layout effects 175 // The client needs to implement these in order to be aware of layout effects
176 // like CSS transforms. 176 // like CSS transforms.
177 virtual IntRect convertFromScrollbarToContainingWidget( 177 virtual IntRect convertFromScrollbarToContainingWidget(
178 const Scrollbar& scrollbar, 178 const Scrollbar& scrollbar,
179 const IntRect& scrollbarRect) const { 179 const IntRect& scrollbarRect) const {
180 return scrollbar.Widget::convertToContainingWidget(scrollbarRect); 180 return scrollbar.Widget::convertToContainingWidget(scrollbarRect);
181 } 181 }
182 virtual IntRect convertFromContainingWidgetToScrollbar( 182 virtual IntRect convertFromContainingWidgetToScrollbar(
183 const Scrollbar& scrollbar, 183 const Scrollbar& scrollbar,
184 const IntRect& parentRect) const { 184 const IntRect& parentRect) const {
185 return scrollbar.Widget::convertFromContainingWidget(parentRect); 185 return scrollbar.Widget::convertFromContainingWidget(parentRect);
186 } 186 }
187 virtual IntPoint convertFromScrollbarToContainingWidget( 187 virtual IntPoint convertFromScrollbarToContainingWidget(
188 const Scrollbar& scrollbar, 188 const Scrollbar& scrollbar,
189 const IntPoint& scrollbarPoint) const { 189 const IntPoint& scrollbarPoint) const {
190 return scrollbar.Widget::convertToContainingWidget(scrollbarPoint); 190 return scrollbar.Widget::convertToContainingWidget(scrollbarPoint);
191 } 191 }
192 virtual IntPoint convertFromContainingWidgetToScrollbar( 192 virtual IntPoint convertFromContainingWidgetToScrollbar(
193 const Scrollbar& scrollbar, 193 const Scrollbar& scrollbar,
194 const IntPoint& parentPoint) const { 194 const IntPoint& parentPoint) const {
195 return scrollbar.Widget::convertFromContainingWidget(parentPoint); 195 return scrollbar.Widget::convertFromContainingWidget(parentPoint);
196 } 196 }
197 197
198 virtual Scrollbar* horizontalScrollbar() const { return nullptr; } 198 virtual Scrollbar* horizontalScrollbar() const { return nullptr; }
199 virtual Scrollbar* verticalScrollbar() const { return nullptr; } 199 virtual Scrollbar* verticalScrollbar() const { return nullptr; }
200 200
201 // Called to update the scrollbars to accurately reflect the state of the
202 // view.
203 virtual void updateScrollbars(){};
204
201 // scrollPosition is the location of the top/left of the scroll viewport in 205 // scrollPosition is the location of the top/left of the scroll viewport in
202 // the coordinate system defined by the top/left of the overflow rect. 206 // the coordinate system defined by the top/left of the overflow rect.
203 // scrollOffset is the offset of the scroll viewport from its position when 207 // scrollOffset is the offset of the scroll viewport from its position when
204 // scrolled all the way to the beginning of its content's flow. 208 // scrolled all the way to the beginning of its content's flow.
205 // For a more detailed explanation of scrollPosition, scrollOffset, and 209 // For a more detailed explanation of scrollPosition, scrollOffset, and
206 // scrollOrigin, see core/layout/README.md. 210 // scrollOrigin, see core/layout/README.md.
207 FloatPoint scrollPosition() const { 211 FloatPoint scrollPosition() const {
208 return FloatPoint(scrollOrigin()) + scrollOffset(); 212 return FloatPoint(scrollOrigin()) + scrollOffset();
209 } 213 }
210 virtual IntSize scrollOffsetInt() const = 0; 214 virtual IntSize scrollOffsetInt() const = 0;
211 virtual ScrollOffset scrollOffset() const { 215 virtual ScrollOffset scrollOffset() const {
212 return ScrollOffset(scrollOffsetInt()); 216 return ScrollOffset(scrollOffsetInt());
213 } 217 }
214 virtual IntSize minimumScrollOffsetInt() const = 0; 218 virtual IntSize minimumScrollOffsetInt() const = 0;
215 virtual ScrollOffset minimumScrollOffset() const { 219 virtual ScrollOffset minimumScrollOffset() const {
216 return ScrollOffset(minimumScrollOffsetInt()); 220 return ScrollOffset(minimumScrollOffsetInt());
217 } 221 }
218 virtual IntSize maximumScrollOffsetInt() const = 0; 222 virtual IntSize maximumScrollOffsetInt() const = 0;
219 virtual ScrollOffset maximumScrollOffset() const { 223 virtual ScrollOffset maximumScrollOffset() const {
220 return ScrollOffset(maximumScrollOffsetInt()); 224 return ScrollOffset(maximumScrollOffsetInt());
221 } 225 }
226 virtual ScrollOffset scrollAnimatorDesiredTargetOffset() const {
227 return scrollAnimator().desiredTargetOffset();
228 }
222 229
223 virtual IntRect visibleContentRect( 230 virtual IntRect visibleContentRect(
224 IncludeScrollbarsInRect = ExcludeScrollbars) const; 231 IncludeScrollbarsInRect = ExcludeScrollbars) const;
225 virtual int visibleHeight() const { return visibleContentRect().height(); } 232 virtual int visibleHeight() const { return visibleContentRect().height(); }
226 virtual int visibleWidth() const { return visibleContentRect().width(); } 233 virtual int visibleWidth() const { return visibleContentRect().width(); }
227 virtual IntSize contentsSize() const = 0; 234 virtual IntSize contentsSize() const = 0;
228 virtual IntPoint lastKnownMousePosition() const { return IntPoint(); } 235 virtual IntPoint lastKnownMousePosition() const { return IntPoint(); }
229 236
230 virtual bool shouldSuspendScrollAnimations() const { return true; } 237 virtual bool shouldSuspendScrollAnimations() const { return true; }
231 virtual void scrollbarStyleChanged() {} 238 virtual void scrollbarStyleChanged() {}
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 // vertical-lr / ltr NO NO 432 // vertical-lr / ltr NO NO
426 // vertical-lr / rtl NO YES 433 // vertical-lr / rtl NO YES
427 // vertical-rl / ltr YES NO 434 // vertical-rl / ltr YES NO
428 // vertical-rl / rtl YES YES 435 // vertical-rl / rtl YES YES
429 IntPoint m_scrollOrigin; 436 IntPoint m_scrollOrigin;
430 }; 437 };
431 438
432 } // namespace blink 439 } // namespace blink
433 440
434 #endif // ScrollableArea_h 441 #endif // ScrollableArea_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698