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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2214253002: Don't traverse non-stacked layer under composited child in traverseNonCompositingDescendants (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index 78d02a87c11a1c59fab1f61efe381b2dd8aebd62..ab1c9454da1bd61a6cd564dd610db3f0333e3de3 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -3489,11 +3489,16 @@ namespace {
// TODO(trchen): Use std::function<void, LayoutObject&> when available.
template <typename LayoutObjectTraversalFunctor>
-void traverseNonCompositingDescendants(LayoutObject&, const LayoutObjectTraversalFunctor&);
+void traverseNonCompositingDescendantsInPaintOrder(LayoutObject&, const LayoutObjectTraversalFunctor&);
template <typename LayoutObjectTraversalFunctor>
-void findNonCompositedDescendantLayerToTraverse(LayoutObject& object, const LayoutObjectTraversalFunctor& functor)
+void traverseNonCompositingDescendantsBelongingToAncestorPaintInvalidationContainer(LayoutObject& object, const LayoutObjectTraversalFunctor& functor)
{
+ // |object| is a paint invalidation container but is not a stacking context, so the paint
+ // invalidation container of stacked descendants don't belong to |object| but belong to
+ // an ancestor. This function traverses all such descendants.
+ DCHECK(object.isPaintInvalidationContainer() && !object.styleRef().isStackingContext());
+
LayoutObject* descendant = object.nextInPreOrder(&object);
while (descendant) {
// Case 1: If the descendant has no layer, keep searching until we find a layer.
@@ -3502,11 +3507,17 @@ void findNonCompositedDescendantLayerToTraverse(LayoutObject& object, const Layo
continue;
}
// Case 2: The descendant has a layer and is not composited.
- // The invalidation container of its subtree is our parent,
- // thus recur into the subtree.
if (!descendant->isPaintInvalidationContainer()) {
trchen 2016/08/04 23:34:55 // Case 2: The descendant is stacked but not compo
Xianzhu 2016/08/05 00:27:07 Done.
- traverseNonCompositingDescendants(*descendant, functor);
- descendant = descendant->nextInPreOrderAfterChildren(&object);
+ // Case 2a: The descendant is stacked. The invalidation container of
+ // its subtree is our ancestor, thus recur into the subtree.
+ if (descendant->styleRef().isStacked()) {
+ traverseNonCompositingDescendantsInPaintOrder(*descendant, functor);
+ descendant = descendant->nextInPreOrderAfterChildren(&object);
+ continue;
+ }
+ // Case 2b: The descendant is not stacked so its paint invalidation container
+ // is still |object|. Keep searching.
+ descendant = descendant->nextInPreOrder(&object);
continue;
}
// Case 3: The descendant is an invalidation container and is a stacking context.
@@ -3523,7 +3534,7 @@ void findNonCompositedDescendantLayerToTraverse(LayoutObject& object, const Layo
}
template <typename LayoutObjectTraversalFunctor>
-void traverseNonCompositingDescendants(LayoutObject& object, const LayoutObjectTraversalFunctor& functor)
+void traverseNonCompositingDescendantsInPaintOrder(LayoutObject& object, const LayoutObjectTraversalFunctor& functor)
{
functor(object);
LayoutObject* descendant = object.nextInPreOrder(&object);
@@ -3540,7 +3551,7 @@ void traverseNonCompositingDescendants(LayoutObject& object, const LayoutObjectT
// If a paint invalidation container is not a stacking context,
// some of its descendants may belong to the parent container.
- findNonCompositedDescendantLayerToTraverse(*descendant, functor);
+ traverseNonCompositingDescendantsBelongingToAncestorPaintInvalidationContainer(*descendant, functor);
descendant = descendant->nextInPreOrderAfterChildren(&object);
}
}
@@ -3553,7 +3564,7 @@ void LayoutObject::invalidateDisplayItemClientsIncludingNonCompositingDescendant
DisableCompositingQueryAsserts disabler;
slowSetPaintingLayerNeedsRepaint();
- traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [reason](LayoutObject& object) {
+ traverseNonCompositingDescendantsInPaintOrder(const_cast<LayoutObject&>(*this), [reason](LayoutObject& object) {
if (object.hasLayer() && toLayoutBoxModelObject(object).hasSelfPaintingLayer())
toLayoutBoxModelObject(object).layer()->setNeedsRepaint();
object.invalidateDisplayItemClients(reason);
@@ -3586,7 +3597,7 @@ void LayoutObject::invalidatePaintIncludingNonCompositingDescendants()
{
// Since we're only painting non-composited layers, we know that they all share the same paintInvalidationContainer.
const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintInvalidation();
- traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](LayoutObject& object) {
+ traverseNonCompositingDescendantsInPaintOrder(*this, [&paintInvalidationContainer](LayoutObject& object) {
if (object.hasLayer())
toLayoutBoxModelObject(object).layer()->setNeedsRepaint();
object.invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationContainer, PaintInvalidationSubtree);
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698