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

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: 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 3373 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 object.invalidateDisplayItemClients(m_paintInvalidationContainer, Pa intInvalidationFull, invalidationRect, invalidationRect); 3384 object.invalidateDisplayItemClients(m_paintInvalidationContainer, Pa intInvalidationFull, invalidationRect, invalidationRect);
3385 } 3385 }
3386 private: 3386 private:
3387 const LayoutBoxModelObject& m_paintInvalidationContainer; 3387 const LayoutBoxModelObject& m_paintInvalidationContainer;
3388 }; 3388 };
3389 3389
3390 const LayoutBoxModelObject& paintInvalidationContainer = *paintInvalidationL ayer->layoutObject(); 3390 const LayoutBoxModelObject& paintInvalidationContainer = *paintInvalidationL ayer->layoutObject();
3391 traverseNonCompositingDescendants(const_cast<LayoutObject&>(object), Functor (paintInvalidationContainer)); 3391 traverseNonCompositingDescendants(const_cast<LayoutObject&>(object), Functor (paintInvalidationContainer));
3392 } 3392 }
3393 3393
3394 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) const
3395 {
3396 // These disablers are valid because we want to use the current compositing/ invalidation status.
3397 DisablePaintInvalidationStateAsserts invalidationDisabler;
3398 DisableCompositingQueryAsserts compositingDisabler;
3399
3400 LayoutRect invalidationRect = previousPaintInvalidationRect();
3401 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer);
3402 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer);
3403 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer, invalidationRect, invalidationRect);
3404 }
3405
3394 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() 3406 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants()
3395 { 3407 {
3396 class Functor : public LayoutObjectTraversalFunctor { 3408 class Functor : public LayoutObjectTraversalFunctor {
3397 public: 3409 public:
3398 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { } 3410 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { }
3399 void operator()(LayoutObject& object) const override 3411 void operator()(LayoutObject& object) const override
3400 { 3412 {
3401 LayoutRect invalidationRect = object.previousPaintInvalidationRect() ; 3413 object.invalidatePaintOfPreviousPaintInvalidationRect(m_paintInvalid ationContainer, PaintInvalidationLayer);
3402 object.adjustInvalidationRectForCompositedScrolling(invalidationRect , m_paintInvalidationContainer); 3414 object.setPreviousPaintInvalidationRect(LayoutRect());
3403 object.invalidatePaintUsingContainer(m_paintInvalidationContainer, i nvalidationRect, PaintInvalidationLayer);
3404 object.invalidateDisplayItemClients(m_paintInvalidationContainer, Pa intInvalidationLayer, invalidationRect, invalidationRect);
3405 } 3415 }
3406 private: 3416 private:
3407 const LayoutBoxModelObject& m_paintInvalidationContainer; 3417 const LayoutBoxModelObject& m_paintInvalidationContainer;
3408 }; 3418 };
3409 3419
3410 // Since we're only painting non-composited layers, we know that they all sh are the same paintInvalidationContainer. 3420 // Since we're only painting non-composited layers, we know that they all sh are the same paintInvalidationContainer.
3411 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree(); 3421 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree();
3412 traverseNonCompositingDescendants(*this, Functor(paintInvalidationContainer) ); 3422 traverseNonCompositingDescendants(*this, Functor(paintInvalidationContainer) );
3413 } 3423 }
3414 3424
3415 // FIXME: If we had a flag to force invalidations in a whole subtree, we could g et rid of this function (crbug.com/410097). 3425 // FIXME: If we had a flag to force invalidations in a whole subtree, we could g et rid of this function (crbug.com/410097).
3416 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen dants() 3426 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen dants()
3417 { 3427 {
3418 class Functor : public LayoutObjectTraversalFunctor { 3428 class Functor : public LayoutObjectTraversalFunctor {
3419 public: 3429 public:
3420 void operator()(LayoutObject& object) const override 3430 void operator()(LayoutObject& object) const override
3421 { 3431 {
3422 object.setShouldDoFullPaintInvalidation(); 3432 object.setShouldDoFullPaintInvalidation();
3423 } 3433 }
3424 }; 3434 };
3425 3435
3426 // Need to access the current compositing status. 3436 // Need to access the current compositing status.
3427 DisableCompositingQueryAsserts disabler; 3437 DisableCompositingQueryAsserts disabler;
3428 traverseNonCompositingDescendants(*this, Functor()); 3438 traverseNonCompositingDescendants(*this, Functor());
3429 } 3439 }
3430 3440
3441 void LayoutObject::invalidatePaintIncludingNonLayerDescendantsInternal(const Lay outBoxModelObject& paintInvalidationContainer)
chrishtr 2015/10/13 17:49:01 NonPaintLayer
Xianzhu 2015/10/13 23:58:12 Changed to invalidatePaintIncludingNonSelfPainting
3442 {
3443 invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationContainer, P aintInvalidationLayer);
3444 setPreviousPaintInvalidationRect(LayoutRect());
3445 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
3446 if (!child->hasLayer())
chrishtr 2015/10/13 17:49:00 What about non-self-painting layers?
Xianzhu 2015/10/13 23:58:12 We should also invalidate them. Done.
3447 child->invalidatePaintIncludingNonLayerDescendantsInternal(paintInva lidationContainer);
3448 }
3449 }
3450
3451 void LayoutObject::invalidatePaintIncludingNonLayerDescendants()
3452 {
3453 invalidatePaintIncludingNonLayerDescendantsInternal(containerForPaintInvalid ationOnRootedTree());
3454 }
3455
3431 void LayoutObject::setIsSlowRepaintObject(bool isSlowRepaintObject) 3456 void LayoutObject::setIsSlowRepaintObject(bool isSlowRepaintObject)
3432 { 3457 {
3433 ASSERT(frameView()); 3458 ASSERT(frameView());
3434 if (m_bitfields.isSlowRepaintObject() == isSlowRepaintObject) 3459 if (m_bitfields.isSlowRepaintObject() == isSlowRepaintObject)
3435 return; 3460 return;
3436 m_bitfields.setIsSlowRepaintObject(isSlowRepaintObject); 3461 m_bitfields.setIsSlowRepaintObject(isSlowRepaintObject);
3437 if (isSlowRepaintObject) 3462 if (isSlowRepaintObject)
3438 frameView()->addSlowRepaintObject(); 3463 frameView()->addSlowRepaintObject();
3439 else 3464 else
3440 frameView()->removeSlowRepaintObject(); 3465 frameView()->removeSlowRepaintObject();
(...skipping 30 matching lines...) Expand all
3471 const blink::LayoutObject* root = object1; 3496 const blink::LayoutObject* root = object1;
3472 while (root->parent()) 3497 while (root->parent())
3473 root = root->parent(); 3498 root = root->parent();
3474 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3499 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3475 } else { 3500 } else {
3476 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3501 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3477 } 3502 }
3478 } 3503 }
3479 3504
3480 #endif 3505 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutObjectChildList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698