Title: [134451] trunk
Revision
134451
Author
dglaz...@chromium.org
Date
2012-11-13 11:24:35 -0800 (Tue, 13 Nov 2012)

Log Message

Unreviewed, rolling out r134434.
http://trac.webkit.org/changeset/134434
https://bugs.webkit.org/show_bug.cgi?id=102072

The test that was added asserts in loader.

Source/WebCore:

* loader/FrameLoader.cpp:
(WebCore::createWindow):
* page/DOMWindow.cpp:
(WebCore):
(WebCore::DOMWindow::adjustWindowRect):
(WebCore::DOMWindow::moveBy):
(WebCore::DOMWindow::moveTo):
(WebCore::DOMWindow::resizeBy):
(WebCore::DOMWindow::resizeTo):
(WebCore::DOMWindow::open):
(WebCore::DOMWindow::showModalDialog):
* page/DOMWindow.h:
(DOMWindow):

LayoutTests:

* fast/dom/Window/open-window-min-size-expected.txt: Removed.
* fast/dom/Window/open-window-min-size.html: Removed.
* fast/dom/Window/resources/print-close.html: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (134450 => 134451)


--- trunk/LayoutTests/ChangeLog	2012-11-13 19:21:03 UTC (rev 134450)
+++ trunk/LayoutTests/ChangeLog	2012-11-13 19:24:35 UTC (rev 134451)
@@ -1,3 +1,15 @@
+2012-11-13  Dimitri Glazkov  <dglaz...@chromium.org>
+
+        Unreviewed, rolling out r134434.
+        http://trac.webkit.org/changeset/134434
+        https://bugs.webkit.org/show_bug.cgi?id=102072
+
+        The test that was added asserts in loader.
+
+        * fast/dom/Window/open-window-min-size-expected.txt: Removed.
+        * fast/dom/Window/open-window-min-size.html: Removed.
+        * fast/dom/Window/resources/print-close.html: Removed.
+
 2012-11-13  Slavomir Kaslev  <skas...@google.com>
 
         [Chromium] Rebaselined platform/chromium/virtual/softwarecompositing/layer-creation/spanOverlapsCanvas.html

Deleted: trunk/LayoutTests/fast/dom/Window/open-window-min-size-expected.txt (134450 => 134451)


--- trunk/LayoutTests/fast/dom/Window/open-window-min-size-expected.txt	2012-11-13 19:21:03 UTC (rev 134450)
+++ trunk/LayoutTests/fast/dom/Window/open-window-min-size-expected.txt	2012-11-13 19:24:35 UTC (rev 134451)
@@ -1,8 +0,0 @@
-PASS successfullyParsed is true
-
-TEST COMPLETE
-PASS 100 is >= 100
-PASS 100 is >= 100
-PASS 100 is >= 100
-PASS 100 is >= 100
-

Deleted: trunk/LayoutTests/fast/dom/Window/open-window-min-size.html (134450 => 134451)


--- trunk/LayoutTests/fast/dom/Window/open-window-min-size.html	2012-11-13 19:21:03 UTC (rev 134450)
+++ trunk/LayoutTests/fast/dom/Window/open-window-min-size.html	2012-11-13 19:24:35 UTC (rev 134451)
@@ -1,32 +0,0 @@
-<html>
-<head>
-<script src=""
-<script>
-function test() {
-    var expectedMsgs = 2;
-    var msgsReceived = 0;
-    window.addEventListener('message', function(e) {
-        msgsReceived++;
-        shouldBeGreaterThanOrEqual(e.data["width"].toString(), "100");
-        shouldBeGreaterThanOrEqual(e.data["height"].toString(), "100");
-        if (msgsReceived === expectedMsgs)
-            testRunner.notifyDone();
-    }, false);
-
-    window.open("resources/print-close.html", "", "width=10, height=10");
-    window.showModalDialog("resources/print-close.html", "", "dialogWidth:10; dialogHeight:10");
-}
-
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    testRunner.waitUntilDone();
-    testRunner.setCanOpenWindows();
-    testRunner.setCloseRemainingWindowsWhenComplete(true);
-}
-
-</script>
-</head>
-<body _onload_="test()">
-<script src=""
-</body>
-</html>

Deleted: trunk/LayoutTests/fast/dom/Window/resources/print-close.html (134450 => 134451)


--- trunk/LayoutTests/fast/dom/Window/resources/print-close.html	2012-11-13 19:21:03 UTC (rev 134450)
+++ trunk/LayoutTests/fast/dom/Window/resources/print-close.html	2012-11-13 19:24:35 UTC (rev 134451)
@@ -1,9 +0,0 @@
-<body _onload_="loaded()">
-<script>
-function loaded() {
-    var msg = { "width": window.outerWidth, "height": window.outerHeight };
-    window.opener.postMessage(msg, '*');
-    window.close();
-}
-</script>
-</body

Modified: trunk/Source/WebCore/ChangeLog (134450 => 134451)


