New issue
Advanced search Search tips

Issue 742413 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug



Sign in to add a comment

Remove forced layout in Document::implicitClose and Document::FinishedParsing

Project Member Reported by chrishtr@chromium.org, Jul 13 2017

Issue description

This layout should happen naturally due to dirty bits and scheduling.


 
Project Member

Comment 2 by bugdroid1@chromium.org, Aug 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e40927a6b8b7da85a67d8a0e2275d98bc57ba906

commit e40927a6b8b7da85a67d8a0e2275d98bc57ba906
Author: Chris Harrelson <chrishtr@chromium.org>
Date: Tue Aug 01 17:26:40 2017

Revert "Force an intersection observation after calling observe()."

This reverts commit fce2e397c7f7c9ef87746abe6b459cc75dc58d29.

Reason for revert: causes issue 750236

Original change's description:
> Force an intersection observation after calling observe().
> 
> Bug: 742413
> Change-Id: I43129261e2c69d32b4e2b31a66d6d4f3bef52a36
> Reviewed-on: https://chromium-review.googlesource.com/571417
> Reviewed-by: Emil A Eklund <eae@chromium.org>
> Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#487579}

TBR=szager@chromium.org,chrishtr@chromium.org,eae@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 742413, 750236
Change-Id: Ida11c28acb1b632b1c7a13825bee6c7e48407ea3
Reviewed-on: https://chromium-review.googlesource.com/594892
Reviewed-by: Emil A Eklund <eae@chromium.org>
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491037}
[modify] https://crrev.com/e40927a6b8b7da85a67d8a0e2275d98bc57ba906/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
[modify] https://crrev.com/e40927a6b8b7da85a67d8a0e2275d98bc57ba906/third_party/WebKit/Source/core/frame/LocalFrameView.h
[modify] https://crrev.com/e40927a6b8b7da85a67d8a0e2275d98bc57ba906/third_party/WebKit/Source/core/intersection_observer/IntersectionObserver.cpp
[modify] https://crrev.com/e40927a6b8b7da85a67d8a0e2275d98bc57ba906/third_party/WebKit/Source/core/scheduler/FrameThrottlingTest.cpp

Project Member

Comment 3 by bugdroid1@chromium.org, Aug 11 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9e783bdc00884b0a760d429db5c5a7784b86c75f

commit 9e783bdc00884b0a760d429db5c5a7784b86c75f
Author: Chris Harrelson <chrishtr@chromium.org>
Date: Fri Aug 11 16:13:45 2017

Re-land: Force an intersection observation after calling observe().

Now avoids paint and compositing phases when an intersection observation
is requested. We only need layout. This saves a lot of memory and
CPU.

Bug: 742413, 750236
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I4fd864b43b61eb1fcdba453d57c9f55c410fcb0d
Reviewed-on: https://chromium-review.googlesource.com/610472
Commit-Queue: Emil A Eklund <eae@chromium.org>
Reviewed-by: Emil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#493767}
[modify] https://crrev.com/9e783bdc00884b0a760d429db5c5a7784b86c75f/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
[modify] https://crrev.com/9e783bdc00884b0a760d429db5c5a7784b86c75f/third_party/WebKit/Source/core/frame/LocalFrameView.h
[modify] https://crrev.com/9e783bdc00884b0a760d429db5c5a7784b86c75f/third_party/WebKit/Source/core/intersection_observer/IntersectionObserver.cpp
[modify] https://crrev.com/9e783bdc00884b0a760d429db5c5a7784b86c75f/third_party/WebKit/Source/core/paint/compositing/PaintLayerCompositor.h
[modify] https://crrev.com/9e783bdc00884b0a760d429db5c5a7784b86c75f/third_party/WebKit/Source/core/scheduler/FrameThrottlingTest.cpp

Summary: Remove forced layout in Document::implicitClose and Document::FinishedParsing (was: Remove forced layout in Document::implicitClose)
Updated description to include Document::FinishedParsing.

This latter one is also bad because it is conditional on certain situations
occuring ("main_resource_was_already_requested").

These forced layouts can also impact performance. See for example:

https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/iFDmDLMLpt8
So I've made some good progress on this. Initially I just skipped the forced style in Document::FinishedParsing, but it caused a lot of layout test regressions (since forced style recalculation has side-effects like fetching CSS backgrounds and so-on). An acceptable solution to reduce the number of those regressions may be to manually advance the document lifecycle state past the styling phase during the layout tests, and that's what this patch stream does:

* https://chromium-review.googlesource.com/c/chromium/src/+/1183427/1
* https://chromium-review.googlesource.com/c/chromium/src/+/1183428/1

The first CL (#1183427), passes the bots, but the second has a mysterious layout test failure (fast/dom/HTMLImageElement/image-srcset-w-onerror.html) that I'm trying to replicate. Interestingly, this failure did not occur in my last rebase, so I'm just bisecting it now.
OK, so I picked this up again (https://chromium-review.googlesource.com/c/chromium/src/+/1104341/6 and previous), very few remaining layout regressions and a couple of failing unit tests (these will be corrected in a subsequent patchset). loading.desktop results are quite similar:

https://drive.google.com/file/d/1RzL2cVuzd38MQNjuB6vadYvEL4BfXqIa/view?usp=sharing


What's also interesting is the effect of this work alongside removing the background HTML parser - during page loading, you get substantially fewer frames drawn, but they're generally more complete:

https://docs.google.com/document/d/1s_sRO8dHpDO7HRHhRkZwBaJuMpAEznb2i885UnmFFF8/edit?usp=sharing


Cc: emilio@chromium.org
Please make sure that background images and other CSS resources that do match elements still block the load event of the document. I'm pretty sure some some pages rely on that, and right now it's compatible across all engines IIRC.

Sign in to add a comment