Unreviewed, rolling out r120541, r120547, and r120548.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jun 2012 21:38:09 +0000 (21:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jun 2012 21:38:09 +0000 (21:38 +0000)
http://trac.webkit.org/changeset/120541
http://trac.webkit.org/changeset/120547
http://trac.webkit.org/changeset/120548
https://bugs.webkit.org/show_bug.cgi?id=89383

This approach doesn't work for WebKit2 (Requested by abarth on
#webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-06-18

Source/WebCore:

* testing/InternalSettings.cpp:
(WebCore::InternalSettings::InternalSettings):
(WebCore::InternalSettings::restoreTo):
* testing/InternalSettings.h:
(InternalSettings):

Tools:

* DumpRenderTree/LayoutTestController.cpp:
(setBackingScaleFactorCallback):
(LayoutTestController::staticFunctions):
* DumpRenderTree/LayoutTestController.h:
(LayoutTestController):
* DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp:
(LayoutTestController::setBackingScaleFactor):
* DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
(LayoutTestController::setBackingScaleFactor):
* DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
(LayoutTestController::setBackingScaleFactor):
* DumpRenderTree/mac/LayoutTestControllerMac.mm:
(LayoutTestController::setBackingScaleFactor):
* DumpRenderTree/win/LayoutTestControllerWin.cpp:
(LayoutTestController::setBackingScaleFactor):
* DumpRenderTree/wx/LayoutTestControllerWx.cpp:
(LayoutTestController::setBackingScaleFactor):
* WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessage):
(WTR::InjectedBundle::postSetBackingScaleFactor):
(WTR):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
(InjectedBundle):
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::setBackingScaleFactor):
(WTR):
(WTR::LayoutTestController::callSetBackingScaleFactorCallback):
* WebKitTestRunner/InjectedBundle/LayoutTestController.h:
(LayoutTestController):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):

LayoutTests:

* compositing/tiled-layers-hidpi.html:
* fast/canvas/2d.backingStorePixelRatio.html:
* fast/canvas/2d.imageDataHD.html:
* fast/hidpi/broken-image-icon-hidpi.html:
* fast/hidpi/broken-image-with-size-hidpi.html:
* fast/hidpi/clip-text-in-hidpi.html:
* fast/hidpi/focus-rings.html:
* fast/hidpi/image-set-as-background.html:
* fast/hidpi/image-set-background-dynamic.html:
* fast/hidpi/image-set-background-repeat-without-size.html:
* fast/hidpi/image-set-background-repeat.html:
* fast/hidpi/image-set-border-image-comparison.html:
* fast/hidpi/image-set-border-image-dynamic.html:
* fast/hidpi/image-set-border-image-simple.html:
* fast/hidpi/image-set-in-content-dynamic.html:
* fast/hidpi/image-set-out-of-order.html:
* fast/hidpi/image-set-simple.html:
* fast/hidpi/image-set-without-specified-width.html:
* fast/hidpi/resize-corner-hidpi.html:
* fast/hidpi/video-controls-in-hidpi.html:
* platform/mac-wk2/plugins/contents-scale-factor.html:
* svg/as-image/image-respects-deviceScaleFactor.html:

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