--- trunk/Source/WebCore/ChangeLog	2012-11-13 19:21:03 UTC (rev 134450)
+++ trunk/Source/WebCore/ChangeLog	2012-11-13 19:24:35 UTC (rev 134451)
@@ -1,3 +1,25 @@
+2012-11-13  Dimitri Glazkov  <dglaz...@chromium.org>
+
+        Unreviewed, rolling out r134434.
+        http://trac.webkit.org/changeset/134434
+        https://bugs.webkit.org/show_bug.cgi?id=102072
+
+        The test that was added asserts in loader.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::createWindow):
+        * page/DOMWindow.cpp:
+        (WebCore):
+        (WebCore::DOMWindow::adjustWindowRect):
+        (WebCore::DOMWindow::moveBy):
+        (WebCore::DOMWindow::moveTo):
+        (WebCore::DOMWindow::resizeBy):
+        (WebCore::DOMWindow::resizeTo):
+        (WebCore::DOMWindow::open):
+        (WebCore::DOMWindow::showModalDialog):
+        * page/DOMWindow.h:
+        (DOMWindow):
+
 2012-11-13  Dan Carney  <dcar...@google.com>
 
         [V8] More efficient wrapper dispatch

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (134450 => 134451)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2012-11-13 19:21:03 UTC (rev 134450)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2012-11-13 19:24:35 UTC (rev 134451)
@@ -3321,25 +3321,21 @@
     page->chrome()->setResizable(features.resizable);
 
     // 'x' and 'y' specify the location of the window, while 'width' and 'height'
-    // specify the size of the viewport. We can only resize the window, so adjust
-    // for the difference between the window size and the viewport size.
+    // specify the size of the page. We can only resize the window, so
+    // adjust for the difference between the window size and the page size.
 
     FloatRect windowRect = page->chrome()->windowRect();
-    FloatSize viewportSize = page->chrome()->pageRect().size();
-
+    FloatSize pageSize = page->chrome()->pageRect().size();
     if (features.xSet)
         windowRect.setX(features.x);
     if (features.ySet)
         windowRect.setY(features.y);
     if (features.widthSet)
-        windowRect.setWidth(features.width + (windowRect.width() - viewportSize.width()));
+        windowRect.setWidth(features.width + (windowRect.width() - pageSize.width()));
     if (features.heightSet)
-        windowRect.setHeight(features.height + (windowRect.height() - viewportSize.height()));
+        windowRect.setHeight(features.height + (windowRect.height() - pageSize.height()));
+    page->chrome()->setWindowRect(windowRect);
 
-    // Ensure non-NaN values, minimum size as well as being within valid screen area.
-    FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect);
-
-    page->chrome()->setWindowRect(newWindowRect);
     page->chrome()->show();
 
     created = true;

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (134450 => 134451)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2012-11-13 19:21:03 UTC (rev 134450)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2012-11-13 19:24:35 UTC (rev 134451)
@@ -308,18 +308,16 @@
 }
 
 // This function:
-// 1) Validates the pending changes are not changing any value to NaN; in that case keep original value.
-// 2) Constrains the window rect to the minimum window size and no bigger than the float rect's dimensions.
-// 3) Constrains the window rect to within the top and left boundaries of the available screen rect.
-// 4) Constrains the window rect to within the bottom and right boundaries of the available screen rect.
-// 5) Translate the window rect coordinates to be within the coordinate space of the screen.
-FloatRect DOMWindow::adjustWindowRect(Page* page, const FloatRect& pendingChanges)
+// 1) Validates the pending changes are not changing to NaN
+// 2) Constrains the window rect to the minimum window size and no bigger than
+//    the the float rect's dimensions.
+// 3) Constrain window rect to within the top and left boundaries of the screen rect
+// 4) Constraint the window rect to within the bottom and right boundaries of the
+//    screen rect.
+// 5) Translate the window rect coordinates to be within the coordinate space of
+//    the screen rect.
+void DOMWindow::adjustWindowRect(const FloatRect& screen, FloatRect& window, const FloatRect& pendingChanges) const
 {
-    ASSERT(page);
-
-    FloatRect screen = screenAvailableRect(page->mainFrame()->view());
-    FloatRect window = page->chrome()->windowRect();
-
     // Make sure we're in a valid state before adjusting dimensions.
     ASSERT(isfinite(screen.x()));
     ASSERT(isfinite(screen.y()));
@@ -329,7 +327,7 @@
     ASSERT(isfinite(window.y()));
     ASSERT(isfinite(window.width()));
     ASSERT(isfinite(window.height()));
-
+    
     // Update window values if new requested values are not NaN.
     if (!isnan(pendingChanges.x()))
         window.setX(pendingChanges.x());
@@ -340,15 +338,15 @@
     if (!isnan(pendingChanges.height()))
         window.setHeight(pendingChanges.height());
 
-    FloatSize minimumSize = page->chrome()->client()->minimumWindowSize();
+    ASSERT(m_frame);
+    Page* page = m_frame->page();
+    FloatSize minimumSize = page ? m_frame->page()->chrome()->client()->minimumWindowSize() : FloatSize(100, 100);
     window.setWidth(min(max(minimumSize.width(), window.width()), screen.width()));
     window.setHeight(min(max(minimumSize.height(), window.height()), screen.height()));
 
-    // Constrain the window position within the valid screen area.
+    // Constrain the window position to the screen.
     window.setX(max(screen.x(), min(window.x(), screen.maxX() - window.width())));
     window.setY(max(screen.y(), min(window.y(), screen.maxY() - window.height())));
-
-    return window;
 }
 
 // FIXME: We can remove this function once V8 showModalDialog is changed to use DOMWindow.
