Chromium Code Reviews| 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()?
|
| } |