Index: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
index 414cd3fac966de2f5e1af5151cb1beb3984d52e6..05e42b617282680ae247cf98806e8a2b5bcc433a 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
@@ -484,8 +484,13 @@ inline bool LayoutBlockFlow::layoutBlockFlow(bool relayoutChildren, LayoutUnit & |
layoutBlockChildren(relayoutChildren, layoutScope, beforeEdge, afterEdge); |
bool preferredLogicalWidthsBecameDirty = !preferredLogicalWidthsWereDirty && preferredLogicalWidthsDirty(); |
- if (preferredLogicalWidthsBecameDirty) |
- return false; |
+ if (preferredLogicalWidthsBecameDirty) { |
+ // The only thing that should dirty preferred widths at this point is the addition of |
+ // overflow:auto scrollbars in a descendant. To avoid a potential infinite loop, |
+ // run layout again with auto scrollbars frozen in their current state. |
+ PaintLayerScrollableArea::FreezeScrollbarsScope freezeScrollbars; |
+ return layoutBlockFlow(relayoutChildren, pageLogicalHeight, layoutScope); |
+ } |
// Expand our intrinsic height to encompass floats. |
if (lowestFloatLogicalBottom() > (logicalHeight() - afterEdge) && createsNewFormattingContext()) |