OLD | NEW |
1 # `Source/core/paint` | 1 # `Source/core/paint` |
2 | 2 |
3 This directory contains implementation of painters of layout objects. | 3 This directory contains implementation of painters of layout objects. |
4 | 4 |
| 5 ## Stacked contents and stacking contexts |
| 6 |
| 7 This chapter is basically a clarification of [CSS 2.1 appendix E. Elaborate desc
ription |
| 8 of Stacking Contexts](http://www.w3.org/TR/CSS21/zindex.html). |
| 9 |
| 10 According to the documentation, we can have the following types of elements that
are |
| 11 treated in different ways during painting: |
| 12 |
| 13 * Stacked elements: elements that are z-ordered in stacking contexts. |
| 14 |
| 15 * Stacking contexts: elements with non-auto z-indices. |
| 16 |
| 17 * Elements that are not real stacking contexts but are treated as stacking |
| 18 contexts but don't manage other stacked elements. Their z-ordering are |
| 19 managed by real stacking contexts. They are positioned elements with |
| 20 `z-index: auto` (E.2.8 in the documentation). |
| 21 |
| 22 They must be managed by the enclosing stacking context as stacked elemen
ts |
| 23 because `z-index:auto` and `z-index:0` are considered equal for stacking |
| 24 context sorting and they may interleave by DOM order. |
| 25 |
| 26 The difference of a stacked element of this type from a real stacking co
ntext |
| 27 is that it doesn't manage z-ordering of stacked descendants. These desce
ndants |
| 28 are managed by the parent stacking context of this stacked element. |
| 29 |
| 30 "Stacked element" is not defined as a formal term in the documentation, but
we found |
| 31 it convenient to use this term to refer to any elements participating z-inde
x ordering |
| 32 in stacking contexts. |
| 33 |
| 34 A stacked element is represented by a `PaintLayerStackingNode` associated wi
th a |
| 35 `PaintLayer`. It's painted as self-painting `PaintLayer`s by `PaintLayerPain
ter` |
| 36 by executing all of the steps of the painting algorithm explained in the doc
umentation |
| 37 for the element. When painting a stacked element of the second type, we don'
t |
| 38 paint its stacked descendants which are managed by the parent stacking conte
xt. |
| 39 |
| 40 * Non-stacked pseudo stacking contexts: elements that are not stacked, but pai
nt |
| 41 their descendants (excluding any stacked contents) as if they created stacki
ng |
| 42 contexts. This includes |
| 43 |
| 44 * inline blocks, inline tables, inline-level replaced elements |
| 45 (E.2.7.2.1.4 in the documentation) |
| 46 * non-positioned floating elements (E.2.5 in the documentation) |
| 47 * [flex items](http://www.w3.org/TR/css-flexbox-1/#painting) |
| 48 * [grid items](http://www.w3.org/TR/css-grid-1/#z-order) |
| 49 * custom scrollbar parts |
| 50 |
| 51 They are painted by `ObjectPainter::paintAllPhasesAtomically()` which execut
es |
| 52 all of the steps of the painting algorithm explained in the documentation, e
xcept |
| 53 ignores any descendants which are positioned or have non-auto z-index (which
is |
| 54 achieved by skipping descendants with self-painting layers). |
| 55 |
| 56 * Other normal elements. |
| 57 |
5 ## Painters | 58 ## Painters |
6 | 59 |
7 ## Paint invalidation | 60 ## Paint invalidation |
8 | 61 |
9 Paint invalidation marks anything that need to be painted differently from the o
riginal | 62 Paint invalidation marks anything that need to be painted differently from the o
riginal |
10 cached painting. | 63 cached painting. |
11 | 64 |
12 ### Slimming paint v1 | 65 ### Slimming paint v1 |
13 | 66 |
14 Though described in this document, most of the actual paint invalidation code is
under | 67 Though described in this document, most of the actual paint invalidation code is
under |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 so we never clear the flags. Instead, we use another set of flags (`previousPain
tPhaseXXXWasEmpty`) | 161 so we never clear the flags. Instead, we use another set of flags (`previousPain
tPhaseXXXWasEmpty`) |
109 to record if a painting of a phase actually produced nothing. We'll skip the nex
t | 162 to record if a painting of a phase actually produced nothing. We'll skip the nex
t |
110 painting of the phase if the flag is set, regardless of the corresponding | 163 painting of the phase if the flag is set, regardless of the corresponding |
111 `needsPaintPhaseXXX` flag. We will clear the `previousPaintPhaseXXXWasEmpty` fla
gs when | 164 `needsPaintPhaseXXX` flag. We will clear the `previousPaintPhaseXXXWasEmpty` fla
gs when |
112 we paint with different clipping, scroll offset or interest rect from the previo
us paint. | 165 we paint with different clipping, scroll offset or interest rect from the previo
us paint. |
113 | 166 |
114 We don't clear the `previousPaintPhaseXXXWasEmpty` flags when the layer is marke
d `needsRepaint`. | 167 We don't clear the `previousPaintPhaseXXXWasEmpty` flags when the layer is marke
d `needsRepaint`. |
115 Instead we clear the flag when the corresponding `needsPaintPhaseXXX` is set. Th
is ensures that | 168 Instead we clear the flag when the corresponding `needsPaintPhaseXXX` is set. Th
is ensures that |
116 we won't clear `previousPaintPhaseXXXWasEmpty` flags when unrelated things chang
ed which won't | 169 we won't clear `previousPaintPhaseXXXWasEmpty` flags when unrelated things chang
ed which won't |
117 cause the paint phases to become non-empty. | 170 cause the paint phases to become non-empty. |
OLD | NEW |