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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 1403963002: Invalidate non-self-painting-layer descendants when creating a layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update test expectations Created 5 years, 2 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 3370 matching lines...) Expand 10 before | Expand all | Expand 10 after
3381 object.invalidateDisplayItemClients(m_paintInvalidationContainer, Pa intInvalidationFull, invalidationRect, invalidationRect); 3381 object.invalidateDisplayItemClients(m_paintInvalidationContainer, Pa intInvalidationFull, invalidationRect, invalidationRect);
3382 } 3382 }
3383 private: 3383 private:
3384 const LayoutBoxModelObject& m_paintInvalidationContainer; 3384 const LayoutBoxModelObject& m_paintInvalidationContainer;
3385 }; 3385 };
3386 3386
3387 const LayoutBoxModelObject& paintInvalidationContainer = *paintInvalidationL ayer->layoutObject(); 3387 const LayoutBoxModelObject& paintInvalidationContainer = *paintInvalidationL ayer->layoutObject();
3388 traverseNonCompositingDescendants(const_cast<LayoutObject&>(object), Functor (paintInvalidationContainer)); 3388 traverseNonCompositingDescendants(const_cast<LayoutObject&>(object), Functor (paintInvalidationContainer));
3389 } 3389 }
3390 3390
3391 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) const
3392 {
3393 // These disablers are valid because we want to use the current compositing/ invalidation status.
3394 DisablePaintInvalidationStateAsserts invalidationDisabler;
3395 DisableCompositingQueryAsserts compositingDisabler;
3396
3397 LayoutRect invalidationRect = previousPaintInvalidationRect();
3398 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer);
3399 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer);
3400 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer, invalidationRect, invalidationRect);
3401 }
3402
3391 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() 3403 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants()
3392 { 3404 {
3393 class Functor : public LayoutObjectTraversalFunctor { 3405 class Functor : public LayoutObjectTraversalFunctor {
3394 public: 3406 public:
3395 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { } 3407 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { }
3396 void operator()(LayoutObject& object) const override 3408 void operator()(LayoutObject& object) const override
3397 { 3409 {
3398 LayoutRect invalidationRect = object.previousPaintInvalidationRect() ; 3410 object.invalidatePaintOfPreviousPaintInvalidationRect(m_paintInvalid ationContainer, PaintInvalidationLayer);
3399 object.adjustInvalidationRectForCompositedScrolling(invalidationRect , m_paintInvalidationContainer); 3411 object.setPreviousPaintInvalidationRect(LayoutRect());
3400 object.invalidatePaintUsingContainer(m_paintInvalidationContainer, i nvalidationRect, PaintInvalidationLayer);
3401 object.invalidateDisplayItemClients(m_paintInvalidationContainer, Pa intInvalidationLayer, invalidationRect, invalidationRect);
3402 } 3412 }
3403 private: 3413 private:
3404 const LayoutBoxModelObject& m_paintInvalidationContainer; 3414 const LayoutBoxModelObject& m_paintInvalidationContainer;
3405 }; 3415 };
3406 3416
3407 // Since we're only painting non-composited layers, we know that they all sh are the same paintInvalidationContainer. 3417 // Since we're only painting non-composited layers, we know that they all sh are the same paintInvalidationContainer.
3408 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree(); 3418 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree();
3409 traverseNonCompositingDescendants(*this, Functor(paintInvalidationContainer) ); 3419 traverseNonCompositingDescendants(*this, Functor(paintInvalidationContainer) );
3410 } 3420 }
3411 3421
3412 // FIXME: If we had a flag to force invalidations in a whole subtree, we could g et rid of this function (crbug.com/410097). 3422 // FIXME: If we had a flag to force invalidations in a whole subtree, we could g et rid of this function (crbug.com/410097).
3413 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen dants() 3423 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen dants()
3414 { 3424 {
3415 class Functor : public LayoutObjectTraversalFunctor { 3425 class Functor : public LayoutObjectTraversalFunctor {
3416 public: 3426 public:
3417 void operator()(LayoutObject& object) const override 3427 void operator()(LayoutObject& object) const override
3418 { 3428 {
3419 object.setShouldDoFullPaintInvalidation(); 3429 object.setShouldDoFullPaintInvalidation();
3420 } 3430 }
3421 }; 3431 };
3422 3432
3423 // Need to access the current compositing status. 3433 // Need to access the current compositing status.
3424 DisableCompositingQueryAsserts disabler; 3434 DisableCompositingQueryAsserts disabler;
3425 traverseNonCompositingDescendants(*this, Functor()); 3435 traverseNonCompositingDescendants(*this, Functor());
3426 } 3436 }
3427 3437
3438 void LayoutObject::invalidatePaintIncludingNonSelfPaintingLayerDescendants(const LayoutBoxModelObject& paintInvalidationContainer)
3439 {
3440 invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationContainer, P aintInvalidationLayer);
3441 setPreviousPaintInvalidationRect(LayoutRect());
Xianzhu 2015/10/14 18:17:48 I removed this line (and line 3411 above) because
3442 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
3443 if (!child->hasLayer() || !toLayoutBoxModelObject(child)->layer()->isSel fPaintingLayer())
chrishtr 2015/10/14 17:43:00 Also non-compositing right? Non-self-painting pain
Xianzhu 2015/10/14 18:17:48 I think all composited layers are self-painting, o
3444 child->invalidatePaintIncludingNonSelfPaintingLayerDescendants(paint InvalidationContainer);
3445 }
3446 }
3447
3428 void LayoutObject::setIsSlowRepaintObject(bool isSlowRepaintObject) 3448 void LayoutObject::setIsSlowRepaintObject(bool isSlowRepaintObject)
3429 { 3449 {
3430 ASSERT(frameView()); 3450 ASSERT(frameView());
3431 if (m_bitfields.isSlowRepaintObject() == isSlowRepaintObject) 3451 if (m_bitfields.isSlowRepaintObject() == isSlowRepaintObject)
3432 return; 3452 return;
3433 m_bitfields.setIsSlowRepaintObject(isSlowRepaintObject); 3453 m_bitfields.setIsSlowRepaintObject(isSlowRepaintObject);
3434 if (isSlowRepaintObject) 3454 if (isSlowRepaintObject)
3435 frameView()->addSlowRepaintObject(); 3455 frameView()->addSlowRepaintObject();
3436 else 3456 else
3437 frameView()->removeSlowRepaintObject(); 3457 frameView()->removeSlowRepaintObject();
(...skipping 30 matching lines...) Expand all
3468 const blink::LayoutObject* root = object1; 3488 const blink::LayoutObject* root = object1;
3469 while (root->parent()) 3489 while (root->parent())
3470 root = root->parent(); 3490 root = root->parent();
3471 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3491 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3472 } else { 3492 } else {
3473 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3493 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3474 } 3494 }
3475 } 3495 }
3476 3496
3477 #endif 3497 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698