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

Unified 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, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/README.md
diff --git a/third_party/WebKit/Source/core/paint/README.md b/third_party/WebKit/Source/core/paint/README.md
index 643933a3a7ad42434d21ed2718b188c344f8dc4a..1c42750aee2dcc06c884566f541310aa545f93bb 100644
--- a/third_party/WebKit/Source/core/paint/README.md
+++ b/third_party/WebKit/Source/core/paint/README.md
@@ -70,13 +70,60 @@ Though described in this document, most of the actual paint invalidation code is
Paint invalidation is a document cycle stage after compositing update and before paint.
During the previous stages, objects are marked for needing paint invalidation checking
if needed by style change, layout change, compositing change, etc. In paint invalidation stage,
-we traverse the layout tree for marked subtrees and objects and send the following information
-to `GraphicsLayer`s and `PaintController`s:
+we traverse the layout tree in pre-order, crossing frame boundaries, for marked subtrees
+and objects and send the following information to `GraphicsLayer`s and `PaintController`s:
* paint invalidation rects: must cover all areas that will generete different pixels.
* invalidated display item clients: must invalidate all display item clients that will
generate different display items.
+#### `PaintInvalidationState`
+
+`PaintInvalidationState` is an optimization used during the paint invalidation phase. Before
+the paint invalidation tree walk, a root `PaintInvalidationState` is created for the root
+`LayoutView`. During the tree walk, one `PaintInvalidationState` is created for each visited
+object based on the `PaintInvalidationState` passed from the parent object.
+It tracks the following information to provide O(1) complexity access to them if possible:
+
+* 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
+ which can handle paint invalidation of the current object. `PaintInvalidationState` must track
+ two paint invalidation containers for stacked contents and normal flow contents 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.
+
+ * Paint invalidation container of a stacked object (and its normal flow contents) is the
+ nearest ancestor composited object which establishes a stacking context.
+
+ * Paint invalidation container of a normal flow object is the nearest composited ancestor.
+
+* Paint offset and clip rect: if possible, `PaintInvalidationState` accumulates paint offsets
+ and overflow clipping rects from the paint invalidation container to provide O(1) complexity to
+ map a point or a rect in current object's local space to paint invalidation container's space.
+ Because locations of absolute-position objects are determined by their containing blocks,
chrishtr 2016/03/31 21:54:59 "Because locations of objects are determined by th
Xianzhu 2016/04/01 16:07:56 Done.
+ we track paint offsets and overflow clipping rects for absolute-position objects separately.
+
+In cases that accurate accumulation of paint offsets and clipping rects is impossible,
+we will fallback to slow-path using `LayoutObject::localToAncestorPoint()` or
+`LayoutObject::mapToVisualRectInAncestorSpace()`. This includes the following cases:
+
+* An object has transform related property, is multi-column or has flipped blocks writing-mode,
+ causing we can't simply accumulate paint offset for mapping a local rect to paint invalidation
+ container;
+
+* An object has has filter or reflection, which needs to expand paint invalidation rect
+ for descendants, because currently we don't include and reflection extents into visual overflow;
+
+* For a fixed-position object we calculate its offset using `LayoutObject::localToAncestorPoint()`,
+ but map for its descendants in fast-path if no other things prevent us from doing this;
+
+* Because we track paint offset from the normal paint invalidation container only, if we are going
+ to use `m_paintInvalidationContainerForStackedContents` and it's different from the normal paint
+ invalidation container, we have to force slow-path because the accumulated paint offset is not
+ usable;
+
+* We also stop to track paint offset and clipping rect for absolute-position objects when
+ `m_paintInvalidationContainerForStackedContents` becomes different from `m_paintInvalidationContainer`,
+ or absolute-position descendants' offsets will be determined by something (e.g. their containing
+ block) above the paint invalidation container.
+
### Paint invalidation of texts
Texts are painted by `InlineTextBoxPainter` using `InlineTextBox` as display item client.

Powered by Google App Engine
This is Rietveld 408576698