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

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, 1 month 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 3742 matching lines...) Expand 10 before | Expand all | Expand 10 after
3753 } 3753 }
3754 3754
3755 static bool isReplacedElement(Node* node) 3755 static bool isReplacedElement(Node* node)
3756 { 3756 {
3757 // Checkboxes and radioboxes are not isReplaced() nor do they have their own renderer in which to override avoidFloats(). 3757 // Checkboxes and radioboxes are not isReplaced() nor do they have their own renderer in which to override avoidFloats().
3758 return node && node->isElementNode() && (toElement(node)->isFormControlEleme nt() || isHTMLImageElement(toElement(node))); 3758 return node && node->isElementNode() && (toElement(node)->isFormControlEleme nt() || isHTMLImageElement(toElement(node)));
3759 } 3759 }
3760 3760
3761 bool RenderBox::avoidsFloats() const 3761 bool RenderBox::avoidsFloats() const
3762 { 3762 {
3763 return isReplaced() || isReplacedElement(node()) || hasOverflowClip() || isH R() || isLegend() || isWritingModeRoot() || isFlexItemIncludingDeprecated(); 3763 // 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
3764 // context .. must not overlap the margin box of any floats in the same bloc k formatting context."
3765 // FIXME: The inclusion of horizontal rule and legend elements here isn't co vered by any spec.
3766 return isReplaced() || isReplacedElement(node()) || isHR() || isLegend() || isTable() || (!isFloatingOrOutOfFlowPositioned() && createsBlockFormattingContex t());
3764 } 3767 }
3765 3768
3766 PaintInvalidationReason RenderBox::paintInvalidationReason(const RenderLayerMode lObject& paintInvalidationContainer, 3769 PaintInvalidationReason RenderBox::paintInvalidationReason(const RenderLayerMode lObject& paintInvalidationContainer,
3767 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec t& newBounds, const LayoutPoint& newLocation) const 3770 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec t& newBounds, const LayoutPoint& newLocation) const
3768 { 3771 {
3769 PaintInvalidationReason invalidationReason = RenderBoxModelObject::paintInva lidationReason(paintInvalidationContainer, oldBounds, oldLocation, newBounds, ne wLocation); 3772 PaintInvalidationReason invalidationReason = RenderBoxModelObject::paintInva lidationReason(paintInvalidationContainer, oldBounds, oldLocation, newBounds, ne wLocation);
3770 if (isFullPaintInvalidationReason(invalidationReason)) 3773 if (isFullPaintInvalidationReason(invalidationReason))
3771 return invalidationReason; 3774 return invalidationReason;
3772 3775
3773 // If the transform is not identity or translation, incremental invalidation is not applicable 3776 // If the transform is not identity or translation, incremental invalidation is not applicable
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
3872 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy OldBounds, PaintInvalidationIncremental); 3875 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy OldBounds, PaintInvalidationIncremental);
3873 return; 3876 return;
3874 } 3877 }
3875 // Invalidate the bigger one if one contains another. Otherwise invalidate b oth. 3878 // Invalidate the bigger one if one contains another. Otherwise invalidate b oth.
3876 if (!rectClippedByNewBounds.contains(rectClippedByOldBounds)) 3879 if (!rectClippedByNewBounds.contains(rectClippedByOldBounds))
3877 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy OldBounds, PaintInvalidationIncremental); 3880 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy OldBounds, PaintInvalidationIncremental);
3878 if (!rectClippedByOldBounds.contains(rectClippedByNewBounds)) 3881 if (!rectClippedByOldBounds.contains(rectClippedByNewBounds))
3879 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy NewBounds, PaintInvalidationIncremental); 3882 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy NewBounds, PaintInvalidationIncremental);
3880 } 3883 }
3881 3884
3885 bool RenderBox::createsBlockFormattingContext() const
3886 {
3887 return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated()
3888 || style()->specifiesColumns() || isRenderFlowThread() || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isDocumentElement( ) || style()->columnSpan();
3889 }
3890
3882 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e) 3891 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e)
3883 { 3892 {
3884 ASSERT(!needsLayout()); 3893 ASSERT(!needsLayout());
3885 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it 3894 // If fragmentation height has changed, we need to lay out. No need to enter the renderer if it
3886 // is childless, though. 3895 // is childless, though.
3887 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) 3896 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild())
3888 layoutScope.setChildNeedsLayout(this); 3897 layoutScope.setChildNeedsLayout(this);
3889 } 3898 }
3890 3899
3891 void RenderBox::addVisualEffectOverflow() 3900 void RenderBox::addVisualEffectOverflow()
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
4438 4447
4439 setLogicalTop(oldLogicalTop); 4448 setLogicalTop(oldLogicalTop);
4440 setLogicalWidth(oldLogicalWidth); 4449 setLogicalWidth(oldLogicalWidth);
4441 setMarginLeft(oldMarginLeft); 4450 setMarginLeft(oldMarginLeft);
4442 setMarginRight(oldMarginRight); 4451 setMarginRight(oldMarginRight);
4443 4452
4444 return borderBox; 4453 return borderBox;
4445 } 4454 }
4446 4455
4447 } // namespace blink 4456 } // namespace blink
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