Automatic update from web-platform-tests
Rewrite counters implementation to no cache approach
This CL removes the old counters implementation that was building
and maintaining a cache of counters (building counters tree).
The removal is due to the following reasons:
1) It didn't support Shadow DOM and there was no way to fix it;
2) It didn't work correctly with style containment and there was
no way to fix it;
3) It was slow and complicated;
4) It was wrong in many cases.
The new approach doesn't build any cache of counters, instead it
visits every element on the very first AttachLayoutTree for the
document and gathers on the fly all the information it needs to
correctly calculate the counters values. It means that we don't
have any overhead due to some additional traversals to build the
counters cache on the first go.
So, all the pages with static (created once and not changed) counters
would render faster.
If there are some counter changes after the first AttachLayoutTree,
we would remember it and then recalculate all counters by doing a full
tree traversal, calculating correct counters values and only update
LayoutCounters created with counter() and counters() functions.
Performance tests held on 300'000 elements with various layouts and
various style updates/element insertions/removals show that doing
such full tree traversal for counter updates doesn't introduce any
noticeable overhead with other browsers (should be noticed that old
implementation could also do full tree traversal in some cases).
For pages with static counters performance for initial document render
is improved around 10 times against the old implementation.
Bug: 990657
Change-Id: I292d3749ad0bf480e88d815e9dbecebe9edc7067
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5483870
Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1298057}
--
wpt-commits: 90cf6d3b851589dea99c460f0aa5e3e9b58f3bbe
wpt-pr: 46054
An explanation of the Firefox Source Code Directory Structure and links to
project pages with documentation can be found at:
https://firefox-source-docs.mozilla.org/contributing/directory_structure.html
For information on how to build Firefox from the source code and create the patch see:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
If you have a question about developing Firefox, and can't find the solution
on https://firefox-source-docs.mozilla.org/, you can try asking your question on Matrix at chat.mozilla.org in `Introduction` (https://chat.mozilla.org/#/room/#introduction:mozilla.org) channel.
Nightly development builds can be downloaded from:
https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/
- or -
https://www.mozilla.org/firefox/channel/desktop/#nightly
Keep in mind that nightly builds, which are used by Firefox developers for
testing, may be buggy.