| OLD | NEW |
| 1 # `Source/core/paint` | 1 # `Source/core/paint` |
| 2 | 2 |
| 3 This directory contains implementation of painters of layout objects. It covers | 3 This directory contains implementation of painters of layout objects. It covers |
| 4 the following document lifecycle states: | 4 the following document lifecycle states: |
| 5 | 5 |
| 6 * PaintInvalidation (`InPaintInvalidation` and `PaintInvalidationClean`) | 6 * PaintInvalidation (`InPaintInvalidation` and `PaintInvalidationClean`) |
| 7 * PrePaint (`InPrePaint` and `PrePaintClean`) | 7 * PrePaint (`InPrePaint` and `PrePaintClean`) |
| 8 * Paint (`InPaint` and `PaintClean`) | 8 * Paint (`InPaint` and `PaintClean`) |
| 9 | 9 |
| 10 ## Glossaries | 10 ## Glossaries |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 `PaintLayer`s to represent some layout objects. It is the ancestor along the
paint | 80 `PaintLayer`s to represent some layout objects. It is the ancestor along the
paint |
| 81 ancestor chain which has a PaintLayer. Implemented in | 81 ancestor chain which has a PaintLayer. Implemented in |
| 82 `PaintLayer::compositingContainer()`. Think of it as skipping intermediate n
ormal | 82 `PaintLayer::compositingContainer()`. Think of it as skipping intermediate n
ormal |
| 83 objects and going directly to the containing stacked object. | 83 objects and going directly to the containing stacked object. |
| 84 | 84 |
| 85 * Compositing container chain: same as paint chain, but for compositing contai
ner. | 85 * Compositing container chain: same as paint chain, but for compositing contai
ner. |
| 86 | 86 |
| 87 * Paint invalidation container: the nearest object on the compositing containe
r | 87 * Paint invalidation container: the nearest object on the compositing containe
r |
| 88 chain which is composited. | 88 chain which is composited. |
| 89 | 89 |
| 90 * Visual rect: the bounding box of all pixels that will be painted by a |
| 91 display item client. |
| 92 |
| 90 ## Paint invalidation | 93 ## Paint invalidation |
| 91 | 94 |
| 92 Paint invalidation marks anything that need to be painted differently from the o
riginal | 95 Paint invalidation marks anything that need to be painted differently from the o
riginal |
| 93 cached painting. | 96 cached painting. |
| 94 | 97 |
| 95 ### Slimming paint v1 | 98 ### Slimming paint v1 |
| 96 | 99 |
| 97 Though described in this document, most of the actual paint invalidation code is
under | 100 Though described in this document, most of the actual paint invalidation code is
under |
| 98 `Source/core/layout`. | 101 `Source/core/layout`. |
| 99 | 102 |
| 100 Paint invalidation is a document cycle stage after compositing update and before
paint. | 103 Paint invalidation is a document cycle stage after compositing update and before
paint. |
| 101 During the previous stages, objects are marked for needing paint invalidation ch
ecking | 104 During the previous stages, objects are marked for needing paint invalidation ch
ecking |
| 102 if needed by style change, layout change, compositing change, etc. In paint inva
lidation stage, | 105 if needed by style change, layout change, compositing change, etc. In paint inva
lidation stage, |
| 103 we traverse the layout tree in pre-order, crossing frame boundaries, for marked
subtrees | 106 we traverse the layout tree in pre-order, crossing frame boundaries, for marked
subtrees |
| 104 and objects and send the following information to `GraphicsLayer`s and `PaintCon
troller`s: | 107 and objects and send the following information to `GraphicsLayer`s and `PaintCon
troller`s: |
| 105 | 108 |
| 106 * paint invalidation rects: must cover all areas that will generete different
pixels. | 109 * invalidated display item clients: must invalidate all display item clients |
| 107 * invalidated display item clients: must invalidate all display item clients t
hat will | 110 that will generate different display items. |
| 108 generate different display items. | 111 |
| 112 * paint invalidation rects: must cover all areas that will generate different |
| 113 pixels. They are generated based on visual rects of invalidated display item |
| 114 clients. |
| 109 | 115 |
| 110 #### `PaintInvalidationState` | 116 #### `PaintInvalidationState` |
| 111 | 117 |
| 112 `PaintInvalidationState` is an optimization used during the paint invalidation p
hase. Before | 118 `PaintInvalidationState` is an optimization used during the paint invalidation p
hase. Before |
| 113 the paint invalidation tree walk, a root `PaintInvalidationState` is created for
the root | 119 the paint invalidation tree walk, a root `PaintInvalidationState` is created for
the root |
| 114 `LayoutView`. During the tree walk, one `PaintInvalidationState` is created for
each visited | 120 `LayoutView`. During the tree walk, one `PaintInvalidationState` is created for
each visited |
| 115 object based on the `PaintInvalidationState` passed from the parent object. | 121 object based on the `PaintInvalidationState` passed from the parent object. |
| 116 It tracks the following information to provide O(1) complexity access to them if
possible: | 122 It tracks the following information to provide O(1) complexity access to them if
possible: |
| 117 | 123 |
| 118 * Paint invalidation container: Since as indicated by the definitions in [Glos
saries](#Other glossaries), | 124 * Paint invalidation container: Since as indicated by the definitions in [Glos
saries](#Other glossaries), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 135 clipping rects for absolute-position objects separately. | 141 clipping rects for absolute-position objects separately. |
| 136 | 142 |
| 137 In cases that accurate accumulation of paint offsets and clipping rects is impos
sible, | 143 In cases that accurate accumulation of paint offsets and clipping rects is impos
sible, |
| 138 we will fall back to slow-path using `LayoutObject::localToAncestorPoint()` or | 144 we will fall back to slow-path using `LayoutObject::localToAncestorPoint()` or |
| 139 `LayoutObject::mapToVisualRectInAncestorSpace()`. This includes the following ca
ses: | 145 `LayoutObject::mapToVisualRectInAncestorSpace()`. This includes the following ca
ses: |
| 140 | 146 |
| 141 * An object has transform related property, is multi-column or has flipped blo
cks writing-mode, | 147 * An object has transform related property, is multi-column or has flipped blo
cks writing-mode, |
| 142 causing we can't simply accumulate paint offset for mapping a local rect to
paint invalidation | 148 causing we can't simply accumulate paint offset for mapping a local rect to
paint invalidation |
| 143 container; | 149 container; |
| 144 | 150 |
| 145 * An object has has filter or reflection, which needs to expand paint invalida
tion rect | 151 * An object has has filter (including filter induced by reflection), which |
| 146 for descendants, because currently we don't include and reflection extents i
nto visual overflow; | 152 needs to expand visual rect for descendants, because currently we don't |
| 153 include and filter extents into visual overflow; |
| 147 | 154 |
| 148 * For a fixed-position object we calculate its offset using `LayoutObject::loc
alToAncestorPoint()`, | 155 * For a fixed-position object we calculate its offset using `LayoutObject::loc
alToAncestorPoint()`, |
| 149 but map for its descendants in fast-path if no other things prevent us from
doing this; | 156 but map for its descendants in fast-path if no other things prevent us from
doing this; |
| 150 | 157 |
| 151 * Because we track paint offset from the normal paint invalidation container o
nly, if we are going | 158 * Because we track paint offset from the normal paint invalidation container o
nly, if we are going |
| 152 to use `m_paintInvalidationContainerForStackedContents` and it's different f
rom the normal paint | 159 to use `m_paintInvalidationContainerForStackedContents` and it's different f
rom the normal paint |
| 153 invalidation container, we have to force slow-path because the accumulated p
aint offset is not | 160 invalidation container, we have to force slow-path because the accumulated p
aint offset is not |
| 154 usable; | 161 usable; |
| 155 | 162 |
| 156 * We also stop to track paint offset and clipping rect for absolute-position o
bjects when | 163 * We also stop to track paint offset and clipping rect for absolute-position o
bjects when |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 267 |
| 261 When layer structure changes, and we are not invalidate paint of the changed sub
tree, | 268 When layer structure changes, and we are not invalidate paint of the changed sub
tree, |
| 262 we need to manually update the `needsPaintPhaseXXX` flags. For example, if an ob
ject changes | 269 we need to manually update the `needsPaintPhaseXXX` flags. For example, if an ob
ject changes |
| 263 style and creates a self-painting-layer, we copy the flags from its containing s
elf-painting | 270 style and creates a self-painting-layer, we copy the flags from its containing s
elf-painting |
| 264 layer to this layer, assuming that this layer needs all paint phases that its co
ntainer | 271 layer to this layer, assuming that this layer needs all paint phases that its co
ntainer |
| 265 self-painting layer needs. | 272 self-painting layer needs. |
| 266 | 273 |
| 267 We could update the `needsPaintPhaseXXX` flags in a separate tree walk, but that
would regress | 274 We could update the `needsPaintPhaseXXX` flags in a separate tree walk, but that
would regress |
| 268 performance of the first paint. For slimming paint v2, we can update the flags d
uring the | 275 performance of the first paint. For slimming paint v2, we can update the flags d
uring the |
| 269 pre-painting tree walk to simplify the logics. | 276 pre-painting tree walk to simplify the logics. |
| OLD | NEW |