<!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>[184466] releases/WebKitGTK/webkit-2.4/Source</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/184466">184466</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-18 05:39:57 -0700 (Mon, 18 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GTK] Add HighDPI support for non-accelerated compositing contents
https://bugs.webkit.org/show_bug.cgi?id=131562
Patch by Owen Taylor <otaylor@redhat.com> on 2014-05-29
Reviewed by Anders Carlsson.
Source/WebCore:
No new tests. This will be tested once we have the proper dependencies in the WebKit testing
JHBuild.
Adapted by Michael Kuhn for 2.4 branch.
* platform/cairo/WidgetBackingStore.h:
(WebCore::WidgetBackingStore::WidgetBackingStore): Accept a device scale argument.
* platform/cairo/WidgetBackingStoreCairo.cpp: Use the device scale argument to make the surface the proper size and set the surface device scale.
* platform/cairo/WidgetBackingStoreCairo.h: Accept a device scale argument.
* platform/graphics/cairo/CairoUtilities.cpp: Add a new helper to set the device scale if Cairo built against is new enough.
* platform/graphics/cairo/CairoUtilities.h:
* platform/gtk/GtkVersioning.h: Add the HAVE_GTK_SCALE_FACTOR macro.
* platform/gtk/WidgetBackingStoreGtkX11.cpp: Use the device scale argument to make the surface the proper size and set the surface device scale.
* platform/gtk/WidgetBackingStoreGtkX11.h: Accept a device scale argument.
Source/WebKit2:
Adapted by Michael Kuhn for 2.4 branch.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(deviceScaleFactorChanged): Added this callback to pass scale changes to the page proxy.
(webkitWebViewBaseCreateWebPage): Attach the callback to the notify signal.
* UIProcess/WebPageProxy.cpp:
* UIProcess/cairo/BackingStoreCairo.cpp:
(WebKit::WebPageProxy::setCustomDeviceScaleFactor): Do not set a custom device scale factor for cairo when it's not supported.
(WebKit::createBackingStoreForGTK): Pass the scale factor to the WebCore backing store.
(WebKit::BackingStore::incorporateUpdate): Ditto.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreplatformcairoWidgetBackingStoreh">releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/cairo/WidgetBackingStore.h</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreplatformcairoWidgetBackingStoreCairocpp">releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreplatformcairoWidgetBackingStoreCairoh">releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.h</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreplatformgraphicscairoCairoUtilitiescpp">releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreplatformgraphicscairoCairoUtilitiesh">releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/graphics/cairo/CairoUtilities.h</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreplatformgtkWidgetBackingStoreGtkX11cpp">releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreplatformgtkWidgetBackingStoreGtkX11h">releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.h</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebKitgtkWebCoreSupportChromeClientGtkcpp">releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebKitgtkWebCoreSupportChromeClientGtkh">releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebKitgtkwebkitwebkitwebviewcpp">releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/webkit/webkitwebview.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebKit2ChangeLog">releases/WebKitGTK/webkit-2.4/Source/WebKit2/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebKit2SharedcairoShareableBitmapCairocpp">releases/WebKitGTK/webkit-2.4/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp">releases/WebKitGTK/webkit-2.4/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebKit2UIProcessWebPageProxycpp">releases/WebKitGTK/webkit-2.4/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebKit2UIProcesscairoBackingStoreCairocpp">releases/WebKitGTK/webkit-2.4/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit24SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2014-05-29 Owen Taylor <otaylor@redhat.com>
+
+ [GTK] Add HighDPI support for non-accelerated compositing contents
+ https://bugs.webkit.org/show_bug.cgi?id=131562
+
+ Reviewed by Anders Carlsson.
+
+ No new tests. This will be tested once we have the proper dependencies in the WebKit testing
+ JHBuild.
+
+ Adapted by Michael Kuhn for 2.4 branch.
+
+ * platform/cairo/WidgetBackingStore.h:
+ (WebCore::WidgetBackingStore::WidgetBackingStore): Accept a device scale argument.
+ * platform/cairo/WidgetBackingStoreCairo.cpp: Use the device scale argument to make the surface the proper size and set the surface device scale.
+ * platform/cairo/WidgetBackingStoreCairo.h: Accept a device scale argument.
+ * platform/graphics/cairo/CairoUtilities.cpp: Add a new helper to set the device scale if Cairo built against is new enough.
+ * platform/graphics/cairo/CairoUtilities.h:
+ * platform/gtk/GtkVersioning.h: Add the HAVE_GTK_SCALE_FACTOR macro.
+ * platform/gtk/WidgetBackingStoreGtkX11.cpp: Use the device scale argument to make the surface the proper size and set the surface device scale.
+ * platform/gtk/WidgetBackingStoreGtkX11.h: Accept a device scale argument.
+
</ins><span class="cx"> 2015-05-03 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] API tests crashing on debug builds due to extra unref
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreplatformcairoWidgetBackingStoreh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/cairo/WidgetBackingStore.h (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/cairo/WidgetBackingStore.h        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/cairo/WidgetBackingStore.h        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -49,11 +49,18 @@
</span><span class="cx"> virtual cairo_surface_t* cairoSurface() = 0;
</span><span class="cx"> virtual void scroll(const IntRect& scrollRect, const IntSize& scrollOffset) = 0;
</span><span class="cx"> const IntSize& size() { return m_size; }
</span><del>- WidgetBackingStore(const IntSize& size) : m_size(size) { }
</del><ins>+ float deviceScaleFactor() { return m_deviceScaleFactor; }
+
+ WidgetBackingStore(const IntSize& size, float deviceScaleFactor)
+ : m_size(size)
+ , m_deviceScaleFactor(deviceScaleFactor)
+ { }
+
</ins><span class="cx"> virtual ~WidgetBackingStore() { }
</span><span class="cx">
</span><del>-private:
</del><ins>+protected:
</ins><span class="cx"> IntSize m_size;
</span><ins>+ float m_deviceScaleFactor;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreplatformcairoWidgetBackingStoreCairocpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -26,8 +26,10 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-static PassRefPtr<cairo_surface_t> createSurfaceForBackingStore(PlatformWidget widget, const IntSize& size)
</del><ins>+static PassRefPtr<cairo_surface_t> createSurfaceForBackingStore(PlatformWidget widget, IntSize size, float deviceScaleFactor)
</ins><span class="cx"> {
</span><ins>+ size.scale(deviceScaleFactor);
+
</ins><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx"> return adoptRef(gdk_window_create_similar_surface(gtk_widget_get_window(widget), CAIRO_CONTENT_COLOR_ALPHA, size.width(), size.height()));
</span><span class="cx"> #else
</span><span class="lines">@@ -36,20 +38,20 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><del>-PassOwnPtr<WidgetBackingStore> WidgetBackingStoreCairo::create(PlatformWidget widget, const IntSize& size)
</del><ins>+PassOwnPtr<WidgetBackingStore> WidgetBackingStoreCairo::create(PlatformWidget widget, const IntSize& size, float deviceScaleFactor)
</ins><span class="cx"> {
</span><del>- return adoptPtr(new WidgetBackingStoreCairo(widget, size));
</del><ins>+ return adoptPtr(new WidgetBackingStoreCairo(widget, size, deviceScaleFactor));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // We keep two copies of the surface here, which will double the memory usage, but increase
</span><span class="cx"> // scrolling performance since we do not have to keep reallocating a memory region during
</span><span class="cx"> // quick scrolling requests.
</span><del>-WidgetBackingStoreCairo::WidgetBackingStoreCairo(PlatformWidget widget, const IntSize& size)
- : WidgetBackingStore(size)
- , m_surface(createSurfaceForBackingStore(widget, size))
- , m_scrollSurface(createSurfaceForBackingStore(widget, size))
-
</del><ins>+WidgetBackingStoreCairo::WidgetBackingStoreCairo(PlatformWidget widget, const IntSize& size, float deviceScaleFactor)
+ : WidgetBackingStore(size, deviceScaleFactor)
+ , m_surface(createSurfaceForBackingStore(widget, size, deviceScaleFactor))
+ , m_scrollSurface(createSurfaceForBackingStore(widget, size, deviceScaleFactor))
</ins><span class="cx"> {
</span><ins>+ cairoSurfaceSetDeviceScale(m_surface.get(), deviceScaleFactor, deviceScaleFactor);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> WidgetBackingStoreCairo::~WidgetBackingStoreCairo()
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreplatformcairoWidgetBackingStoreCairoh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.h (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.h        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.h        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -26,8 +26,8 @@
</span><span class="cx"> class WidgetBackingStoreCairo : public WidgetBackingStore {
</span><span class="cx">
</span><span class="cx"> public:
</span><del>- static PassOwnPtr<WidgetBackingStore> create(PlatformWidget, const IntSize&);
- WidgetBackingStoreCairo(PlatformWidget, const IntSize&);
</del><ins>+ static PassOwnPtr<WidgetBackingStore> create(PlatformWidget, const IntSize&, float deviceScaleFactor);
+ WidgetBackingStoreCairo(PlatformWidget, const IntSize&, float deviceScaleFactor);
</ins><span class="cx"> ~WidgetBackingStoreCairo();
</span><span class="cx"> cairo_surface_t* cairoSurface();
</span><span class="cx"> void scroll(const IntRect&, const IntSize&);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreplatformgraphicscairoCairoUtilitiescpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #include "Path.h"
</span><span class="cx"> #include "PlatformPathCairo.h"
</span><span class="cx"> #include "RefPtrCairo.h"
</span><ins>+#include <wtf/Assertions.h>
</ins><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx">
</span><span class="cx"> #if ENABLE(ACCELERATED_2D_CANVAS)
</span><span class="lines">@@ -259,4 +260,15 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void cairoSurfaceSetDeviceScale(cairo_surface_t* surface, double xScale, double yScale)
+{
+ // This function was added pretty much simultaneous to when 1.13 was branched.
+#if HAVE(CAIRO_SURFACE_SET_DEVICE_SCALE)
+ cairo_surface_set_device_scale(surface, xScale, yScale);
+#else
+ UNUSED_PARAM(surface);
+ ASSERT_UNUSED(xScale, 1 == xScale);
+ ASSERT_UNUSED(yScale, 1 == yScale);
+#endif
+}
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreplatformgraphicscairoCairoUtilitiesh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/graphics/cairo/CairoUtilities.h (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/graphics/cairo/CairoUtilities.h        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/graphics/cairo/CairoUtilities.h        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -31,6 +31,9 @@
</span><span class="cx"> #include "IntSize.h"
</span><span class="cx"> #include <cairo.h>
</span><span class="cx">
</span><ins>+// This function was added pretty much simultaneous to when 1.13 was branched.
+#define HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE CAIRO_VERSION_MAJOR > 1 || (CAIRO_VERSION_MAJOR == 1 && CAIRO_VERSION_MINOR >= 13)
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> class AffineTransform;
</span><span class="cx"> class Color;
</span><span class="lines">@@ -56,6 +59,7 @@
</span><span class="cx"> void copyRectFromOneSurfaceToAnother(cairo_surface_t* from, cairo_surface_t* to, const IntSize& offset, const IntRect&, const IntSize& = IntSize(), cairo_operator_t = CAIRO_OPERATOR_OVER);
</span><span class="cx">
</span><span class="cx"> IntSize cairoSurfaceSize(cairo_surface_t*);
</span><ins>+void cairoSurfaceSetDeviceScale(cairo_surface_t*, double xScale, double yScale);
</ins><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreplatformgtkWidgetBackingStoreGtkX11cpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.cpp (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.cpp        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.cpp        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(GTK) && PLATFORM(X11) && defined(GDK_WINDOWING_X11)
</span><span class="cx">
</span><ins>+#include "CairoUtilities.h"
</ins><span class="cx"> #include "GtkVersioning.h"
</span><span class="cx"> #include "RefPtrCairo.h"
</span><span class="cx"> #include <cairo-xlib.h>
</span><span class="lines">@@ -29,26 +30,28 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-PassOwnPtr<WidgetBackingStore> WidgetBackingStoreGtkX11::create(GtkWidget* widget, const IntSize& size)
</del><ins>+PassOwnPtr<WidgetBackingStore> WidgetBackingStoreGtkX11::create(GtkWidget* widget, const IntSize& size, float deviceScaleFactor)
</ins><span class="cx"> {
</span><del>- return adoptPtr(new WidgetBackingStoreGtkX11(widget, size));
</del><ins>+ return adoptPtr(new WidgetBackingStoreGtkX11(widget, size, deviceScaleFactor));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// We keep two copies of the surface here, which will double the memory usage, but increase
-// scrolling performance since we do not have to keep reallocating a memory region during
-// quick scrolling requests.
-WidgetBackingStoreGtkX11::WidgetBackingStoreGtkX11(GtkWidget* widget, const IntSize& size)
- : WidgetBackingStore(size)
</del><ins>+WidgetBackingStoreGtkX11::WidgetBackingStoreGtkX11(GtkWidget* widget, const IntSize& size, float deviceScaleFactor)
+ : WidgetBackingStore(size, deviceScaleFactor)
</ins><span class="cx"> {
</span><ins>+ IntSize scaledSize = size;
+ scaledSize.scale(deviceScaleFactor);
+
</ins><span class="cx"> GdkVisual* visual = gtk_widget_get_visual(widget);
</span><span class="cx"> GdkScreen* screen = gdk_visual_get_screen(visual);
</span><span class="cx"> m_display = GDK_SCREEN_XDISPLAY(screen);
</span><span class="cx"> m_pixmap = XCreatePixmap(m_display, GDK_WINDOW_XID(gdk_screen_get_root_window(screen)),
</span><del>- size.width(), size.height(), gdk_visual_get_depth(visual));
</del><ins>+ scaledSize.width(), scaledSize.height(), gdk_visual_get_depth(visual));
</ins><span class="cx"> m_gc = XCreateGC(m_display, m_pixmap, 0, 0);
</span><span class="cx">
</span><span class="cx"> m_surface = adoptRef(cairo_xlib_surface_create(m_display, m_pixmap,
</span><del>- GDK_VISUAL_XVISUAL(visual), size.width(), size.height()));
</del><ins>+ GDK_VISUAL_XVISUAL(visual), scaledSize.width(), scaledSize.height()));
+
+ cairoSurfaceSetDeviceScale(m_surface.get(), deviceScaleFactor, deviceScaleFactor);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> WidgetBackingStoreGtkX11::~WidgetBackingStoreGtkX11()
</span><span class="lines">@@ -72,9 +75,14 @@
</span><span class="cx"> if (targetRect.isEmpty())
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ targetRect.scale(m_deviceScaleFactor);
+
+ IntSize scaledScrollOffset = scrollOffset;
+ scaledScrollOffset.scale(m_deviceScaleFactor);
+
</ins><span class="cx"> cairo_surface_flush(m_surface.get());
</span><span class="cx"> XCopyArea(m_display, m_pixmap, m_pixmap, m_gc,
</span><del>- targetRect.x() - scrollOffset.width(), targetRect.y() - scrollOffset.height(),
</del><ins>+ targetRect.x() - scaledScrollOffset.width(), targetRect.y() - scaledScrollOffset.height(),
</ins><span class="cx"> targetRect.width(), targetRect.height(),
</span><span class="cx"> targetRect.x(), targetRect.y());
</span><span class="cx"> cairo_surface_mark_dirty_rectangle(m_surface.get(),
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreplatformgtkWidgetBackingStoreGtkX11h"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.h (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.h        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.h        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -29,8 +29,8 @@
</span><span class="cx"> class WidgetBackingStoreGtkX11 : public WidgetBackingStore {
</span><span class="cx">
</span><span class="cx"> public:
</span><del>- static PassOwnPtr<WidgetBackingStore> create(GtkWidget*, const IntSize&);
- WidgetBackingStoreGtkX11(GtkWidget*, const IntSize&);
</del><ins>+ static PassOwnPtr<WidgetBackingStore> create(GtkWidget*, const IntSize&, float deviceScaleFactor);
+ WidgetBackingStoreGtkX11(GtkWidget*, const IntSize&, float deviceScaleFactor);
</ins><span class="cx"> ~WidgetBackingStoreGtkX11();
</span><span class="cx"> cairo_surface_t* cairoSurface();
</span><span class="cx"> void scroll(const IntRect& scrollRect, const IntSize& scrollOffset);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebKitgtkWebCoreSupportChromeClientGtkcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "ChromeClientGtk.h"
</span><span class="cx">
</span><ins>+#include "CairoUtilities.h"
</ins><span class="cx"> #include "Chrome.h"
</span><span class="cx"> #include "Console.h"
</span><span class="cx"> #include "DumpRenderTreeSupportGtk.h"
</span><span class="lines">@@ -97,18 +98,27 @@
</span><span class="cx"> #endif
</span><span class="cx"> #include "WidgetBackingStoreCairo.h"
</span><span class="cx">
</span><ins>+#define HAVE_GTK_SCALE_FACTOR HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE && GTK_CHECK_VERSION(3, 10, 0)
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><del>-static PassOwnPtr<WidgetBackingStore> createBackingStore(GtkWidget* widget, const IntSize& size)
</del><ins>+static PassOwnPtr<WidgetBackingStore> createBackingStore(GtkWidget* widget, const IntSize& size, bool scale)
</ins><span class="cx"> {
</span><ins>+ float deviceScaleFactor = 1.0;
+
+#if HAVE(GTK_SCALE_FACTOR)
+ if (scale)
+ deviceScaleFactor = gtk_widget_get_scale_factor(widget);
+#endif
+
</ins><span class="cx"> #if PLATFORM(X11) && defined(GDK_WINDOWING_X11)
</span><span class="cx"> GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
</span><span class="cx"> if (GDK_IS_X11_DISPLAY(display))
</span><del>- return WebCore::WidgetBackingStoreGtkX11::create(widget, size);
</del><ins>+ return WebCore::WidgetBackingStoreGtkX11::create(widget, size, deviceScaleFactor);
</ins><span class="cx"> #endif
</span><del>- return WebCore::WidgetBackingStoreCairo::create(widget, size);
</del><ins>+ return WebCore::WidgetBackingStoreCairo::create(widget, size, deviceScaleFactor);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ChromeClient::ChromeClient(WebKitWebView* webView)
</span><span class="lines">@@ -483,7 +493,7 @@
</span><span class="cx"> || newSize.width() > backingStore->size().width()
</span><span class="cx"> || newSize.height() > backingStore->size().height()) {
</span><span class="cx">
</span><del>- OwnPtr<WidgetBackingStore> newBackingStore = createBackingStore(GTK_WIDGET(m_webView), newSize);
</del><ins>+ OwnPtr<WidgetBackingStore> newBackingStore = createBackingStore(GTK_WIDGET(m_webView), newSize, true);
</ins><span class="cx"> RefPtr<cairo_t> cr = adoptRef(cairo_create(newBackingStore->cairoSurface()));
</span><span class="cx">
</span><span class="cx"> clearEverywhereInBackingStore(m_webView, cr.get());
</span><span class="lines">@@ -518,6 +528,21 @@
</span><span class="cx"> m_repaintSoonSourceId = g_idle_add_full(G_PRIORITY_DEFAULT, reinterpret_cast<GSourceFunc>(repaintEverythingSoonTimeout), this, 0);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ChromeClient::deviceScaleFactorChanged()
+{
+#if HAVE(GTK_SCALE_FACTOR)
+ if (m_webView->priv->backingStore) {
+ int scaleFactor = gtk_widget_get_scale_factor(GTK_WIDGET(m_webView));
+ float oldScaleFactor = m_webView->priv->backingStore->deviceScaleFactor();
+
+ if (scaleFactor != oldScaleFactor) {
+ m_webView->priv->backingStore = 0;
+ widgetSizeChanged(IntSize(0, 0), getWebViewRect(m_webView).size());
+ }
+ }
+#endif
+}
+
</ins><span class="cx"> static void coalesceRectsIfPossible(const IntRect& clipRect, Vector<IntRect>& rects)
</span><span class="cx"> {
</span><span class="cx"> const unsigned int cRectThreshold = 10;
</span><span class="lines">@@ -553,7 +578,6 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<cairo_t> backingStoreContext = adoptRef(cairo_create(webView->priv->backingStore->cairoSurface()));
</span><span class="cx"> GraphicsContext gc(backingStoreContext.get());
</span><del>- gc.applyDeviceScaleFactor(frame->page()->deviceScaleFactor());
</del><span class="cx"> for (size_t i = 0; i < rects.size(); i++) {
</span><span class="cx"> const IntRect& rect = rects[i];
</span><span class="cx">
</span><span class="lines">@@ -1011,11 +1035,11 @@
</span><span class="cx">
</span><span class="cx"> if (turningOnCompositing) {
</span><span class="cx"> m_displayTimer.stop();
</span><del>- m_webView->priv->backingStore = createBackingStore(GTK_WIDGET(m_webView), IntSize(1, 1));
</del><ins>+ m_webView->priv->backingStore = createBackingStore(GTK_WIDGET(m_webView), IntSize(1, 1), false);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (turningOffCompositing) {
</span><del>- m_webView->priv->backingStore = createBackingStore(GTK_WIDGET(m_webView), getWebViewRect(m_webView).size());
</del><ins>+ m_webView->priv->backingStore = createBackingStore(GTK_WIDGET(m_webView), getWebViewRect(m_webView).size(), true);
</ins><span class="cx"> RefPtr<cairo_t> cr = adoptRef(cairo_create(m_webView->priv->backingStore->cairoSurface()));
</span><span class="cx"> clearEverywhereInBackingStore(m_webView, cr.get());
</span><span class="cx"> }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebKitgtkWebCoreSupportChromeClientGtkh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -156,6 +156,7 @@
</span><span class="cx"> void paint(Timer<ChromeClient>*);
</span><span class="cx"> void forcePaint();
</span><span class="cx"> void widgetSizeChanged(const IntSize& oldWidgetSize, IntSize newSize);
</span><ins>+ void deviceScaleFactorChanged();
</ins><span class="cx">
</span><span class="cx"> WebKitWebView* webView() { return m_webView; }
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebKitgtkwebkitwebkitwebviewcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/webkit/webkitwebview.cpp (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/webkit/webkitwebview.cpp        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/webkit/webkitwebview.cpp        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -130,6 +130,8 @@
</span><span class="cx"> #include <gdk/gdkwayland.h>
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#define HAVE_GTK_SCALE_FACTOR HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE && GTK_CHECK_VERSION(3, 10, 0)
+
</ins><span class="cx"> /**
</span><span class="cx"> * SECTION:webkitwebview
</span><span class="cx"> * @short_description: The central class of the WebKitGTK+ API
</span><span class="lines">@@ -281,6 +283,9 @@
</span><span class="cx"> static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GParamSpec* pspec, WebKitWebView* webView);
</span><span class="cx"> static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures);
</span><span class="cx"> static void webkitWebViewDirectionChanged(WebKitWebView*, GtkTextDirection previousDirection, gpointer);
</span><ins>+#if HAVE(GTK_SCALE_FACTOR)
+static void webkitWebViewNotifyScaleFactor(WebKitWebView* webView, GParamSpec *pspec, gpointer);
+#endif
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx"> static void PopupMenuPositionFunc(GtkMenu* menu, gint *x, gint *y, gboolean *pushIn, gpointer userData)
</span><span class="lines">@@ -3851,6 +3856,10 @@
</span><span class="cx"> // time of writing this comment), we simply set all the pages to the same group.
</span><span class="cx"> priv->corePage->setGroupName(webkitPageGroupName());
</span><span class="cx">
</span><ins>+#if HAVE(GTK_SCALE_FACTOR)
+ priv->corePage->setDeviceScaleFactor(gtk_widget_get_scale_factor(GTK_WIDGET(webView)));
+#endif
+
</ins><span class="cx"> // We also add a simple wrapper class to provide the public
</span><span class="cx"> // interface for the Web Inspector.
</span><span class="cx"> priv->webInspector = adoptGRef(WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL)));
</span><span class="lines">@@ -3890,6 +3899,10 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> g_signal_connect(webView, "direction-changed", G_CALLBACK(webkitWebViewDirectionChanged), 0);
</span><ins>+
+#if HAVE(GTK_SCALE_FACTOR)
+ g_signal_connect(webView, "notify::scale-factor", G_CALLBACK(webkitWebViewNotifyScaleFactor), 0);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GtkWidget* webkit_web_view_new(void)
</span><span class="lines">@@ -5555,6 +5568,18 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if HAVE(GTK_SCALE_FACTOR)
+void webkitWebViewNotifyScaleFactor(WebKitWebView* webView, GParamSpec* pspec, gpointer)
+{
+ Page* page = core(webView);
+
+ page->setDeviceScaleFactor(gtk_widget_get_scale_factor(GTK_WIDGET(webView)));
+
+ WebKit::ChromeClient& chromeClient = static_cast<WebKit::ChromeClient&>(page->chrome().client());
+ chromeClient.deviceScaleFactorChanged();
+}
+#endif
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="cx"> WebCore::Page* core(WebKitWebView* webView)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit2/ChangeLog (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebKit2/ChangeLog        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit2/ChangeLog        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-05-29 Owen Taylor <otaylor@redhat.com>
+
+ [GTK] Add HighDPI support for non-accelerated compositing contents
+ https://bugs.webkit.org/show_bug.cgi?id=131562
+
+ Reviewed by Anders Carlsson.
+
+ Adapted by Michael Kuhn for 2.4 branch.
+
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (deviceScaleFactorChanged): Added this callback to pass scale changes to the page proxy.
+ (webkitWebViewBaseCreateWebPage): Attach the callback to the notify signal.
+ * UIProcess/WebPageProxy.cpp:
+ * UIProcess/cairo/BackingStoreCairo.cpp:
+ (WebKit::WebPageProxy::setCustomDeviceScaleFactor): Do not set a custom device scale factor for cairo when it's not supported.
+ (WebKit::createBackingStoreForGTK): Pass the scale factor to the WebCore backing store.
+ (WebKit::BackingStore::incorporateUpdate): Ditto.
+
</ins><span class="cx"> 2014-11-19 Michael Catanzaro <mcatanzaro@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Error in documentation of webkit_print_operation_get_page_setup()
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebKit2SharedcairoShareableBitmapCairocpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -60,19 +60,16 @@
</span><span class="cx">
</span><span class="cx"> void ShareableBitmap::paint(GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect)
</span><span class="cx"> {
</span><del>- RefPtr<cairo_surface_t> surface = createSurfaceFromData(data(), m_size);
- FloatRect destRect(dstPoint, srcRect.size());
- context.platformContext()->drawSurfaceToContext(surface.get(), destRect, srcRect, &context);
</del><ins>+ paint(context, 1, dstPoint, srcRect);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ShareableBitmap::paint(GraphicsContext& context, float scaleFactor, const IntPoint& dstPoint, const IntRect& srcRect)
</span><span class="cx"> {
</span><del>- if (scaleFactor != 1) {
- // See <https://bugs.webkit.org/show_bug.cgi?id=64665>.
- notImplemented();
- return;
- }
- paint(context, dstPoint, srcRect);
</del><ins>+ RefPtr<cairo_surface_t> surface = createSurfaceFromData(data(), m_size);
+ FloatRect destRect(dstPoint, srcRect.size());
+ FloatRect srcRectScaled(srcRect);
+ srcRectScaled.scale(scaleFactor);
+ context.platformContext()->drawSurfaceToContext(surface.get(), destRect, srcRectScaled, &context);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PassRefPtr<cairo_surface_t> ShareableBitmap::createCairoSurface()
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> #include "WebPageProxy.h"
</span><span class="cx"> #include "WebPreferences.h"
</span><span class="cx"> #include "WebViewBaseInputMethodFilter.h"
</span><ins>+#include <WebCore/CairoUtilities.h>
</ins><span class="cx"> #include <WebCore/ClipboardUtilitiesGtk.h>
</span><span class="cx"> #include <WebCore/DataObjectGtk.h>
</span><span class="cx"> #include <WebCore/DragData.h>
</span><span class="lines">@@ -77,6 +78,10 @@
</span><span class="cx"> #include <WebCore/RedirectedXCompositeWindow.h>
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+// gtk_widget_get_scale_factor() appeared in GTK 3.10, but we also need
+// to make sure we have cairo new enough to support cairo_surface_set_device_scale
+#define HAVE_GTK_SCALE_FACTOR HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE && GTK_CHECK_VERSION(3, 10, 0)
+
</ins><span class="cx"> using namespace WebKit;
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="lines">@@ -980,6 +985,13 @@
</span><span class="cx"> priv->pageProxy->pageGroup().preferences()->setAcceleratedCompositingEnabled(false);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if HAVE(GTK_SCALE_FACTOR)
+static void deviceScaleFactorChanged(WebKitWebViewBase* webkitWebViewBase)
+{
+ webkitWebViewBase->priv->pageProxy->setIntrinsicDeviceScaleFactor(gtk_widget_get_scale_factor(GTK_WIDGET(webkitWebViewBase)));
+}
+#endif // HAVE(GTK_SCALE_FACTOR)
+
</ins><span class="cx"> void webkitWebViewBaseCreateWebPage(WebKitWebViewBase* webkitWebViewBase, WebContext* context, WebPageGroup* pageGroup, WebPageProxy* relatedPage)
</span><span class="cx"> {
</span><span class="cx"> WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
</span><span class="lines">@@ -995,6 +1007,12 @@
</span><span class="cx"> priv->pageProxy->setAcceleratedCompositingWindowId(priv->redirectedWindow->windowId());
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if HAVE(GTK_SCALE_FACTOR)
+ // We attach this here, because changes in scale factor are passed directly to the page proxy.
+ priv->pageProxy->setIntrinsicDeviceScaleFactor(gtk_widget_get_scale_factor(GTK_WIDGET(webkitWebViewBase)));
+ g_signal_connect(webkitWebViewBase, "notify::scale-factor", G_CALLBACK(deviceScaleFactorChanged), nullptr);
+#endif
+
</ins><span class="cx"> webkitWebViewBaseUpdatePreferences(webkitWebViewBase);
</span><span class="cx">
</span><span class="cx"> // This must happen here instead of the instance initializer, because the input method
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit2/UIProcess/WebPageProxy.cpp (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -129,6 +129,10 @@
</span><span class="cx"> #include "ViewSnapshotStore.h"
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if USE(CAIRO)
+#include <WebCore/CairoUtilities.h>
+#endif
+
</ins><span class="cx"> // This controls what strategy we use for mouse wheel coalescing.
</span><span class="cx"> #define MERGE_WHEEL_EVENTS 1
</span><span class="cx">
</span><span class="lines">@@ -1630,6 +1634,12 @@
</span><span class="cx"> if (!isValid())
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ // FIXME: Remove this once we bump cairo requirements to support HiDPI.
+ // https://bugs.webkit.org/show_bug.cgi?id=133378
+#if USE(CAIRO) && !HAVE(CAIRO_SURFACE_SET_DEVICE_SCALE)
+ return;
+#endif
+
</ins><span class="cx"> if (m_customDeviceScaleFactor == customScaleFactor)
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebKit2UIProcesscairoBackingStoreCairocpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp (184465 => 184466)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp        2015-05-18 12:23:14 UTC (rev 184465)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp        2015-05-18 12:39:57 UTC (rev 184466)
</span><span class="lines">@@ -48,14 +48,14 @@
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(GTK)
</span><del>-static OwnPtr<WidgetBackingStore> createBackingStoreForGTK(GtkWidget* widget, const IntSize& size)
</del><ins>+static OwnPtr<WidgetBackingStore> createBackingStoreForGTK(GtkWidget* widget, const IntSize& size, float deviceScaleFactor)
</ins><span class="cx"> {
</span><span class="cx"> #if PLATFORM(X11) && defined(GDK_WINDOWING_X11)
</span><span class="cx"> GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
</span><span class="cx"> if (GDK_IS_X11_DISPLAY(display))
</span><del>- return WebCore::WidgetBackingStoreGtkX11::create(widget, size);
</del><ins>+ return WebCore::WidgetBackingStoreGtkX11::create(widget, size, deviceScaleFactor);
</ins><span class="cx"> #endif
</span><del>- return WebCore::WidgetBackingStoreCairo::create(widget, size);
</del><ins>+ return WebCore::WidgetBackingStoreCairo::create(widget, size, deviceScaleFactor);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -73,9 +73,9 @@
</span><span class="cx"> {
</span><span class="cx"> if (!m_backingStore)
</span><span class="cx"> #if PLATFORM(EFL)
</span><del>- m_backingStore = WidgetBackingStoreCairo::create(EwkView::toEvasObject(toAPI(m_webPageProxy)), size());
</del><ins>+ m_backingStore = WidgetBackingStoreCairo::create(EwkView::toEvasObject(toAPI(m_webPageProxy)), size(), deviceScaleFactor());
</ins><span class="cx"> #else
</span><del>- m_backingStore = createBackingStoreForGTK(m_webPageProxy->viewWidget(), size());
</del><ins>+ m_backingStore = createBackingStoreForGTK(m_webPageProxy->viewWidget(), size(), deviceScaleFactor());
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> scroll(updateInfo.scrollRect, updateInfo.scrollOffset);
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx"> IntRect updateRect = updateInfo.updateRects[i];
</span><span class="cx"> IntRect srcRect = updateRect;
</span><span class="cx"> srcRect.move(-updateRectLocation.x(), -updateRectLocation.y());
</span><del>- bitmap->paint(graphicsContext, updateRect.location(), srcRect);
</del><ins>+ bitmap->paint(graphicsContext, deviceScaleFactor(), updateRect.location(), srcRect);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>