Commit a9ecdb68 authored by Stefan Zager's avatar Stefan Zager Committed by Commit Bot

[RootLayerScrolling] Delay call to FrameRectsChanged on overflow scroll.

In the non-RLS code path, when the FrameView's scroll offset changes,
pending_scroll_delta_ is modified, and some of the work is delayed until
the next lifecycle update.  Calling FrameRectsChanged() on every overflow
scroll has a significant performance impact, so this patch replicates the
non-RLS behavior of FrameView by postponing the call to FrameRectsChanged.

BUG=770343

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I10cf0782852dcf1c8021a7a62ce0078aae297e39
Reviewed-on: https://chromium-review.googlesource.com/951641
Commit-Queue: Stefan Zager <szager@chromium.org>
Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541288}
parent c1134a86
......@@ -207,6 +207,7 @@ LocalFrameView::LocalFrameView(LocalFrame& frame, IntRect frame_rect)
horizontal_scrollbar_mode_(kScrollbarAuto),
vertical_scrollbar_mode_(kScrollbarAuto),
scrollbars_suppressed_(false),
root_layer_did_scroll_(false),
in_update_scrollbars_(false),
frame_timing_requests_dirty_(true),
hidden_for_throttling_(false),
......@@ -1717,6 +1718,12 @@ bool LocalFrameView::ShouldSetCursor() const {
page->GetFocusController().IsActive();
}
void LocalFrameView::NotifyFrameRectsChangedIfNeededRecursive() {
ForAllNonThrottledLocalFrameViews([](LocalFrameView& frame_view) {
frame_view.NotifyFrameRectsChangedIfNeeded();
});
}
void LocalFrameView::ScrollContentsIfNeededRecursive() {
ForAllNonThrottledLocalFrameViews(
[](LocalFrameView& frame_view) { frame_view.ScrollContentsIfNeeded(); });
......@@ -3255,7 +3262,11 @@ bool LocalFrameView::UpdateLifecyclePhasesInternal(
}
if (target_state >= DocumentLifecycle::kCompositingClean) {
ScrollContentsIfNeededRecursive();
if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) {
NotifyFrameRectsChangedIfNeededRecursive();
} else {
ScrollContentsIfNeededRecursive();
}
frame_->GetPage()->GlobalRootScrollerController().DidUpdateCompositing(
*this);
......@@ -4741,6 +4752,13 @@ void LocalFrameView::ScrollRectToVisibleInRemoteParent(
params);
}
void LocalFrameView::NotifyFrameRectsChangedIfNeeded() {
if (root_layer_did_scroll_) {
root_layer_did_scroll_ = false;
FrameRectsChanged();
}
}
void LocalFrameView::ScrollContentsIfNeeded() {
if (pending_scroll_delta_.IsZero())
return;
......
......@@ -616,6 +616,9 @@ class CORE_EXPORT LocalFrameView final
}
bool ScrollbarsSuppressed() const { return scrollbars_suppressed_; }
// Indicates the root layer's scroll offset changed since the last frame
void SetRootLayerDidScroll() { root_layer_did_scroll_ = true; }
// Methods for converting between this frame and other coordinate spaces.
// For definitions and an explanation of the varous spaces, please see:
// http://www.chromium.org/developers/design-documents/blink-coordinate-spaces
......@@ -964,6 +967,7 @@ class CORE_EXPORT LocalFrameView final
ScrollBehavior ScrollBehaviorStyle() const override;
void ScrollContentsIfNeeded();
void NotifyFrameRectsChangedIfNeeded();
enum ComputeScrollbarExistenceOption { kFirstPass, kIncremental };
void ComputeScrollbarExistence(bool& new_has_horizontal_scrollbar,
......@@ -1031,6 +1035,7 @@ class CORE_EXPORT LocalFrameView final
DocumentLifecycle::LifecycleState target_state);
void ScrollContentsIfNeededRecursive();
void NotifyFrameRectsChangedIfNeededRecursive();
void UpdateStyleAndLayoutIfNeededRecursive();
void PrePaint();
void PaintTree();
......@@ -1247,7 +1252,7 @@ class CORE_EXPORT LocalFrameView final
IntSize layout_overflow_size_;
bool scrollbars_suppressed_;
bool root_layer_did_scroll_;
bool in_update_scrollbars_;
std::unique_ptr<LayoutAnalyzer> analyzer_;
......
......@@ -464,9 +464,8 @@ void PaintLayerScrollableArea::UpdateScrollOffset(
// As a performance optimization, the scroll offset of the root layer is
// not included in EmbeddedContentView's stored frame rect, so there is no
// reason to mark the FrameView as needing a geometry update here.
// However plugins still need to be notified, so we call FrameRectsChanged.
if (is_root_layer)
frame_view->FrameRectsChanged();
frame_view->SetRootLayerDidScroll();
else
frame_view->SetNeedsUpdateGeometries();
UpdateCompositingLayersAfterScroll();
......
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