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

Unified Diff: Source/WebCore/page/FrameView.cpp

Issue 10116046: Merge 113287 - Auto-size may not work on first load (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/page/FrameView.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « Source/WebCore/page/FrameView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698