Title: [113287] trunk/Source/WebCore
- Revision
- 113287
- Author
- [email protected]
- Date
- 2012-04-04 21:22:50 -0700 (Wed, 04 Apr 2012)
Log Message
Auto-size may not work on first load
https://bugs.webkit.org/show_bug.cgi?id=82989
Patch by Andrei Burago <[email protected]> on 2012-04-04
Reviewed by David Levin.
No new tests. The only known repro scenario involves using chrome with a third-party extension,
which makes making a test out of it problematic.
* dom/Document.cpp:
(WebCore::Document::implicitClose):
* page/FrameView.cpp:
(WebCore::FrameView::autoSizeIfEnabled):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (113286 => 113287)
--- trunk/Source/WebCore/ChangeLog 2012-04-05 04:18:26 UTC (rev 113286)
+++ trunk/Source/WebCore/ChangeLog 2012-04-05 04:22:50 UTC (rev 113287)
@@ -1,3 +1,18 @@
+2012-04-04 Andrei Burago <[email protected]>
+
+ Auto-size may not work on first load
+ https://bugs.webkit.org/show_bug.cgi?id=82989
+
+ Reviewed by David Levin.
+
+ No new tests. The only known repro scenario involves using chrome with a third-party extension,
+ which makes making a test out of it problematic.
+
+ * dom/Document.cpp:
+ (WebCore::Document::implicitClose):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::autoSizeIfEnabled):
+
2012-04-04 Adam Barth <[email protected]>
XSSAuditor doesn't catch injected srcdoc attributes
Modified: trunk/Source/WebCore/dom/Document.cpp (113286 => 113287)
--- trunk/Source/WebCore/dom/Document.cpp 2012-04-05 04:18:26 UTC (rev 113286)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-04-05 04:22:50 UTC (rev 113287)
@@ -2350,11 +2350,11 @@
printf("onload fired at %d\n", elapsedTime());
#endif
- m_processingLoadEvent = false;
-
// An event handler may have removed the frame
- if (!frame())
+ if (!frame()) {
+ m_processingLoadEvent = false;
return;
+ }
// Make sure both the initial layout and reflow happen after the onload
// fires. This will improve onload scores, and other browsers do it.
@@ -2363,6 +2363,7 @@
if (frame()->navigationScheduler()->locationChangePending() && elapsedTime() < cLayoutScheduleThreshold) {
// Just bail out. Before or during the onload we were shifted to another page.
// The old i-Bench suite does this. When this happens don't bother painting or laying out.
+ m_processingLoadEvent = false;
view()->unscheduleRelayout();
return;
}
@@ -2382,6 +2383,8 @@
view()->layout();
}
+ m_processingLoadEvent = false;
+
// If painting and compositing layer updates were suppressed pending the load event, do these actions now.
if (renderer() && settings() && settings()->suppressesIncrementalRendering()) {
#if USE(ACCELERATED_COMPOSITING)
Modified: trunk/Source/WebCore/page/FrameView.cpp (113286 => 113287)
--- trunk/Source/WebCore/page/FrameView.cpp 2012-04-05 04:18:26 UTC (rev 113286)
+++ trunk/Source/WebCore/page/FrameView.cpp 2012-04-05 04:22:50 UTC (rev 113287)
@@ -148,6 +148,7 @@
, m_scrollCorner(0)
, m_shouldAutoSize(false)
, m_inAutoSize(false)
+ , m_didRunAutosize(false)
{
init();
@@ -2411,6 +2412,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++) {
@@ -2467,6 +2473,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).
@@ -2474,6 +2482,7 @@
setHorizontalScrollbarLock(false);
setScrollbarModes(horizonalScrollbarMode, verticalScrollbarMode, true, true);
}
+ m_didRunAutosize = true;
}
void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow)
@@ -3141,6 +3150,7 @@
m_shouldAutoSize = enable;
m_minAutoSize = minSize;
m_maxAutoSize = maxSize;
+ m_didRunAutosize = false;
setNeedsLayout();
scheduleRelayout();
Modified: trunk/Source/WebCore/page/FrameView.h (113286 => 113287)
--- trunk/Source/WebCore/page/FrameView.h 2012-04-05 04:18:26 UTC (rev 113286)
+++ trunk/Source/WebCore/page/FrameView.h 2012-04-05 04:22:50 UTC (rev 113287)
@@ -509,6 +509,8 @@
// If true, automatically resize the frame view around its content.
bool m_shouldAutoSize;
bool m_inAutoSize;
+ // True if autosize has been run since m_shouldAutoSize was set.
+ bool m_didRunAutosize;
// The lower bound on the size when autosizing.
IntSize m_minAutoSize;
// The upper bound on the size when autosizing.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes