Skip to content

Commit 28e2ee7

Browse files
committed
[css-containment] Add some optimization use-cases.
1 parent 26216a7 commit 28e2ee7

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

css-containment/Overview.bs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ Types of Containment</h2>
122122
and helps authors compose their page out of functional units,
123123
as it limits how widely an effect a given change can have on a document.
124124

125+
Issue: What other effects need to be built into the containment types?
126+
125127
<h3 id='containment-layout'>
126128
Layout Containment</h3>
127129

@@ -137,7 +139,18 @@ Layout Containment</h3>
137139

138140
Possible optimizations that can be enabled by <a>layout containment</a> include (but are not limited to):
139141

140-
...
142+
1. When the style or contents of a descendant of the containing element is changed,
143+
calculating what part of the DOM tree is "dirtied" and might need to be re-laid out
144+
can stop at the containing element.
145+
146+
2. When laying out the page,
147+
if the containing element is off-screen or obscured,
148+
the layout of its contents can be delayed or done at a lower priority.
149+
150+
3. When laying out the page,
151+
the contents of separate containing elements
152+
can be laid out in parallel,
153+
as they're guaranteed not to affect each other.
141154

142155
<h3 id='containment-style'>
143156
Style Containment</h3>
@@ -168,7 +181,9 @@ Style Containment</h3>
168181

169182
Possible optimizations that can be enabled by <a>style containment</a> include (but are not limited to):
170183

171-
...
184+
1. Whenever a property is changed on a descendant of the containing element,
185+
calculating what part of the DOM tree is "dirtied" and might need to have its style recalculated
186+
can stop at the containing element.
172187

173188
<h3 id='containment-paint'>
174189
Paint Containment</h3>
@@ -181,5 +196,11 @@ Paint Containment</h3>
181196

182197
Possible optimizations that can be enabled by <a>paint containment</a> include (but are not limited to):
183198

184-
...
199+
1. If the containing element is off-screen or obscured,
200+
the UA can directly skip trying to paint its contents,
201+
as they're guaranteed to be off-screen/obscured as well.
185202

203+
2. If the containing element is ''overflow:visible'',
204+
the UA can reserve "canvas" space for the element exactly the element's size.
205+
(Normally, UAs often predictively overpaint elements somewhat,
206+
so scrolls can start showing content immediately.)

0 commit comments

Comments
 (0)