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

Side by Side Diff: Source/WebCore/rendering/RenderBlock.cpp

Issue 6952018: Merge 85876 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/742/
Patch Set: Created 9 years, 7 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
« no previous file with comments | « Source/WebCore/rendering/RenderBlock.h ('k') | no next file » | 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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 typedef WTF::HashMap<const RenderBox*, HashSet<RenderBlock*>*> PercentHeightCont ainerMap; 71 typedef WTF::HashMap<const RenderBox*, HashSet<RenderBlock*>*> PercentHeightCont ainerMap;
72 static PercentHeightContainerMap* gPercentHeightContainerMap = 0; 72 static PercentHeightContainerMap* gPercentHeightContainerMap = 0;
73 73
74 typedef WTF::HashMap<RenderBlock*, ListHashSet<RenderInline*>*> ContinuationOutl ineTableMap; 74 typedef WTF::HashMap<RenderBlock*, ListHashSet<RenderInline*>*> ContinuationOutl ineTableMap;
75 75
76 typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet; 76 typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet;
77 static int gDelayUpdateScrollInfo = 0; 77 static int gDelayUpdateScrollInfo = 0;
78 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; 78 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0;
79 79
80 bool RenderBlock::s_canPropagateFloatIntoSibling = false;
81
80 // Our MarginInfo state used when laying out block children. 82 // Our MarginInfo state used when laying out block children.
81 RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, int beforeBorderPadding, int afterBorderPadding) 83 RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, int beforeBorderPadding, int afterBorderPadding)
82 : m_atBeforeSideOfBlock(true) 84 : m_atBeforeSideOfBlock(true)
83 , m_atAfterSideOfBlock(false) 85 , m_atAfterSideOfBlock(false)
84 , m_marginBeforeQuirk(false) 86 , m_marginBeforeQuirk(false)
85 , m_marginAfterQuirk(false) 87 , m_marginAfterQuirk(false)
86 , m_determinedMarginBeforeQuirk(false) 88 , m_determinedMarginBeforeQuirk(false)
87 { 89 {
88 // Whether or not we can collapse our own margins with our children. We don 't do this 90 // Whether or not we can collapse our own margins with our children. We don 't do this
89 // if we had any border/padding (obviously), if we're the root or HTML eleme nts, or if 91 // if we had any border/padding (obviously), if we're the root or HTML eleme nts, or if
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 parent()->dirtyLinesFromChangedChild(this); 191 parent()->dirtyLinesFromChangedChild(this);
190 } 192 }
191 193
192 m_lineBoxes.deleteLineBoxes(renderArena()); 194 m_lineBoxes.deleteLineBoxes(renderArena());
193 195
194 RenderBox::destroy(); 196 RenderBox::destroy();
195 } 197 }
196 198
197 void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle* newSt yle) 199 void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle* newSt yle)
198 { 200 {
201 s_canPropagateFloatIntoSibling = style() ? !isFloatingOrPositioned() && !avo idsFloats() : false;
202
199 setReplaced(newStyle->isDisplayInlineType()); 203 setReplaced(newStyle->isDisplayInlineType());
200 204
201 if (style() && parent() && diff == StyleDifferenceLayout && style()->positio n() != newStyle->position()) { 205 if (style() && parent() && diff == StyleDifferenceLayout && style()->positio n() != newStyle->position()) {
202 if (newStyle->position() == StaticPosition) 206 if (newStyle->position() == StaticPosition)
203 // Clear our positioned objects list. Our absolutely positioned desc endants will be 207 // Clear our positioned objects list. Our absolutely positioned desc endants will be
204 // inserted into our containing block's positioned objects list duri ng layout. 208 // inserted into our containing block's positioned objects list duri ng layout.
205 removePositionedObjects(0); 209 removePositionedObjects(0);
206 else if (style()->position() == StaticPosition) { 210 else if (style()->position() == StaticPosition) {
207 // Remove our absolutely positioned descendants from their current c ontaining block. 211 // Remove our absolutely positioned descendants from their current c ontaining block.
208 // They will be inserted into our positioned objects list during lay out. 212 // They will be inserted into our positioned objects list during lay out.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } 256 }
253 } 257 }
254 258
255 m_lineHeight = -1; 259 m_lineHeight = -1;
256 260
257 // Update pseudos for :before and :after now. 261 // Update pseudos for :before and :after now.
258 if (!isAnonymous() && document()->usesBeforeAfterRules() && canHaveChildren( )) { 262 if (!isAnonymous() && document()->usesBeforeAfterRules() && canHaveChildren( )) {
259 updateBeforeAfterContent(BEFORE); 263 updateBeforeAfterContent(BEFORE);
260 updateBeforeAfterContent(AFTER); 264 updateBeforeAfterContent(AFTER);
261 } 265 }
266
267 // After our style changed, if we lose our ability to propagate floats into next sibling
268 // blocks, then we need to mark our descendants with floats for layout and c lear all floats
269 // from next sibling blocks that exist in our floating objects list. See bug 56299.
270 bool canPropagateFloatIntoSibling = !isFloatingOrPositioned() && !avoidsFloa ts();
271 if (diff == StyleDifferenceLayout && s_canPropagateFloatIntoSibling && !canP ropagateFloatIntoSibling && hasOverhangingFloats()) {
272 markAllDescendantsWithFloatsForLayout();
273 markSiblingsWithFloatsForLayout();
274 }
262 } 275 }
263 276
264 void RenderBlock::updateBeforeAfterContent(PseudoId pseudoId) 277 void RenderBlock::updateBeforeAfterContent(PseudoId pseudoId)
265 { 278 {
266 // If this is an anonymous wrapper, then the parent applies its own pseudo-e lement style to it. 279 // If this is an anonymous wrapper, then the parent applies its own pseudo-e lement style to it.
267 if (parent() && parent()->createsAnonymousWrapper()) 280 if (parent() && parent()->createsAnonymousWrapper())
268 return; 281 return;
269 return children()->updateBeforeAfterContent(this, pseudoId); 282 return children()->updateBeforeAfterContent(this, pseudoId);
270 } 283 }
271 284
(...skipping 3519 matching lines...) Expand 10 before | Expand all | Expand 10 after
3791 for (RenderObject* child = firstChild(); child; child = child->nextSibli ng()) { 3804 for (RenderObject* child = firstChild(); child; child = child->nextSibli ng()) {
3792 if ((!floatToRemove && child->isFloatingOrPositioned()) || !child->i sRenderBlock()) 3805 if ((!floatToRemove && child->isFloatingOrPositioned()) || !child->i sRenderBlock())
3793 continue; 3806 continue;
3794 RenderBlock* childBlock = toRenderBlock(child); 3807 RenderBlock* childBlock = toRenderBlock(child);
3795 if ((floatToRemove ? childBlock->containsFloat(floatToRemove) : chil dBlock->containsFloats()) || childBlock->shrinkToAvoidFloats()) 3808 if ((floatToRemove ? childBlock->containsFloat(floatToRemove) : chil dBlock->containsFloats()) || childBlock->shrinkToAvoidFloats())
3796 childBlock->markAllDescendantsWithFloatsForLayout(floatToRemove, inLayout); 3809 childBlock->markAllDescendantsWithFloatsForLayout(floatToRemove, inLayout);
3797 } 3810 }
3798 } 3811 }
3799 } 3812 }
3800 3813
3814 void RenderBlock::markSiblingsWithFloatsForLayout()
3815 {
3816 FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
3817 FloatingObjectSetIterator end = floatingObjectSet.end();
3818 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++ it) {
3819 if (logicalBottomForFloat(*it) > logicalHeight()) {
3820 RenderBox* floatingBox = (*it)->renderer();
3821
3822 RenderObject* next = nextSibling();
3823 while (next) {
3824 if (next->isRenderBlock() && !next->isFloatingOrPositioned() && !toRenderBlock(next)->avoidsFloats()) {
3825 RenderBlock* nextBlock = toRenderBlock(next);
3826 if (nextBlock->containsFloat(floatingBox))
3827 nextBlock->markAllDescendantsWithFloatsForLayout(floatin gBox);
3828 else
3829 break;
3830 }
3831
3832 next = next->nextSibling();
3833 }
3834 }
3835 }
3836 }
3837
3801 int RenderBlock::getClearDelta(RenderBox* child, int yPos) 3838 int RenderBlock::getClearDelta(RenderBox* child, int yPos)
3802 { 3839 {
3803 // There is no need to compute clearance if we have no floats. 3840 // There is no need to compute clearance if we have no floats.
3804 if (!containsFloats()) 3841 if (!containsFloats())
3805 return 0; 3842 return 0;
3806 3843
3807 // At least one float is present. We need to perform the clearance computat ion. 3844 // At least one float is present. We need to perform the clearance computat ion.
3808 bool clearSet = child->style()->clear() != CNONE; 3845 bool clearSet = child->style()->clear() != CNONE;
3809 int bottom = 0; 3846 int bottom = 0;
3810 switch (child->style()->clear()) { 3847 switch (child->style()->clear()) {
(...skipping 2465 matching lines...) Expand 10 before | Expand all | Expand 10 after
6276 6313
6277 inline void RenderBlock::FloatingObjects::decreaseObjectsCount(FloatingObject::T ype type) 6314 inline void RenderBlock::FloatingObjects::decreaseObjectsCount(FloatingObject::T ype type)
6278 { 6315 {
6279 if (type == FloatingObject::FloatLeft) 6316 if (type == FloatingObject::FloatLeft)
6280 m_leftObjectsCount--; 6317 m_leftObjectsCount--;
6281 else 6318 else
6282 m_rightObjectsCount--; 6319 m_rightObjectsCount--;
6283 } 6320 }
6284 6321
6285 } // namespace WebCore 6322 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderBlock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698