41 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/tiled-layers-hidpi.html
LayoutTests/fast/canvas/2d.backingStorePixelRatio.html
LayoutTests/fast/canvas/2d.imageDataHD.html
LayoutTests/fast/hidpi/broken-image-icon-hidpi.html
LayoutTests/fast/hidpi/broken-image-with-size-hidpi.html
LayoutTests/fast/hidpi/clip-text-in-hidpi.html
LayoutTests/fast/hidpi/focus-rings.html
LayoutTests/fast/hidpi/image-set-as-background.html
LayoutTests/fast/hidpi/image-set-background-dynamic.html
LayoutTests/fast/hidpi/image-set-background-repeat-without-size.html
LayoutTests/fast/hidpi/image-set-background-repeat.html
LayoutTests/fast/hidpi/image-set-border-image-comparison.html
LayoutTests/fast/hidpi/image-set-border-image-dynamic.html
LayoutTests/fast/hidpi/image-set-border-image-simple.html
LayoutTests/fast/hidpi/image-set-in-content-dynamic.html
LayoutTests/fast/hidpi/image-set-out-of-order.html
LayoutTests/fast/hidpi/image-set-simple.html
LayoutTests/fast/hidpi/image-set-without-specified-width.html
LayoutTests/fast/hidpi/resize-corner-hidpi.html
LayoutTests/fast/hidpi/video-controls-in-hidpi.html
LayoutTests/platform/mac-wk2/plugins/contents-scale-factor.html
LayoutTests/svg/as-image/image-respects-deviceScaleFactor.html
Source/WebCore/ChangeLog
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Tools/ChangeLog
Tools/DumpRenderTree/LayoutTestController.cpp
Tools/DumpRenderTree/LayoutTestController.h
Tools/DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp
Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp
Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm
Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp
Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
Tools/WebKitTestRunner/TestInvocation.cpp

index 778aee4..2eac6a6 100644 (file)
@@ -1,3 +1,37 @@
+2012-06-18  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r120541, r120547, and r120548.
+        http://trac.webkit.org/changeset/120541
+        http://trac.webkit.org/changeset/120547
+        http://trac.webkit.org/changeset/120548
+        https://bugs.webkit.org/show_bug.cgi?id=89383
+
+        This approach doesn't work for WebKit2 (Requested by abarth on
+        #webkit).
+
+        * compositing/tiled-layers-hidpi.html:
+        * fast/canvas/2d.backingStorePixelRatio.html:
+        * fast/canvas/2d.imageDataHD.html:
+        * fast/hidpi/broken-image-icon-hidpi.html:
+        * fast/hidpi/broken-image-with-size-hidpi.html:
+        * fast/hidpi/clip-text-in-hidpi.html:
+        * fast/hidpi/focus-rings.html:
+        * fast/hidpi/image-set-as-background.html:
+        * fast/hidpi/image-set-background-dynamic.html:
+        * fast/hidpi/image-set-background-repeat-without-size.html:
+        * fast/hidpi/image-set-background-repeat.html:
+        * fast/hidpi/image-set-border-image-comparison.html:
+        * fast/hidpi/image-set-border-image-dynamic.html:
+        * fast/hidpi/image-set-border-image-simple.html:
+        * fast/hidpi/image-set-in-content-dynamic.html:
+        * fast/hidpi/image-set-out-of-order.html:
+        * fast/hidpi/image-set-simple.html:
+        * fast/hidpi/image-set-without-specified-width.html:
+        * fast/hidpi/resize-corner-hidpi.html:
+        * fast/hidpi/video-controls-in-hidpi.html:
+        * platform/mac-wk2/plugins/contents-scale-factor.html:
+        * svg/as-image/image-respects-deviceScaleFactor.html:
+
 2012-06-18  Adam Barth  <abarth@webkit.org>
 
         Fix the expected result for this test.  This got landed with the wrong expected.txt file.
index ba1ca23..1b3842c 100644 (file)
             if (window.testRunner) {
                 testRunner.waitUntilDone();
                 testRunner.dumpAsText();
-                internals.settings.setDeviceScaleFactor(2);
-                setTimeout(function() {
-                    document.getElementById('layer-tree').innerText = window.testRunner.layerTreeAsText();
-                    testRunner.notifyDone();
-                }, 0);
+                testRunner.setBackingScaleFactor(2, finishTest);
             }
         }
+        
+        function finishTest() {
+            setTimeout(function() {
+                               document.getElementById('layer-tree').innerText = window.testRunner.layerTreeAsText();
+                               testRunner.notifyDone();
+                       }, 0);
+        }
         </script>
     </head>
     <body onload="startTest();">
index e6e0de1..9c0a9f7 100644 (file)
@@ -11,8 +11,7 @@
         var context1 = canvas1.getContext("2d");
 
         layoutTestController.waitUntilDone();
-        internals.settings.setDeviceScaleFactor(2);
-        setTimeout(function() {
+        layoutTestController.setBackingScaleFactor(2, function() {
             var canvas2 = document.createElement("canvas");
             var context2 = canvas2.getContext("2d");
 
@@ -20,7 +19,7 @@
             log ("context2.webkitBackingStorePixelRatio is " + context2.webkitBackingStorePixelRatio);
 
             layoutTestController.notifyDone();
-        }, 0);
+        });
     } else {
         log ("When not run inside DumpRenderTree or WebKitTestRunner, this test just prints the value of");
         log ("backingStorePixelRatio. Please verify that it matches what you expect, based on the");
index cd05e50..b392bbd 100644 (file)
@@ -52,8 +52,7 @@
         log("This test requires WebKitTestRunner or DumpRenderTree.");
 
     layoutTestController.waitUntilDone();
-    internals.settings.setDeviceScaleFactor(2);
-    setTimeout(function() {
+    layoutTestController.setBackingScaleFactor(2, function() {
         var canvas = document.createElement("canvas");
         canvas.width = 8;
         canvas.height = 8;
             log("High-DPI canvas is not enabled.");
 
         layoutTestController.notifyDone();
-    }, 0);
+    });
 </script>
index b5f3ef1..da4d837 100644 (file)
@@ -1,10 +1,16 @@
 <html>
     <script>
         function startTest() {
-            if (window.internals)
-                internals.settings.setDeviceScaleFactor(2);
+            if (window.layoutTestController) {
+                layoutTestController.waitUntilDone();
+                layoutTestController.setBackingScaleFactor(2, finishTest);
+            }
         }
-    </script>
+        
+        function finishTest() {
+            setTimeout(function() { layoutTestController.notifyDone(); }, 0);
+        }
+        </script>
     </head>
     <body onload="startTest();">
         <div>This test passes if the broken image icon appears high-resolution in HiDPI and if the outline is of the appropriate size.</div>
index 8d24c0b..54956e4 100644 (file)
@@ -1,10 +1,16 @@
 <html>
     <script>
         function startTest() {
-            if (window.internals)
-                internals.settings.setDeviceScaleFactor(2);
+            if (window.layoutTestController) {
+                layoutTestController.waitUntilDone();
+                layoutTestController.setBackingScaleFactor(2, finishTest);
+            }
         }
-    </script>
+        
+        function finishTest() {
+            setTimeout(function() { layoutTestController.notifyDone(); }, 0);
+        }
+        </script>
     </head>
     <body onload="startTest();">
         <div>This test passes if the broken image icon appears high-resolution in HiDPI and is the appropriate size.</div>
index bed885b..229ccae 100644 (file)
@@ -2,11 +2,16 @@
 <head>
 <script>
     function startTest() {
-        if (window.internals)
-            internals.settings.setDeviceScaleFactor(2);
-
+        if (window.layoutTestController) {
+            layoutTestController.waitUntilDone();
+            layoutTestController.setBackingScaleFactor(2, finishTest);
+        }
+    }
+    
+    function finishTest() {
         var test = document.getElementById("test");
         test.innerHTML = window.devicePixelRatio;
+        setTimeout(function() { layoutTestController.notifyDone(); }, 0);
     }
 </script>
 </head>
index 36b8827..8afd3cb 100644 (file)
@@ -1,11 +1,16 @@
 <html>
 <script>
     function startTest() {
-        if (window.internals)
-            internals.settings.setDeviceScaleFactor(2);
-
+        if (window.layoutTestController) {
+            layoutTestController.waitUntilDone();
+            layoutTestController.setBackingScaleFactor(2, finishTest);
+        }
+    }
+    
+    function finishTest() {
         var div = document.getElementById("div");
         div.focus();
+        setTimeout(function() { layoutTestController.notifyDone(); }, 0);
     }
     </script>
 </head>
index faaf4cc..382c402 100644 (file)
@@ -7,8 +7,7 @@
 
         if (!sessionStorage.scaleFactorIsSet) {
             layoutTestController.waitUntilDone();
-            internals.settings.setDeviceScaleFactor(2);
-            setTimeout(scaleFactorIsSet, 0);
+            layoutTestController.setBackingScaleFactor(2, scaleFactorIsSet);
         }
         
         if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) {
index fda2cce..b70065d 100644 (file)
@@ -3,15 +3,19 @@
     <head>
     <script>
         function startTest() {
-            if (window.internals)
-                internals.settings.setDeviceScaleFactor(2);
+            if (window.layoutTestController) {
+                layoutTestController.waitUntilDone();
+                layoutTestController.setBackingScaleFactor(2, finishTest);
+            }
+        }
 
+        function finishTest() {
             var test = document.getElementById("foo");
             test.innerHTML = window.devicePixelRatio;
             setTimeout(function() { layoutTestController.notifyDone(); }, 0);
         }
     </script>
-   
+    
 <style>
     #foo {
         width:100px;
index cdcc4de..867acf2 100644 (file)
@@ -7,8 +7,7 @@
 
         if (!sessionStorage.scaleFactorIsSet) {
             layoutTestController.waitUntilDone();
-            internals.settings.setDeviceScaleFactor(2);
-            setTimeout(scaleFactorIsSet, 0);
+            layoutTestController.setBackingScaleFactor(2, scaleFactorIsSet);
         }
         
         if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) {
index 7ac17cb..b51716d 100644 (file)
@@ -7,8 +7,7 @@
 
         if (!sessionStorage.scaleFactorIsSet) {
             layoutTestController.waitUntilDone();
-            internals.settings.setDeviceScaleFactor(2);
-            setTimeout(scaleFactorIsSet, 0);
+            layoutTestController.setBackingScaleFactor(2, scaleFactorIsSet);
         }
         
         if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) {
index 5ce22ee..b28c5c8 100644 (file)
@@ -2,8 +2,14 @@
 <head>
 <script>
     function startTest() {
-        if (window.internals)
-            internals.settings.setDeviceScaleFactor(2);
+        if (window.layoutTestController) {
+            layoutTestController.waitUntilDone();
+            layoutTestController.setBackingScaleFactor(2, finishTest);
+        }
+    }
+    
+    function finishTest() {
+        setTimeout(function() { layoutTestController.notifyDone(); }, 0);
     }
 </script>
 
index 4d08ce4..3b976bf 100644 (file)
@@ -3,11 +3,16 @@
     <head>
     <script>
         function startTest() {
-            if (window.internals)
-                internals.settings.setDeviceScaleFactor(2);
+            if (window.layoutTestController) {
+                layoutTestController.waitUntilDone();
+                layoutTestController.setBackingScaleFactor(2, finishTest);
+            }
+        }
 
+        function finishTest() {
             var test = document.getElementById("foo");
             test.innerHTML = window.devicePixelRatio;
+            setTimeout(function() { layoutTestController.notifyDone(); }, 0);
         }
     </script>
     
index 489a60a..211f50d 100644 (file)
@@ -7,8 +7,7 @@
 
         if (!sessionStorage.scaleFactorIsSet) {
             layoutTestController.waitUntilDone();
-            internals.settings.setDeviceScaleFactor(2);
-            setTimeout(scaleFactorIsSet, 0);
+            layoutTestController.setBackingScaleFactor(2, scaleFactorIsSet);
         }
         
         if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) {
index b4fbd70..040b6bd 100644 (file)
@@ -3,11 +3,16 @@
     <head>
     <script>
         function startTest() {
-            if (window.internals)
-                internals.settings.setDeviceScaleFactor(2)
+            if (window.layoutTestController) {
+                layoutTestController.waitUntilDone();
+                layoutTestController.setBackingScaleFactor(2, finishTest);
+            }
+        }
 
+        function finishTest() {
             var test = document.getElementById("foo");
             test.innerHTML = window.devicePixelRatio;
+            setTimeout(function() { layoutTestController.notifyDone(); }, 0);
         }
     </script>
     
index 3989503..670c652 100644 (file)
@@ -7,8 +7,7 @@
 
         if (!sessionStorage.scaleFactorIsSet) {
             layoutTestController.waitUntilDone();
-            internals.settings.setDeviceScaleFactor(2);
-            setTimeout(scaleFactorIsSet, 0);
+            layoutTestController.setBackingScaleFactor(2, scaleFactorIsSet);
         }
         
         if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) {
index dbd87c3..1b12b8d 100644 (file)
@@ -7,8 +7,7 @@
 
         if (!sessionStorage.scaleFactorIsSet) {
             layoutTestController.waitUntilDone();
-            internals.settings.setDeviceScaleFactor(2);
-            setTimeout(scaleFactorIsSet, 0);
+            layoutTestController.setBackingScaleFactor(2, scaleFactorIsSet);
         }
         
         if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) {
index 807fb43..b808547 100644 (file)
@@ -7,8 +7,7 @@
 
         if (!sessionStorage.scaleFactorIsSet) {
             layoutTestController.waitUntilDone();
-            internals.settings.setDeviceScaleFactor(2);
-            setTimeout(scaleFactorIsSet, 0);
+            layoutTestController.setBackingScaleFactor(2, scaleFactorIsSet);
         }
         
         if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) {
index a25abdf..ebd37f5 100644 (file)
@@ -1,10 +1,16 @@
 <html>
     <script>
         function startTest() {
-            if (window.internals)
-                internals.settings.setDeviceScaleFactor(2);
+            if (window.layoutTestController) {
+                layoutTestController.waitUntilDone();
+                layoutTestController.setBackingScaleFactor(2, finishTest);
+            }
         }
-    </script>
+        
+        function finishTest() {
+            setTimeout(function() { layoutTestController.notifyDone(); }, 0);
+        }
+        </script>
     </head>
     <body onload="startTest();">
         <div>This test passes if the resize corner icon appears high-resolution in HiDPI.</div>
index 22523c6..4b2eb02 100644 (file)
@@ -1,10 +1,16 @@
 <html>
 <script>
     function startTest() {
-        if (window.internals)
-            internals.settings.setDeviceScaleFactor(2);
+        if (window.layoutTestController) {
+            layoutTestController.waitUntilDone();
+            layoutTestController.setBackingScaleFactor(2, finishTest);
+        }
     }
-</script>
+    
+    function finishTest() {
+        setTimeout(function() { layoutTestController.notifyDone(); }, 0);
+    }
+    </script>
 </head>
 <body onload="startTest();">
     <div>This test passes if the video controls are non-blurry and properly positioned in HiDPI.</div>
index 28d5300..26bd46d 100644 (file)
@@ -29,8 +29,8 @@ function runTest()
     shouldBe("plugin1.contentsScaleFactor", "1.0");
     shouldBe("plugin1.cachedContentsScaleFactor", "1.0");
 
-    internals.settings.setDeviceScaleFactor(2);
-    setTimeout(function() {
+    // Now change the backing scale factor.
+    testRunner.setBackingScaleFactor(2, function() {
         shouldBe("plugin1.contentsScaleFactor", "2.0");
         shouldBe("plugin1.cachedContentsScaleFactor", "2.0");
     
@@ -41,7 +41,7 @@ function runTest()
         shouldBe("plugin2.cachedContentsScaleFactor", "2.0");
 
         testRunner.notifyDone();
-    }, 0);
+    });
 }
 </script>
 
