<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[164859] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/164859">164859</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2014-02-28 07:24:18 -0800 (Fri, 28 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add hiDPI support to DumpRenderTree/WebKitTestRunner without the need of reloading the test case.
https://bugs.webkit.org/show_bug.cgi?id=129438

Reviewed by Simon Fraser.

'hidpi-' prefixed test cases now trigger 2x scale factor on the testing
offscreen window. It makes testing subpixel rendering and positioning possible.

Both the offscreen window's and WebKit's scaling are set accordingly.

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(createWebViewAndOffscreenWindow): unrelated cleanup.
(destroyWebViewAndOffscreenWindow): unrelated cleanup.
(dumpRenderTree):
(changeOffscreenWindowScaleIfNeeded):
(runTest):
* DumpRenderTree/mac/DumpRenderTreeWindow.h:
* DumpRenderTree/mac/DumpRenderTreeWindow.mm:
(-[DumpRenderTreeWindow initWithContentRect:styleMask:backing:defer:]): cleanup.
* WebKitTestRunner/PlatformWebView.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::changeOffscreenWindowScaleIfNeeded):
(WTR::TestInvocation::invoke):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::changeOffscreenWindowScaleIfNeeded):

LayoutTests:

* fast/borders/hidpi-simple-hairline-border-painting-expected.html: Added.
* fast/borders/hidpi-simple-hairline-border-painting.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreemacDumpRenderTreemm">trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreemacDumpRenderTreeWindowh">trunk/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.h</a></li>
<li><a href="#trunkToolsDumpRenderTreemacDumpRenderTreeWindowmm">trunk/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnerPlatformWebViewh">trunk/Tools/WebKitTestRunner/PlatformWebView.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestInvocationcpp">trunk/Tools/WebKitTestRunner/TestInvocation.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnereflPlatformWebViewEflcpp">trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnergtkPlatformWebViewGtkcpp">trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosPlatformWebViewIOSmm">trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnermacPlatformWebViewMacmm">trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastbordershidpisimplehairlineborderpaintingexpectedhtml">trunk/LayoutTests/fast/borders/hidpi-simple-hairline-border-painting-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastbordershidpisimplehairlineborderpaintinghtml">trunk/LayoutTests/fast/borders/hidpi-simple-hairline-border-painting.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (164858 => 164859)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-28 14:34:08 UTC (rev 164858)
+++ trunk/LayoutTests/ChangeLog        2014-02-28 15:24:18 UTC (rev 164859)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-02-28  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        Add hiDPI support to DumpRenderTree/WebKitTestRunner without the need of reloading the test case.
+        https://bugs.webkit.org/show_bug.cgi?id=129438
+
+        Reviewed by Simon Fraser.
+
+        'hidpi-' prefixed test cases now trigger 2x scale factor on the testing
+        offscreen window. It makes testing subpixel rendering and positioning possible.
+
+        Both the offscreen window's and WebKit's scaling are set accordingly.
+
+        * fast/borders/hidpi-simple-hairline-border-painting-expected.html: Added.
+        * fast/borders/hidpi-simple-hairline-border-painting.html: Added.
+
</ins><span class="cx"> 2014-02-28  Mihnea Ovidenie  &lt;mihnea@adobe.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSSRegions] ASSERTION FAILED: !m_regionsInvalidated in RenderFlowThread::regionAtBlockOffset
</span></span></pre></div>
<a id="trunkLayoutTestsfastbordershidpisimplehairlineborderpaintingexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/borders/hidpi-simple-hairline-border-painting-expected.html (0 => 164859)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/borders/hidpi-simple-hairline-border-painting-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/borders/hidpi-simple-hairline-border-painting-expected.html        2014-02-28 15:24:18 UTC (rev 164859)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;title&gt;It tests if 0.5px borders get painted.&lt;/title&gt;
+&lt;style&gt;
+  div {
+        width: 49px;
+        height: 49px;
+        border: 1px solid green;
+  }
+&lt;/style&gt;
+&lt;body&gt;
+        &lt;div&gt;&lt;/div&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastbordershidpisimplehairlineborderpaintinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/borders/hidpi-simple-hairline-border-painting.html (0 => 164859)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/borders/hidpi-simple-hairline-border-painting.html                                (rev 0)
+++ trunk/LayoutTests/fast/borders/hidpi-simple-hairline-border-painting.html        2014-02-28 15:24:18 UTC (rev 164859)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;title&gt;It tests if 0.5px borders get painted.&lt;/title&gt;
+&lt;style&gt;
+.outer {
+        width: 50px;
+        height: 50px;
+        border: 0.5px solid green;
+}
+.inner {
+        width: 49px;
+        height: 49px;
+        border: 0.5px solid green;
+}
+&lt;/style&gt;
+&lt;body&gt;
+        &lt;div class=&quot;outer&quot;&gt;&lt;div class=&quot;inner&quot;&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (164858 => 164859)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-02-28 14:34:08 UTC (rev 164858)
+++ trunk/Tools/ChangeLog        2014-02-28 15:24:18 UTC (rev 164859)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2014-02-28  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        Add hiDPI support to DumpRenderTree/WebKitTestRunner without the need of reloading the test case.
+        https://bugs.webkit.org/show_bug.cgi?id=129438
+
+        Reviewed by Simon Fraser.
+
+        'hidpi-' prefixed test cases now trigger 2x scale factor on the testing
+        offscreen window. It makes testing subpixel rendering and positioning possible.
+
+        Both the offscreen window's and WebKit's scaling are set accordingly.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (createWebViewAndOffscreenWindow): unrelated cleanup.
+        (destroyWebViewAndOffscreenWindow): unrelated cleanup.
+        (dumpRenderTree):
+        (changeOffscreenWindowScaleIfNeeded):
+        (runTest):
+        * DumpRenderTree/mac/DumpRenderTreeWindow.h:
+        * DumpRenderTree/mac/DumpRenderTreeWindow.mm:
+        (-[DumpRenderTreeWindow initWithContentRect:styleMask:backing:defer:]): cleanup.
+        * WebKitTestRunner/PlatformWebView.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::changeOffscreenWindowScaleIfNeeded):
+        (WTR::TestInvocation::invoke):
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::changeOffscreenWindowScaleIfNeeded):
+
</ins><span class="cx"> 2014-02-27  Brian Burg  &lt;bburg@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: model tests should use a special Test.html inspector page
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacDumpRenderTreemm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (164858 => 164859)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2014-02-28 14:34:08 UTC (rev 164858)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2014-02-28 15:24:18 UTC (rev 164859)
</span><span class="lines">@@ -90,6 +90,7 @@
</span><span class="cx"> #import &lt;wtf/Threading.h&gt;
</span><span class="cx"> #import &lt;wtf/ObjcRuntimeExtras.h&gt;
</span><span class="cx"> #import &lt;wtf/OwnPtr.h&gt;
</span><ins>+#import &lt;wtf/text/WTFString.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> #import &lt;Carbon/Carbon.h&gt;
</span><span class="lines">@@ -771,10 +772,36 @@
</span><span class="cx">         [uiWindow retain];
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><ins>+    mainFrame = [webView mainFrame];
</ins><span class="cx"> 
</span><span class="cx">     return webView;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void destroyWebViewAndOffscreenWindow()
+{
+    WebView *webView = [mainFrame webView];
+
+    [webView close];
+    mainFrame = nil;
+
+#if !PLATFORM(IOS)
+    NSWindow* window = [webView window];
+    // Work around problem where registering drag types leaves an outstanding
+    // &quot;perform selector&quot; on the window, which retains the window. It's a bit
+    // inelegant and perhaps dangerous to just blow them all away, but in practice
+    // it probably won't cause any trouble (and this is just a test tool, after all).
+    [NSObject cancelPreviousPerformRequestsWithTarget:window];
+
+    [window close]; // releases when closed
+#else
+    UIWindow *uiWindow = [gWebBrowserView window];
+    [uiWindow removeFromSuperview];
+    [uiWindow release];
+#endif
+
+    [webView release];
+}
+
</ins><span class="cx"> static NSString *libraryPathForDumpRenderTree()
</span><span class="cx"> {
</span><span class="cx">     //FIXME: This may not be sufficient to prevent interactions/crashes
</span><span class="lines">@@ -1121,8 +1148,7 @@
</span><span class="cx">     [NSSound _setAlertType:0];
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    WebView *webView = createWebViewAndOffscreenWindow();
-    mainFrame = [webView mainFrame];
</del><ins>+    createWebViewAndOffscreenWindow();
</ins><span class="cx"> 
</span><span class="cx">     [[NSURLCache sharedURLCache] removeAllCachedResponses];
</span><span class="cx">     [WebCache empty];
</span><span class="lines">@@ -1148,28 +1174,8 @@
</span><span class="cx">     if (threaded)
</span><span class="cx">         stopJavaScriptThreads();
</span><span class="cx"> 
</span><del>-#if !PLATFORM(IOS)
-    NSWindow *window = [webView window];
-#endif
-    [webView close];
-    mainFrame = nil;
-
-#if !PLATFORM(IOS)
-    // Work around problem where registering drag types leaves an outstanding
-    // &quot;perform selector&quot; on the window, which retains the window. It's a bit
-    // inelegant and perhaps dangerous to just blow them all away, but in practice
-    // it probably won't cause any trouble (and this is just a test tool, after all).
-    [NSObject cancelPreviousPerformRequestsWithTarget:window];
</del><ins>+    destroyWebViewAndOffscreenWindow();
</ins><span class="cx">     
</span><del>-    [window close]; // releases when closed
-#else
-    UIWindow *uiWindow = [gWebBrowserView window];
-    [uiWindow removeFromSuperview];
-    [uiWindow release];
-#endif
-
-    [webView release];
-    
</del><span class="cx">     releaseGlobalControllers();
</span><span class="cx">     
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="lines">@@ -1437,6 +1443,20 @@
</span><span class="cx">     printf(&quot;===============================================\n&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void changeWindowScaleIfNeeded(const char* testPathOrUR)
+{
+    bool hasHighDPIWindow = [[[mainFrame webView] window] backingScaleFactor] != 1;
+    WTF::String localPathOrUrl = String(testPathOrUR);
+    bool needsHighDPIWindow = localPathOrUrl.findIgnoringCase(&quot;hidpi-&quot;) != notFound;
+    if (hasHighDPIWindow == needsHighDPIWindow)
+        return;
+
+    CGFloat newScaleFactor = needsHighDPIWindow ? 2 : 1;
+    // When the new scale factor is set on the window first, WebView doesn't see it as a new scale and stops propagating the behavior change to WebCore::Page.
+    gTestRunner-&gt;setBackingScaleFactor(newScaleFactor);
+    [[[mainFrame webView] window] _setWindowResolution:newScaleFactor displayIfChanged:YES];
+}
+
</ins><span class="cx"> static void sizeWebViewForCurrentTest()
</span><span class="cx"> {
</span><span class="cx">     // W3C SVG tests expect to be 480x360
</span><span class="lines">@@ -1733,8 +1753,10 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    const string testURL([[url absoluteString] UTF8String]);
</del><ins>+    const char* testURL([[url absoluteString] UTF8String]);
</ins><span class="cx">     
</span><ins>+    changeWindowScaleIfNeeded(testURL);
+
</ins><span class="cx">     resetWebViewToConsistentStateBeforeTesting();
</span><span class="cx"> 
</span><span class="cx">     gTestRunner = TestRunner::create(testURL, command.expectedPixelHash);
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacDumpRenderTreeWindowh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.h (164858 => 164859)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.h        2014-02-28 14:34:08 UTC (rev 164858)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.h        2014-02-28 15:24:18 UTC (rev 164859)
</span><span class="lines">@@ -38,6 +38,12 @@
</span><span class="cx"> 
</span><span class="cx"> @class WebView;
</span><span class="cx"> 
</span><ins>+@interface NSWindow (Details)
+
+- (void)_setWindowResolution:(CGFloat)resolution displayIfChanged:(BOOL)displayIfChanged;
+
+@end
+
</ins><span class="cx"> @interface DumpRenderTreeWindow : NSWindow
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacDumpRenderTreeWindowmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm (164858 => 164859)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm        2014-02-28 14:34:08 UTC (rev 164858)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm        2014-02-28 15:24:18 UTC (rev 164859)
</span><span class="lines">@@ -74,8 +74,9 @@
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
</span><span class="cx"> {
</span><del>-    [self _addToOpenWindows];
-    return [super initWithContentRect:contentRect styleMask:styleMask backing:bufferingType defer:deferCreation];
</del><ins>+    if ((self = [super initWithContentRect:contentRect styleMask:styleMask backing:bufferingType defer:deferCreation]))
+        [self _addToOpenWindows];
+    return self;
</ins><span class="cx"> }
</span><span class="cx"> #else
</span><span class="cx"> - (id)initWithLayer:(CALayer *)layer
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerPlatformWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/PlatformWebView.h (164858 => 164859)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/PlatformWebView.h        2014-02-28 14:34:08 UTC (rev 164858)
+++ trunk/Tools/WebKitTestRunner/PlatformWebView.h        2014-02-28 15:24:18 UTC (rev 164859)
</span><span class="lines">@@ -89,6 +89,8 @@
</span><span class="cx">     WKRetainPtr&lt;WKImageRef&gt; windowSnapshotImage();
</span><span class="cx">     WKDictionaryRef options() const { return m_options.get(); }
</span><span class="cx"> 
</span><ins>+    void changeWindowScaleIfNeeded(float newScale);
+
</ins><span class="cx"> private:
</span><span class="cx">     PlatformWKView m_view;
</span><span class="cx">     PlatformWindow m_window;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestInvocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (164858 => 164859)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2014-02-28 14:34:08 UTC (rev 164858)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2014-02-28 15:24:18 UTC (rev 164859)
</span><span class="lines">@@ -127,6 +127,13 @@
</span><span class="cx">         TestController::shared().mainWebView()-&gt;resizeTo(TestController::viewWidth, TestController::viewHeight);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void changeWindowScaleIfNeeded(const char* pathOrURL)
+{
+    WTF::String localPathOrUrl = String(pathOrURL);
+    bool needsHighDPIWindow = localPathOrUrl.findIgnoringCase(&quot;hidpi-&quot;) != notFound;
+    TestController::shared().mainWebView()-&gt;changeWindowScaleIfNeeded(needsHighDPIWindow ? 2 : 1);
+}
+
</ins><span class="cx"> static bool shouldLogFrameLoadDelegates(const char* pathOrURL)
</span><span class="cx"> {
</span><span class="cx">     return strstr(pathOrURL, &quot;loading/&quot;);
</span><span class="lines">@@ -193,6 +200,7 @@
</span><span class="cx"> void TestInvocation::invoke()
</span><span class="cx"> {
</span><span class="cx">     TestController::TimeoutDuration timeoutToUse = TestController::LongTimeout;
</span><ins>+    changeWindowScaleIfNeeded(m_pathOrURL.c_str());
</ins><span class="cx">     sizeWebViewForCurrentTest(m_pathOrURL.c_str());
</span><span class="cx">     updateLayoutType(m_pathOrURL.c_str());
</span><span class="cx">     updateThreadedScrollingForCurrentTest(m_pathOrURL.c_str());
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnereflPlatformWebViewEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp (164858 => 164859)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp        2014-02-28 14:34:08 UTC (rev 164858)
+++ trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp        2014-02-28 15:24:18 UTC (rev 164859)
</span><span class="lines">@@ -127,6 +127,10 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PlatformWebView::changeWindowScaleIfNeeded(float)
+{
+}
+
</ins><span class="cx"> WKRetainPtr&lt;WKImageRef&gt; PlatformWebView::windowSnapshotImage()
</span><span class="cx"> {
</span><span class="cx">     int width;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnergtkPlatformWebViewGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp (164858 => 164859)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp        2014-02-28 14:34:08 UTC (rev 164858)
+++ trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp        2014-02-28 15:24:18 UTC (rev 164859)
</span><span class="lines">@@ -114,6 +114,10 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PlatformWebView::changeWindowScaleIfNeeded(float)
+{
+}
+
</ins><span class="cx"> WKRetainPtr&lt;WKImageRef&gt; PlatformWebView::windowSnapshotImage()
</span><span class="cx"> {
</span><span class="cx">     // FIXME: implement to capture pixels in the UI process,
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosPlatformWebViewIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm (164858 => 164859)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm        2014-02-28 14:34:08 UTC (rev 164858)
+++ trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm        2014-02-28 15:24:18 UTC (rev 164859)
</span><span class="lines">@@ -207,6 +207,11 @@
</span><span class="cx"> //    [m_window makeFirstResponder:m_view];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PlatformWebView::changeWindowScaleIfNeeded(float)
+{
+    // Retina only surface.
+}
+
</ins><span class="cx"> WKRetainPtr&lt;WKImageRef&gt; PlatformWebView::windowSnapshotImage()
</span><span class="cx"> {
</span><span class="cx">     return 0; // FIXME for iOS?
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnermacPlatformWebViewMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm (164858 => 164859)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm        2014-02-28 14:34:08 UTC (rev 164858)
+++ trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm        2014-02-28 15:24:18 UTC (rev 164859)
</span><span class="lines">@@ -109,7 +109,12 @@
</span><span class="cx">     NSRect currentFrame = [self frame];
</span><span class="cx">     return NSMakeRect(_fakeOrigin.x, _fakeOrigin.y, currentFrame.size.width, currentFrame.size.height);
</span><span class="cx"> }
</span><ins>+@end
</ins><span class="cx"> 
</span><ins>+@interface NSWindow (Details)
+
+- (void)_setWindowResolution:(CGFloat)resolution displayIfChanged:(BOOL)displayIfChanged;
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> namespace WTR {
</span><span class="lines">@@ -242,4 +247,16 @@
</span><span class="cx">     return useThreadedScrolling == [(TestRunnerWKView *)m_view useThreadedScrolling];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PlatformWebView::changeWindowScaleIfNeeded(float newScale)
+{
+    CGFloat currentScale = [m_window backingScaleFactor];
+    if (currentScale == newScale)
+        return;
+    [m_window _setWindowResolution:newScale displayIfChanged:YES];
+    // Changing the scaling factor on the window does not trigger NSWindowDidChangeBackingPropertiesNotification. We need to send the notification manually.
+    RetainPtr&lt;NSMutableDictionary&gt; notificationUserInfo = [[NSMutableDictionary alloc] initWithCapacity:1];
+    [notificationUserInfo setObject:[NSNumber numberWithDouble:currentScale] forKey:NSBackingPropertyOldScaleFactorKey];
+    [[NSNotificationCenter defaultCenter] postNotificationName:NSWindowDidChangeBackingPropertiesNotification object:m_window userInfo:notificationUserInfo.get()];
+}
+
</ins><span class="cx"> } // namespace WTR
</span></span></pre>
</div>
</div>

</body>
</html>