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

Unified Diff: ui/compositor/layer.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/layer.h ('k') | ui/compositor/overscroll/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer.cc
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index 83409bb748fc9d82976b43678174cd4612f488be..bbe0418f8c2b39f3f9da89e5e8a46e268144f70d 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -528,6 +528,36 @@ void Layer::SwitchCCLayerForTest() {
content_layer_ = new_layer;
}
+gfx::ScrollOffset Layer::CurrentScrollOffset() const {
+ return cc_layer_->scroll_offset();
+}
+
+void Layer::SetScrollOffset(const gfx::ScrollOffset& offset) {
+#if 0
+ if (IsDrawn())
+ ScheduleDraw();
+ cc_layer_->SetScrollOffsetFromImplSide(offset, nullptr);
+#else
+ bool scrolled_on_impl_side =
+ GetCompositor() &&
+ GetCompositor()->ScrollLayerTo(cc_layer_->id(), offset);
+
+ if (!scrolled_on_impl_side)
+ cc_layer_->SetScrollOffset(offset);
+#endif
+}
+
+void Layer::SetScrollable(Layer* parent_clip_layer,
+ bool can_overscroll,
+ const base::Closure& on_scroll) {
+ cc_layer_->SetScrollParent(parent_clip_layer->cc_layer_);
+ cc_layer_->SetIsContainerForFixedPositionLayers(true);
+ cc_layer_->SetScrollClipAndCanOverscroll(parent_clip_layer->cc_layer_->id(),
+ can_overscroll);
+ cc_layer_->set_did_scroll_callback(on_scroll);
+ cc_layer_->SetUserScrollable(true, true);
+}
+
void Layer::SetTextureMailbox(
const cc::TextureMailbox& mailbox,
std::unique_ptr<cc::SingleReleaseCallback> release_callback,
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/compositor/overscroll/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698