index c4ffc09..0654699 100644 (file)
@@ -2,10 +2,11 @@
 <head>
     <script>
     function init() {
-        if (!window.internals)
+        if (!window.layoutTestController)
             return;
 
-        internals.settings.setDeviceScaleFactor(2);
+        layoutTestController.waitUntilDone();
+        layoutTestController.setBackingScaleFactor(2, function () { layoutTestController.notifyDone(); });
     }
     window.onload = init;
     </script>
index b33432f..82a7fba 100644 (file)
@@ -1,3 +1,20 @@
+2012-06-18  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r120541, r120547, and r120548.
+        http://trac.webkit.org/changeset/120541
+        http://trac.webkit.org/changeset/120547
+        http://trac.webkit.org/changeset/120548
+        https://bugs.webkit.org/show_bug.cgi?id=89383
+
+        This approach doesn't work for WebKit2 (Requested by abarth on
+        #webkit).
+
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::InternalSettings):
+        (WebCore::InternalSettings::restoreTo):
+        * testing/InternalSettings.h:
+        (InternalSettings):
+
 2012-06-18  Yong Li  <yoli@rim.com>
 
         [BlackBerry] NetworkJob::startNewJobWithRequest() should check the frame pointer
index 410a97b..e1d9cdb 100644 (file)
@@ -107,7 +107,6 @@ InternalSettings::InternalSettings(Frame* frame)
     , m_originalWindowFocusRestricted(settings()->windowFocusRestricted())
     , m_originalDeviceSupportsTouch(settings()->deviceSupportsTouch())
     , m_originalDeviceSupportsMouse(settings()->deviceSupportsMouse())
