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

Unified Diff: ui/compositor/compositor.cc

Issue 1680613002: Adding momentum/overscroll to views:: ScrollViews Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Tableview layout. aaaand I think we are done Created 4 years, 5 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/compositor/compositor.h ('k') | ui/compositor/compositor.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/compositor.cc
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 1c3f3bc0e1256c0f734c25c32661214c9ce02073..0677baf840994ce8cfc1d6fc0a64ef3f1467e32b 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -38,6 +38,7 @@
#include "ui/compositor/dip_util.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator_collection.h"
+#include "ui/compositor/overscroll/ui_scroll_input_manager.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_switches.h"
@@ -102,6 +103,10 @@ Compositor::Compositor(ui::ContextFactory* context_factory,
cc::LayerTreeSettings settings;
+#if defined(OS_MACOSX)
+ settings.enable_elastic_overscroll = true;
+#endif
+
// This will ensure PictureLayers always can have LCD text, to match the
// previous behaviour with ContentLayers, where LCD-not-allowed notifications
// were ignored.
@@ -209,6 +214,14 @@ Compositor::Compositor(ui::ContextFactory* context_factory,
params.main_task_runner = task_runner_;
params.animation_host = cc::AnimationHost::CreateMainInstance();
host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params);
+
+ // Tie composited scrolling with whether the platform wants elastic scrolling.
+ // TODO(tapted): Use composited scrolling on all platforms.
+ if (settings.enable_elastic_overscroll) {
+ scroll_input_manager_.reset(
+ new UIScrollInputManager(host_->GetInputHandler()));
+ }
+
UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor",
base::TimeTicks::Now() - before_create);
@@ -502,6 +515,10 @@ scoped_refptr<CompositorLock> Compositor::GetCompositorLock() {
return compositor_lock_;
}
+bool Compositor::ScrollLayerTo(int layer_id, const gfx::ScrollOffset& offset) {
+ return host_->GetInputHandler()->ScrollLayerTo(layer_id, offset);
+}
+
void Compositor::UnlockCompositor() {
DCHECK(compositor_lock_);
compositor_lock_ = NULL;
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/compositor.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698