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

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

Issue 268833003: Refactor avoidsFloats() to reflect CSS2.1 spec more clearly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 6 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
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 return isReplaced() || hasOverflowClip() || isHR() || isLegend() || isWritin gModeRoot() || isFlexItemIncludingDeprecated(); 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
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();
4082 } 4091 }
4083 4092
4084 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e) 4093 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e)
4085 { 4094 {
4086 ASSERT(!needsLayout()); 4095 ASSERT(!needsLayout());
4087 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it 4096 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it
4088 // is childless, though. 4097 // is childless, though.
4089 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) 4098 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild())
4090 layoutScope.setChildNeedsLayout(this); 4099 layoutScope.setChildNeedsLayout(this);
4091 } 4100 }
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
4635 return 0; 4644 return 0;
4636 4645
4637 if (!layoutState && !flowThreadContainingBlock()) 4646 if (!layoutState && !flowThreadContainingBlock())
4638 return 0; 4647 return 0;
4639 4648
4640 RenderBlock* containerBlock = containingBlock(); 4649 RenderBlock* containerBlock = containingBlock();
4641 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4650 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4642 } 4651 }
4643 4652
4644 } // namespace WebCore 4653 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698