-    , m_originalDeviceScaleFactor(page() ? page()->deviceScaleFactor() : 1.0)
 {
 }
 
@@ -129,9 +128,6 @@ void InternalSettings::restoreTo(Settings* settings)
     settings->setWindowFocusRestricted(m_originalWindowFocusRestricted);
     settings->setDeviceSupportsTouch(m_originalDeviceSupportsTouch);
     settings->setDeviceSupportsMouse(m_originalDeviceSupportsMouse);
-
-    if (page())
-        page()->setDeviceScaleFactor(m_originalDeviceScaleFactor);
 }
 
 Settings* InternalSettings::settings() const
index 0cff614..cd28b63 100644 (file)
@@ -108,7 +108,6 @@ private:
     bool m_originalWindowFocusRestricted;
     bool m_originalDeviceSupportsTouch;
     bool m_originalDeviceSupportsMouse;
-    float m_originalDeviceScaleFactor;
 };
 
 } // namespace WebCore
index 04ced79..7eab76d 100644 (file)
@@ -1,3 +1,47 @@
+2012-06-18  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r120541, r120547, and r120548.
+        http://trac.webkit.org/changeset/120541
+        http://trac.webkit.org/changeset/120547
+        http://trac.webkit.org/changeset/120548
+        https://bugs.webkit.org/show_bug.cgi?id=89383
+
+        This approach doesn't work for WebKit2 (Requested by abarth on
+        #webkit).
+
+        * DumpRenderTree/LayoutTestController.cpp:
+        (setBackingScaleFactorCallback):
+        (LayoutTestController::staticFunctions):
+        * DumpRenderTree/LayoutTestController.h:
+        (LayoutTestController):
+        * DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp:
+        (LayoutTestController::setBackingScaleFactor):
+        * DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
+        (LayoutTestController::setBackingScaleFactor):
+        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+        (LayoutTestController::setBackingScaleFactor):
+        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+        (LayoutTestController::setBackingScaleFactor):
+        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+        (LayoutTestController::setBackingScaleFactor):
+        * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
+        (LayoutTestController::setBackingScaleFactor):
+        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::didReceiveMessage):
+        (WTR::InjectedBundle::postSetBackingScaleFactor):
+        (WTR):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+        (InjectedBundle):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::setBackingScaleFactor):
+        (WTR):
+        (WTR::LayoutTestController::callSetBackingScaleFactorCallback):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+        (LayoutTestController):
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+
 2012-06-18  Zan Dobersek  <zandobersek@gmail.com>
 
         REGRESSION(r120546): It made 3 webkitpy tests fail
