Index: Source/WebCore/page/FrameView.cpp |
=================================================================== |
--- Source/WebCore/page/FrameView.cpp (revision 114571) |
+++ Source/WebCore/page/FrameView.cpp (working copy) |
@@ -148,6 +148,7 @@ |
, m_scrollCorner(0) |
, m_shouldAutoSize(false) |
, m_inAutoSize(false) |
+ , m_didRunAutosize(false) |
{ |
init(); |
@@ -2420,6 +2421,11 @@ |
if (!documentRenderBox) |
return; |
+ // If this is the first time we run autosize, start from small height and |
+ // allow it to grow. |
+ if (!m_didRunAutosize) |
+ resize(frameRect().width(), m_minAutoSize.height()); |
+ |
// Do the resizing twice. The first time is basically a rough calculation using the preferred width |
// which may result in a height change during the second iteration. |
for (int i = 0; i < 2; i++) { |
@@ -2476,6 +2482,8 @@ |
// during an intermediate state (and then changing back to a bigger size as the load progresses). |
if (!frame()->loader()->isComplete() && (newSize.height() < size.height() || newSize.width() < size.width())) |
break; |
+ else if (document->processingLoadEvent()) |
+ newSize = newSize.expandedTo(size); |
resize(newSize.width(), newSize.height()); |
// Force the scrollbar state to avoid the scrollbar code adding them and causing them to be needed. For example, |
// a vertical scrollbar may cause text to wrap and thus increase the height (which is the only reason the scollbar is needed). |
@@ -2483,6 +2491,7 @@ |
setHorizontalScrollbarLock(false); |
setScrollbarModes(horizonalScrollbarMode, verticalScrollbarMode, true, true); |
} |
+ m_didRunAutosize = true; |
} |
void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow) |
@@ -3119,6 +3128,7 @@ |
m_shouldAutoSize = enable; |
m_minAutoSize = minSize; |
m_maxAutoSize = maxSize; |
+ m_didRunAutosize = false; |
setNeedsLayout(); |
scheduleRelayout(); |