<!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>[196277] branches/safari-601.3.9.1-branch</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/196277">196277</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-02-08 15:15:18 -0800 (Mon, 08 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/187245">r187245</a>.  rdar://problem/19861992</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601391branchSourceWebCoreChangeLog">branches/safari-601.3.9.1-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari601391branchSourceWebCoreWebCorevcxprojWebCorevcxproj">branches/safari-601.3.9.1-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#branchessafari601391branchSourceWebCoreWebCorevcxprojWebCorevcxprojfilters">branches/safari-601.3.9.1-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters</a></li>
<li><a href="#branchessafari601391branchSourceWebCoreplatformgraphicscawinPlatformCALayerWinInternalcpp">branches/safari-601.3.9.1-branch/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp</a></li>
<li><a href="#branchessafari601391branchSourceWebCoreplatformwinPlatformMouseEventWincpp">branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/PlatformMouseEventWin.cpp</a></li>
<li><a href="#branchessafari601391branchSourceWebCoreplatformwinScrollbarThemeWincpp">branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/ScrollbarThemeWin.cpp</a></li>
<li><a href="#branchessafari601391branchSourceWebCoreplatformwinWheelEventWincpp">branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/WheelEventWin.cpp</a></li>
<li><a href="#branchessafari601391branchSourceWebKitwinChangeLog">branches/safari-601.3.9.1-branch/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#branchessafari601391branchSourceWebKitwinWebCoreSupportWebFrameLoaderClientcpp">branches/safari-601.3.9.1-branch/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp</a></li>
<li><a href="#branchessafari601391branchSourceWebKitwinWebFramecpp">branches/safari-601.3.9.1-branch/Source/WebKit/win/WebFrame.cpp</a></li>
<li><a href="#branchessafari601391branchSourceWebKitwinWebPreferencescpp">branches/safari-601.3.9.1-branch/Source/WebKit/win/WebPreferences.cpp</a></li>
<li><a href="#branchessafari601391branchSourceWebKitwinWebViewcpp">branches/safari-601.3.9.1-branch/Source/WebKit/win/WebView.cpp</a></li>
<li><a href="#branchessafari601391branchSourceWebKitwinWebViewh">branches/safari-601.3.9.1-branch/Source/WebKit/win/WebView.h</a></li>
<li><a href="#branchessafari601391branchToolsChangeLog">branches/safari-601.3.9.1-branch/Tools/ChangeLog</a></li>
<li><a href="#branchessafari601391branchToolsWinLauncherCommoncpp">branches/safari-601.3.9.1-branch/Tools/WinLauncher/Common.cpp</a></li>
<li><a href="#branchessafari601391branchToolsWinLauncherWinLaunchercpp">branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinLauncher.cpp</a></li>
<li><a href="#branchessafari601391branchToolsWinLauncherWinLauncherh">branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinLauncher.h</a></li>
<li><a href="#branchessafari601391branchToolsWinLauncherWinLauncherWebHosth">branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinLauncherWebHost.h</a></li>
<li><a href="#branchessafari601391branchToolsWinLauncherWinMaincpp">branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinMain.cpp</a></li>
<li><a href="#branchessafari601391branchToolswinDLLLauncherDLLLauncherMaincpp">branches/safari-601.3.9.1-branch/Tools/win/DLLLauncher/DLLLauncherMain.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari601391branchSourceWebCoreplatformwinGDIUtilitiescpp">branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/GDIUtilities.cpp</a></li>
<li><a href="#branchessafari601391branchSourceWebCoreplatformwinGDIUtilitiesh">branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/GDIUtilities.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601391branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Source/WebCore/ChangeLog (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebCore/ChangeLog        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Source/WebCore/ChangeLog        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2016-02-08  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
+        Merge r187245.
+
+    2015-07-23  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+            [Win] Implement High DPI support features
+            https://bugs.webkit.org/show_bug.cgi?id=146335
+            &lt;rdar://problem/21558269&gt;
+
+            Reviewed by Alex Christensen.
+
+            * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
+            (WebCore::PlatformCALayerWinInternal::drawTile): Don't translate the CGContext to the position
+            of the CACFLayerRef; the underlying context is already in the right position.
+            * platform/win/PlatformMouseEventWin.cpp: Update class to adjust mouse
+            event coordinates based on scaling factor.
+            (WebCore::deviceScaleFactor):
+            (WebCore::positionForEvent):
+            * platform/win/ScrollbarThemeWin.cpp:
+            (WebCore::scrollbarThicknessInPixels):
+            (WebCore::ScrollbarThemeWin::scrollbarThickness):
+            (WebCore::ScrollbarThemeWin::themeChanged):
+            * platform/win/WheelEventWin.cpp: Update class to adjust wheel event
+            coordinates based on scaling factor.
+            (WebCore::deviceScaleFactor):
+            (WebCore::positionForEvent):
+            (WebCore::globalPositionForEvent):
+            (WebCore::PlatformWheelEvent::PlatformWheelEvent):
+
</ins><span class="cx"> 2016-01-19  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r192700.
</span></span></pre></div>
<a id="branchessafari601391branchSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -8128,6 +8128,7 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\win\EventLoopWin.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\win\FileSystemWin.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\win\GDIObjectCounter.cpp&quot; /&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\platform\win\GDIUtilities.cpp&quot; /&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\platform\win\ImportedFunctionsEnumerator.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\win\ImportedModulesEnumerator.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\win\KeyEventWin.cpp&quot; /&gt;
</span><span class="lines">@@ -20177,6 +20178,7 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\platform\win\DefWndProcWindowClass.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\platform\win\DelayLoadedModulesEnumerator.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\platform\win\GDIObjectCounter.h&quot; /&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\platform\win\GDIUtilities.h&quot; /&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\platform\win\HWndDC.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\platform\win\ImportedFunctionsEnumerator.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\platform\win\ImportedModulesEnumerator.h&quot; /&gt;
</span></span></pre></div>
<a id="branchessafari601391branchSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -7269,6 +7269,9 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\ca\win\WebTiledBackingLayerWin.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;platform\graphics\ca\win&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\platform\win\GDIUtilities.cpp&quot;&gt;
+      &lt;Filter&gt;platform\graphics\win&lt;/Filter&gt;
+    &lt;/ClCompile&gt;
</ins><span class="cx">   &lt;/ItemGroup&gt;
</span><span class="cx">   &lt;ItemGroup&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\Modules\geolocation\Coordinates.h&quot;&gt;
</span><span class="lines">@@ -15261,6 +15264,9 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\platform\graphics\ca\win\WebTiledBackingLayerWin.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;platform\graphics\ca\win&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\platform\win\GDIUtilities.h&quot;&gt;
+      &lt;Filter&gt;platform\graphics\win&lt;/Filter&gt;
+    &lt;/ClInclude&gt;
</ins><span class="cx">   &lt;/ItemGroup&gt;
</span><span class="cx">   &lt;ItemGroup&gt;
</span><span class="cx">     &lt;None Include=&quot;..\css\CSSGrammar.y.in&quot;&gt;
</span></span></pre></div>
<a id="branchessafari601391branchSourceWebCoreplatformgraphicscawinPlatformCALayerWinInternalcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -325,3 +325,38 @@
</span><span class="cx"> 
</span><span class="cx">     CACFLayerSetBorderColor(owner()-&gt;platformLayer(), color.get());
</span><span class="cx"> }
</span><ins>+
+void PlatformCALayerWinInternal::drawTile(CACFLayerRef tile, CGContextRef context)
+{
+    CGPoint tilePosition = CACFLayerGetPosition(tile);
+    CGRect tileBounds = CACFLayerGetBounds(tile);
+
+    CGContextSaveGState(context);
+
+    // Set the context clipping rectangle to the current tile
+    CGContextClipToRect(context, CGRectMake(tilePosition.x, tilePosition.y, tileBounds.size.width, tileBounds.size.height));
+
+    if (owner()-&gt;owner()-&gt;platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesTopDown) {
+        // If the layer is rendering top-down, it will flip the coordinates in y. Tiled layers are
+        // already flipping, so we need to undo that here.
+        CGContextTranslateCTM(context, 0, owner()-&gt;bounds().height());
+        CGContextScaleCTM(context, 1, -1);
+    }
+
+    // Draw the tile
+    displayCallback(owner()-&gt;platformLayer(), context);
+
+    CGContextRestoreGState(context);
+}
+
+TileController* PlatformCALayerWinInternal::createTileController(PlatformCALayer* rootLayer)
+{
+    ASSERT(!m_tileController);
+    m_tileController = std::make_unique&lt;TileController&gt;(rootLayer);
+    return m_tileController.get();
+}
+
+TiledBacking* PlatformCALayerWinInternal::tiledBacking()
+{
+    return m_tileController.get();
+}
</ins></span></pre></div>
<a id="branchessafari601391branchSourceWebCoreplatformwinGDIUtilitiescppfromrev187245trunkSourceWebCoreplatformwinGDIUtilitiescpp"></a>
<div class="copfile"><h4>Copied: branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/GDIUtilities.cpp (from rev 187245, trunk/Source/WebCore/platform/win/GDIUtilities.cpp) (0 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/GDIUtilities.cpp                                (rev 0)
+++ branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/GDIUtilities.cpp        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+/*
+* Copyright (C) 2015 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include &quot;config.h&quot;
+#include &quot;GDIUtilities.h&quot;
+
+#include &quot;HWndDC.h&quot;
+
+namespace WebCore {
+
+float deviceScaleFactorForWindow(HWND window)
+{
+    HWndDC dc(window);
+    return ::GetDeviceCaps(dc, LOGPIXELSX) / 96.0f;
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="branchessafari601391branchSourceWebCoreplatformwinGDIUtilitieshfromrev187245trunkSourceWebCoreplatformwinGDIUtilitiesh"></a>
<div class="copfile"><h4>Copied: branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/GDIUtilities.h (from rev 187245, trunk/Source/WebCore/platform/win/GDIUtilities.h) (0 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/GDIUtilities.h                                (rev 0)
+++ branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/GDIUtilities.h        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+/*
+* Copyright (C) 2015 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef GDIUtilties_h
+#define GDIUtilties_h
+
+#include &lt;windows.h&gt;
+
+namespace WebCore {
+
+WEBCORE_EXPORT float deviceScaleFactorForWindow(HWND);
+
+} // namespace WebCore
+
+#endif // GDIUtilties_h
</ins></span></pre></div>
<a id="branchessafari601391branchSourceWebCoreplatformwinPlatformMouseEventWincpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/PlatformMouseEventWin.cpp (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/PlatformMouseEventWin.cpp        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/PlatformMouseEventWin.cpp        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2007, 2015 Apple Inc.  All rights reserved.
</ins><span class="cx">  * Copyright (C) 2007-2008 Torch Mobile Inc.
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -27,8 +27,11 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;PlatformMouseEvent.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;GDIUtilities.h&quot;
+#include &quot;HWndDC.h&quot;
</ins><span class="cx"> #include &lt;wtf/Assertions.h&gt;
</span><span class="cx"> #include &lt;wtf/CurrentTime.h&gt;
</span><ins>+#include &lt;wtf/MathExtras.h&gt;
</ins><span class="cx"> #include &lt;windows.h&gt;
</span><span class="cx"> #include &lt;windowsx.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -38,7 +41,9 @@
</span><span class="cx"> 
</span><span class="cx"> static IntPoint positionForEvent(HWND hWnd, LPARAM lParam)
</span><span class="cx"> {
</span><del>-    POINT point = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
</del><ins>+    IntPoint point(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
+    float inverseScaleFactor = 1.0f / deviceScaleFactorForWindow(hWnd);
+    point.scale(inverseScaleFactor, inverseScaleFactor);
</ins><span class="cx">     return point;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601391branchSourceWebCoreplatformwinScrollbarThemeWincpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/ScrollbarThemeWin.cpp (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/ScrollbarThemeWin.cpp        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/ScrollbarThemeWin.cpp        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -26,7 +26,9 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;ScrollbarThemeWin.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;GDIUtilities.h&quot;
</ins><span class="cx"> #include &quot;GraphicsContext.h&quot;
</span><ins>+#include &quot;HWndDC.h&quot;
</ins><span class="cx"> #include &quot;LocalWindowsContext.h&quot;
</span><span class="cx"> #include &quot;PlatformMouseEvent.h&quot;
</span><span class="cx"> #include &quot;Scrollbar.h&quot;
</span><span class="lines">@@ -107,14 +109,18 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int ScrollbarThemeWin::scrollbarThickness(ScrollbarControlSize)
</del><ins>+static int scrollbarThicknessInPixels()
</ins><span class="cx"> {
</span><del>-    static int thickness;
-    if (!thickness)
-        thickness = ::GetSystemMetrics(SM_CXVSCROLL);
</del><ins>+    static int thickness = ::GetSystemMetrics(SM_CXVSCROLL);
</ins><span class="cx">     return thickness;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+int ScrollbarThemeWin::scrollbarThickness(ScrollbarControlSize)
+{
+    float inverseScaleFactor = 1.0f / deviceScaleFactorForWindow(0);
+    return clampTo&lt;int&gt;(inverseScaleFactor * scrollbarThicknessInPixels());
+}
+
</ins><span class="cx"> void ScrollbarThemeWin::themeChanged()
</span><span class="cx"> {
</span><span class="cx">     if (!scrollbarTheme)
</span></span></pre></div>
<a id="branchessafari601391branchSourceWebCoreplatformwinWheelEventWincpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/WheelEventWin.cpp (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/WheelEventWin.cpp        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Source/WebCore/platform/win/WheelEventWin.cpp        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -28,6 +28,8 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;FloatPoint.h&quot;
</span><span class="cx"> #include &quot;FloatSize.h&quot;
</span><ins>+#include &quot;GDIUtilities.h&quot;
+#include &quot;HWndDC.h&quot;
</ins><span class="cx"> #include &lt;windows.h&gt;
</span><span class="cx"> #include &lt;windowsx.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -40,13 +42,18 @@
</span><span class="cx"> {
</span><span class="cx">     POINT point = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
</span><span class="cx">     ScreenToClient(hWnd, &amp;point);
</span><del>-    return point;
</del><ins>+    IntPoint logicalPoint(point);
+    float inverseScaleFactor = 1.0f / deviceScaleFactorForWindow(hWnd);
+    logicalPoint.scale(inverseScaleFactor, inverseScaleFactor);
+    return logicalPoint;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static IntPoint globalPositionForEvent(HWND hWnd, LPARAM lParam)
</span><span class="cx"> {
</span><del>-    POINT point = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
-    return point;
</del><ins>+    IntPoint logicalPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
+    float inverseScaleFactor = 1.0f / deviceScaleFactorForWindow(hWnd);
+    logicalPoint.scale(inverseScaleFactor, inverseScaleFactor);
+    return logicalPoint;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static int horizontalScrollChars()
</span><span class="lines">@@ -77,11 +84,14 @@
</span><span class="cx"> 
</span><span class="cx">     // Global Position is just x, y location of event
</span><span class="cx">     POINT point = {location.x(), location.y()};
</span><ins>+    float inverseScaleFactor = 1.0f / deviceScaleFactorForWindow(hWnd);
</ins><span class="cx">     m_globalPosition = point;
</span><ins>+    m_globalPosition.scale(inverseScaleFactor, inverseScaleFactor);
</ins><span class="cx"> 
</span><span class="cx">     // Position needs to be translated to our client
</span><span class="cx">     ScreenToClient(hWnd, &amp;point);
</span><span class="cx">     m_position = point;
</span><ins>+    m_position.scale(inverseScaleFactor, inverseScaleFactor);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PlatformWheelEvent::PlatformWheelEvent(HWND hWnd, WPARAM wParam, LPARAM lParam, bool isMouseHWheel)
</span><span class="lines">@@ -90,6 +100,8 @@
</span><span class="cx">     , m_globalPosition(globalPositionForEvent(hWnd, lParam))
</span><span class="cx">     , m_directionInvertedFromDevice(false)
</span><span class="cx"> {
</span><ins>+    float scaleFactor = deviceScaleFactorForWindow(hWnd);
+
</ins><span class="cx">     // How many pixels should we scroll per line?  Gecko uses the height of the
</span><span class="cx">     // current line, which means scroll distance changes as you go through the
</span><span class="cx">     // page or go to different pages.  IE 7 is ~50 px/line, although the value
</span><span class="lines">@@ -97,8 +109,8 @@
</span><span class="cx">     // smoothing algorithm on scrolling, it can get away with slightly larger
</span><span class="cx">     // scroll values without feeling jerky.  Here we use 100 px per three lines
</span><span class="cx">     // (the default scroll amount on Windows is three lines per wheel tick).
</span><del>-    static const float cScrollbarPixelsPerLine = 100.0f / 3.0f;
-    float delta = GET_WHEEL_DELTA_WPARAM(wParam) / static_cast&lt;float&gt;(WHEEL_DELTA);
</del><ins>+    static const float cScrollbarPixelsPerLine = scaleFactor * 100.0f / 3.0f;
+    float delta = GET_WHEEL_DELTA_WPARAM(wParam) / (scaleFactor * static_cast&lt;float&gt;(WHEEL_DELTA));
</ins><span class="cx">     if (isMouseHWheel) {
</span><span class="cx">         // Windows is &lt;-- -/+ --&gt;, WebKit wants &lt;-- +/- --&gt;, so we negate
</span><span class="cx">         // |delta| after saving the original value on the wheel tick member.
</span></span></pre></div>
<a id="branchessafari601391branchSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Source/WebKit/win/ChangeLog (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebKit/win/ChangeLog        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Source/WebKit/win/ChangeLog        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2016-02-08  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
+        Merge r187245.
+
+    2015-07-23  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+            [Win] Implement High DPI support features
+            https://bugs.webkit.org/show_bug.cgi?id=146335
+            &lt;rdar://problem/21558269&gt;
+
+            Reviewed by Alex Christensen.
+
+            * WebCoreSupport/WebFrameLoaderClient.cpp:
+            (WebFrameLoaderClient::transitionToCommittedForNewPage): Size
+            page for current device scale factor.
+            * WebFrame.cpp:
+            (WebFrame::paintDocumentRectToContext): Account for device scale factor.
+            (WebFrame::paintScrollViewRectToContextAtPoint): Ditto.
+            * WebView.cpp:
+            (WebView::repaint): Adjust paint rect for device scale factor.
+            (WebView::scrollBackingStore): Adjust coordinates for scale factor.
+            (WebView::sizeChanged): Ditto.
+            (WebView::updateBackingStore): Ditto.
+            (WebView::paint): Ditto.
+            (WebView::paintIntoBackingStore): Ditto.
+            (WebView::handleContextMenuEvent): Ditto.
+            (WebView::gestureNotify): Ditto.
+            (WebView::gesture): Ditto.
+            (WebView::initializeToolTipWindow): Adjust max tool tip width
+            for device scale factor.
+            (WebView::selectionRect): Adjust coordinates for scale factor.
+            (WebView::elementAtPoint): Ditto.
+            (WebView::scrollOffset): Ditto.
+            (WebView::scrollBy): Ditto.
+            (WebView::visibleContentRect): Ditto.
+            (WebView::paintContents): Ditto.
+            * WebView.h:
+
</ins><span class="cx"> 2016-01-19  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge patch for rdar://problem/23025615.
</span></span></pre></div>
<a id="branchessafari601391branchSourceWebKitwinWebCoreSupportWebFrameLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -1017,11 +1017,13 @@
</span><span class="cx"> {
</span><span class="cx">     WebView* view = m_webFrame-&gt;webView();
</span><span class="cx"> 
</span><del>-    RECT rect;
-    view-&gt;frameRect(&amp;rect);
</del><ins>+    RECT pixelRect;
+    view-&gt;frameRect(&amp;pixelRect);
</ins><span class="cx">     bool transparent = view-&gt;transparent();
</span><span class="cx">     Color backgroundColor = transparent ? Color::transparent : Color::white;
</span><del>-    core(m_webFrame)-&gt;createView(IntRect(rect).size(), backgroundColor, transparent);
</del><ins>+    IntRect logicalFrame(pixelRect);
+    logicalFrame.scale(1.0f / view-&gt;deviceScaleFactor());
+    core(m_webFrame)-&gt;createView(logicalFrame.size(), backgroundColor, transparent);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebFrameLoaderClient::didSaveToPageCache()
</span></span></pre></div>
<a id="branchessafari601391branchSourceWebKitwinWebFramecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Source/WebKit/win/WebFrame.cpp (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebKit/win/WebFrame.cpp        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Source/WebKit/win/WebFrame.cpp        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -336,6 +336,8 @@
</span><span class="cx">     dirtyRect.setHeight(height);
</span><span class="cx">     gc.clip(dirtyRect);
</span><span class="cx">     gc.translate(-rect.left, -rect.top);
</span><ins>+    float scaleFactor = webView()-&gt;deviceScaleFactor();
+    gc.scale(WebCore::FloatSize(scaleFactor, scaleFactor));
</ins><span class="cx">     view-&gt;paintContents(&amp;gc, rect);
</span><span class="cx">     gc.restore();
</span><span class="cx"> 
</span><span class="lines">@@ -360,6 +362,8 @@
</span><span class="cx">     gc.save();
</span><span class="cx">     IntRect dirtyRect(rect);
</span><span class="cx">     dirtyRect.move(-pt.x, -pt.y);
</span><ins>+    float scaleFactor = webView()-&gt;deviceScaleFactor();
+    gc.scale(WebCore::FloatSize(scaleFactor, scaleFactor));
</ins><span class="cx">     view-&gt;paint(&amp;gc, dirtyRect);
</span><span class="cx">     gc.restore();
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601391branchSourceWebKitwinWebPreferencescpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Source/WebKit/win/WebPreferences.cpp (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebKit/win/WebPreferences.cpp        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Source/WebKit/win/WebPreferences.cpp        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -194,7 +194,7 @@
</span><span class="cx"> 
</span><span class="cx">     CFMutableDictionaryRef defaults = CFDictionaryCreateMutable(0, 0, &amp;kCFTypeDictionaryKeyCallBacks, &amp;kCFTypeDictionaryValueCallBacks);
</span><span class="cx"> 
</span><del>-    CFDictionaryAddValue(defaults, CFSTR(WebKitStandardFontPreferenceKey), CFSTR(&quot;Segoe UI&quot;));
</del><ins>+    CFDictionaryAddValue(defaults, CFSTR(WebKitStandardFontPreferenceKey), CFSTR(&quot;Times New Roman&quot;));
</ins><span class="cx">     CFDictionaryAddValue(defaults, CFSTR(WebKitFixedFontPreferenceKey), CFSTR(&quot;Courier New&quot;));
</span><span class="cx">     CFDictionaryAddValue(defaults, CFSTR(WebKitSerifFontPreferenceKey), CFSTR(&quot;Times New Roman&quot;));
</span><span class="cx">     CFDictionaryAddValue(defaults, CFSTR(WebKitSansSerifFontPreferenceKey), CFSTR(&quot;Arial&quot;));
</span></span></pre></div>
<a id="branchessafari601391branchSourceWebKitwinWebViewcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Source/WebKit/win/WebView.cpp (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebKit/win/WebView.cpp        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Source/WebKit/win/WebView.cpp        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -107,6 +107,7 @@
</span><span class="cx"> #include &lt;WebCore/FrameWin.h&gt;
</span><span class="cx"> #include &lt;WebCore/FullScreenController.h&gt;
</span><span class="cx"> #include &lt;WebCore/GDIObjectCounter.h&gt;
</span><ins>+#include &lt;WebCore/GDIUtilities.h&gt;
</ins><span class="cx"> #include &lt;WebCore/GeolocationController.h&gt;
</span><span class="cx"> #include &lt;WebCore/GeolocationError.h&gt;
</span><span class="cx"> #include &lt;WebCore/GraphicsContext.h&gt;
</span><span class="lines">@@ -363,6 +364,7 @@
</span><span class="cx"> 
</span><span class="cx"> const int WM_XP_THEMECHANGED = 0x031A;
</span><span class="cx"> const int WM_VISTA_MOUSEHWHEEL = 0x020E;
</span><ins>+const int WM_DPICHANGED = 0x02E0;
</ins><span class="cx"> 
</span><span class="cx"> static const int maxToolTipWidth = 250;
</span><span class="cx"> 
</span><span class="lines">@@ -821,8 +823,11 @@
</span><span class="cx">     return S_OK;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebView::repaint(const WebCore::IntRect&amp; windowRect, bool contentChanged, bool immediate, bool repaintContentOnly)
</del><ins>+void WebView::repaint(const WebCore::IntRect&amp; logicalWindowRect, bool contentChanged, bool immediate, bool repaintContentOnly)
</ins><span class="cx"> {
</span><ins>+    WebCore::IntRect windowRect(logicalWindowRect);
+    windowRect.scale(deviceScaleFactor());
+
</ins><span class="cx">     if (isAcceleratedCompositing()) {
</span><span class="cx">         // The contentChanged, immediate, and repaintContentOnly parameters are all based on a non-
</span><span class="cx">         // compositing painting/scrolling model.
</span><span class="lines">@@ -920,10 +925,19 @@
</span><span class="cx">         m_uiDelegatePrivate-&gt;webViewDidInvalidate(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebView::scrollBackingStore(FrameView* frameView, int dx, int dy, const IntRect&amp; scrollViewRect, const IntRect&amp; clipRect)
</del><ins>+void WebView::scrollBackingStore(FrameView* frameView, int logicalDx, int logicalDy, const IntRect&amp; logicalScrollViewRect, const IntRect&amp; logicalClipRect)
</ins><span class="cx"> {
</span><span class="cx">     m_needsDisplay = true;
</span><span class="cx"> 
</span><ins>+    // Dimensions passed to us from WebCore are in logical units. We must convert to pixels:
+    float scaleFactor = deviceScaleFactor();
+    int dx = clampTo&lt;int&gt;(scaleFactor * logicalDx);
+    int dy = clampTo&lt;int&gt;(scaleFactor * logicalDy);
+    IntRect scrollViewRect(logicalScrollViewRect);
+    scrollViewRect.scale(scaleFactor);
+    IntRect clipRect(logicalClipRect);
+    clipRect.scale(scaleFactor);
+
</ins><span class="cx">     if (isAcceleratedCompositing()) {
</span><span class="cx">         // FIXME: We should be doing something smarter here, like moving tiles around and painting
</span><span class="cx">         // any newly-exposed tiles. &lt;http://webkit.org/b/52714&gt;
</span><span class="lines">@@ -952,7 +966,7 @@
</span><span class="cx">     HWndDC windowDC(m_viewWindow);
</span><span class="cx">     auto bitmapDC = adoptGDIObject(::CreateCompatibleDC(windowDC));
</span><span class="cx">     HGDIOBJ oldBitmap = ::SelectObject(bitmapDC.get(), m_backingStoreBitmap-&gt;get());
</span><del>-    
</del><ins>+
</ins><span class="cx">     // Scroll the bitmap.
</span><span class="cx">     RECT scrollRectWin(scrollViewRect);
</span><span class="cx">     RECT clipRectWin(clipRect);
</span><span class="lines">@@ -982,8 +996,11 @@
</span><span class="cx"> 
</span><span class="cx">     deleteBackingStore();
</span><span class="cx"> 
</span><del>-    if (Frame* coreFrame = core(topLevelFrame()))
-        coreFrame-&gt;view()-&gt;resize(newSize);
</del><ins>+    if (Frame* coreFrame = core(topLevelFrame())) {
+        IntSize logicalSize = newSize;
+        logicalSize.scale(1.0f / deviceScaleFactor());
+        coreFrame-&gt;view()-&gt;resize(logicalSize);
+    }
</ins><span class="cx"> 
</span><span class="cx"> #if USE(CA)
</span><span class="cx">     if (m_layerTreeHost)
</span><span class="lines">@@ -999,6 +1016,16 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool WebView::dpiChanged(float, const WebCore::IntSize&amp; newSize)
+{
+    if (!IsProcessDPIAware())
+        return false;
+
+    sizeChanged(newSize);
+
+    return true;
+}
+
</ins><span class="cx"> // This emulates the Mac smarts for painting rects intelligently.  This is very
</span><span class="cx"> // important for us, since we double buffer based off dirty rects.
</span><span class="cx"> static void getUpdateRects(HRGN region, const IntRect&amp; dirtyRect, Vector&lt;IntRect&gt;&amp; rects)
</span><span class="lines">@@ -1199,7 +1226,7 @@
</span><span class="cx">         deleteBackingStoreSoon();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebView::paintIntoBackingStore(FrameView* frameView, HDC bitmapDC, const IntRect&amp; dirtyRect, WindowsToPaint windowsToPaint)
</del><ins>+void WebView::paintIntoBackingStore(FrameView* frameView, HDC bitmapDC, const IntRect&amp; dirtyRectPixels, WindowsToPaint windowsToPaint)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: This function should never be called in accelerated compositing mode, and we should
</span><span class="cx">     // assert as such. But currently it *is* sometimes called, so we can't assert yet. See
</span><span class="lines">@@ -1211,7 +1238,7 @@
</span><span class="cx">     // but it was being hit during our layout tests, and is being investigated in
</span><span class="cx">     // http://webkit.org/b/29350.
</span><span class="cx"> 
</span><del>-    RECT rect = dirtyRect;
</del><ins>+    RECT rect = dirtyRectPixels;
</ins><span class="cx"> 
</span><span class="cx"> #if FLASH_BACKING_STORE_REDRAW
</span><span class="cx">     {
</span><span class="lines">@@ -1220,15 +1247,21 @@
</span><span class="cx">         FillRect(dc, &amp;rect, yellowBrush.get());
</span><span class="cx">         GdiFlush();
</span><span class="cx">         Sleep(50);
</span><del>-        paintIntoWindow(bitmapDC, dc, dirtyRect);
</del><ins>+        paintIntoWindow(bitmapDC, dc, dirtyRectPixels);
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    float scaleFactor = deviceScaleFactor();
+    float inverseScaleFactor = 1.0f / scaleFactor;
+
+    IntRect logicalDirtyRect = dirtyRectPixels;
+    logicalDirtyRect.scale(inverseScaleFactor);
+
</ins><span class="cx">     GraphicsContext gc(bitmapDC, m_transparent);
</span><span class="cx">     gc.setShouldIncludeChildWindows(windowsToPaint == PaintWebViewAndChildren);
</span><span class="cx">     gc.save();
</span><span class="cx">     if (m_transparent)
</span><del>-        gc.clearRect(dirtyRect);
</del><ins>+        gc.clearRect(logicalDirtyRect);
</ins><span class="cx">     else
</span><span class="cx">         FillRect(bitmapDC, &amp;rect, (HBRUSH)GetStockObject(WHITE_BRUSH));
</span><span class="cx"> 
</span><span class="lines">@@ -1237,15 +1270,18 @@
</span><span class="cx">         uiPrivate-&gt;drawBackground(this, bitmapDC, &amp;rect);
</span><span class="cx"> 
</span><span class="cx">     if (frameView &amp;&amp; frameView-&gt;frame().contentRenderer()) {
</span><del>-        gc.clip(dirtyRect);
-        frameView-&gt;paint(&amp;gc, dirtyRect);
</del><ins>+        gc.save();
+        gc.scale(FloatSize(scaleFactor, scaleFactor));
+        gc.clip(logicalDirtyRect);
+        frameView-&gt;paint(&amp;gc, logicalDirtyRect);
+        gc.restore();
</ins><span class="cx">         if (m_shouldInvertColors)
</span><del>-            gc.fillRect(dirtyRect, Color::white, ColorSpaceDeviceRGB, CompositeDifference);
</del><ins>+            gc.fillRect(logicalDirtyRect, Color::white, ColorSpaceDeviceRGB, CompositeDifference);
</ins><span class="cx">     }
</span><span class="cx">     gc.restore();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebView::paintIntoWindow(HDC bitmapDC, HDC windowDC, const IntRect&amp; dirtyRect)
</del><ins>+void WebView::paintIntoWindow(HDC bitmapDC, HDC windowDC, const IntRect&amp; dirtyRectPixels)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: This function should never be called in accelerated compositing mode, and we should
</span><span class="cx">     // assert as such. But currently it *is* sometimes called, so we can't assert yet. See
</span><span class="lines">@@ -1254,7 +1290,7 @@
</span><span class="cx">     LOCAL_GDI_COUNTER(0, __FUNCTION__);
</span><span class="cx"> #if FLASH_WINDOW_REDRAW
</span><span class="cx">     auto greenBrush = adoptGDIObject(::CreateSolidBrush(RGB(0, 255, 0)));
</span><del>-    RECT rect = dirtyRect;
</del><ins>+    RECT rect = dirtyRectPixels;
</ins><span class="cx">     FillRect(windowDC, &amp;rect, greenBrush.get());
</span><span class="cx">     GdiFlush();
</span><span class="cx">     Sleep(50);
</span><span class="lines">@@ -1262,8 +1298,8 @@
</span><span class="cx"> 
</span><span class="cx">     // Blit the dirty rect from the backing store into the same position
</span><span class="cx">     // in the destination DC.
</span><del>-    BitBlt(windowDC, dirtyRect.x(), dirtyRect.y(), dirtyRect.width(), dirtyRect.height(), bitmapDC,
-           dirtyRect.x(), dirtyRect.y(), SRCCOPY);
</del><ins>+    BitBlt(windowDC, dirtyRectPixels.x(), dirtyRectPixels.y(), dirtyRectPixels.width(), dirtyRectPixels.height(), bitmapDC,
+        dirtyRectPixels.x(), dirtyRectPixels.y(), SRCCOPY);
</ins><span class="cx"> 
</span><span class="cx">     m_needsDisplay = false;
</span><span class="cx"> }
</span><span class="lines">@@ -1410,9 +1446,15 @@
</span><span class="cx"> 
</span><span class="cx">     lParam = MAKELPARAM(coords.x, coords.y);
</span><span class="cx"> 
</span><ins>+    // Convert coordinates to logical pixels
+    float scaleFactor = deviceScaleFactor();
+    float inverseScaleFactor = 1.0f / scaleFactor;
+    IntPoint logicalCoords(coords);
+    logicalCoords.scale(inverseScaleFactor, inverseScaleFactor);
+
</ins><span class="cx">     m_page-&gt;contextMenuController().clearContextMenu();
</span><span class="cx"> 
</span><del>-    IntPoint documentPoint(m_page-&gt;mainFrame().view()-&gt;windowToContents(coords));
</del><ins>+    IntPoint documentPoint(m_page-&gt;mainFrame().view()-&gt;windowToContents(logicalCoords));
</ins><span class="cx">     HitTestResult result = m_page-&gt;mainFrame().eventHandler().hitTestResultAtPoint(documentPoint);
</span><span class="cx">     Frame* targetFrame = result.innerNonSharedNode() ? result.innerNonSharedNode()-&gt;document().frame() : &amp;m_page-&gt;focusController().focusedOrMainFrame();
</span><span class="cx"> 
</span><span class="lines">@@ -1437,9 +1479,11 @@
</span><span class="cx">     if (!view)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    POINT point(view-&gt;contentsToWindow(contextMenuController.hitTestResult().roundedPointInInnerNodeFrame()));
</del><ins>+    IntPoint logicalPoint = view-&gt;contentsToWindow(contextMenuController.hitTestResult().roundedPointInInnerNodeFrame());
+    logicalPoint.scale(scaleFactor, scaleFactor);
</ins><span class="cx"> 
</span><span class="cx">     // Translate the point to screen coordinates
</span><ins>+    POINT point = logicalPoint;
</ins><span class="cx">     if (!::ClientToScreen(m_viewWindow, &amp;point))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -1632,6 +1676,12 @@
</span><span class="cx"> 
</span><span class="cx">     bool hitScrollbar = false;
</span><span class="cx">     POINT gestureBeginPoint = {gn-&gt;ptsLocation.x, gn-&gt;ptsLocation.y};
</span><ins>+
+    float scaleFactor = deviceScaleFactor();
+    float inverseScaleFactor = 1.0f / scaleFactor;
+    IntPoint logicalGestureBeginPoint(gestureBeginPoint);
+    logicalGestureBeginPoint.scale(inverseScaleFactor, inverseScaleFactor);
+
</ins><span class="cx">     HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::DisallowShadowContent);
</span><span class="cx">     for (Frame* childFrame = &amp;m_page-&gt;mainFrame(); childFrame; childFrame = EventHandler::subframeForTargetNode(m_gestureTargetNode.get())) {
</span><span class="cx">         FrameView* frameView = childFrame-&gt;view();
</span><span class="lines">@@ -1644,7 +1694,7 @@
</span><span class="cx">         if (!layer)
</span><span class="cx">             break;
</span><span class="cx"> 
</span><del>-        HitTestResult result(frameView-&gt;screenToContents(gestureBeginPoint));
</del><ins>+        HitTestResult result(frameView-&gt;screenToContents(logicalGestureBeginPoint));
</ins><span class="cx">         layer-&gt;hitTest(request, result);
</span><span class="cx">         m_gestureTargetNode = result.innerNode();
</span><span class="cx"> 
</span><span class="lines">@@ -1749,13 +1799,15 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         ScrollableArea* scrolledArea = 0;
</span><ins>+        float scaleFactor = deviceScaleFactor();
+        IntSize logicalScrollDelta(-deltaX * scaleFactor, -deltaY * scaleFactor);
</ins><span class="cx"> 
</span><span class="cx">         if (!m_gestureTargetNode || !m_gestureTargetNode-&gt;renderer()) {
</span><span class="cx">             // We might directly hit the document without hitting any nodes
</span><del>-            coreFrame-&gt;view()-&gt;scrollBy(IntSize(-deltaX, -deltaY));
</del><ins>+            coreFrame-&gt;view()-&gt;scrollBy(logicalScrollDelta);
</ins><span class="cx">             scrolledArea = coreFrame-&gt;view();
</span><span class="cx">         } else
</span><del>-            m_gestureTargetNode-&gt;renderer()-&gt;enclosingLayer()-&gt;enclosingScrollableLayer()-&gt;scrollByRecursively(IntSize(-deltaX, -deltaY), WebCore::RenderLayer::ScrollOffsetClamped, &amp;scrolledArea);
</del><ins>+            m_gestureTargetNode-&gt;renderer()-&gt;enclosingLayer()-&gt;enclosingScrollableLayer()-&gt;scrollByRecursively(logicalScrollDelta, WebCore::RenderLayer::ScrollOffsetClamped, &amp;scrolledArea);
</ins><span class="cx"> 
</span><span class="cx">         if (!(UpdatePanningFeedbackPtr() &amp;&amp; BeginPanningFeedbackPtr() &amp;&amp; EndPanningFeedbackPtr())) {
</span><span class="cx">             CloseGestureInfoHandlePtr()(gestureHandle);
</span><span class="lines">@@ -2194,7 +2246,11 @@
</span><span class="cx"> 
</span><span class="cx">     RECT windowRect = {0};
</span><span class="cx">     frameRect(&amp;windowRect);
</span><del>-    repaint(windowRect, true, true);
</del><ins>+
+    // repaint expects logical pixels, so rescale here.
+    IntRect logicalRect(windowRect);
+    logicalRect.scale(1.0f / deviceScaleFactor());
+    repaint(logicalRect, true, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool WebView::registerWebViewWindowClass()
</span><span class="lines">@@ -2337,6 +2393,9 @@
</span><span class="cx">             if (lParam != 0)
</span><span class="cx">                 webView-&gt;sizeChanged(IntSize(LOWORD(lParam), HIWORD(lParam)));
</span><span class="cx">             break;
</span><ins>+        case WM_DPICHANGED:
+            webView-&gt;dpiChanged(LOWORD(wParam), IntSize(LOWORD(lParam), HIWORD(lParam)));
+            break;
</ins><span class="cx">         case WM_SHOWWINDOW:
</span><span class="cx">             lResult = DefWindowProc(hWnd, message, wParam, lParam);
</span><span class="cx">             if (wParam == 0) {
</span><span class="lines">@@ -2904,7 +2963,7 @@
</span><span class="cx">     info.uId = reinterpret_cast&lt;UINT_PTR&gt;(m_viewWindow);
</span><span class="cx"> 
</span><span class="cx">     ::SendMessage(m_toolTipHwnd, TTM_ADDTOOL, 0, reinterpret_cast&lt;LPARAM&gt;(&amp;info));
</span><del>-    ::SendMessage(m_toolTipHwnd, TTM_SETMAXTIPWIDTH, 0, maxToolTipWidth);
</del><ins>+    ::SendMessage(m_toolTipHwnd, TTM_SETMAXTIPWIDTH, 0, clampTo&lt;int&gt;(maxToolTipWidth * deviceScaleFactor()));
</ins><span class="cx"> 
</span><span class="cx">     ::SetWindowPos(m_toolTipHwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
</span><span class="cx"> }
</span><span class="lines">@@ -3675,18 +3734,20 @@
</span><span class="cx">     return S_OK;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-HRESULT STDMETHODCALLTYPE WebView::selectionRect(RECT* rc)
</del><ins>+HRESULT WebView::selectionRect(RECT* rc)
</ins><span class="cx"> {
</span><span class="cx">     WebCore::Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
</span><span class="cx"> 
</span><span class="cx">     IntRect ir = enclosingIntRect(frame.selection().selectionBounds());
</span><span class="cx">     ir = frame.view()-&gt;convertToContainingWindow(ir);
</span><span class="cx">     ir.move(-frame.view()-&gt;scrollOffset().width(), -frame.view()-&gt;scrollOffset().height());
</span><del>-    rc-&gt;left = ir.x();
-    rc-&gt;top = ir.y();
-    rc-&gt;bottom = rc-&gt;top + ir.height();
-    rc-&gt;right = rc-&gt;left + ir.width();
</del><span class="cx"> 
</span><ins>+    float scaleFactor = deviceScaleFactor();
+    rc-&gt;left = ir.x() * scaleFactor;
+    rc-&gt;top = ir.y() * scaleFactor;
+    rc-&gt;bottom = rc-&gt;top + ir.height() * scaleFactor;
+    rc-&gt;right = rc-&gt;left + ir.width() * scaleFactor;
+
</ins><span class="cx">     return S_OK;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3762,9 +3823,7 @@
</span><span class="cx">     return S_OK;
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-HRESULT STDMETHODCALLTYPE WebView::elementAtPoint( 
-        /* [in] */ LPPOINT point,
-        /* [retval][out] */ IPropertyBag** elementDictionary)
</del><ins>+HRESULT WebView::elementAtPoint(LPPOINT point, IPropertyBag** elementDictionary)
</ins><span class="cx"> {
</span><span class="cx">     if (!elementDictionary) {
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="lines">@@ -3778,6 +3837,8 @@
</span><span class="cx">         return E_FAIL;
</span><span class="cx"> 
</span><span class="cx">     IntPoint webCorePoint = IntPoint(point-&gt;x, point-&gt;y);
</span><ins>+    float inverseScaleFactor = 1.0f / deviceScaleFactor();
+    webCorePoint.scale(inverseScaleFactor, inverseScaleFactor);
</ins><span class="cx">     HitTestResult result = HitTestResult(webCorePoint);
</span><span class="cx">     if (frame-&gt;contentRenderer())
</span><span class="cx">         result = frame-&gt;eventHandler().hitTestResultAtPoint(webCorePoint);
</span><span class="lines">@@ -5300,32 +5361,37 @@
</span><span class="cx">     return m_frameLoadDelegatePrivate.copyRefTo(d);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-HRESULT STDMETHODCALLTYPE WebView::scrollOffset( 
-    /* [retval][out] */ LPPOINT offset)
</del><ins>+HRESULT WebView::scrollOffset(LPPOINT offset)
</ins><span class="cx"> {
</span><span class="cx">     if (!offset)
</span><span class="cx">         return E_POINTER;
</span><span class="cx">     IntSize offsetIntSize = m_page-&gt;mainFrame().view()-&gt;scrollOffset();
</span><ins>+
+    offsetIntSize.scale(deviceScaleFactor());
+
</ins><span class="cx">     offset-&gt;x = offsetIntSize.width();
</span><span class="cx">     offset-&gt;y = offsetIntSize.height();
</span><span class="cx">     return S_OK;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-HRESULT STDMETHODCALLTYPE WebView::scrollBy( 
-    /* [in] */ LPPOINT offset)
</del><ins>+HRESULT WebView::scrollBy(LPPOINT offset)
</ins><span class="cx"> {
</span><span class="cx">     if (!offset)
</span><span class="cx">         return E_POINTER;
</span><del>-    m_page-&gt;mainFrame().view()-&gt;scrollBy(IntSize(offset-&gt;x, offset-&gt;y));
</del><ins>+
+    IntSize scrollDelta(offset-&gt;x, offset-&gt;y);
+    scrollDelta.scale(1.0f / deviceScaleFactor());
+    m_page-&gt;mainFrame().view()-&gt;scrollBy(scrollDelta);
</ins><span class="cx">     return S_OK;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-HRESULT STDMETHODCALLTYPE WebView::visibleContentRect( 
-    /* [retval][out] */ LPRECT rect)
</del><ins>+HRESULT WebView::visibleContentRect(LPRECT rect)
</ins><span class="cx"> {
</span><span class="cx">     if (!rect)
</span><span class="cx">         return E_POINTER;
</span><ins>+
</ins><span class="cx">     FloatRect visibleContent = m_page-&gt;mainFrame().view()-&gt;visibleContentRect();
</span><ins>+    visibleContent.scale(deviceScaleFactor());
</ins><span class="cx">     rect-&gt;left = (LONG) visibleContent.x();
</span><span class="cx">     rect-&gt;top = (LONG) visibleContent.y();
</span><span class="cx">     rect-&gt;right = (LONG) visibleContent.maxX();
</span><span class="lines">@@ -5680,6 +5746,8 @@
</span><span class="cx">         caret = targetFrame-&gt;editor().firstRectForRange(tempRange.get());
</span><span class="cx">     }
</span><span class="cx">     caret = targetFrame-&gt;view()-&gt;contentsToWindow(caret);
</span><ins>+    caret.scale(deviceScaleFactor());
+
</ins><span class="cx">     CANDIDATEFORM form;
</span><span class="cx">     form.dwIndex = 0;
</span><span class="cx">     form.dwStyle = CFS_EXCLUDE;
</span><span class="lines">@@ -5939,6 +6007,7 @@
</span><span class="cx">         caret = targetFrame-&gt;editor().firstRectForRange(tempRange.get());
</span><span class="cx">     }
</span><span class="cx">     caret = targetFrame-&gt;view()-&gt;contentsToWindow(caret);
</span><ins>+    caret.scale(deviceScaleFactor());
</ins><span class="cx">     charPos-&gt;pt.x = caret.x();
</span><span class="cx">     charPos-&gt;pt.y = caret.y();
</span><span class="cx">     ::ClientToScreen(m_viewWindow, &amp;charPos-&gt;pt);
</span><span class="lines">@@ -6644,7 +6713,6 @@
</span><span class="cx">             ::GetClientRect(m_viewWindow, &amp;clientRect);
</span><span class="cx">             m_backingLayer-&gt;setSize(IntRect(clientRect).size());
</span><span class="cx">             m_backingLayer-&gt;setNeedsDisplay();
</span><del>-
</del><span class="cx">             m_layerTreeHost-&gt;setRootChildLayer(PlatformCALayer::platformCALayer(m_backingLayer-&gt;platformLayer()));
</span><span class="cx"> 
</span><span class="cx">             // We aren't going to be using our backing store while we're in accelerated compositing
</span><span class="lines">@@ -6793,15 +6861,22 @@
</span><span class="cx">     flushPendingGraphicsLayerChangesSoon();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebView::paintContents(const GraphicsLayer*, GraphicsContext&amp; context, GraphicsLayerPaintingPhase, const FloatRect&amp; inClip)
</del><ins>+void WebView::paintContents(const GraphicsLayer*, GraphicsContext&amp; context, GraphicsLayerPaintingPhase, const FloatRect&amp; inClipPixels)
</ins><span class="cx"> {
</span><span class="cx">     Frame* frame = core(m_mainFrame);
</span><span class="cx">     if (!frame)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    float scaleFactor = deviceScaleFactor();
+    float inverseScaleFactor = 1.0f / scaleFactor;
+
+    FloatRect logicalClip = inClipPixels;
+    logicalClip.scale(inverseScaleFactor);
+
</ins><span class="cx">     context.save();
</span><del>-    context.clip(inClip);
-    frame-&gt;view()-&gt;paint(&amp;context, enclosingIntRect(inClip));
</del><ins>+    context.scale(FloatSize(scaleFactor, scaleFactor));
+    context.clip(logicalClip);
+    frame-&gt;view()-&gt;paint(&amp;context, enclosingIntRect(logicalClip));
</ins><span class="cx">     context.restore();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -7144,6 +7219,8 @@
</span><span class="cx">     IntRect rect = frame.editor().firstRectForRange(range.get());
</span><span class="cx">     resultIntRect = frame.view()-&gt;contentsToWindow(rect);
</span><span class="cx"> 
</span><ins>+    resultIntRect.scale(deviceScaleFactor());
+
</ins><span class="cx">     resultRect-&gt;left = resultIntRect.x();
</span><span class="cx">     resultRect-&gt;top = resultIntRect.y();
</span><span class="cx">     resultRect-&gt;right = resultIntRect.x() + resultIntRect.width();
</span><span class="lines">@@ -7195,12 +7272,6 @@
</span><span class="cx">     return S_OK;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static float scaleFactorFromWindow(HWND window)
-{
-    HWndDC dc(window);
-    return ::GetDeviceCaps(dc, LOGPIXELSX) / 96.0f;
-}
-
</del><span class="cx"> float WebView::deviceScaleFactor() const
</span><span class="cx"> {
</span><span class="cx">     if (m_customDeviceScaleFactor)
</span><span class="lines">@@ -7209,12 +7280,12 @@
</span><span class="cx">     // FIXME(146335): Should check for Windows 8.1 High DPI Features here first.
</span><span class="cx"> 
</span><span class="cx">     if (m_viewWindow)
</span><del>-        return scaleFactorFromWindow(m_viewWindow);
</del><ins>+        return WebCore::deviceScaleFactorForWindow(m_viewWindow);
</ins><span class="cx"> 
</span><span class="cx">     if (m_hostWindow)
</span><del>-        return scaleFactorFromWindow(m_hostWindow);
</del><ins>+        return WebCore::deviceScaleFactorForWindow(m_hostWindow);
</ins><span class="cx"> 
</span><del>-    return scaleFactorFromWindow(0);
</del><ins>+    return WebCore::deviceScaleFactorForWindow(nullptr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> HRESULT WebView::setCustomBackingScaleFactor(double customScaleFactor)
</span></span></pre></div>
<a id="branchessafari601391branchSourceWebKitwinWebViewh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Source/WebKit/win/WebView.h (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Source/WebKit/win/WebView.h        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Source/WebKit/win/WebView.h        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -988,6 +988,9 @@
</span><span class="cx">     /* [out, retval] */ RECT* resultRect);
</span><span class="cx"> 
</span><span class="cx">     HRESULT STDMETHODCALLTYPE selectedRangeForTesting(/* [out] */ UINT* location, /* [out] */ UINT* length);
</span><ins>+
+    float deviceScaleFactor() const;
+
</ins><span class="cx"> private:
</span><span class="cx">     void setZoomMultiplier(float multiplier, bool isTextOnly);
</span><span class="cx">     float zoomMultiplier(bool isTextOnly);
</span><span class="lines">@@ -1000,6 +1003,7 @@
</span><span class="cx">     bool active();
</span><span class="cx"> 
</span><span class="cx">     void sizeChanged(const WebCore::IntSize&amp;);
</span><ins>+    bool dpiChanged(float, const WebCore::IntSize&amp;);
</ins><span class="cx"> 
</span><span class="cx">     enum WindowsToPaint { PaintWebViewOnly, PaintWebViewAndChildren };
</span><span class="cx">     void paintIntoBackingStore(WebCore::FrameView*, HDC bitmapDC, const WebCore::IntRect&amp; dirtyRect, WindowsToPaint);
</span><span class="lines">@@ -1026,8 +1030,6 @@
</span><span class="cx">     bool m_shouldInvertColors;
</span><span class="cx">     void setShouldInvertColors(bool);
</span><span class="cx"> 
</span><del>-    float deviceScaleFactor() const;
-
</del><span class="cx"> protected:
</span><span class="cx">     static bool registerWebViewWindowClass();
</span><span class="cx">     static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
</span></span></pre></div>
<a id="branchessafari601391branchToolsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Tools/ChangeLog (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Tools/ChangeLog        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Tools/ChangeLog        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2016-02-08  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
+        Merge r187245.
+
+    2015-07-23  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+            [Win] Implement proper High DPI support features
+            https://bugs.webkit.org/show_bug.cgi?id=146335
+            &lt;rdar://problem/21558269&gt;
+
+            Reviewed by Alex Christensen.
+
+            Update WinLauncher to take device scaling factor into account.
+
+            * WinLauncher/Common.cpp:
+            (resizeSubViews): Make sure toolbars and URL bar are properly sized and using
+            a valid font.
+            (computeFullDesktopFrame): Handle high DPI desktops.
+            (WndProc): Make comments more precise.
+            * WinLauncher/WinLauncher.cpp:
+            (WinLauncher::init): Determine device scale factor at launch.
+            (WinLauncher::updateDeviceScaleFactor): Added.
+            * WinLauncher/WinLauncher.h:
+            * WinLauncher/WinLauncherWebHost.h: Use C++11 initialization.
+            * WinLauncher/WinMain.cpp: Size interface based on scaling factor.
+            (wWinMain): Ditto.
+            * win/DLLLauncher/DLLLauncherMain.cpp:
+            (wWinMain): Tell Windows we understand high DPI.
+
</ins><span class="cx"> 2015-10-27  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r191395. rdar://problem/22847057
</span></span></pre></div>
<a id="branchessafari601391branchToolsWinLauncherCommoncpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Tools/WinLauncher/Common.cpp (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Tools/WinLauncher/Common.cpp        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Tools/WinLauncher/Common.cpp        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -65,6 +65,10 @@
</span><span class="cx"> 
</span><span class="cx"> static const int maxHistorySize = 10;
</span><span class="cx"> 
</span><ins>+#ifndef WM_DPICHANGED
+#define WM_DPICHANGED 0x02E0
+#endif
+
</ins><span class="cx"> typedef _com_ptr_t&lt;_com_IIID&lt;IWebFrame, &amp;__uuidof(IWebFrame)&gt;&gt; IWebFramePtr;
</span><span class="cx"> typedef _com_ptr_t&lt;_com_IIID&lt;IWebMutableURLRequest, &amp;__uuidof(IWebMutableURLRequest)&gt;&gt; IWebMutableURLRequestPtr;
</span><span class="cx"> 
</span><span class="lines">@@ -72,6 +76,7 @@
</span><span class="cx"> HINSTANCE hInst;
</span><span class="cx"> HWND hMainWnd;
</span><span class="cx"> HWND hURLBarWnd;
</span><ins>+HGDIOBJ hURLFont;
</ins><span class="cx"> HWND hBackButtonWnd;
</span><span class="cx"> HWND hForwardButtonWnd;
</span><span class="cx"> HWND hCacheWnd;
</span><span class="lines">@@ -101,17 +106,29 @@
</span><span class="cx"> static void loadURL(BSTR urlBStr);
</span><span class="cx"> static void updateStatistics(HWND hDlg);
</span><span class="cx"> 
</span><ins>+namespace WebCore {
+float deviceScaleFactorForWindow(HWND);
+}
+
</ins><span class="cx"> static void resizeSubViews()
</span><span class="cx"> {
</span><span class="cx">     if (gWinLauncher-&gt;usesLayeredWebView() || !gViewWindow)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    float scaleFactor = WebCore::deviceScaleFactorForWindow(gViewWindow);
+
</ins><span class="cx">     RECT rcClient;
</span><span class="cx">     GetClientRect(hMainWnd, &amp;rcClient);
</span><del>-    MoveWindow(hBackButtonWnd, 0, 0, CONTROLBUTTON_WIDTH, URLBAR_HEIGHT, TRUE);
-    MoveWindow(hForwardButtonWnd, CONTROLBUTTON_WIDTH, 0, CONTROLBUTTON_WIDTH, URLBAR_HEIGHT, TRUE);
-    MoveWindow(hURLBarWnd, CONTROLBUTTON_WIDTH * 2, 0, rcClient.right, URLBAR_HEIGHT, TRUE);
-    MoveWindow(gViewWindow, 0, URLBAR_HEIGHT, rcClient.right, rcClient.bottom - URLBAR_HEIGHT, TRUE);
</del><ins>+
+    int height = scaleFactor * URLBAR_HEIGHT;
+    int width = scaleFactor * CONTROLBUTTON_WIDTH;
+
+    MoveWindow(hBackButtonWnd, 0, 0, width, height, TRUE);
+    MoveWindow(hForwardButtonWnd, width, 0, width, height, TRUE);
+    MoveWindow(hURLBarWnd, width * 2, 0, rcClient.right, height, TRUE);
+    MoveWindow(gViewWindow, 0, height, rcClient.right, rcClient.bottom - height, TRUE);
+
+    ::SendMessage(hURLBarWnd, static_cast&lt;UINT&gt;(WM_SETFONT), reinterpret_cast&lt;WPARAM&gt;(gWinLauncher-&gt;urlBarFont()), TRUE);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void subclassForLayeredWindow()
</span><span class="lines">@@ -132,10 +149,12 @@
</span><span class="cx">     if (!::SystemParametersInfo(SPI_GETWORKAREA, 0, static_cast&lt;void*&gt;(&amp;desktop), 0))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    float scaleFactor = WebCore::deviceScaleFactorForWindow(nullptr);
+
</ins><span class="cx">     s_windowPosition.x = 0;
</span><span class="cx">     s_windowPosition.y = 0;
</span><del>-    s_windowSize.cx = desktop.right - desktop.left;
-    s_windowSize.cy = desktop.bottom - desktop.top;
</del><ins>+    s_windowSize.cx = scaleFactor * (desktop.right - desktop.left);
+    s_windowSize.cy = scaleFactor * (desktop.bottom - desktop.top);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> BOOL WINAPI DllMain(HINSTANCE dllInstance, DWORD reason, LPVOID)
</span><span class="lines">@@ -421,13 +440,13 @@
</span><span class="cx">             // For testing our transparent window, we need a region to use as a handle for
</span><span class="cx">             // dragging. The right way to do this would be to query the web view to see what's
</span><span class="cx">             // under the mouse. However, for testing purposes we just use an arbitrary
</span><del>-            // 30 pixel band at the top of the view as an arbitrary gripping location.
</del><ins>+            // 30 logical pixel band at the top of the view as an arbitrary gripping location.
</ins><span class="cx">             //
</span><span class="cx">             // When we are within this bad, return HT_CAPTION to tell Windows we want to
</span><span class="cx">             // treat this region as if it were the title bar on a normal window.
</span><span class="cx">             int y = HIWORD(lParam);
</span><del>-
-            if ((y &gt; window.top) &amp;&amp; (y &lt; window.top + dragBarHeight))
</del><ins>+            float scaledDragBarHeightFactor = dragBarHeight * gWinLauncher-&gt;deviceScaleFactor();
+            if ((y &gt; window.top) &amp;&amp; (y &lt; window.top + scaledDragBarHeightFactor))
</ins><span class="cx">                 return HTCAPTION;
</span><span class="cx">         }
</span><span class="cx">         return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
</span><span class="lines">@@ -519,6 +538,10 @@
</span><span class="cx"> 
</span><span class="cx">         resizeSubViews();
</span><span class="cx">         break;
</span><ins>+    case WM_DPICHANGED:
+        if (gWinLauncher)
+            gWinLauncher-&gt;updateDeviceScaleFactor();
+        return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
</ins><span class="cx">     default:
</span><span class="cx">         return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
</span><span class="cx">     }
</span></span></pre></div>
<a id="branchessafari601391branchToolsWinLauncherWinLaunchercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinLauncher.cpp (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinLauncher.cpp        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinLauncher.cpp        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2008, 2013, 2014 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2008, 2013-2015 Apple Inc.  All rights reserved.
</ins><span class="cx">  * Copyright (C) 2009, 2011 Brent Fulgham.  All rights reserved.
</span><span class="cx">  * Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2013 Alex Christensen. All rights reserved.
</span><span class="lines">@@ -47,6 +47,10 @@
</span><span class="cx"> #include &lt;string&gt;
</span><span class="cx"> #include &lt;vector&gt;
</span><span class="cx"> 
</span><ins>+namespace WebCore {
+float deviceScaleFactorForWindow(HWND);
+}
+
</ins><span class="cx"> static const int maxHistorySize = 10;
</span><span class="cx"> 
</span><span class="cx"> typedef _com_ptr_t&lt;_com_IIID&lt;IWebMutableURLRequest, &amp;__uuidof(IWebMutableURLRequest)&gt;&gt; IWebMutableURLRequestPtr;
</span><span class="lines">@@ -61,6 +65,8 @@
</span><span class="cx"> 
</span><span class="cx"> HRESULT WinLauncher::init()
</span><span class="cx"> {
</span><ins>+    updateDeviceScaleFactor();
+
</ins><span class="cx">     HRESULT hr = WebKitCreateInstance(CLSID_WebView, 0, IID_IWebView, reinterpret_cast&lt;void**&gt;(&amp;m_webView.GetInterfacePtr()));
</span><span class="cx">     if (FAILED(hr))
</span><span class="cx">         return hr;
</span><span class="lines">@@ -478,3 +484,19 @@
</span><span class="cx"> 
</span><span class="cx">     webActions-&gt;zoomPageOut(nullptr);
</span><span class="cx"> }
</span><ins>+
+void WinLauncher::generateFontForScaleFactor(float scaleFactor)
+{
+    if (m_hURLBarFont)
+        ::DeleteObject(m_hURLBarFont);
+
+    m_hURLBarFont = ::CreateFont(scaleFactor * 18, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
+        OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, FF_DONTCARE, L&quot;Times New Roman&quot;);
+}
+
+
+void WinLauncher::updateDeviceScaleFactor()
+{
+    m_deviceScaleFactor = WebCore::deviceScaleFactorForWindow(m_hMainWnd);
+    generateFontForScaleFactor(m_deviceScaleFactor);
+}
</ins></span></pre></div>
<a id="branchessafari601391branchToolsWinLauncherWinLauncherh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinLauncher.h (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinLauncher.h        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinLauncher.h        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2014 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2014-2015 Apple Inc.  All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -90,7 +90,14 @@
</span><span class="cx">     void zoomIn();
</span><span class="cx">     void zoomOut();
</span><span class="cx"> 
</span><ins>+    float deviceScaleFactor() { return m_deviceScaleFactor; }
+    void updateDeviceScaleFactor();
+
+    HGDIOBJ urlBarFont() { return m_hURLBarFont; }
+
</ins><span class="cx"> private:
</span><ins>+    void generateFontForScaleFactor(float);
+
</ins><span class="cx">     std::vector&lt;IWebHistoryItemPtr&gt; m_historyItems;
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;PageLoadTestClient&gt; m_pageLoadTestClient;
</span><span class="lines">@@ -112,8 +119,10 @@
</span><span class="cx">     IWebCoreStatisticsPtr m_statistics;
</span><span class="cx">     IWebCachePtr m_webCache;
</span><span class="cx"> 
</span><del>-    HWND m_hMainWnd;
-    HWND m_hURLBarWnd;
</del><ins>+    HWND m_hMainWnd { nullptr };
+    HWND m_hURLBarWnd { nullptr };
+    HGDIOBJ m_hURLBarFont { nullptr };
</ins><span class="cx"> 
</span><ins>+    float m_deviceScaleFactor { 1.0f };
</ins><span class="cx">     bool m_useLayeredWebView;
</span><span class="cx"> };
</span></span></pre></div>
<a id="branchessafari601391branchToolsWinLauncherWinLauncherWebHosth"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinLauncherWebHost.h (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinLauncherWebHost.h        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinLauncherWebHost.h        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -76,7 +76,9 @@
</span><span class="cx">     HRESULT updateAddressBar(IWebView&amp;);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    HWND m_hURLBarWnd;
-    ULONG m_refCount;
-    WinLauncher* m_client;
</del><ins>+    HWND m_hURLBarWnd { 0 };
+    HGDIOBJ m_URLBarFont { 0 };
+    HGDIOBJ m_oldFont { 0 };
+    ULONG m_refCount { 0 };
+    WinLauncher* m_client { nullptr };
</ins><span class="cx"> };
</span></span></pre></div>
<a id="branchessafari601391branchToolsWinLauncherWinMaincpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinMain.cpp (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinMain.cpp        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Tools/WinLauncher/WinMain.cpp        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -31,6 +31,10 @@
</span><span class="cx"> #include &quot;WinLauncherWebHost.h&quot;
</span><span class="cx"> #include &quot;Common.cpp&quot;
</span><span class="cx"> 
</span><ins>+namespace WebCore {
+float deviceScaleFactorForWindow(HWND);
+}
+
</ins><span class="cx"> int WINAPI wWinMain(HINSTANCE, HINSTANCE, PWSTR, int nCmdShow)
</span><span class="cx"> {
</span><span class="cx"> #ifdef _CRTDBG_MAP_ALLOC
</span><span class="lines">@@ -65,10 +69,12 @@
</span><span class="cx">     // Init COM
</span><span class="cx">     OleInitialize(nullptr);
</span><span class="cx"> 
</span><ins>+    float scaleFactor = WebCore::deviceScaleFactorForWindow(nullptr);
+
</ins><span class="cx">     if (usesLayeredWebView) {
</span><span class="cx">         hURLBarWnd = CreateWindow(L&quot;EDIT&quot;, L&quot;Type URL Here&quot;,
</span><span class="cx">             WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOVSCROLL, 
</span><del>-            s_windowPosition.x, s_windowPosition.y + s_windowSize.cy, s_windowSize.cx, URLBAR_HEIGHT,
</del><ins>+            scaleFactor * s_windowPosition.x, scaleFactor * (s_windowPosition.y + s_windowSize.cy), scaleFactor * s_windowSize.cx, scaleFactor * URLBAR_HEIGHT,
</ins><span class="cx">             0, 0, hInst, 0);
</span><span class="cx">     } else {
</span><span class="cx">         hMainWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
</span><span class="lines">@@ -78,8 +84,8 @@
</span><span class="cx">             return FALSE;
</span><span class="cx"> 
</span><span class="cx">         hBackButtonWnd = CreateWindow(L&quot;BUTTON&quot;, L&quot;&lt;&quot;, WS_CHILD | WS_VISIBLE  | BS_TEXT, 0, 0, 0, 0, hMainWnd, 0, hInst, 0);
</span><del>-        hForwardButtonWnd = CreateWindow(L&quot;BUTTON&quot;, L&quot;&gt;&quot;, WS_CHILD | WS_VISIBLE  | BS_TEXT, CONTROLBUTTON_WIDTH, 0, 0, 0, hMainWnd, 0, hInst, 0);
-        hURLBarWnd = CreateWindow(L&quot;EDIT&quot;, 0, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOVSCROLL, CONTROLBUTTON_WIDTH * 2, 0, 0, 0, hMainWnd, 0, hInst, 0);
</del><ins>+        hForwardButtonWnd = CreateWindow(L&quot;BUTTON&quot;, L&quot;&gt;&quot;, WS_CHILD | WS_VISIBLE | BS_TEXT, scaleFactor * CONTROLBUTTON_WIDTH, 0, 0, 0, hMainWnd, 0, hInst, 0);
+        hURLBarWnd = CreateWindow(L&quot;EDIT&quot;, 0, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOVSCROLL, scaleFactor * CONTROLBUTTON_WIDTH * 2, 0, 0, 0, hMainWnd, 0, hInst, 0);
</ins><span class="cx"> 
</span><span class="cx">         ShowWindow(hMainWnd, nCmdShow);
</span><span class="cx">         UpdateWindow(hMainWnd);
</span><span class="lines">@@ -93,8 +99,12 @@
</span><span class="cx"> 
</span><span class="cx">     SetFocus(hURLBarWnd);
</span><span class="cx"> 
</span><del>-    RECT clientRect = { s_windowPosition.x, s_windowPosition.y, s_windowPosition.x + s_windowSize.cx, s_windowPosition.y + s_windowSize.cy };
</del><ins>+    RECT clientRect;
+    ::GetClientRect(hMainWnd, &amp;clientRect);
</ins><span class="cx"> 
</span><ins>+    if (usesLayeredWebView)
+        clientRect = { s_windowPosition.x, s_windowPosition.y, s_windowPosition.x + s_windowSize.cx, s_windowPosition.y + s_windowSize.cy };
+
</ins><span class="cx">     WinLauncherWebHost* webHost = nullptr;
</span><span class="cx"> 
</span><span class="cx">     IWebDownloadDelegatePtr downloadDelegate;
</span></span></pre></div>
<a id="branchessafari601391branchToolswinDLLLauncherDLLLauncherMaincpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.3.9.1-branch/Tools/win/DLLLauncher/DLLLauncherMain.cpp (196276 => 196277)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.3.9.1-branch/Tools/win/DLLLauncher/DLLLauncherMain.cpp        2016-02-08 23:14:47 UTC (rev 196276)
+++ branches/safari-601.3.9.1-branch/Tools/win/DLLLauncher/DLLLauncherMain.cpp        2016-02-08 23:15:18 UTC (rev 196277)
</span><span class="lines">@@ -193,6 +193,9 @@
</span><span class="cx">     _set_FMA3_enable(0);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    BOOL didIt = SetProcessDPIAware();
+    _ASSERT(didIt);
+
</ins><span class="cx"> #ifdef _CRTDBG_MAP_ALLOC
</span><span class="cx">     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
</span><span class="cx">     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
</span></span></pre>
</div>
</div>

</body>
</html>