Commit 82812cf3 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

[RLS] Use faster fast-path when updating composited root scroller offset.

Previously, we would update all of the composited layers plus reach into the
LayerTreeHost (via some virtuals) to update even more things. All of these
will be updated anyway if the composited layer configurations actually change,
and it's pure overhead here.

PaintLayerCompositor::FrameViewDidScroll does the same thing (and this is
where I cribbed from in my original patch), but it's overkill. I didn't
change that call site, however, since it is non-RLS specific.

Bug:818709

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I3643e42bc4b68bafcfd06dfe787a18b09ee2c7da
Reviewed-on: https://chromium-review.googlesource.com/1038439
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555302}
parent e896f838
......@@ -461,6 +461,20 @@ void ScrollingCoordinator::ScrollableAreaScrollbarLayerDidChange(
}
}
bool ScrollingCoordinator::UpdateCompositedScrollOffset(
ScrollableArea* scrollable_area) {
GraphicsLayer* scroll_layer = scrollable_area->LayerForScrolling();
if (!scroll_layer || scroll_layer->GetScrollableArea() != scrollable_area)
return false;
WebLayer* web_layer = toWebLayer(scrollable_area->LayerForScrolling());
if (!web_layer)
return false;
web_layer->SetScrollPosition(scrollable_area->ScrollPosition());
return true;
}
bool ScrollingCoordinator::ScrollableAreaScrollLayerDidChange(
ScrollableArea* scrollable_area) {
if (!page_ || !page_->MainFrame())
......
......@@ -112,6 +112,11 @@ class CORE_EXPORT ScrollingCoordinator final
bool is_left_side_vertical_scrollbar);
void WillDestroyScrollableArea(ScrollableArea*);
// Udates scroll offset, if the appropriate composited layers exist,
// and if successful, returns true. Otherwise returns false.
bool UpdateCompositedScrollOffset(ScrollableArea* scrollable_area);
// Updates the compositor layers and returns true if the scrolling coordinator
// handled this change.
// TODO(pdr): Factor the container bounds change out of this function. The
......
......@@ -2130,7 +2130,7 @@ void PaintLayerScrollableArea::UpdateCompositingLayersAfterScroll() {
ScrollingCoordinator* scrolling_coordinator = GetScrollingCoordinator();
bool handled_scroll =
Layer()->IsRootLayer() && scrolling_coordinator &&
scrolling_coordinator->ScrollableAreaScrollLayerDidChange(this);
scrolling_coordinator->UpdateCompositedScrollOffset(this);
if (!handled_scroll) {
Layer()->GetCompositedLayerMapping()->SetNeedsGraphicsLayerUpdate(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment