Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: third_party/WebKit/Source/core/paint/README.md

Issue 1833493003: Remove ForceHorriblySlowRectMapping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pi
Patch Set: Add markdown, etc. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 5 ## Stacked contents and stacking contexts
6 6
7 This chapter is basically a clarification of [CSS 2.1 appendix E. Elaborate desc ription 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). 8 of Stacking Contexts](http://www.w3.org/TR/CSS21/zindex.html).
9 9
10 According to the documentation, we can have the following types of elements that are 10 According to the documentation, we can have the following types of elements that are
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 cached painting. 63 cached painting.
64 64
65 ### Slimming paint v1 65 ### Slimming paint v1
66 66
67 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
68 `Source/core/layout`. 68 `Source/core/layout`.
69 69
70 Paint invalidation is a document cycle stage after compositing update and before paint. 70 Paint invalidation is a document cycle stage after compositing update and before paint.
71 During the previous stages, objects are marked for needing paint invalidation ch ecking 71 During the previous stages, objects are marked for needing paint invalidation ch ecking
72 if needed by style change, layout change, compositing change, etc. In paint inva lidation stage, 72 if needed by style change, layout change, compositing change, etc. In paint inva lidation stage,
73 we traverse the layout tree for marked subtrees and objects and send the followi ng information 73 we traverse the layout tree in pre-order, crossing frame boundaries, for marked subtrees
74 to `GraphicsLayer`s and `PaintController`s: 74 and objects and send the following information to `GraphicsLayer`s and `PaintCon troller`s:
75 75
76 * paint invalidation rects: must cover all areas that will generete different pixels. 76 * paint invalidation rects: must cover all areas that will generete different pixels.
77 * invalidated display item clients: must invalidate all display item clients t hat will 77 * invalidated display item clients: must invalidate all display item clients t hat will
78 generate different display items. 78 generate different display items.
79 79
80 #### `PaintInvalidationState`
81
82 `PaintInvalidationState` is an optimization used during the paint invalidation p hase. Before
83 the paint invalidation tree walk, a root `PaintInvalidationState` is created for the root
84 `LayoutView`. During the tree walk, one `PaintInvalidationState` is created for each visited
85 object based on the `PaintInvalidationState` passed from the parent object.
86 It tracks the following information to provide O(1) complexity access to them if possible:
87
88 * Paint invalidation container: an ancestor (crossing frame boundaries) of the current object
chrishtr 2016/03/31 21:54:59 "stacked object": positioned objects, non-auto-z-i
Xianzhu 2016/04/01 16:07:56 Done. We already have a whole chapter for "stacked
89 which can handle paint invalidation of the current object. `PaintInvalidatio nState` must track
90 two paint invalidation containers for stacked contents and normal flow conte nts separately:
chrishtr 2016/03/31 21:54:59 Add: Since as indicated by the definitions above,
trchen 2016/03/31 22:00:38 It this example correct? It looks to me both A and
chrishtr 2016/03/31 22:06:05 Sorry, forgot to remove position:absolute on B.
Xianzhu 2016/04/01 16:07:56 Done.
91
92 * Paint invalidation container of a stacked object (and its normal flow co ntents) is the
93 nearest ancestor composited object which establishes a stacking context.
94
95 * Paint invalidation container of a normal flow object is the nearest comp osited ancestor.
96
97 * Paint offset and clip rect: if possible, `PaintInvalidationState` accumulate s paint offsets
98 and overflow clipping rects from the paint invalidation container to provide O(1) complexity to
99 map a point or a rect in current object's local space to paint invalidation container's space.
100 Because locations of absolute-position objects are determined by their conta ining blocks,
chrishtr 2016/03/31 21:54:59 "Because locations of objects are determined by th
Xianzhu 2016/04/01 16:07:56 Done.
101 we track paint offsets and overflow clipping rects for absolute-position obj ects separately.
102
103 In cases that accurate accumulation of paint offsets and clipping rects is impos sible,
104 we will fallback to slow-path using `LayoutObject::localToAncestorPoint()` or
105 `LayoutObject::mapToVisualRectInAncestorSpace()`. This includes the following ca ses:
106
107 * An object has transform related property, is multi-column or has flipped blo cks writing-mode,
108 causing we can't simply accumulate paint offset for mapping a local rect to paint invalidation
109 container;
110
111 * An object has has filter or reflection, which needs to expand paint invalida tion rect
112 for descendants, because currently we don't include and reflection extents i nto visual overflow;
113
114 * For a fixed-position object we calculate its offset using `LayoutObject::loc alToAncestorPoint()`,
115 but map for its descendants in fast-path if no other things prevent us from doing this;
116
117 * Because we track paint offset from the normal paint invalidation container o nly, if we are going
118 to use `m_paintInvalidationContainerForStackedContents` and it's different f rom the normal paint
119 invalidation container, we have to force slow-path because the accumulated p aint offset is not
120 usable;
121
122 * We also stop to track paint offset and clipping rect for absolute-position o bjects when
123 `m_paintInvalidationContainerForStackedContents` becomes different from `m_p aintInvalidationContainer`,
124 or absolute-position descendants' offsets will be determined by something (e .g. their containing
125 block) above the paint invalidation container.
126
80 ### Paint invalidation of texts 127 ### Paint invalidation of texts
81 128
82 Texts are painted by `InlineTextBoxPainter` using `InlineTextBox` as display ite m client. 129 Texts are painted by `InlineTextBoxPainter` using `InlineTextBox` as display ite m client.
83 Text backgrounds and masks are painted by `InlineTextFlowPainter` using `InlineF lowBox` 130 Text backgrounds and masks are painted by `InlineTextFlowPainter` using `InlineF lowBox`
84 as display item client. We should invalidate these display item clients when the ir painting 131 as display item client. We should invalidate these display item clients when the ir painting
85 will change. 132 will change.
86 133
87 `LayoutInline`s and `LayoutText`s are marked for full paint invalidation if need ed when 134 `LayoutInline`s and `LayoutText`s are marked for full paint invalidation if need ed when
88 new style is set on them. During paint invalidation, we invalidate the `InlineFl owBox`s 135 new style is set on them. During paint invalidation, we invalidate the `InlineFl owBox`s
89 directly contained by the `LayoutInline` in `LayoutInline::invalidateDisplayItem Clients()` and 136 directly contained by the `LayoutInline` in `LayoutInline::invalidateDisplayItem Clients()` and
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 In a subsequence paint, if the layer would generate exactly the same display ite ms, we'll simply 183 In a subsequence paint, if the layer would generate exactly the same display ite ms, we'll simply
137 output a `CachedSubsequence` display item in place of the display items, and ski p all paintings 184 output a `CachedSubsequence` display item in place of the display items, and ski p all paintings
138 of the layer and its descendants in painting order. After painting, `PaintContro ller` will 185 of the layer and its descendants in painting order. After painting, `PaintContro ller` will
139 replace `CacheSubsequence` with cached display items created in previous paintin gs. 186 replace `CacheSubsequence` with cached display items created in previous paintin gs.
140 187
141 There are many conditions affecting 188 There are many conditions affecting
142 * whether we need to generate subsequence for a PaintLayer; 189 * whether we need to generate subsequence for a PaintLayer;
143 * whether we can use cached subsequence for a PaintLayer. 190 * whether we can use cached subsequence for a PaintLayer.
144 See `shouldCreateSubsequence()` and `shouldRepaintSubsequence()` in `PaintLayerP ainter.cpp` for 191 See `shouldCreateSubsequence()` and `shouldRepaintSubsequence()` in `PaintLayerP ainter.cpp` for
145 the conditions. 192 the conditions.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698