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

Eliminate potential redundant calls to UpdateGeometry.

LocalFrameView::UpdateGeometries is called from
PerformPostLayoutTasks, and then UpdateGeometriesIfNeeded is called
after layout in UpdateStyleAndLayoutIfNeededRecursiveInternal.  If
the first call doesn't clear the needs_update_geometries_ flag, then
the second call will do unnecessary work.

BUG=811457
R=chrishtr@chromium.org

Change-Id: Idc8e11c444d8b02cd9d54c2fd158bbdd59bd5de4
Reviewed-on: https://chromium-review.googlesource.com/923119Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537226}
parent 36073bb6
...@@ -1126,6 +1126,9 @@ void LocalFrameView::UpdateLayout() { ...@@ -1126,6 +1126,9 @@ void LocalFrameView::UpdateLayout() {
RUNTIME_CALL_TIMER_SCOPE(V8PerIsolateData::MainThreadIsolate(), RUNTIME_CALL_TIMER_SCOPE(V8PerIsolateData::MainThreadIsolate(),
RuntimeCallStats::CounterId::kUpdateLayout); RuntimeCallStats::CounterId::kUpdateLayout);
// The actual call to UpdateGeometries is in PerformPostLayoutTasks.
SetNeedsUpdateGeometries();
if (auto_size_info_) if (auto_size_info_)
auto_size_info_->AutoSizeIfNeeded(); auto_size_info_->AutoSizeIfNeeded();
...@@ -1424,21 +1427,6 @@ bool LocalFrameView::HasIntrinsicSizingInfo() const { ...@@ -1424,21 +1427,6 @@ bool LocalFrameView::HasIntrinsicSizingInfo() const {
return EmbeddedReplacedContent(); return EmbeddedReplacedContent();
} }
void LocalFrameView::UpdateGeometries() {
HeapVector<Member<EmbeddedContentView>> views;
ForAllChildViewsAndPlugins(
[&](EmbeddedContentView& view) { views.push_back(view); });
for (const auto& view : views) {
// Script or plugins could detach the frame so abort processing if that
// happens.
if (!GetLayoutView())
break;
view->UpdateGeometry();
}
}
void LocalFrameView::UpdateGeometry() { void LocalFrameView::UpdateGeometry() {
LayoutEmbeddedContent* layout = frame_->OwnerLayoutObject(); LayoutEmbeddedContent* layout = frame_->OwnerLayoutObject();
if (!layout) if (!layout)
...@@ -2092,6 +2080,7 @@ void LocalFrameView::UpdateLayersAndCompositingAfterScrollIfNeeded() { ...@@ -2092,6 +2080,7 @@ void LocalFrameView::UpdateLayersAndCompositingAfterScrollIfNeeded() {
DisableCompositingQueryAsserts disabler; DisableCompositingQueryAsserts disabler;
layer->UpdateLayerPositionsAfterOverflowScroll(); layer->UpdateLayerPositionsAfterOverflowScroll();
layout_object->SetMayNeedPaintInvalidationSubtree(); layout_object->SetMayNeedPaintInvalidationSubtree();
SetNeedsUpdateGeometries();
} }
} }
...@@ -2099,7 +2088,7 @@ void LocalFrameView::UpdateLayersAndCompositingAfterScrollIfNeeded() { ...@@ -2099,7 +2088,7 @@ void LocalFrameView::UpdateLayersAndCompositingAfterScrollIfNeeded() {
// change. Update LocalFrameView and layer positions after scrolling, but // change. Update LocalFrameView and layer positions after scrolling, but
// only if we're not inside of layout. // only if we're not inside of layout.
if (!nested_layout_count_) { if (!nested_layout_count_) {
UpdateGeometries(); UpdateGeometriesIfNeeded();
if (auto* layout_view = this->GetLayoutView()) if (auto* layout_view = this->GetLayoutView())
layout_view->Layer()->SetNeedsCompositingInputsUpdate(); layout_view->Layer()->SetNeedsCompositingInputsUpdate();
} }
...@@ -2590,7 +2579,7 @@ void LocalFrameView::PerformPostLayoutTasks() { ...@@ -2590,7 +2579,7 @@ void LocalFrameView::PerformPostLayoutTasks() {
GetFrame().LocalFrameRoot().GetEventHandler().ScheduleCursorUpdate(); GetFrame().LocalFrameRoot().GetEventHandler().ScheduleCursorUpdate();
} }
UpdateGeometries(); UpdateGeometriesIfNeeded();
// Plugins could have torn down the page inside updateGeometries(). // Plugins could have torn down the page inside updateGeometries().
if (!GetLayoutView()) if (!GetLayoutView())
...@@ -2989,10 +2978,19 @@ void LocalFrameView::VisualViewportScrollbarsChanged() { ...@@ -2989,10 +2978,19 @@ void LocalFrameView::VisualViewportScrollbarsChanged() {
void LocalFrameView::UpdateGeometriesIfNeeded() { void LocalFrameView::UpdateGeometriesIfNeeded() {
if (!needs_update_geometries_) if (!needs_update_geometries_)
return; return;
needs_update_geometries_ = false; needs_update_geometries_ = false;
HeapVector<Member<EmbeddedContentView>> views;
ForAllChildViewsAndPlugins(
[&](EmbeddedContentView& view) { views.push_back(view); });
for (const auto& view : views) {
// Script or plugins could detach the frame so abort processing if that
// happens.
if (!GetLayoutView())
break;
UpdateGeometries(); view->UpdateGeometry();
}
} }
void LocalFrameView::UpdateAllLifecyclePhases() { void LocalFrameView::UpdateAllLifecyclePhases() {
......
...@@ -1104,7 +1104,6 @@ class CORE_EXPORT LocalFrameView final ...@@ -1104,7 +1104,6 @@ class CORE_EXPORT LocalFrameView final
void DidChangeGlobalRootScroller() override; void DidChangeGlobalRootScroller() override;
void UpdateGeometriesIfNeeded(); void UpdateGeometriesIfNeeded();
void UpdateGeometries();
bool WasViewportResized(); bool WasViewportResized();
void SendResizeEventIfNeeded(); void SendResizeEventIfNeeded();
......
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