This repository was archived by the owner on Sep 11, 2024. It is now read-only.
Add CSS containment rules for shorter reflow operations#6127
Merged
Conversation
turt2live
approved these changes
Jun 3, 2021
Member
turt2live
left a comment
There was a problem hiding this comment.
overall seems fine, though caniuse says Safari isn't supported: does this have negative impacts on Safari, or is it just ignored?
Contributor
Author
It will have no effect and be ignored In a world where all browser would support that property we could spare ourselves adding |
This was referenced Jun 3, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This introduces CSS containment to the codebase
I am using mainly three CSS properties
You can see the perf benchmark below where I frantically scroll up and down the timeline in Matrix HQ, this PR focuses on reducing the purple (layout) and green (paint). Another PR is looking at reducing the yellow (script) check #6079
contain
Here is a list of all the areas of the page that will now isolate its subtree from the rest of the page. They looked like correct candidates and from my research no content bleeds out of them, making them great candidates for CSS containment
contain: strict)There are probably a lot more area that could benefit from that, but they seemed like some logical blocks of content that will unlikely ever bleed content outside of themselves
content-visiblity
The above lets us almost create a virtualised list of events purely using CSS. This has not landed in every browser but will progressively enhance the experience as this feature lands in more ecosystems
contain-intrinsic-sizeis an estimation of the height of every event in the timeline. This value is arbitrary and subject to change. As far as I understand it's a signal browsers will use to decide when to start rendering components and almost create a better estimatedscrollHeightso that the scrollbar is not "jumpy"Before 🐌
After 🐎