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

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

Issue 330913007: Revert of Refactor avoidsFloats() to reflect CSS2.1 spec more clearly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/RenderBox.h ('k') | Source/core/rendering/RenderFieldset.h » ('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) 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 4060 matching lines...) Expand 10 before | Expand all | Expand 10 after
4071 // Floating objects don't shrink. Objects that don't avoid floats don't shr ink. Marquees don't shrink. 4071 // Floating objects don't shrink. Objects that don't avoid floats don't shr ink. Marquees don't shrink.
4072 if ((isInline() && !isMarquee()) || !avoidsFloats() || isFloating()) 4072 if ((isInline() && !isMarquee()) || !avoidsFloats() || isFloating())
4073 return false; 4073 return false;
4074 4074
4075 // Only auto width objects can possibly shrink to avoid floats. 4075 // Only auto width objects can possibly shrink to avoid floats.
4076 return style()->width().isAuto(); 4076 return style()->width().isAuto();
4077 } 4077 }
4078 4078
4079 bool RenderBox::avoidsFloats() const 4079 bool RenderBox::avoidsFloats() const
4080 { 4080 {
4081 // CSS2.1: "The border box of a table, a block-level replaced element, or an element in the normal flow that establishes a new block formatting 4081 return isReplaced() || hasOverflowClip() || isHR() || isLegend() || isWritin gModeRoot() || isFlexItemIncludingDeprecated();
4082 // context .. must not overlap the margin box of any floats in the same bloc k formatting context."
4083 // FIXME: The inclusion of horizontal rule and legend elements here isn't co vered by any spec.
4084 return isReplaced() || isHR() || isLegend() || isTable() || (!isFloatingOrOu tOfFlowPositioned() && createsBlockFormattingContext());
4085 }
4086
4087 bool RenderBox::createsBlockFormattingContext() const
4088 {
4089 return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated()
4090 || style()->specifiesColumns() || isRenderFlowThread() || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isDocumentElement( ) || style()->columnSpan();
4091 } 4082 }
4092 4083
4093 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e) 4084 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e)
4094 { 4085 {
4095 ASSERT(!needsLayout()); 4086 ASSERT(!needsLayout());
4096 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it 4087 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it
4097 // is childless, though. 4088 // is childless, though.
4098 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) 4089 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild())
4099 layoutScope.setChildNeedsLayout(this); 4090 layoutScope.setChildNeedsLayout(this);
4100 } 4091 }
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
4644 return 0; 4635 return 0;
4645 4636
4646 if (!layoutState && !flowThreadContainingBlock()) 4637 if (!layoutState && !flowThreadContainingBlock())
4647 return 0; 4638 return 0;
4648 4639
4649 RenderBlock* containerBlock = containingBlock(); 4640 RenderBlock* containerBlock = containingBlock();
4650 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4641 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4651 } 4642 }
4652 4643
4653 } // namespace WebCore 4644 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderFieldset.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698