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

Unified Diff: Source/core/rendering/RenderBox.cpp

Issue 25048006: Attempt to clean up requiresLayoutToDetermineWidth to be more clear (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: MATCH THE CHUNKS HARDER Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBox.cpp
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index b0cd4d79b14e72a0f184c0a89d600c638d763fe2..1b9064a62ad47674a8ea5908ae6785750fea57a7 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -408,26 +408,31 @@ int RenderBox::pixelSnappedOffsetHeight() const
return snapSizeToPixel(offsetHeight(), y() + clientTop());
}
-bool RenderBox::requiresLayoutToDetermineWidth() const
-{
- RenderStyle* style = this->style();
- return !style->width().isFixed()
- || !style->minWidth().isFixed()
- || (!style->maxWidth().isUndefined() && !style->maxWidth().isFixed())
- || !style->paddingLeft().isFixed()
- || !style->paddingRight().isFixed()
- || style->resize() != RESIZE_NONE
- || style->boxSizing() == BORDER_BOX
- || !isRenderBlock()
- || !isRenderBlockFlow()
+bool RenderBox::canDetermineWidthWithoutLayout() const
+{
+ // FIXME: There are likely many subclasses of RenderBlockFlow which
Julien - ping for review 2013/09/30 16:28:06 Maybe also classes outside RenderBlockFlow?
+ // cannot determine their layout just from style!
+ // Perhaps we should create a "PlainRenderBlockFlow"
+ // and move this optimization there?
+ if (!isRenderBlockFlow()
+ // Flexbox items can be expanded beyond their width.
|| isFlexItemIncludingDeprecated()
- // TableCells can expand beyond a specified width.
- || isTableCell();
+ // Table Layout controls cell size, width is ignored.
Julien - ping for review 2013/09/30 16:28:06 width is not ignored when doing a table layout. On
+ || isTableCell())
+ return false;
+
+ RenderStyle* style = this->style();
+ return style->width().isFixed()
+ && style->minWidth().isFixed()
+ && (style->maxWidth().isUndefined() || style->maxWidth().isFixed())
+ && style->paddingLeft().isFixed()
+ && style->paddingRight().isFixed()
+ && style->boxSizing() == CONTENT_BOX;
}
LayoutUnit RenderBox::fixedOffsetWidth() const
{
- ASSERT(!requiresLayoutToDetermineWidth());
+ ASSERT(canDetermineWidthWithoutLayout());
RenderStyle* style = this->style();
@@ -2088,7 +2093,9 @@ static float getMaxWidthListMarker(const RenderBox* renderer)
if (!itemChild->isListMarker())
continue;
RenderBox* itemMarker = toRenderBox(itemChild);
- if (itemMarker->requiresLayoutToDetermineWidth() && itemMarker->needsLayout()) {
+ // FIXME: canDetermineWidthWithoutLayout expects us to use fixedOffsetWidth, which this code
+ // does not do! This check is likely wrong.
+ if (!itemMarker->canDetermineWidthWithoutLayout() && itemMarker->needsLayout()) {
// Make sure to compute the autosized width.
itemMarker->layout();
Julien - ping for review 2013/09/30 16:28:06 layoutIfNeeded()?
}
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698