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

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

Issue 1173053003: Remove ScrollableArea::notifyScrollPositionChanged and cleanup scroll animators. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase + remove updateScrollbars from FrameView::setScrollPosition Created 5 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) 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // visible in the area. Returns the new location of the input rect relative once again to the document. 82 // visible in the area. Returns the new location of the input rect relative once again to the document.
83 // Note, in the case of a Document container, such as FrameView, the output will always be the input rect 83 // Note, in the case of a Document container, such as FrameView, the output will always be the input rect
84 // since scrolling it can't change the location of content relative to the d ocument, unlike an overflowing 84 // since scrolling it can't change the location of content relative to the d ocument, unlike an overflowing
85 // element. 85 // element.
86 virtual LayoutRect scrollIntoView(const LayoutRect& rectInContent, const Scr ollAlignment& alignX, const ScrollAlignment& alignY); 86 virtual LayoutRect scrollIntoView(const LayoutRect& rectInContent, const Scr ollAlignment& alignX, const ScrollAlignment& alignY);
87 87
88 // Scrolls the area so that the given rect, given in the area's content coor dinates, such that it's 88 // Scrolls the area so that the given rect, given in the area's content coor dinates, such that it's
89 // cenetered in the second rect, which is given relative to the area's origi n. 89 // cenetered in the second rect, which is given relative to the area's origi n.
90 void scrollIntoRect(const LayoutRect& rectInContent, const FloatRect& target RectInFrame); 90 void scrollIntoRect(const LayoutRect& rectInContent, const FloatRect& target RectInFrame);
91 91
92 // Should be called when the scroll position changes externally, for example if the scroll layer position
93 // is updated on the scrolling thread and we need to notify the main thread.
94 void notifyScrollPositionChanged(const DoublePoint&);
95
96 static bool scrollBehaviorFromString(const String&, ScrollBehavior&); 92 static bool scrollBehaviorFromString(const String&, ScrollBehavior&);
97 93
98 virtual ScrollResult handleWheel(const PlatformWheelEvent&); 94 virtual ScrollResult handleWheel(const PlatformWheelEvent&);
99 95
100 // Functions for controlling if you can scroll past the end of the document. 96 // Functions for controlling if you can scroll past the end of the document.
101 bool constrainsScrollingToContentEdge() const { return m_constrainsScrolling ToContentEdge; } 97 bool constrainsScrollingToContentEdge() const { return m_constrainsScrolling ToContentEdge; }
102 void setConstrainsScrollingToContentEdge(bool constrainsScrollingToContentEd ge) { m_constrainsScrollingToContentEdge = constrainsScrollingToContentEdge; } 98 void setConstrainsScrollingToContentEdge(bool constrainsScrollingToContentEd ge) { m_constrainsScrollingToContentEdge = constrainsScrollingToContentEdge; }
103 99
104 // Adjust the passed in scroll position to keep it between the minimum and m aximum positions. 100 // Adjust the passed in scroll position to keep it between the minimum and m aximum positions.
105 IntPoint adjustScrollPositionWithinRange(const IntPoint&) const; 101 IntPoint adjustScrollPositionWithinRange(const IntPoint&) const;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 virtual GraphicsLayer* layerForScrolling() const { return 0; } 261 virtual GraphicsLayer* layerForScrolling() const { return 0; }
266 virtual GraphicsLayer* layerForHorizontalScrollbar() const { return 0; } 262 virtual GraphicsLayer* layerForHorizontalScrollbar() const { return 0; }
267 virtual GraphicsLayer* layerForVerticalScrollbar() const { return 0; } 263 virtual GraphicsLayer* layerForVerticalScrollbar() const { return 0; }
268 virtual GraphicsLayer* layerForScrollCorner() const { return 0; } 264 virtual GraphicsLayer* layerForScrollCorner() const { return 0; }
269 bool hasLayerForHorizontalScrollbar() const; 265 bool hasLayerForHorizontalScrollbar() const;
270 bool hasLayerForVerticalScrollbar() const; 266 bool hasLayerForVerticalScrollbar() const;
271 bool hasLayerForScrollCorner() const; 267 bool hasLayerForScrollCorner() const;
272 268
273 void layerForScrollingDidChange(); 269 void layerForScrollingDidChange();
274 270
271 void cancelScrollAnimation();
275 void cancelProgrammaticScrollAnimation(); 272 void cancelProgrammaticScrollAnimation();
276 273
277 virtual ~ScrollableArea(); 274 virtual ~ScrollableArea();
278 275
279 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0; 276 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0;
280 virtual void invalidateScrollCornerRect(const IntRect&) = 0; 277 virtual void invalidateScrollCornerRect(const IntRect&) = 0;
281 278
282 // Returns the default scroll style this area should scroll with when not 279 // Returns the default scroll style this area should scroll with when not
283 // explicitly specified. E.g. The scrolling behavior of an element can be 280 // explicitly specified. E.g. The scrolling behavior of an element can be
284 // specified in CSS. 281 // specified in CSS.
(...skipping 14 matching lines...) Expand all
299 296
300 // Subtracts space occupied by this ScrollableArea's scrollbars. 297 // Subtracts space occupied by this ScrollableArea's scrollbars.
301 // Does nothing if overlay scrollbars are enabled. 298 // Does nothing if overlay scrollbars are enabled.
302 IntSize excludeScrollbars(const IntSize&) const; 299 IntSize excludeScrollbars(const IntSize&) const;
303 protected: 300 protected:
304 ScrollableArea(); 301 ScrollableArea();
305 302
306 void setScrollOrigin(const IntPoint&); 303 void setScrollOrigin(const IntPoint&);
307 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } 304 void resetScrollOriginChanged() { m_scrollOriginChanged = false; }
308 305
309 private: 306 // Needed to let the animators call scrollPositionChanged.
307 friend class ScrollAnimator;
308 friend class ProgrammaticScrollAnimator;
310 void scrollPositionChanged(const DoublePoint&, ScrollType); 309 void scrollPositionChanged(const DoublePoint&, ScrollType);
311 310
312 // NOTE: Only called from the ScrollAnimator. 311 private:
313 friend class ScrollAnimator;
314 void setScrollOffsetFromAnimation(const DoublePoint&, ScrollType);
315
316 void programmaticScrollHelper(const DoublePoint&, ScrollBehavior); 312 void programmaticScrollHelper(const DoublePoint&, ScrollBehavior);
317 void userScrollHelper(const DoublePoint&, ScrollBehavior); 313 void userScrollHelper(const DoublePoint&, ScrollBehavior);
318 314
319 // This function should be overriden by subclasses to perform the actual 315 // This function should be overriden by subclasses to perform the actual
320 // scroll of the content. By default the DoublePoint version will just 316 // scroll of the content. By default the DoublePoint version will just
321 // call into the IntPoint version. If fractional scroll is needed, one 317 // call into the IntPoint version. If fractional scroll is needed, one
322 // can override the DoublePoint version to take advantage of the double 318 // can override the DoublePoint version to take advantage of the double
323 // precision scroll offset. 319 // precision scroll offset.
324 // FIXME: Remove the IntPoint version. And change the function to 320 // FIXME: Remove the IntPoint version. And change the function to
325 // take DoubleSize. crbug.com/414283. 321 // take DoubleSize. crbug.com/414283.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // vertical-lr / ltr NO NO 358 // vertical-lr / ltr NO NO
363 // vertical-lr / rtl NO YES 359 // vertical-lr / rtl NO YES
364 // vertical-rl / ltr YES NO 360 // vertical-rl / ltr YES NO
365 // vertical-rl / rtl YES YES 361 // vertical-rl / rtl YES YES
366 IntPoint m_scrollOrigin; 362 IntPoint m_scrollOrigin;
367 }; 363 };
368 364
369 } // namespace blink 365 } // namespace blink
370 366
371 #endif // ScrollableArea_h 367 #endif // ScrollableArea_h
OLDNEW
« no previous file with comments | « Source/platform/scroll/ScrollAnimatorNone.cpp ('k') | Source/platform/scroll/ScrollableArea.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698