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

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: DCHECK for no layer 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
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..d3ab9bc94633221786e33d8c56bfdc7e91c298b3 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;
@@ -89,6 +93,7 @@ class VIEWS_EXPORT ScrollView : public View, public ScrollBarController {
void OnMouseExited(const ui::MouseEvent& event) override;
void OnGestureEvent(ui::GestureEvent* event) override;
const char* GetClassName() const override;
+ ScrollView* EnclosingScrollView() override;
// ScrollBarController overrides:
void ScrollToPosition(ScrollBar* source, int position) override;
@@ -125,9 +130,24 @@ class VIEWS_EXPORT ScrollView : public View, public ScrollBarController {
// Update the scrollbars positions given viewport and content sizes.
void UpdateScrollBarPositions();
- // The current contents and its viewport. |contents_| is contained in
- // |contents_viewport_|.
+ // 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);
+
+ // 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 the
+ // layer-backed |contents_container_| which guarantees it is at least as high
+ // and wide as the |contents_viewport_|, which does the clipping. If
+ // |contents_container_| is null, the origin of |contents_| is offset to
+ // perform scrolling.
View* contents_;
+ View* contents_container_;
View* contents_viewport_;
// The current header and its viewport. |header_| is contained in

Powered by Google App Engine
This is Rietveld 408576698