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

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

Issue 1837033002: Invalidate objects when their content box changes dimensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 3812 matching lines...) Expand 10 before | Expand all | Expand 10 after
3823 } 3823 }
3824 3824
3825 // If the transform is not identity or translation, incremental invalidation is not applicable 3825 // If the transform is not identity or translation, incremental invalidation is not applicable
3826 // because the difference between oldBounds and newBounds doesn't cover all area needing invalidation. 3826 // because the difference between oldBounds and newBounds doesn't cover all area needing invalidation.
3827 // FIXME: Should also consider ancestor transforms since paintInvalidationCo ntainer. crbug.com/426111. 3827 // FIXME: Should also consider ancestor transforms since paintInvalidationCo ntainer. crbug.com/426111.
3828 if (invalidationReason == PaintInvalidationIncremental 3828 if (invalidationReason == PaintInvalidationIncremental
3829 && paintInvalidationContainer != this 3829 && paintInvalidationContainer != this
3830 && hasLayer() && layer()->transform() && !layer()->transform()->isIdenti tyOrTranslation()) 3830 && hasLayer() && layer()->transform() && !layer()->transform()->isIdenti tyOrTranslation())
3831 return PaintInvalidationBoundsChange; 3831 return PaintInvalidationBoundsChange;
3832 3832
3833 if (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()-> maskLayers().thisOrNextLayersUseContentBox() || style()->boxSizing() == BoxSizin gBorderBox) {
3834 LayoutRect oldContentBoxRect = m_rareData ? m_rareData->m_previousConten tBoxRect : LayoutRect();
3835 LayoutRect newContentBoxRect = contentBoxRect();
3836 if (oldContentBoxRect != newContentBoxRect)
3837 return PaintInvalidationContentBoxChange;
3838 }
3839
3833 if (!style()->hasBackground() && !style()->hasBoxDecorations()) { 3840 if (!style()->hasBackground() && !style()->hasBoxDecorations()) {
3834 // We could let incremental invalidation cover non-composited scrollbars , but just 3841 // We could let incremental invalidation cover non-composited scrollbars , but just
3835 // do a full invalidation because incremental invalidation will go away with slimming paint. 3842 // do a full invalidation because incremental invalidation will go away with slimming paint.
3836 if (invalidationReason == PaintInvalidationIncremental && hasNonComposit edScrollbars()) 3843 if (invalidationReason == PaintInvalidationIncremental && hasNonComposit edScrollbars())
3837 return PaintInvalidationBorderBoxChange; 3844 return PaintInvalidationBorderBoxChange;
3838 return invalidationReason; 3845 return invalidationReason;
3839 } 3846 }
3840 3847
3841 if (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()-> maskLayers().thisOrNextLayersUseContentBox()) {
3842 LayoutRect oldContentBoxRect = m_rareData ? m_rareData->m_previousConten tBoxRect : LayoutRect();
3843 LayoutRect newContentBoxRect = contentBoxRect();
3844 if (oldContentBoxRect != newContentBoxRect)
3845 return PaintInvalidationContentBoxChange;
3846 }
3847
3848 if (style()->backgroundLayers().thisOrNextLayersHaveLocalAttachment()) { 3848 if (style()->backgroundLayers().thisOrNextLayersHaveLocalAttachment()) {
3849 LayoutRect oldLayoutOverflowRect = m_rareData ? m_rareData->m_previousLa youtOverflowRect : LayoutRect(); 3849 LayoutRect oldLayoutOverflowRect = m_rareData ? m_rareData->m_previousLa youtOverflowRect : LayoutRect();
3850 LayoutRect newLayoutOverflowRect = layoutOverflowRect(); 3850 LayoutRect newLayoutOverflowRect = layoutOverflowRect();
3851 if (oldLayoutOverflowRect != newLayoutOverflowRect) 3851 if (oldLayoutOverflowRect != newLayoutOverflowRect)
3852 return PaintInvalidationLayoutOverflowBoxChange; 3852 return PaintInvalidationLayoutOverflowBoxChange;
3853 } 3853 }
3854 3854
3855 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ; 3855 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ;
3856 LayoutSize newBorderBoxSize = size(); 3856 LayoutSize newBorderBoxSize = size();
3857 3857
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
4512 // If m_rareData is already created, always save. 4512 // If m_rareData is already created, always save.
4513 if (m_rareData) 4513 if (m_rareData)
4514 return true; 4514 return true;
4515 4515
4516 LayoutSize paintInvalidationSize = previousPaintInvalidationRectSize(); 4516 LayoutSize paintInvalidationSize = previousPaintInvalidationRectSize();
4517 // Don't save old box sizes if the paint rect is empty because we'll 4517 // Don't save old box sizes if the paint rect is empty because we'll
4518 // full invalidate once the paint rect becomes non-empty. 4518 // full invalidate once the paint rect becomes non-empty.
4519 if (paintInvalidationSize.isEmpty()) 4519 if (paintInvalidationSize.isEmpty())
4520 return false; 4520 return false;
4521 4521
4522 // If we use border-box sizing we need to track changes in the size of the c ontent box.
4523 if (style()->boxSizing() == BoxSizingBorderBox)
4524 return true;
4525
4522 // We need the old box sizes only when the box has background, decorations, or masks. 4526 // We need the old box sizes only when the box has background, decorations, or masks.
4523 // Main LayoutView paints base background, thus interested in box size. 4527 // Main LayoutView paints base background, thus interested in box size.
4524 if (!isLayoutView() && !style()->hasBackground() && !style()->hasBoxDecorati ons() && !style()->hasMask()) 4528 if (!isLayoutView() && !style()->hasBackground() && !style()->hasBoxDecorati ons() && !style()->hasMask())
4525 return false; 4529 return false;
4526 4530
4527 // No need to save old border box size if we can use size of the old paint 4531 // No need to save old border box size if we can use size of the old paint
4528 // rect as the old border box size in the next invalidation. 4532 // rect as the old border box size in the next invalidation.
4529 if (paintInvalidationSize != size()) 4533 if (paintInvalidationSize != size())
4530 return true; 4534 return true;
4531 4535
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
4703 4707
4704 void LayoutBox::clearPercentHeightDescendants() 4708 void LayoutBox::clearPercentHeightDescendants()
4705 { 4709 {
4706 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { 4710 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4707 if (curr->isBox()) 4711 if (curr->isBox())
4708 toLayoutBox(curr)->removeFromPercentHeightContainer(); 4712 toLayoutBox(curr)->removeFromPercentHeightContainer();
4709 } 4713 }
4710 } 4714 }
4711 4715
4712 } // namespace blink 4716 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698