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

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

Issue 2219903002: Revert of 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 3d8ce8f59b0dcdb308c25acb5c7d087a64cd85d2..78d02a87c11a1c59fab1f61efe381b2dd8aebd62 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -3489,45 +3489,41 @@
// TODO(trchen): Use std::function<void, LayoutObject&> when available.
template <typename LayoutObjectTraversalFunctor>
-void traverseNonCompositingDescendantsInPaintOrder(LayoutObject&, const LayoutObjectTraversalFunctor&);
+void traverseNonCompositingDescendants(LayoutObject&, const LayoutObjectTraversalFunctor&);
template <typename LayoutObjectTraversalFunctor>
-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());
-
+void findNonCompositedDescendantLayerToTraverse(LayoutObject& object, const LayoutObjectTraversalFunctor& functor)
+{
LayoutObject* descendant = object.nextInPreOrder(&object);
while (descendant) {
- if (!descendant->hasLayer() || !descendant->styleRef().isStacked()) {
- // Case 1: The descendant is not stacked (or is stacked but has not been
- // allocated a layer yet during style change), so either it's a paint invalidation
- // container in the same situation as |object|, or its paint invalidation
- // container is in such situation. Keep searching until a stacked layer is found.
+ // Case 1: If the descendant has no layer, keep searching until we find a layer.
+ if (!descendant->hasLayer()) {
descendant = descendant->nextInPreOrder(&object);
- } else if (!descendant->isPaintInvalidationContainer()) {
- // Case 2: The descendant is stacked and is not composited.
- // The invalidation container of its subtree is our ancestor,
- // thus recur into the subtree.
- traverseNonCompositingDescendantsInPaintOrder(*descendant, functor);
+ 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()) {
+ traverseNonCompositingDescendants(*descendant, functor);
descendant = descendant->nextInPreOrderAfterChildren(&object);
- } else if (descendant->styleRef().isStackingContext()) {
- // Case 3: The descendant is an invalidation container and is a stacking context.
- // No objects in the subtree can have invalidation container outside of it,
- // thus skip the whole subtree.
+ continue;
+ }
+ // Case 3: The descendant is an invalidation container and is a stacking context.
+ // No objects in the subtree can have invalidation container outside of it,
+ // thus skip the whole subtree.
+ if (descendant->styleRef().isStackingContext()) {
descendant = descendant->nextInPreOrderAfterChildren(&object);
- } else {
- // Case 4: The descendant is an invalidation container but not a stacking context.
- // This is the same situation as |object|, thus keep searching.
- descendant = descendant->nextInPreOrder(&object);
- }
+ continue;
+ }
+ // Case 4: The descendant is an invalidation container but not a stacking context.
+ // This is the same situation as the root, thus keep searching.
+ descendant = descendant->nextInPreOrder(&object);
}
}
template <typename LayoutObjectTraversalFunctor>
-void traverseNonCompositingDescendantsInPaintOrder(LayoutObject& object, const LayoutObjectTraversalFunctor& functor)
+void traverseNonCompositingDescendants(LayoutObject& object, const LayoutObjectTraversalFunctor& functor)
{
functor(object);
LayoutObject* descendant = object.nextInPreOrder(&object);
@@ -3535,17 +3531,17 @@
if (!descendant->isPaintInvalidationContainer()) {
functor(*descendant);
descendant = descendant->nextInPreOrder(&object);
- } else if (descendant->styleRef().isStackingContext()) {
- // The descendant is an invalidation container and is a stacking context.
- // No objects in the subtree can have invalidation container outside of it,
- // thus skip the whole subtree.
+ continue;
+ }
+ if (descendant->styleRef().isStackingContext()) {
descendant = descendant->nextInPreOrderAfterChildren(&object);
- } else {
- // If a paint invalidation container is not a stacking context,
- // some of its descendants may belong to the parent container.
- traverseNonCompositingDescendantsBelongingToAncestorPaintInvalidationContainer(*descendant, functor);
- descendant = descendant->nextInPreOrderAfterChildren(&object);
- }
+ continue;
+ }
+
+ // If a paint invalidation container is not a stacking context,
+ // some of its descendants may belong to the parent container.
+ findNonCompositedDescendantLayerToTraverse(*descendant, functor);
+ descendant = descendant->nextInPreOrderAfterChildren(&object);
}
}
@@ -3557,7 +3553,7 @@
DisableCompositingQueryAsserts disabler;
slowSetPaintingLayerNeedsRepaint();
- traverseNonCompositingDescendantsInPaintOrder(const_cast<LayoutObject&>(*this), [reason](LayoutObject& object) {
+ traverseNonCompositingDescendants(const_cast<LayoutObject&>(*this), [reason](LayoutObject& object) {
if (object.hasLayer() && toLayoutBoxModelObject(object).hasSelfPaintingLayer())
toLayoutBoxModelObject(object).layer()->setNeedsRepaint();
object.invalidateDisplayItemClients(reason);
@@ -3590,7 +3586,7 @@
{
// Since we're only painting non-composited layers, we know that they all share the same paintInvalidationContainer.
const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintInvalidation();
- traverseNonCompositingDescendantsInPaintOrder(*this, [&paintInvalidationContainer](LayoutObject& object) {
+ traverseNonCompositingDescendants(*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