index 49115e0..cd01d1c 100644 (file)
@@ -2107,6 +2107,22 @@ static JSValueRef focusWebViewCallback(JSContextRef context, JSObjectRef, JSObje
     return JSValueMakeUndefined(context);
 }
 
+static JSValueRef setBackingScaleFactorCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount != 2)
+        return JSValueMakeUndefined(context);
+
+    double backingScaleFactor = JSValueToNumber(context, arguments[0], exception);
+    ASSERT(!*exception);
+
+    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+    controller->setBackingScaleFactor(backingScaleFactor);
+
+    // The second argument is a callback that is called once the backing scale factor has been set.
+    JSObjectCallAsFunction(context, JSValueToObject(context, arguments[1], 0), thisObject, 0, 0, 0);
+    return JSValueMakeUndefined(context);
+}
+
 static JSValueRef preciseTimeCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     return JSValueMakeNumber(context, WTF::currentTime());
@@ -2426,6 +2442,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
         { "addChromeInputField", addChromeInputFieldCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "removeChromeInputField", removeChromeInputFieldCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "focusWebView", focusWebViewCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "setBackingScaleFactor", setBackingScaleFactorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "preciseTime", preciseTimeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setHasCustomFullScreenBehavior", setHasCustomFullScreenBehaviorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { 0, 0, 0 }
index 97fc67c..54ca927 100644 (file)
@@ -319,6 +319,8 @@ public:
     void removeChromeInputField();
     void focusWebView();
 
+    void setBackingScaleFactor(double);
+
     void setPOSIXLocale(JSStringRef locale);
 
     void setWebViewEditable(bool);
index 953e2f0..ceadb7a 100644 (file)
@@ -825,6 +825,10 @@ void LayoutTestController::focusWebView()
 {
 }
 
+void LayoutTestController::setBackingScaleFactor(double)
+{
+}
+
 void LayoutTestController::setMockSpeechInputDumpRect(bool)
 {
 }
index 37cc687..b73653d 100644 (file)
@@ -871,6 +871,11 @@ void LayoutTestController::focusWebView()
     notImplemented();
 }
 
