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

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

Issue 255433003: RenderBlock::isSelfCollapsingBlock() should early exit on a relayout boundary (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | « no previous file | 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, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 7 * Copyright (C) 2014 Samsung Electronics. 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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 break; 1171 break;
1172 } 1172 }
1173 setContinuation(0); 1173 setContinuation(0);
1174 destroy(); 1174 destroy();
1175 } 1175 }
1176 } 1176 }
1177 } 1177 }
1178 1178
1179 bool RenderBlock::isSelfCollapsingBlock() const 1179 bool RenderBlock::isSelfCollapsingBlock() const
1180 { 1180 {
1181 // Placeholder elements are not laid out until the dimensions of their paren t text control are known, so they
1182 // don't get layout until their parent has had layout - this is unique in th e layout tree and means
1183 // when we call isSelfCollapsingBlock on them we find that they still need l ayout.
1184 ASSERT(!needsLayout() || (node() && node()->isElementNode() && toElement(nod e())->shadowPseudoId() == "-webkit-input-placeholder"));
1185
1186 // We are not self-collapsing if we 1181 // We are not self-collapsing if we
1187 // (a) have a non-zero height according to layout (an optimization to avoid wasting time) 1182 // (a) have a non-zero height according to layout (an optimization to avoid wasting time)
1188 // (b) are a table, 1183 // (b) are a table,
1189 // (c) have border/padding, 1184 // (c) have border/padding,
1190 // (d) have a min-height 1185 // (d) have a min-height
1191 // (e) have specified that one of our margins can't collapse using a CSS ext ension 1186 // (e) have specified that one of our margins can't collapse using a CSS ext ension
1192 // (f) establish a new block formatting context. 1187 // (f) establish a new block formatting context.
1193 1188
1189 // The early exit must be done before we check for clean layout.
1190 // We should be able to give a quick answer if the box is a relayout boundar y.
1191 // Being a relayout boundary implies a block formatting context, and also
ojan 2014/04/24 17:22:09 This comment is a little confusing. It talks about
1192 // our internal layout shouldn't affect our container in any way.
1194 if (createsBlockFormattingContext()) 1193 if (createsBlockFormattingContext())
1195 return false; 1194 return false;
1196 1195
1196 // Placeholder elements are not laid out until the dimensions of their paren t text control are known, so they
1197 // don't get layout until their parent has had layout - this is unique in th e layout tree and means
1198 // when we call isSelfCollapsingBlock on them we find that they still need l ayout.
1199 ASSERT(!needsLayout() || (node() && node()->isElementNode() && toElement(nod e())->shadowPseudoId() == "-webkit-input-placeholder"));
1200
1197 if (logicalHeight() > 0 1201 if (logicalHeight() > 0
1198 || isTable() || borderAndPaddingLogicalHeight() 1202 || isTable() || borderAndPaddingLogicalHeight()
1199 || style()->logicalMinHeight().isPositive() 1203 || style()->logicalMinHeight().isPositive()
1200 || style()->marginBeforeCollapse() == MSEPARATE || style()->marginAfterC ollapse() == MSEPARATE) 1204 || style()->marginBeforeCollapse() == MSEPARATE || style()->marginAfterC ollapse() == MSEPARATE)
1201 return false; 1205 return false;
1202 1206
1203 Length logicalHeightLength = style()->logicalHeight(); 1207 Length logicalHeightLength = style()->logicalHeight();
1204 bool hasAutoHeight = logicalHeightLength.isAuto(); 1208 bool hasAutoHeight = logicalHeightLength.isAuto();
1205 if (logicalHeightLength.isPercent() && !document().inQuirksMode()) { 1209 if (logicalHeightLength.isPercent() && !document().inQuirksMode()) {
1206 hasAutoHeight = true; 1210 hasAutoHeight = true;
(...skipping 3791 matching lines...) Expand 10 before | Expand all | Expand 10 after
4998 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5002 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
4999 { 5003 {
5000 showRenderObject(); 5004 showRenderObject();
5001 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5005 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5002 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5006 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5003 } 5007 }
5004 5008
5005 #endif 5009 #endif
5006 5010
5007 } // namespace WebCore 5011 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698