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

Unified Diff: cc/trees/layer_tree_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_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 58f8630ad133b3baaaf8da4be7afd77e60efcd2e..2923a0106c13fb61750e99d8c524d857c82d54ee 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -242,51 +242,23 @@ void LayerTreeImpl::UpdateScrollbars(int scroll_layer_id, int clip_layer_id) {
clip_size.Scale(1 / current_page_scale_factor());
}
- bool scrollbar_needs_animation = false;
- bool clip_layer_size_did_change = false;
- bool scroll_layer_size_did_change = false;
bool y_offset_did_change = false;
for (auto* scrollbar : ScrollbarsFor(scroll_layer->element_id())) {
if (scrollbar->orientation() == HORIZONTAL) {
- scrollbar_needs_animation |= scrollbar->SetCurrentPos(current_offset.x());
- clip_layer_size_did_change |=
- scrollbar->SetClipLayerLength(clip_size.width());
- scroll_layer_size_did_change |=
- scrollbar->SetScrollLayerLength(scroll_size.width());
+ scrollbar->SetCurrentPos(current_offset.x());
+ scrollbar->SetClipLayerLength(clip_size.width());
+ scrollbar->SetScrollLayerLength(scroll_size.width());
} else {
- scrollbar_needs_animation |= y_offset_did_change |=
- scrollbar->SetCurrentPos(current_offset.y());
- clip_layer_size_did_change |=
- scrollbar->SetClipLayerLength(clip_size.height());
- scroll_layer_size_did_change |=
- scrollbar->SetScrollLayerLength(scroll_size.height());
+ y_offset_did_change = scrollbar->SetCurrentPos(current_offset.y());
+ scrollbar->SetClipLayerLength(clip_size.height());
+ scrollbar->SetScrollLayerLength(scroll_size.height());
}
- scrollbar_needs_animation |=
- scrollbar->SetVerticalAdjust(clip_layer->bounds_delta().y());
+ scrollbar->SetVerticalAdjust(clip_layer->bounds_delta().y());
}
- scrollbar_needs_animation |=
- (clip_layer_size_did_change || scroll_layer_size_did_change);
-
if (y_offset_did_change && IsViewportLayerId(scroll_layer_id))
TRACE_COUNTER_ID1("cc", "scroll_offset_y", scroll_layer->id(),
current_offset.y());
-
- if (scrollbar_needs_animation) {
- ScrollbarAnimationController* controller =
- layer_tree_host_impl_->ScrollbarAnimationControllerForElementId(
- scroll_layer->element_id());
- if (!controller)
- return;
-
- // TODO(chaopeng) clip_layer_size_did_change should call DidResize after
- // crbug.com/701810 got fixed.
- if (scroll_layer_size_did_change) {
- controller->DidResize();
- } else {
- controller->DidScrollUpdate();
- }
- }
}
RenderSurfaceImpl* LayerTreeImpl::RootRenderSurface() const {
@@ -965,6 +937,13 @@ void LayerTreeImpl::DidUpdatePageScale() {
set_needs_update_draw_properties();
DidUpdateScrollState(inner_viewport_scroll_layer_id_);
+
+ if (IsActiveTree() && OuterViewportScrollLayer()) {
bokan 2017/04/25 22:56:48 Use LTHI::ViewportMainScrollLayer rather than Oute
skobes 2017/04/27 00:46:31 Done.
+ if (ScrollbarAnimationController* controller =
+ layer_tree_host_impl_->ScrollbarAnimationControllerForElementId(
+ OuterViewportScrollLayer()->element_id()))
+ controller->DidScrollUpdate();
+ }
}
void LayerTreeImpl::SetDeviceScaleFactor(float device_scale_factor) {

Powered by Google App Engine
This is Rietveld 408576698