+void LayoutTestController::setBackingScaleFactor(double)
+{
+    notImplemented();
+}
+
 void LayoutTestController::simulateDesktopNotificationClick(JSStringRef title)
 {
 }
index 5bab45e..72d69fa 100644 (file)
@@ -972,6 +972,10 @@ void LayoutTestController::focusWebView()
 {
 }
 
+void LayoutTestController::setBackingScaleFactor(double)
+{
+}
+
 void LayoutTestController::simulateDesktopNotificationClick(JSStringRef title)
 {
 }
index a6f38cc..884572e 100644 (file)
@@ -1170,6 +1170,11 @@ void LayoutTestController::focusWebView()
     [[[mainFrame webView] window] makeFirstResponder:[mainFrame webView]];
 }
 
+void LayoutTestController::setBackingScaleFactor(double backingScaleFactor)
+{
+    [[mainFrame webView] _setCustomBackingScaleFactor:backingScaleFactor];
+}
+
 void LayoutTestController::simulateDesktopNotificationClick(JSStringRef title)
 {
     // FIXME: Implement.
index 45e7606..9d03abc 100644 (file)
@@ -1450,6 +1450,10 @@ void LayoutTestController::focusWebView()
 {
 }
 
+void LayoutTestController::setBackingScaleFactor(double)
+{
+}
+
 void LayoutTestController::simulateDesktopNotificationClick(JSStringRef title)
 {
     // FIXME: Implement.
index 5c66645..e0c0584 100644 (file)
@@ -611,6 +611,10 @@ void LayoutTestController::focusWebView()
 {
 }
 
+void LayoutTestController::setBackingScaleFactor(double)
+{
+}
+
 void LayoutTestController::simulateDesktopNotificationClick(JSStringRef title)
 {
     // FIXME: Implement.
index 6ab2fce..b5766c0 100644 (file)
@@ -135,6 +135,8 @@ module WTR {
         void removeChromeInputField(in object callback);
         void focusWebView(in object callback);
 
+        void setBackingScaleFactor(in double backingScaleFactor, in object callback);
+
         void setWindowIsKey(in boolean isKey);
 
         // FIXME: handle non-boolean preferences.
index b51ebef..c9c3fec 100644 (file)
@@ -180,6 +180,10 @@ void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messag
         m_layoutTestController->callFocusWebViewCallback();
         return;
     }
+    if (WKStringIsEqualToUTF8CString(messageName, "CallSetBackingScaleFactorCallback")) {
+        m_layoutTestController->callSetBackingScaleFactorCallback();
+        return;
+    }
 
     WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error"));
     WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithUTF8CString("Unknown"));
@@ -305,6 +309,13 @@ void InjectedBundle::postFocusWebView()
     WKBundlePostMessage(m_bundle, messageName.get(), 0);
 }
 
+void InjectedBundle::postSetBackingScaleFactor(double backingScaleFactor)
+{
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetBackingScaleFactor"));
+    WKRetainPtr<WKDoubleRef> messageBody(AdoptWK, WKDoubleCreate(backingScaleFactor));
+    WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+}
+
 void InjectedBundle::postSetWindowIsKey(bool isKey)
 {
     WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetWindowIsKey"));
index b99370d..26bedc4 100644 (file)
@@ -86,6 +86,7 @@ public:
     void postAddChromeInputField();
     void postRemoveChromeInputField();
     void postFocusWebView();
+    void postSetBackingScaleFactor(double);
     void postSetWindowIsKey(bool);
 
 private:
index b0b0afb..df9dfa4 100644 (file)
@@ -537,7 +537,8 @@ static CallbackMap& callbackMap()
 enum {
     AddChromeInputFieldCallbackID = 1,
     RemoveChromeInputFieldCallbackID,
-    FocusWebViewCallbackID
+    FocusWebViewCallbackID,
+    SetBackingScaleFactorCallbackID
 };
 
 static void cacheLayoutTestControllerCallback(unsigned index, JSValueRef callback)
@@ -580,6 +581,12 @@ void LayoutTestController::focusWebView(JSValueRef callback)
     InjectedBundle::shared().postFocusWebView();
 }
 
+void LayoutTestController::setBackingScaleFactor(double backingScaleFactor, JSValueRef callback)
+{
+    cacheLayoutTestControllerCallback(SetBackingScaleFactorCallbackID, callback);
+    InjectedBundle::shared().postSetBackingScaleFactor(backingScaleFactor);
+}
+
 void LayoutTestController::setWindowIsKey(bool isKey)
 {
     InjectedBundle::shared().postSetWindowIsKey(isKey);
@@ -600,6 +607,11 @@ void LayoutTestController::callFocusWebViewCallback()
     callLayoutTestControllerCallback(FocusWebViewCallbackID);
 }
 
+void LayoutTestController::callSetBackingScaleFactorCallback()
+{
+    callLayoutTestControllerCallback(SetBackingScaleFactorCallbackID);
+}
+
 void LayoutTestController::overridePreference(JSStringRef preference, bool value)
 {
     WKBundleOverrideBoolPreferenceForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), toWK(preference).get(), value);
