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

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

Issue 1544423002: Improve positioned/percentHeight descendant/container tracking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows build break Created 4 years, 11 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 return NoPaintLayer; 113 return NoPaintLayer;
114 } 114 }
115 115
116 void LayoutBox::willBeDestroyed() 116 void LayoutBox::willBeDestroyed()
117 { 117 {
118 clearOverrideSize(); 118 clearOverrideSize();
119 clearContainingBlockOverrideSize(); 119 clearContainingBlockOverrideSize();
120 clearExtraInlineAndBlockOffests(); 120 clearExtraInlineAndBlockOffests();
121 121
122 LayoutBlock::removePercentHeightDescendantIfNeeded(this); 122 if (isOutOfFlowPositioned())
123 LayoutBlock::removePositionedObject(this);
124 removeFromPercentHeightContainer();
123 125
124 ShapeOutsideInfo::removeInfo(*this); 126 ShapeOutsideInfo::removeInfo(*this);
125 127
126 LayoutBoxModelObject::willBeDestroyed(); 128 LayoutBoxModelObject::willBeDestroyed();
127 } 129 }
128 130
129 void LayoutBox::removeFloatingOrPositionedChildFromBlockLists() 131 void LayoutBox::removeFloatingOrPositionedChildFromBlockLists()
130 { 132 {
131 ASSERT(isFloatingOrOutOfFlowPositioned()); 133 ASSERT(isFloatingOrOutOfFlowPositioned());
132 134
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 { 203 {
202 // Horizontal writing mode definition is updated in LayoutBoxModelObject::up dateFromStyle, 204 // Horizontal writing mode definition is updated in LayoutBoxModelObject::up dateFromStyle,
203 // (as part of the LayoutBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal 205 // (as part of the LayoutBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal
204 // writing mode value before style change here. 206 // writing mode value before style change here.
205 bool oldHorizontalWritingMode = isHorizontalWritingMode(); 207 bool oldHorizontalWritingMode = isHorizontalWritingMode();
206 208
207 LayoutBoxModelObject::styleDidChange(diff, oldStyle); 209 LayoutBoxModelObject::styleDidChange(diff, oldStyle);
208 210
209 const ComputedStyle& newStyle = styleRef(); 211 const ComputedStyle& newStyle = styleRef();
210 if (needsLayout() && oldStyle) 212 if (needsLayout() && oldStyle)
211 LayoutBlock::removePercentHeightDescendantIfNeeded(this); 213 removeFromPercentHeightContainer();
212 214
213 if (LayoutBlock::hasPercentHeightContainerMap() && slowFirstChild() 215 if (oldHorizontalWritingMode != isHorizontalWritingMode())
214 && oldHorizontalWritingMode != isHorizontalWritingMode()) 216 clearPercentHeightDescendants();
215 LayoutBlock::clearPercentHeightDescendantsFrom(this);
216 217
217 // If our zoom factor changes and we have a defined scrollLeft/Top, we need to adjust that value into the 218 // If our zoom factor changes and we have a defined scrollLeft/Top, we need to adjust that value into the
218 // new zoomed coordinate space. 219 // new zoomed coordinate space.
219 if (hasOverflowClip() && oldStyle && oldStyle->effectiveZoom() != newStyle.e ffectiveZoom() && layer()) { 220 if (hasOverflowClip() && oldStyle && oldStyle->effectiveZoom() != newStyle.e ffectiveZoom() && layer()) {
220 if (int left = layer()->scrollableArea()->scrollXOffset()) { 221 if (int left = layer()->scrollableArea()->scrollXOffset()) {
221 left = (left / oldStyle->effectiveZoom()) * newStyle.effectiveZoom() ; 222 left = (left / oldStyle->effectiveZoom()) * newStyle.effectiveZoom() ;
222 layer()->scrollableArea()->scrollToXOffset(left); 223 layer()->scrollableArea()->scrollToXOffset(left);
223 } 224 }
224 if (int top = layer()->scrollableArea()->scrollYOffset()) { 225 if (int top = layer()->scrollableArea()->scrollYOffset()) {
225 top = (top / oldStyle->effectiveZoom()) * newStyle.effectiveZoom(); 226 top = (top / oldStyle->effectiveZoom()) * newStyle.effectiveZoom();
(...skipping 4658 matching lines...) Expand 10 before | Expand all | Expand 10 after
4884 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4885 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4885 } 4886 }
4886 4887
4887 void LayoutBox::clearPreviousPaintInvalidationRects() 4888 void LayoutBox::clearPreviousPaintInvalidationRects()
4888 { 4889 {
4889 LayoutBoxModelObject::clearPreviousPaintInvalidationRects(); 4890 LayoutBoxModelObject::clearPreviousPaintInvalidationRects();
4890 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea()) 4891 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea())
4891 scrollableArea->clearPreviousPaintInvalidationRects(); 4892 scrollableArea->clearPreviousPaintInvalidationRects();
4892 } 4893 }
4893 4894
4895 void LayoutBox::setPercentHeightContainer(LayoutBlock* container)
4896 {
4897 ASSERT(!container || !percentHeightContainer());
4898 if (!container && !m_rareData)
4899 return;
4900 ensureRareData().m_percentHeightContainer = container;
4901 }
4902
4903 void LayoutBox::removeFromPercentHeightContainer()
4904 {
4905 if (!percentHeightContainer())
4906 return;
4907
4908 ASSERT(percentHeightContainer()->hasPercentHeightDescendant(this));
4909 percentHeightContainer()->removePercentHeightDescendant(this);
4910 // The above call should call this object's setPercentHeightContainer(nullpt r).
4911 ASSERT(!percentHeightContainer());
4912 }
4913
4914 void LayoutBox::clearPercentHeightDescendants()
4915 {
4916 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4917 if (curr->isBox())
4918 toLayoutBox(curr)->removeFromPercentHeightContainer();
4919 }
4920 }
4921
4894 } // namespace blink 4922 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698