@@ -1452,7 +1450,8 @@
     FloatRect update = fr;
     update.move(x, y);
     // Security check (the spec talks about UniversalBrowserWrite to disable this check...)
-    page->chrome()->setWindowRect(adjustWindowRect(page, update));
+    adjustWindowRect(screenAvailableRect(page->mainFrame()->view()), fr, update);
+    page->chrome()->setWindowRect(fr);
 }
 
 void DOMWindow::moveTo(float x, float y) const
@@ -1471,9 +1470,10 @@
     FloatRect sr = screenAvailableRect(page->mainFrame()->view());
     fr.setLocation(sr.location());
     FloatRect update = fr;
-    update.move(x, y);
+    update.move(x, y);     
     // Security check (the spec talks about UniversalBrowserWrite to disable this check...)
-    page->chrome()->setWindowRect(adjustWindowRect(page, update));
+    adjustWindowRect(sr, fr, update);
+    page->chrome()->setWindowRect(fr);
 }
 
 void DOMWindow::resizeBy(float x, float y) const
@@ -1491,7 +1491,8 @@
     FloatRect fr = page->chrome()->windowRect();
     FloatSize dest = fr.size() + FloatSize(x, y);
     FloatRect update(fr.location(), dest);
-    page->chrome()->setWindowRect(adjustWindowRect(page, update));
+    adjustWindowRect(screenAvailableRect(page->mainFrame()->view()), fr, update);
+    page->chrome()->setWindowRect(fr);
 }
 
 void DOMWindow::resizeTo(float width, float height) const
@@ -1509,7 +1510,8 @@
     FloatRect fr = page->chrome()->windowRect();
     FloatSize dest = FloatSize(width, height);
     FloatRect update(fr.location(), dest);
-    page->chrome()->setWindowRect(adjustWindowRect(page, update));
+    adjustWindowRect(screenAvailableRect(page->mainFrame()->view()), fr, update);
+    page->chrome()->setWindowRect(fr);
 }
 
 int DOMWindow::setTimeout(PassOwnPtr<ScheduledAction> action, int timeout, ExceptionCode& ec)
@@ -1928,6 +1930,15 @@
     }
 
     WindowFeatures windowFeatures(windowFeaturesString);
+    FloatRect windowRect(windowFeatures.xSet ? windowFeatures.x : 0, windowFeatures.ySet ? windowFeatures.y : 0,
+        windowFeatures.widthSet ? windowFeatures.width : 0, windowFeatures.heightSet ? windowFeatures.height : 0);
+    Page* page = m_frame->page();
+    DOMWindow::adjustWindowRect(screenAvailableRect(page ? page->mainFrame()->view() : 0), windowRect, windowRect);
+    windowFeatures.x = windowRect.x();
+    windowFeatures.y = windowRect.y();
+    windowFeatures.height = windowRect.height();
+    windowFeatures.width = windowRect.width();
+
     Frame* result = createWindow(urlString, frameName, windowFeatures, activeWindow, firstFrame, m_frame);
     return result ? result->document()->domWindow() : 0;
 }
@@ -1947,8 +1958,7 @@
     if (!canShowModalDialogNow(m_frame) || !firstWindow->allowPopUp())
         return;
 
-    WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(m_frame->view()));
-    Frame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures,
+    Frame* dialogFrame = createWindow(urlString, emptyAtom, WindowFeatures(dialogFeaturesString, screenAvailableRect(m_frame->view())),
         activeWindow, firstFrame, m_frame, function, functionContext);
     if (!dialogFrame)
         return;

Modified: trunk/Source/WebCore/page/DOMWindow.h (134450 => 134451)


--- trunk/Source/WebCore/page/DOMWindow.h	2012-11-13 19:21:03 UTC (rev 134450)
+++ trunk/Source/WebCore/page/DOMWindow.h	2012-11-13 19:24:35 UTC (rev 134451)
@@ -120,7 +120,7 @@
         static bool dispatchAllPendingBeforeUnloadEvents();
         static void dispatchAllPendingUnloadEvents();
 
-        static FloatRect adjustWindowRect(Page*, const FloatRect& pendingChanges);
+        void adjustWindowRect(const FloatRect& screen, FloatRect& window, const FloatRect& pendingChanges) const;
 
         // FIXME: We can remove this function once V8 showModalDialog is changed to use DOMWindow.
         static void parseModalDialogFeatures(const String&, HashMap<String, String>&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to