index 7164388..c0500f7 100644 (file)
@@ -192,12 +192,14 @@ public:
     void addChromeInputField(JSValueRef);
     void removeChromeInputField(JSValueRef);
     void focusWebView(JSValueRef);
+    void setBackingScaleFactor(double, JSValueRef);
 
     void setWindowIsKey(bool);
 
     void callAddChromeInputFieldCallback();
     void callRemoveChromeInputFieldCallback();
     void callFocusWebViewCallback();
+    void callSetBackingScaleFactorCallback();
 
     void overridePreference(JSStringRef preference, bool value);
 
index 217871f..d5c0af6 100644 (file)
@@ -297,6 +297,16 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName
         return;
     }
 
+    if (WKStringIsEqualToUTF8CString(messageName, "SetBackingScaleFactor")) {
+        ASSERT(WKGetTypeID(messageBody) == WKDoubleGetTypeID());
+        double backingScaleFactor = WKDoubleGetValue(static_cast<WKDoubleRef>(messageBody));
+        WKPageSetCustomBackingScaleFactor(TestController::shared().mainWebView()->page(), backingScaleFactor);
+
+        WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallSetBackingScaleFactorCallback"));
+        WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), 0);
+        return;
+    }
+
     ASSERT_NOT_REACHED();
 }