[chromium] iframes in an autoresized window get sized incorrectly.
authorlevin@chromium.org <levin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Jan 2012 00:29:46 +0000 (00:29 +0000)
committerlevin@chromium.org <levin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Jan 2012 00:29:46 +0000 (00:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75806

Reviewed by Adam Barth.

Source/WebKit/chromium:

TEST: fast/autoresize/autoresize-with-iframe.html

* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::createFrameView): Only do autoresizing
for the main frame not child frames.

LayoutTests:

* fast/autoresize/autoresize-with-iframe-expected.txt: Added.
* fast/autoresize/autoresize-with-iframe.html: Added.
* fast/autoresize/basic.html: Pulled out autoresize-util.js
* fast/autoresize/resources/autoresize-util.js: Added.
(log):
(shouldBe):
* fast/autoresize/resources/iframe.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@104419 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/autoresize/autoresize-with-iframe-expected.txt [new file with mode: 0644]
LayoutTests/fast/autoresize/autoresize-with-iframe.html [new file with mode: 0644]
LayoutTests/fast/autoresize/basic.html
LayoutTests/fast/autoresize/resources/autoresize-util.js [new file with mode: 0644]
LayoutTests/fast/autoresize/resources/iframe.html [new file with mode: 0644]
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebFrameImpl.cpp

index 970fd0e..49f058a 100644 (file)
@@ -1,3 +1,18 @@
+2012-01-08  David Levin  <levin@chromium.org>
+
+        [chromium] iframes in an autoresized window get sized incorrectly.
+        https://bugs.webkit.org/show_bug.cgi?id=75806
+
+        Reviewed by Adam Barth.
+
+        * fast/autoresize/autoresize-with-iframe-expected.txt: Added.
+        * fast/autoresize/autoresize-with-iframe.html: Added.
+        * fast/autoresize/basic.html: Pulled out autoresize-util.js
+        * fast/autoresize/resources/autoresize-util.js: Added.
+        (log):
+        (shouldBe):
+        * fast/autoresize/resources/iframe.html: Added.
+
 2012-01-08  Benjamin Poulain  <benjamin@webkit.org>
 
         Valid canonical URLs should have a lowercase hostname
diff --git a/LayoutTests/fast/autoresize/autoresize-with-iframe-expected.txt b/LayoutTests/fast/autoresize/autoresize-with-iframe-expected.txt
new file mode 100644 (file)
index 0000000..84cfad4
--- /dev/null
@@ -0,0 +1,10 @@
+
+
+--------
+Frame: 'frame'
+--------
+This test only works in DumpRenderTree since it relies on setting up autoresize from javascript. It verifies that iframes are sized correctly when the main window is autoresized. On success, you should see a series of PASS messages followed by a DONE.
+PASS: document.body.scrollWidth equaled 400
+PASS: document.body.scrollHeight equaled 200
+DONE
+
diff --git a/LayoutTests/fast/autoresize/autoresize-with-iframe.html b/LayoutTests/fast/autoresize/autoresize-with-iframe.html
new file mode 100644 (file)
index 0000000..12d8bff
--- /dev/null
@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.enableAutoResizeMode(10, 10, 1000, 1000);
+    layoutTestController.dumpAsText();
+    layoutTestController.dumpChildFramesAsText();
+    layoutTestController.waitUntilDone();
+}
+
+function run()
+{
+    var frameWindow = document.getElementById("frame").contentWindow;
+    frameWindow.postMessage("shouldBe('document.body.scrollWidth', 400)", "*");
+    frameWindow.postMessage("shouldBe('document.body.scrollHeight', 200)", "*");
+    frameWindow.postMessage("log('DONE'); if (window.layoutTestController) layoutTestController.notifyDone();", "*");
+}
+</script>
+</head>
+<body onload="run()" style="width:400px; height:200px; background-color:yellow;">
+<iframe id="frame" style="width:100%; height:100%;" src="resources/iframe.html">
+</iframe>
+</body>
+</html>
index a1afcb7..0fefc24 100644 (file)
@@ -1,21 +1,7 @@
 <!doctype html>
 <html>
+<script src='resources/autoresize-util.js'></script>
 <script>
-function log(message)
-{
-    document.getElementById("result").innerHTML += message + "<br>";
-}
-
-function shouldBe(a, b)
-{
-  aValue = eval(a);
-  bValue = eval(b);
-  if (aValue == bValue)
-     log('PASS: ' + a + ' equaled ' + b);
-  else
-     log('FAILED: ' + a + '(' + aValue + ') did not equal ' + b + '(' + bValue + ')');
-}
-
 function runTest()
 {
     if (window.layoutTestController) {
diff --git a/LayoutTests/fast/autoresize/resources/autoresize-util.js b/LayoutTests/fast/autoresize/resources/autoresize-util.js
new file mode 100644 (file)
index 0000000..97d89d6
--- /dev/null
@@ -0,0 +1,14 @@
+function log(message)
+{
+    document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function shouldBe(a, b)
+{
+  aValue = eval(a);
+  bValue = eval(b);
+  if (aValue == bValue)
+     log('PASS: ' + a + ' equaled ' + b);
+  else
+     log('FAILED: ' + a + '(' + aValue + ') did not equal ' + b + '(' + bValue + ')');
+}
diff --git a/LayoutTests/fast/autoresize/resources/iframe.html b/LayoutTests/fast/autoresize/resources/iframe.html
new file mode 100644 (file)
index 0000000..9d0856a
--- /dev/null
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+<body style="background-color:green;">
+This test only works in DumpRenderTree since it relies on setting up autoresize from javascript. It verifies that iframes are sized correctly when the main window is autoresized. On success, you should see a series of PASS messages followed by a DONE.
+<div id='result'>
+</div>
+<script src='autoresize-util.js'></script>
+<script>
+window.onmessage = function (evt)
+{
+    eval(evt.data);
+}
+</script>
+</body>
+</html>
index 1654503..0fd261f 100644 (file)
@@ -1,3 +1,16 @@
+2012-01-08  David Levin  <levin@chromium.org>
+
+        [chromium] iframes in an autoresized window get sized incorrectly.
+        https://bugs.webkit.org/show_bug.cgi?id=75806
+
+        Reviewed by Adam Barth.
+
+        TEST: fast/autoresize/autoresize-with-iframe.html
+
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::createFrameView): Only do autoresizing
+        for the main frame not child frames.
+
 2012-01-08  Adam Barth  <abarth@webkit.org>
 
         [Chromium] Remove use_skia option from GYP
index e5ae9c5..2e8a328 100644 (file)
@@ -2093,7 +2093,7 @@ void WebFrameImpl::createFrameView()
     WebViewImpl* webView = viewImpl();
     bool isMainFrame = webView->mainFrameImpl()->frame() == m_frame;
     m_frame->createView(webView->size(), Color::white, webView->isTransparent(),  webView->fixedLayoutSize(), isMainFrame ? webView->isFixedLayoutModeEnabled() : 0);
-    if (webView->shouldAutoResize())
+    if (webView->shouldAutoResize() && isMainFrame)
         m_frame->view()->enableAutoSizeMode(true, webView->minAutoSize(), webView->maxAutoSize());
 
 #if ENABLE(GESTURE_RECOGNIZER)