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

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

Issue 1413823005: Invalidate objects when containing block changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 if (paintInvalidationContainerSkipped && object == paintInvalidationCont ainer) 880 if (paintInvalidationContainerSkipped && object == paintInvalidationCont ainer)
881 *paintInvalidationContainerSkipped = true; 881 *paintInvalidationContainerSkipped = true;
882 } 882 }
883 return nullptr; 883 return nullptr;
884 } 884 }
885 885
886 LayoutBlock* LayoutObject::containerForFixedPosition(const LayoutBoxModelObject* paintInvalidationContainer, bool* paintInvalidationContainerSkipped) const 886 LayoutBlock* LayoutObject::containerForFixedPosition(const LayoutBoxModelObject* paintInvalidationContainer, bool* paintInvalidationContainerSkipped) const
887 { 887 {
888 ASSERT(!paintInvalidationContainerSkipped || !*paintInvalidationContainerSki pped); 888 ASSERT(!paintInvalidationContainerSkipped || !*paintInvalidationContainerSki pped);
889 ASSERT(!isText()); 889 ASSERT(!isText());
890 ASSERT(style()->position() == FixedPosition);
891 890
892 LayoutObject* ancestor = parent(); 891 LayoutObject* ancestor = parent();
893 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a ncestor->parent()) { 892 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a ncestor->parent()) {
894 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo ntainer) 893 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo ntainer)
895 *paintInvalidationContainerSkipped = true; 894 *paintInvalidationContainerSkipped = true;
896 } 895 }
897 896
898 ASSERT(!ancestor || !ancestor->isAnonymousBlock()); 897 ASSERT(!ancestor || !ancestor->isAnonymousBlock());
899 return toLayoutBlock(ancestor); 898 return toLayoutBlock(ancestor);
900 } 899 }
(...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 object.invalidateDisplayItemClients(m_paintInvalidationContainer, Pa intInvalidationFull, nullptr); 3383 object.invalidateDisplayItemClients(m_paintInvalidationContainer, Pa intInvalidationFull, nullptr);
3385 } 3384 }
3386 private: 3385 private:
3387 const LayoutBoxModelObject& m_paintInvalidationContainer; 3386 const LayoutBoxModelObject& m_paintInvalidationContainer;
3388 }; 3387 };
3389 3388
3390 const LayoutBoxModelObject& paintInvalidationContainer = *paintInvalidationL ayer->layoutObject(); 3389 const LayoutBoxModelObject& paintInvalidationContainer = *paintInvalidationL ayer->layoutObject();
3391 traverseNonCompositingDescendants(const_cast<LayoutObject&>(object), Functor (paintInvalidationContainer)); 3390 traverseNonCompositingDescendants(const_cast<LayoutObject&>(object), Functor (paintInvalidationContainer));
3392 } 3391 }
3393 3392
3394 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo xModelObject& paintInvalidationContainer, PaintInvalidationReason reason) const 3393 void LayoutObject::invalidatePaintOfPreviousPaintInvalidationRect(const LayoutBo xModelObject& paintInvalidationContainer, PaintInvalidationReason reason)
3395 { 3394 {
3396 // These disablers are valid because we want to use the current compositing/ invalidation status. 3395 // These disablers are valid because we want to use the current compositing/ invalidation status.
3397 DisablePaintInvalidationStateAsserts invalidationDisabler; 3396 DisablePaintInvalidationStateAsserts invalidationDisabler;
3398 DisableCompositingQueryAsserts compositingDisabler; 3397 DisableCompositingQueryAsserts compositingDisabler;
3399 3398
3400 LayoutRect invalidationRect = previousPaintInvalidationRect(); 3399 LayoutRect invalidationRect = previousPaintInvalidationRect();
3401 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer); 3400 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer);
3402 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer); 3401 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer);
3403 3402
3404 // The PaintController may have changed. Pass the previous paint invalidatio n rect to the new PaintController. 3403 // The PaintController may have changed. Pass the previous paint invalidatio n rect to the new PaintController.
3405 // The rect will be updated if it changes during the next paint invalidation . 3404 // The rect will be updated if it changes during the next paint invalidation .
3406 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer, &invalidationRect); 3405 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer, &invalidationRect);
3406
3407 // This method may be used to invalidate paint of an object changing paint i nvalidation container.
3408 // Clear previous paint invalidation rect on the original paint invalidation container to avoid
3409 // under-invalidation if the new paint invalidation rect on the new paint in validation container
3410 // happens to be the same as the old one.
3411 setPreviousPaintInvalidationRect(LayoutRect());
3407 } 3412 }
3408 3413
3409 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() 3414 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants()
3410 { 3415 {
3411 class Functor : public LayoutObjectTraversalFunctor { 3416 class Functor : public LayoutObjectTraversalFunctor {
3412 public: 3417 public:
3413 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { } 3418 explicit Functor(const LayoutBoxModelObject& paintInvalidationContainer) : m_paintInvalidationContainer(paintInvalidationContainer) { }
3414 void operator()(LayoutObject& object) const override 3419 void operator()(LayoutObject& object) const override
3415 { 3420 {
3416 object.invalidatePaintOfPreviousPaintInvalidationRect(m_paintInvalid ationContainer, PaintInvalidationLayer); 3421 object.invalidatePaintOfPreviousPaintInvalidationRect(m_paintInvalid ationContainer, PaintInvalidationLayer);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3512 const blink::LayoutObject* root = object1; 3517 const blink::LayoutObject* root = object1;
3513 while (root->parent()) 3518 while (root->parent())
3514 root = root->parent(); 3519 root = root->parent();
3515 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3520 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3516 } else { 3521 } else {
3517 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3522 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3518 } 3523 }
3519 } 3524 }
3520 3525
3521 #endif 3526 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutObjectChildList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698