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

Unified Diff: ui/views/controls/scroll_view.h

Issue 2188133002: Scroll with Layers in views::ScrollView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-ScrollTrack
Patch Set: bugref, scale_delta DCHECK + comment Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/blink/input_handler_proxy_unittest.cc ('k') | ui/views/controls/scroll_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/scroll_view.h
diff --git a/ui/views/controls/scroll_view.h b/ui/views/controls/scroll_view.h
index 42348fc536898c984b7b767e9cdbdd5f4b03c0e3..8973aeedef353f75cffaff517e18614bd6ef5a23 100644
--- a/ui/views/controls/scroll_view.h
+++ b/ui/views/controls/scroll_view.h
@@ -12,6 +12,10 @@
#include "base/macros.h"
#include "ui/views/controls/scrollbar/scroll_bar.h"
+namespace gfx {
+class ScrollOffset;
+}
+
namespace views {
namespace test {
class ScrollViewTestApi;
@@ -51,6 +55,11 @@ class VIEWS_EXPORT ScrollView : public View, public ScrollBarController {
// Sets the header, deleting the previous header.
void SetHeader(View* header);
+ // Sets the background color. The default is white when scrolling with layers,
+ // otherwise transparent. An opaque color when scrolling with layers ensures
+ // fonts can be drawn with subpixel antialiasing.
+ void SetBackgroundColor(SkColor color);
+
// Returns the visible region of the content View.
gfx::Rect GetVisibleRect() const;
@@ -125,6 +134,20 @@ class VIEWS_EXPORT ScrollView : public View, public ScrollBarController {
// Update the scrollbars positions given viewport and content sizes.
void UpdateScrollBarPositions();
+ // Helpers to get and set the current scroll offset (either from the ui::Layer
+ // or from the |contents_| origin offset).
+ gfx::ScrollOffset CurrentOffset() const;
+ void ScrollToOffset(const gfx::ScrollOffset& offset);
+
+ // Whether the ScrollView scrolls using ui::Layer APIs.
+ bool ScrollsWithLayers() const;
+
+ // Callback entrypoint when hosted Layers are scrolled by the Compositor.
+ void OnLayerScrolled();
+
+ // Horizontally scrolls the header (if any) to match the contents.
+ void ScrollHeader();
+
// The current contents and its viewport. |contents_| is contained in
// |contents_viewport_|.
View* contents_;
@@ -149,6 +172,10 @@ class VIEWS_EXPORT ScrollView : public View, public ScrollBarController {
int min_height_;
int max_height_;
+ // The background color given to the viewport (for overscroll), and to the
+ // contents when scrolling with layers.
+ SkColor background_color_;
+
// If true, never show the horizontal scrollbar (even if the contents is wider
// than the viewport).
bool hide_horizontal_scrollbar_;
« no previous file with comments | « ui/events/blink/input_handler_proxy_unittest.cc ('k') | ui/views/controls/scroll_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698