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

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

Issue 191693002: Delay scrollContents until the next paint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // Functions for getting/setting the size of the document contained inside t he ScrollView (as an IntSize or as individual width and height 137 // Functions for getting/setting the size of the document contained inside t he ScrollView (as an IntSize or as individual width and height
138 // values). 138 // values).
139 virtual IntSize contentsSize() const OVERRIDE; // Always at least as big as the visibleWidth()/visibleHeight(). 139 virtual IntSize contentsSize() const OVERRIDE; // Always at least as big as the visibleWidth()/visibleHeight().
140 int contentsWidth() const { return contentsSize().width(); } 140 int contentsWidth() const { return contentsSize().width(); }
141 int contentsHeight() const { return contentsSize().height(); } 141 int contentsHeight() const { return contentsSize().height(); }
142 virtual void setContentsSize(const IntSize&); 142 virtual void setContentsSize(const IntSize&);
143 143
144 // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values). 144 // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values).
145 virtual IntPoint scrollPosition() const OVERRIDE { return visibleContentRect ().location(); } 145 virtual IntPoint scrollPosition() const OVERRIDE { return visibleContentRect ().location(); }
146 IntSize scrollOffset() const { return toIntSize(visibleContentRect().locatio n()); } // Gets the scrolled position as an IntSize. Convenient for adding to ot her sizes. 146 IntSize scrollOffset() const { return toIntSize(visibleContentRect().locatio n()); } // Gets the scrolled position as an IntSize. Convenient for adding to ot her sizes.
147 IntSize scrollDelta() const { return m_scrollDelta; }
147 virtual IntPoint maximumScrollPosition() const OVERRIDE; // The maximum posi tion we can be scrolled to. 148 virtual IntPoint maximumScrollPosition() const OVERRIDE; // The maximum posi tion we can be scrolled to.
148 virtual IntPoint minimumScrollPosition() const OVERRIDE; // The minimum posi tion we can be scrolled to. 149 virtual IntPoint minimumScrollPosition() const OVERRIDE; // The minimum posi tion we can be scrolled to.
149 // Adjust the passed in scroll position to keep it between the minimum and m aximum positions. 150 // Adjust the passed in scroll position to keep it between the minimum and m aximum positions.
150 IntPoint adjustScrollPositionWithinRange(const IntPoint&) const; 151 IntPoint adjustScrollPositionWithinRange(const IntPoint&) const;
151 int scrollX() const { return scrollPosition().x(); } 152 int scrollX() const { return scrollPosition().x(); }
152 int scrollY() const { return scrollPosition().y(); } 153 int scrollY() const { return scrollPosition().y(); }
153 154
154 virtual IntSize overhangAmount() const OVERRIDE; 155 virtual IntSize overhangAmount() const OVERRIDE;
155 156
156 void cacheCurrentScrollPosition() { m_cachedScrollPosition = scrollPosition( ); } 157 void cacheCurrentScrollPosition() { m_cachedScrollPosition = scrollPosition( ); }
157 IntPoint cachedScrollPosition() const { return m_cachedScrollPosition; } 158 IntPoint cachedScrollPosition() const { return m_cachedScrollPosition; }
158 159
159 // Functions for scrolling the view. 160 // Functions for scrolling the view.
160 virtual void setScrollPosition(const IntPoint&); 161 virtual void setScrollPosition(const IntPoint&);
161 void scrollBy(const IntSize& s) { return setScrollPosition(scrollPosition() + s); } 162 void scrollBy(const IntSize& s) { return setScrollPosition(scrollPosition() + s); }
162 163
163 bool scroll(ScrollDirection, ScrollGranularity); 164 bool scroll(ScrollDirection, ScrollGranularity);
164 165
165 // Scroll the actual contents of the view (either blitting or invalidating a s needed). 166 // Scroll the actual contents of the view (either blitting or invalidating a s needed).
167 void scrollContentsIfNeeded();
166 void scrollContents(const IntSize& scrollDelta); 168 void scrollContents(const IntSize& scrollDelta);
167 169
168 // This gives us a means of blocking painting on our scrollbars until the fi rst layout has occurred. 170 // This gives us a means of blocking painting on our scrollbars until the fi rst layout has occurred.
169 void setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppress = fal se); 171 void setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppress = fal se);
170 bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; } 172 bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; }
171 173
172 IntPoint rootViewToContents(const IntPoint&) const; 174 IntPoint rootViewToContents(const IntPoint&) const;
173 IntPoint contentsToRootView(const IntPoint&) const; 175 IntPoint contentsToRootView(const IntPoint&) const;
174 IntRect rootViewToContents(const IntRect&) const; 176 IntRect rootViewToContents(const IntRect&) const;
175 IntRect contentsToRootView(const IntRect&) const; 177 IntRect contentsToRootView(const IntRect&) const;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 RefPtr<Scrollbar> m_horizontalScrollbar; 290 RefPtr<Scrollbar> m_horizontalScrollbar;
289 RefPtr<Scrollbar> m_verticalScrollbar; 291 RefPtr<Scrollbar> m_verticalScrollbar;
290 ScrollbarMode m_horizontalScrollbarMode; 292 ScrollbarMode m_horizontalScrollbarMode;
291 ScrollbarMode m_verticalScrollbarMode; 293 ScrollbarMode m_verticalScrollbarMode;
292 294
293 bool m_horizontalScrollbarLock; 295 bool m_horizontalScrollbarLock;
294 bool m_verticalScrollbarLock; 296 bool m_verticalScrollbarLock;
295 297
296 HashSet<RefPtr<Widget> > m_children; 298 HashSet<RefPtr<Widget> > m_children;
297 299
300 IntSize m_scrollDelta;
abarth-chromium 2014/03/08 06:54:52 m_pendingScrollDelta? The word "pending" might hi
ykyyip 2014/03/11 01:59:39 Done.
298 IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but we will wait to make this change until more code is shared. 301 IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but we will wait to make this change until more code is shared.
299 IntPoint m_cachedScrollPosition; 302 IntPoint m_cachedScrollPosition;
300 IntSize m_contentsSize; 303 IntSize m_contentsSize;
301 304
302 int m_scrollbarsAvoidingResizer; 305 int m_scrollbarsAvoidingResizer;
303 bool m_scrollbarsSuppressed; 306 bool m_scrollbarsSuppressed;
304 307
305 bool m_inUpdateScrollbars; 308 bool m_inUpdateScrollbars;
306 unsigned m_updateScrollbarsPass; 309 unsigned m_updateScrollbarsPass;
307 310
308 IntPoint m_panScrollIconPoint; 311 IntPoint m_panScrollIconPoint;
309 bool m_drawPanScrollIcon; 312 bool m_drawPanScrollIcon;
310 313
311 bool m_paintsEntireContents; 314 bool m_paintsEntireContents;
312 bool m_clipsRepaints; 315 bool m_clipsRepaints;
313 316
314 void init(); 317 void init();
315 void destroy(); 318 void destroy();
316 319
317 IntRect rectToCopyOnScroll() const; 320 IntRect rectToCopyOnScroll() const;
318 321
319 // Called when the scroll position within this view changes. FrameView over rides this to generate repaint invalidations. 322 // Called when the scroll position within this view changes. FrameView over rides this to generate repaint invalidations.
323 virtual void invalidateFixedElementsBeforeScrolling(const IntSize&, const In tRect&) { }
320 virtual void repaintFixedElementsAfterScrolling() { } 324 virtual void repaintFixedElementsAfterScrolling() { }
321 virtual void updateFixedElementsAfterScrolling() { } 325 virtual void updateFixedElementsAfterScrolling() { }
322 326
323 void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntR ect& verticalOverhangRect); 327 void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntR ect& verticalOverhangRect);
324 void updateOverhangAreas(); 328 void updateOverhangAreas();
325 329
326 virtual int pageStep(ScrollbarOrientation) const OVERRIDE; 330 virtual int pageStep(ScrollbarOrientation) const OVERRIDE;
327 }; // class ScrollView 331 }; // class ScrollView
328 332
329 DEFINE_TYPE_CASTS(ScrollView, Widget, widget, widget->isScrollView(), widget.isS crollView()); 333 DEFINE_TYPE_CASTS(ScrollView, Widget, widget, widget->isScrollView(), widget.isS crollView());
330 334
331 } // namespace WebCore 335 } // namespace WebCore
332 336
333 #endif // ScrollView_h 337 #endif // ScrollView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698