<!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>[169445] trunk/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/169445">169445</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-05-29 08:10:54 -0700 (Thu, 29 May 2014)</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.
* 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:
* 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="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformcairoWidgetBackingStoreh">trunk/Source/WebCore/platform/cairo/WidgetBackingStore.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcairoWidgetBackingStoreCairocpp">trunk/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformcairoWidgetBackingStoreCairoh">trunk/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscairoCairoUtilitiescpp">trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscairoCairoUtilitiesh">trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkWidgetBackingStoreGtkX11cpp">trunk/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkWidgetBackingStoreGtkX11h">trunk/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcesscairoBackingStoreCairocpp">trunk/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169444 => 169445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-29 10:33:02 UTC (rev 169444)
+++ trunk/Source/WebCore/ChangeLog        2014-05-29 15:10:54 UTC (rev 169445)
</span><span class="lines">@@ -1,3 +1,23 @@
</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.
+
+ * 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"> 2014-05-28 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> Captions during HLS playback flash/are difficult to readily
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcairoWidgetBackingStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cairo/WidgetBackingStore.h (169444 => 169445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cairo/WidgetBackingStore.h        2014-05-29 10:33:02 UTC (rev 169444)
+++ trunk/Source/WebCore/platform/cairo/WidgetBackingStore.h        2014-05-29 15:10:54 UTC (rev 169445)
</span><span class="lines">@@ -49,11 +49,17 @@
</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>+
+ 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="trunkSourceWebCoreplatformcairoWidgetBackingStoreCairocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp (169444 => 169445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp        2014-05-29 10:33:02 UTC (rev 169444)
+++ trunk/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp        2014-05-29 15:10:54 UTC (rev 169445)
</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="trunkSourceWebCoreplatformcairoWidgetBackingStoreCairoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.h (169444 => 169445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.h        2014-05-29 10:33:02 UTC (rev 169444)
+++ trunk/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.h        2014-05-29 15:10:54 UTC (rev 169445)
</span><span class="lines">@@ -27,8 +27,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="trunkSourceWebCoreplatformgraphicscairoCairoUtilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp (169444 => 169445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp        2014-05-29 10:33:02 UTC (rev 169444)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp        2014-05-29 15:10:54 UTC (rev 169445)
</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">@@ -282,4 +283,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="trunkSourceWebCoreplatformgraphicscairoCairoUtilitiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h (169444 => 169445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h        2014-05-29 10:33:02 UTC (rev 169444)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h        2014-05-29 15:10:54 UTC (rev 169445)
</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">@@ -57,6 +60,7 @@
</span><span class="cx">
</span><span class="cx"> IntSize cairoSurfaceSize(cairo_surface_t*);
</span><span class="cx"> void flipImageSurfaceVertically(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="trunkSourceWebCoreplatformgtkWidgetBackingStoreGtkX11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.cpp (169444 => 169445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.cpp        2014-05-29 10:33:02 UTC (rev 169444)
+++ trunk/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.cpp        2014-05-29 15:10:54 UTC (rev 169445)
</span><span class="lines">@@ -19,6 +19,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "WidgetBackingStoreGtkX11.h"
</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">@@ -27,23 +28,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>-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">@@ -67,9 +73,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="trunkSourceWebCoreplatformgtkWidgetBackingStoreGtkX11h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.h (169444 => 169445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.h        2014-05-29 10:33:02 UTC (rev 169444)
+++ trunk/Source/WebCore/platform/gtk/WidgetBackingStoreGtkX11.h        2014-05-29 15:10:54 UTC (rev 169445)
</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="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (169444 => 169445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-29 10:33:02 UTC (rev 169444)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-29 15:10:54 UTC (rev 169445)
</span><span class="lines">@@ -1,3 +1,20 @@
</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.
+
+ * 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-05-28 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Use GMainLoopSource for idle and timeout sources in WebKit2
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (169444 => 169445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2014-05-29 10:33:02 UTC (rev 169444)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2014-05-29 15:10:54 UTC (rev 169445)
</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">@@ -78,6 +79,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">@@ -965,6 +970,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">@@ -980,6 +992,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="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (169444 => 169445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-05-29 10:33:02 UTC (rev 169444)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-05-29 15:10:54 UTC (rev 169445)
</span><span class="lines">@@ -139,6 +139,10 @@
</span><span class="cx"> #include "WebVideoFullscreenManagerProxyMessages.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">@@ -1845,6 +1849,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="trunkSourceWebKit2UIProcesscairoBackingStoreCairocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp (169444 => 169445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp        2014-05-29 10:33:02 UTC (rev 169444)
+++ trunk/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp        2014-05-29 15:10:54 UTC (rev 169445)
</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>