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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2842553003: Call SAC::DidScrollUpdate only for compositor-triggered scrolls. (Closed)
Patch Set: rebase Created 3 years, 8 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: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 6965594181cb0a4dd868f89b7894ae6e36d2fdfa..94c5e0bb1b2ffc801c3009dae5ab81a7f05d939a 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -349,6 +349,8 @@ void LayerTreeHostImpl::UpdateSyncTreeAfterCommitOrImplSideInvalidation() {
tile_manager_.TakeImagesToInvalidateOnSyncTree());
if (CommitToActiveTree()) {
+ active_tree_->ShowScrollbars();
bokan 2017/04/25 22:56:48 I was a little confused until I checked the ShowSc
skobes 2017/04/27 00:46:31 Renamed to HandleScrollbarShowRequestsFromMain.
+
// We have to activate animations here or "IsActive()" is true on the layers
// but the animations aren't activated yet so they get ignored by
// UpdateDrawProperties.
@@ -3280,8 +3282,9 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
DistributeScrollDelta(scroll_state);
- active_tree_->SetCurrentlyScrollingNode(
- scroll_state->current_native_scrolling_node());
+ ScrollNode* current_scrolling_node =
+ scroll_state->current_native_scrolling_node();
+ active_tree_->SetCurrentlyScrollingNode(current_scrolling_node);
did_lock_scrolling_layer_ =
scroll_state->delta_consumed_for_scroll_sequence();
@@ -3289,6 +3292,8 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
bool did_scroll_y = scroll_state->caused_scroll_y();
bool did_scroll_content = did_scroll_x || did_scroll_y;
if (did_scroll_content) {
+ ShowScrollbarsForImplScroll(current_scrolling_node->element_id);
+
// If we are scrolling with an active scroll handler, forward latency
// tracking information to the main thread so the delay introduced by the
// handler is accounted for.
@@ -3349,6 +3354,7 @@ void LayerTreeHostImpl::SetSynchronousInputHandlerRootScrollOffset(
if (!changed)
return;
+ ShowScrollbarsForImplScroll(OuterViewportScrollLayer()->element_id());
client_->SetNeedsCommitOnImplThread();
// After applying the synchronous input handler's scroll offset, tell it what
// we ended up with.
@@ -4150,6 +4156,7 @@ void LayerTreeHostImpl::SetElementScrollOffsetMutated(
const gfx::ScrollOffset& scroll_offset) {
if (list_type == ElementListType::ACTIVE) {
SetTreeLayerScrollOffsetMutated(element_id, active_tree(), scroll_offset);
+ ShowScrollbarsForImplScroll(element_id);
} else {
SetTreeLayerScrollOffsetMutated(element_id, pending_tree(), scroll_offset);
SetTreeLayerScrollOffsetMutated(element_id, recycle_tree(), scroll_offset);
@@ -4302,4 +4309,12 @@ void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) {
has_scrolled_by_touch_ = true;
}
+void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) {
+ if (!element_id)
+ return;
+ if (ScrollbarAnimationController* animation_controller =
+ ScrollbarAnimationControllerForElementId(element_id))
+ animation_controller->DidScrollUpdate();
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698