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

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: 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 return NoPaintLayer; 124 return NoPaintLayer;
125 } 125 }
126 126
127 void LayoutBox::willBeDestroyed() 127 void LayoutBox::willBeDestroyed()
128 { 128 {
129 clearOverrideSize(); 129 clearOverrideSize();
130 clearContainingBlockOverrideSize(); 130 clearContainingBlockOverrideSize();
131 clearExtraInlineAndBlockOffests(); 131 clearExtraInlineAndBlockOffests();
132 132
133 LayoutBlock::removePercentHeightDescendantIfNeeded(this); 133 if (isOutOfFlowPositioned())
134 LayoutBlock::removePositionedObject(this);
135 removeFromPercentHeightContainer();
134 136
135 ShapeOutsideInfo::removeInfo(*this); 137 ShapeOutsideInfo::removeInfo(*this);
136 138
137 LayoutBoxModelObject::willBeDestroyed(); 139 LayoutBoxModelObject::willBeDestroyed();
138 } 140 }
139 141
140 void LayoutBox::removeFloatingOrPositionedChildFromBlockLists() 142 void LayoutBox::removeFloatingOrPositionedChildFromBlockLists()
141 { 143 {
142 ASSERT(isFloatingOrOutOfFlowPositioned()); 144 ASSERT(isFloatingOrOutOfFlowPositioned());
143 145
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 { 214 {
213 // Horizontal writing mode definition is updated in LayoutBoxModelObject::up dateFromStyle, 215 // Horizontal writing mode definition is updated in LayoutBoxModelObject::up dateFromStyle,
214 // (as part of the LayoutBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal 216 // (as part of the LayoutBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal
215 // writing mode value before style change here. 217 // writing mode value before style change here.
216 bool oldHorizontalWritingMode = isHorizontalWritingMode(); 218 bool oldHorizontalWritingMode = isHorizontalWritingMode();
217 219
218 LayoutBoxModelObject::styleDidChange(diff, oldStyle); 220 LayoutBoxModelObject::styleDidChange(diff, oldStyle);
219 221
220 const ComputedStyle& newStyle = styleRef(); 222 const ComputedStyle& newStyle = styleRef();
221 if (needsLayout() && oldStyle) 223 if (needsLayout() && oldStyle)
222 LayoutBlock::removePercentHeightDescendantIfNeeded(this); 224 removeFromPercentHeightContainer();
223 225
224 if (LayoutBlock::hasPercentHeightContainerMap() && slowFirstChild() 226 if (oldHorizontalWritingMode != isHorizontalWritingMode())
225 && oldHorizontalWritingMode != isHorizontalWritingMode()) 227 clearPercentHeightDescendants();
226 LayoutBlock::clearPercentHeightDescendantsFrom(this);
227 228
228 // If our zoom factor changes and we have a defined scrollLeft/Top, we need to adjust that value into the 229 // If our zoom factor changes and we have a defined scrollLeft/Top, we need to adjust that value into the
229 // new zoomed coordinate space. 230 // new zoomed coordinate space.
230 if (hasOverflowClip() && oldStyle && oldStyle->effectiveZoom() != newStyle.e ffectiveZoom() && layer()) { 231 if (hasOverflowClip() && oldStyle && oldStyle->effectiveZoom() != newStyle.e ffectiveZoom() && layer()) {
231 if (int left = layer()->scrollableArea()->scrollXOffset()) { 232 if (int left = layer()->scrollableArea()->scrollXOffset()) {
232 left = (left / oldStyle->effectiveZoom()) * newStyle.effectiveZoom() ; 233 left = (left / oldStyle->effectiveZoom()) * newStyle.effectiveZoom() ;
233 layer()->scrollableArea()->scrollToXOffset(left); 234 layer()->scrollableArea()->scrollToXOffset(left);
234 } 235 }
235 if (int top = layer()->scrollableArea()->scrollYOffset()) { 236 if (int top = layer()->scrollableArea()->scrollYOffset()) {
236 top = (top / oldStyle->effectiveZoom()) * newStyle.effectiveZoom(); 237 top = (top / oldStyle->effectiveZoom()) * newStyle.effectiveZoom();
(...skipping 4367 matching lines...) Expand 10 before | Expand all | Expand 10 after
4604 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4605 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4605 } 4606 }
4606 4607
4607 void LayoutBox::clearPreviousPaintInvalidationRects() 4608 void LayoutBox::clearPreviousPaintInvalidationRects()
4608 { 4609 {
4609 LayoutBoxModelObject::clearPreviousPaintInvalidationRects(); 4610 LayoutBoxModelObject::clearPreviousPaintInvalidationRects();
4610 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea()) 4611 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea())
4611 scrollableArea->clearPreviousPaintInvalidationRects(); 4612 scrollableArea->clearPreviousPaintInvalidationRects();
4612 } 4613 }
4613 4614
4615 void LayoutBox::setPercentHeightContainer(LayoutBlock* container)
4616 {
4617 ASSERT(!container || !percentHeightContainer());
4618 if (!container && !m_rareData)
4619 return;
4620 ensureRareData().m_percentHeightContainer = container;
4621 }
4622
4623 void LayoutBox::removeFromPercentHeightContainer()
4624 {
4625 if (!percentHeightContainer())
4626 return;
4627
4628 ASSERT(percentHeightContainer()->hasPercentHeightDescendant(this));
4629 percentHeightContainer()->removePercentHeightDescendant(this);
4630 // The above call should call this object's setPercentHeightContainer(nullpt r).
4631 ASSERT(!percentHeightContainer());
4632 }
4633
4634 void LayoutBox::clearPercentHeightDescendants()
4635 {
4636 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4637 if (curr->isBox())
4638 toLayoutBox(curr)->removeFromPercentHeightContainer();
4639 }
4640 }
4641
4614 } // namespace blink 4642 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698