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

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 204843002: Reduce invalidation on children-needs-layout containers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: And more and more... Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderTable.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 // Not in the middle of layout so have to find the thread the slow way. 605 // Not in the middle of layout so have to find the thread the slow way.
606 RenderObject* curr = const_cast<RenderObject*>(this); 606 RenderObject* curr = const_cast<RenderObject*>(this);
607 while (curr) { 607 while (curr) {
608 if (curr->isRenderFlowThread()) 608 if (curr->isRenderFlowThread())
609 return toRenderFlowThread(curr); 609 return toRenderFlowThread(curr);
610 curr = curr->containingBlock(); 610 curr = curr->containingBlock();
611 } 611 }
612 return 0; 612 return 0;
613 } 613 }
614 614
615 bool RenderObject::skipInvalidationWhenLaidOutChildren() const
616 {
617 if (!neededLayoutBecauseOfChildren())
618 return false;
619
620 // SVG renderers need to be invalidated when their children are laid out.
621 // RenderBlocks with line boxes are responsible to invalidate them so we can 't ignore them.
622 if (isSVG() || (isRenderBlock() && toRenderBlock(this)->firstLineBox()))
623 return false;
624
625 return rendererHasNoBoxEffect();
626 }
627
615 RenderBlock* RenderObject::firstLineBlock() const 628 RenderBlock* RenderObject::firstLineBlock() const
616 { 629 {
617 return 0; 630 return 0;
618 } 631 }
619 632
620 static inline bool objectIsRelayoutBoundary(const RenderObject* object) 633 static inline bool objectIsRelayoutBoundary(const RenderObject* object)
621 { 634 {
622 // FIXME: In future it may be possible to broaden these conditions in order to improve performance. 635 // FIXME: In future it may be possible to broaden these conditions in order to improve performance.
623 if (object->isTextControl()) 636 if (object->isTextControl())
624 return true; 637 return true;
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 if (newBounds.location() != oldBounds.location()) 1671 if (newBounds.location() != oldBounds.location())
1659 return InvalidationBoundsChange; 1672 return InvalidationBoundsChange;
1660 1673
1661 // If the size is zero on one of our bounds then we know we're going to have 1674 // If the size is zero on one of our bounds then we know we're going to have
1662 // to do a full invalidation of either old bounds or new bounds. If we fall 1675 // to do a full invalidation of either old bounds or new bounds. If we fall
1663 // into the incremental invalidation we'll issue two invalidations instead 1676 // into the incremental invalidation we'll issue two invalidations instead
1664 // of one. 1677 // of one.
1665 if (oldBounds.size().isZero() || newBounds.size().isZero()) 1678 if (oldBounds.size().isZero() || newBounds.size().isZero())
1666 return InvalidationBoundsChange; 1679 return InvalidationBoundsChange;
1667 1680
1681 // This covers the case where we mark containing blocks for layout
1682 // and they change size but don't have anything to paint. This is
1683 // a pretty common case for <body> as we add / remove children
1684 // (and the default background is done by FrameView).
1685 if (skipInvalidationWhenLaidOutChildren() && !mayNeedPaintInvalidation())
1686 return InvalidationNone;
1687
1668 return InvalidationIncremental; 1688 return InvalidationIncremental;
1669 } 1689 }
1670 1690
1671 void RenderObject::incrementallyInvalidatePaint(const RenderLayerModelObject* pa intInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBoun ds) 1691 void RenderObject::incrementallyInvalidatePaint(const RenderLayerModelObject* pa intInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBoun ds)
1672 { 1692 {
1673 ASSERT(paintInvalidationContainer); 1693 ASSERT(paintInvalidationContainer);
1674 1694
1675 ASSERT(oldBounds.location() == newBounds.location()); 1695 ASSERT(oldBounds.location() == newBounds.location());
1676 1696
1677 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); 1697 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX();
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 bool RenderObject::isRelayoutBoundaryForInspector() const 3398 bool RenderObject::isRelayoutBoundaryForInspector() const
3379 { 3399 {
3380 return objectIsRelayoutBoundary(this); 3400 return objectIsRelayoutBoundary(this);
3381 } 3401 }
3382 3402
3383 void RenderObject::clearPaintInvalidationState() 3403 void RenderObject::clearPaintInvalidationState()
3384 { 3404 {
3385 setShouldDoFullPaintInvalidationAfterLayout(false); 3405 setShouldDoFullPaintInvalidationAfterLayout(false);
3386 setShouldDoFullPaintInvalidationIfSelfPaintingLayer(false); 3406 setShouldDoFullPaintInvalidationIfSelfPaintingLayer(false);
3387 setOnlyNeededPositionedMovementLayout(false); 3407 setOnlyNeededPositionedMovementLayout(false);
3408 setNeededLayoutBecauseOfChildren(false);
3388 setShouldInvalidateOverflowForPaint(false); 3409 setShouldInvalidateOverflowForPaint(false);
3389 setLayoutDidGetCalled(false); 3410 setLayoutDidGetCalled(false);
3390 setMayNeedPaintInvalidation(false); 3411 setMayNeedPaintInvalidation(false);
3391 } 3412 }
3392 3413
3393 bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document) 3414 bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document)
3394 { 3415 {
3395 return DeprecatedDisableModifyRenderTreeStructureAsserts::canModifyRenderTre eStateInAnyState() 3416 return DeprecatedDisableModifyRenderTreeStructureAsserts::canModifyRenderTre eStateInAnyState()
3396 || document.lifecycle().stateAllowsRenderTreeMutations(); 3417 || document.lifecycle().stateAllowsRenderTreeMutations();
3397 } 3418 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3431 { 3452 {
3432 if (object1) { 3453 if (object1) {
3433 const WebCore::RenderObject* root = object1; 3454 const WebCore::RenderObject* root = object1;
3434 while (root->parent()) 3455 while (root->parent())
3435 root = root->parent(); 3456 root = root->parent();
3436 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3457 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3437 } 3458 }
3438 } 3459 }
3439 3460
3440 #endif 3461 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698