<!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>[183731] 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/183731">183731</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-03 08:20:34 -0700 (Sun, 03 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK][EFL] Unify platform display handling
https://bugs.webkit.org/show_bug.cgi?id=144517

Reviewed by Martin Robinson.

Source/WebCore:

There are several places were we are handling the X display
connection:

- GLContext::sharedX11Display() creates a new connection.
- X11Helper::nativeDisplay() creates a new connection.
- BackingStoreBackendCairoX11 uses the GTK+ shared connection.
- NetscapePlugin::x11HostDisplay() uses the GTK+/ecore shared connection
- The rest of the GTK+ code uses the shared GTK+ connection

And then we also have WaylandDisplay and the code to check if the
current display is wayland or X11.
We could unify all these to share the same connection to reduce
the amount of ifdefs and ensure a single connection. That will
also allow us to use &quot;smart pointers&quot; for the X resources that
need a Display* to be freed.

* PlatformEfl.cmake: Add new files to compilation.
* PlatformGTK.cmake: Move some files to WebCore_SOURCES sinc ethey
don't use GTK+ anymore, and add new files to compilation.
* platform/graphics/GLContext.cpp:
(WebCore::GLContext::cleanupActiveContextsAtExit): Remove the
custom X11 connection.
(WebCore::GLContext::createContextForWindow): Check if the shared
display is Wayland to create a EGL context in such case.
* platform/graphics/PlatformDisplay.cpp: Added.
(WebCore::PlatformDisplay::createPlatformDisplay): Creates the
shared display, using the GTK+/ecore shared connection.
(WebCore::PlatformDisplay::sharedDisplay): Return the shared display.
* platform/graphics/PlatformDisplay.h: Added.
* platform/graphics/egl/GLContextEGL.cpp:
(WebCore::sharedEGLDisplay): Use PlatformDisplay::sharedDisplay()
to get the native display.
(WebCore::GLContextEGL::createPixmapContext): Ditto.
* platform/graphics/glx/GLContextGLX.cpp:
(WebCore::GLContextGLX::createWindowContext): Ditto.
(WebCore::GLContextGLX::createPbufferContext): Ditto.
(WebCore::GLContextGLX::createPixmapContext): Ditto.
(WebCore::GLContextGLX::createContext): Ditto.
(WebCore::GLContextGLX::~GLContextGLX): Ditto.
(WebCore::GLContextGLX::defaultFrameBufferSize): Ditto.
(WebCore::GLContextGLX::makeContextCurrent): Ditto.
(WebCore::GLContextGLX::swapBuffers): Ditto.
(WebCore::GLContextGLX::cairoDevice): Ditto.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): Ditto.
* platform/graphics/surfaces/glx/X11Helper.cpp:
(WebCore::X11Helper::nativeDisplay): Ditto.
* platform/graphics/wayland/PlatformDisplayWayland.cpp: Renamed from Source/WebCore/platform/graphics/wayland/WaylandDisplay.cpp.
(WebCore::PlatformDisplayWayland::globalCallback):
(WebCore::PlatformDisplayWayland::globalRemoveCallback):
(WebCore::PlatformDisplayWayland::create): Renamed instance() as
create() since the single instance is now handled by PlatformDisplay.
(WebCore::PlatformDisplayWayland::PlatformDisplayWayland):
(WebCore::PlatformDisplayWayland::createSurface):
(WebCore::PlatformDisplayWayland::createSharingGLContext):
* platform/graphics/wayland/PlatformDisplayWayland.h: Renamed from Source/WebCore/platform/graphics/wayland/WaylandDisplay.h.
* platform/graphics/x11/PlatformDisplayX11.cpp: Added.
(WebCore::PlatformDisplayX11::PlatformDisplayX11):
(WebCore::PlatformDisplayX11::~PlatformDisplayX11):
* platform/graphics/x11/PlatformDisplayX11.h: Added.
* platform/gtk/GtkUtilities.cpp:
(WebCore::getDisplaySystemType): Deleted.
* platform/gtk/GtkUtilities.h:

Source/WebKit2:

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseRealize): Use PlatformDisplay::sharedDisplay()
to checkt the display type.
(webkitWebViewBaseCreateWebPage): Ditto.
* UIProcess/cairo/BackingStoreCairo.cpp:
(WebKit::BackingStore::createBackend): Pass the native X11 shared
display to BackingStoreBackendCairoX11.
* WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
(WebKit::NetscapePlugin::x11HostDisplay): Return the native X11
shared display.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePlatformEflcmake">trunk/Source/WebCore/PlatformEfl.cmake</a></li>
<li><a href="#trunkSourceWebCorePlatformGTKcmake">trunk/Source/WebCore/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGLContextcpp">trunk/Source/WebCore/platform/graphics/GLContext.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicseglGLContextEGLcpp">trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsglxGLContextGLXcpp">trunk/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBasecpp">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicssurfacesglxX11Helpercpp">trunk/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkGtkUtilitiescpp">trunk/Source/WebCore/platform/gtk/GtkUtilities.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkGtkUtilitiesh">trunk/Source/WebCore/platform/gtk/GtkUtilities.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="#trunkSourceWebKit2UIProcesscairoBackingStoreCairocpp">trunk/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsNetscapex11NetscapePluginX11cpp">trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgraphicsPlatformDisplaycpp">trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsPlatformDisplayh">trunk/Source/WebCore/platform/graphics/PlatformDisplay.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicswaylandPlatformDisplayWaylandcpp">trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicswaylandPlatformDisplayWaylandh">trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.h</a></li>
<li>trunk/Source/WebCore/platform/graphics/x11/</li>
<li><a href="#trunkSourceWebCoreplatformgraphicsx11PlatformDisplayX11cpp">trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsx11PlatformDisplayX11h">trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgraphicswaylandWaylandDisplaycpp">trunk/Source/WebCore/platform/graphics/wayland/WaylandDisplay.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicswaylandWaylandDisplayh">trunk/Source/WebCore/platform/graphics/wayland/WaylandDisplay.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebCore/ChangeLog        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -1,5 +1,76 @@
</span><span class="cx"> 2015-05-03  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><ins>+        [GTK][EFL] Unify platform display handling
+        https://bugs.webkit.org/show_bug.cgi?id=144517
+
+        Reviewed by Martin Robinson.
+
+        There are several places were we are handling the X display
+        connection:
+
+        - GLContext::sharedX11Display() creates a new connection.
+        - X11Helper::nativeDisplay() creates a new connection.
+        - BackingStoreBackendCairoX11 uses the GTK+ shared connection.
+        - NetscapePlugin::x11HostDisplay() uses the GTK+/ecore shared connection
+        - The rest of the GTK+ code uses the shared GTK+ connection
+
+        And then we also have WaylandDisplay and the code to check if the
+        current display is wayland or X11.
+        We could unify all these to share the same connection to reduce
+        the amount of ifdefs and ensure a single connection. That will
+        also allow us to use &quot;smart pointers&quot; for the X resources that
+        need a Display* to be freed.
+
+        * PlatformEfl.cmake: Add new files to compilation.
+        * PlatformGTK.cmake: Move some files to WebCore_SOURCES sinc ethey
+        don't use GTK+ anymore, and add new files to compilation.
+        * platform/graphics/GLContext.cpp:
+        (WebCore::GLContext::cleanupActiveContextsAtExit): Remove the
+        custom X11 connection.
+        (WebCore::GLContext::createContextForWindow): Check if the shared
+        display is Wayland to create a EGL context in such case.
+        * platform/graphics/PlatformDisplay.cpp: Added.
+        (WebCore::PlatformDisplay::createPlatformDisplay): Creates the
+        shared display, using the GTK+/ecore shared connection.
+        (WebCore::PlatformDisplay::sharedDisplay): Return the shared display.
+        * platform/graphics/PlatformDisplay.h: Added.
+        * platform/graphics/egl/GLContextEGL.cpp:
+        (WebCore::sharedEGLDisplay): Use PlatformDisplay::sharedDisplay()
+        to get the native display.
+        (WebCore::GLContextEGL::createPixmapContext): Ditto.
+        * platform/graphics/glx/GLContextGLX.cpp:
+        (WebCore::GLContextGLX::createWindowContext): Ditto.
+        (WebCore::GLContextGLX::createPbufferContext): Ditto.
+        (WebCore::GLContextGLX::createPixmapContext): Ditto.
+        (WebCore::GLContextGLX::createContext): Ditto.
+        (WebCore::GLContextGLX::~GLContextGLX): Ditto.
+        (WebCore::GLContextGLX::defaultFrameBufferSize): Ditto.
+        (WebCore::GLContextGLX::makeContextCurrent): Ditto.
+        (WebCore::GLContextGLX::swapBuffers): Ditto.
+        (WebCore::GLContextGLX::cairoDevice): Ditto.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): Ditto.
+        * platform/graphics/surfaces/glx/X11Helper.cpp:
+        (WebCore::X11Helper::nativeDisplay): Ditto.
+        * platform/graphics/wayland/PlatformDisplayWayland.cpp: Renamed from Source/WebCore/platform/graphics/wayland/WaylandDisplay.cpp.
+        (WebCore::PlatformDisplayWayland::globalCallback):
+        (WebCore::PlatformDisplayWayland::globalRemoveCallback):
+        (WebCore::PlatformDisplayWayland::create): Renamed instance() as
+        create() since the single instance is now handled by PlatformDisplay.
+        (WebCore::PlatformDisplayWayland::PlatformDisplayWayland):
+        (WebCore::PlatformDisplayWayland::createSurface):
+        (WebCore::PlatformDisplayWayland::createSharingGLContext):
+        * platform/graphics/wayland/PlatformDisplayWayland.h: Renamed from Source/WebCore/platform/graphics/wayland/WaylandDisplay.h.
+        * platform/graphics/x11/PlatformDisplayX11.cpp: Added.
+        (WebCore::PlatformDisplayX11::PlatformDisplayX11):
+        (WebCore::PlatformDisplayX11::~PlatformDisplayX11):
+        * platform/graphics/x11/PlatformDisplayX11.h: Added.
+        * platform/gtk/GtkUtilities.cpp:
+        (WebCore::getDisplaySystemType): Deleted.
+        * platform/gtk/GtkUtilities.h:
+
+2015-05-03  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
</ins><span class="cx">         [GTK] API tests crashing on debug builds due to extra unref
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=144508
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformEflcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformEfl.cmake (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformEfl.cmake        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebCore/PlatformEfl.cmake        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -17,6 +17,7 @@
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/surfaces/glx&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/texmap&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/texmap/coordinated&quot;
</span><ins>+    &quot;${WEBCORE_DIR}/platform/graphics/x11&quot;
</ins><span class="cx">     &quot;${WEBCORE_DIR}/platform/linux&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/mediastream/openwebrtc&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/mock/mediasource&quot;
</span><span class="lines">@@ -107,6 +108,7 @@
</span><span class="cx">     platform/geoclue/GeolocationProviderGeoclue2.cpp
</span><span class="cx"> 
</span><span class="cx">     platform/graphics/ImageSource.cpp
</span><ins>+    platform/graphics/PlatformDisplay.cpp
</ins><span class="cx">     platform/graphics/WOFFFileFormat.cpp
</span><span class="cx"> 
</span><span class="cx">     platform/graphics/cairo/BackingStoreBackendCairoImpl.cpp
</span><span class="lines">@@ -195,6 +197,8 @@
</span><span class="cx">     platform/graphics/texmap/coordinated/TiledBackingStore.cpp
</span><span class="cx">     platform/graphics/texmap/coordinated/UpdateAtlas.cpp
</span><span class="cx"> 
</span><ins>+    platform/graphics/x11/PlatformDisplayX11.cpp
+
</ins><span class="cx">     platform/image-decoders/ImageDecoder.cpp
</span><span class="cx"> 
</span><span class="cx">     platform/image-decoders/bmp/BMPImageDecoder.cpp
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformGTK.cmake (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformGTK.cmake        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebCore/PlatformGTK.cmake        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -17,6 +17,7 @@
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/opengl&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/opentype&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/wayland&quot;
</span><ins>+    &quot;${WEBCORE_DIR}/platform/graphics/x11&quot;
</ins><span class="cx">     &quot;${WEBCORE_DIR}/platform/linux&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/mediastream/openwebrtc&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/mock/mediasource&quot;
</span><span class="lines">@@ -63,6 +64,7 @@
</span><span class="cx">     platform/geoclue/GeolocationProviderGeoclue1.cpp
</span><span class="cx">     platform/geoclue/GeolocationProviderGeoclue2.cpp
</span><span class="cx"> 
</span><ins>+    platform/graphics/GLContext.cpp
</ins><span class="cx">     platform/graphics/GraphicsContext3DPrivate.cpp
</span><span class="cx">     platform/graphics/ImageSource.cpp
</span><span class="cx">     platform/graphics/WOFFFileFormat.cpp
</span><span class="lines">@@ -87,11 +89,15 @@
</span><span class="cx">     platform/graphics/cairo/RefPtrCairo.cpp
</span><span class="cx">     platform/graphics/cairo/TransformationMatrixCairo.cpp
</span><span class="cx"> 
</span><ins>+    platform/graphics/egl/GLContextEGL.cpp
+
</ins><span class="cx">     platform/graphics/freetype/FontCacheFreeType.cpp
</span><span class="cx">     platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
</span><span class="cx">     platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp
</span><span class="cx">     platform/graphics/freetype/SimpleFontDataFreeType.cpp
</span><span class="cx"> 
</span><ins>+    platform/graphics/glx/GLContextGLX.cpp
+
</ins><span class="cx">     platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp
</span><span class="cx">     platform/graphics/gstreamer/GRefPtrGStreamer.cpp
</span><span class="cx">     platform/graphics/gstreamer/GStreamerUtilities.cpp
</span><span class="lines">@@ -119,6 +125,8 @@
</span><span class="cx"> 
</span><span class="cx">     platform/graphics/opentype/OpenTypeVerticalData.cpp
</span><span class="cx"> 
</span><ins>+    platform/graphics/x11/PlatformDisplayX11.cpp
+
</ins><span class="cx">     platform/gtk/ErrorsGtk.cpp
</span><span class="cx">     platform/gtk/EventLoopGtk.cpp
</span><span class="cx">     platform/gtk/FileSystemGtk.cpp
</span><span class="lines">@@ -191,14 +199,10 @@
</span><span class="cx">     page/gtk/DragControllerGtk.cpp
</span><span class="cx">     page/gtk/EventHandlerGtk.cpp
</span><span class="cx"> 
</span><del>-    platform/graphics/GLContext.cpp
</del><ins>+    platform/graphics/PlatformDisplay.cpp
</ins><span class="cx"> 
</span><del>-    platform/graphics/egl/GLContextEGL.cpp
-
</del><span class="cx">     platform/graphics/freetype/FontPlatformDataFreeType.cpp
</span><span class="cx"> 
</span><del>-    platform/graphics/glx/GLContextGLX.cpp
-
</del><span class="cx">     platform/graphics/gtk/ColorGtk.cpp
</span><span class="cx">     platform/graphics/gtk/GdkCairoUtilities.cpp
</span><span class="cx">     platform/graphics/gtk/IconGtk.cpp
</span><span class="lines">@@ -472,7 +476,7 @@
</span><span class="cx"> 
</span><span class="cx"> if (ENABLE_WAYLAND_TARGET)
</span><span class="cx">     list(APPEND WebCorePlatformGTK_SOURCES
</span><del>-        platform/graphics/wayland/WaylandDisplay.cpp
</del><ins>+        platform/graphics/wayland/PlatformDisplayWayland.cpp
</ins><span class="cx">         platform/graphics/wayland/WaylandEventSource.cpp
</span><span class="cx">         platform/graphics/wayland/WaylandSurface.cpp
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGLContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GLContext.cpp (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GLContext.cpp        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebCore/platform/graphics/GLContext.cpp        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -22,6 +22,9 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;GLContext.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;PlatformDisplay.h&quot;
+#include &lt;wtf/ThreadSpecific.h&gt;
+
</ins><span class="cx"> #if USE(EGL)
</span><span class="cx"> #include &quot;GLContextEGL.h&quot;
</span><span class="cx"> #endif
</span><span class="lines">@@ -30,19 +33,6 @@
</span><span class="cx"> #include &quot;GLContextGLX.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#include &lt;wtf/ThreadSpecific.h&gt;
-
-#if PLATFORM(X11)
-#include &lt;X11/Xlib.h&gt;
-#endif
-
-#if PLATFORM(GTK)
-#include &lt;gdk/gdk.h&gt;
-#if PLATFORM(WAYLAND) &amp;&amp; !defined(GTK_API_VERSION_2) &amp;&amp; defined(GDK_WINDOWING_WAYLAND)
-#include &lt;gdk/gdkwayland.h&gt;
-#endif
-#endif
-
</del><span class="cx"> using WTF::ThreadSpecific;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -74,25 +64,6 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(X11)
</span><del>-// We do not want to call glXMakeContextCurrent using different Display pointers,
-// because it might lead to crashes in some drivers (fglrx). We use a shared display
-// pointer here.
-static Display* gSharedX11Display = 0;
-Display* GLContext::sharedX11Display()
-{
-    if (!gSharedX11Display)
-        gSharedX11Display = XOpenDisplay(0);
-    return gSharedX11Display;
-}
-
-void GLContext::cleanupSharedX11Display()
-{
-    if (!gSharedX11Display)
-        return;
-    XCloseDisplay(gSharedX11Display);
-    gSharedX11Display = 0;
-}
-
</del><span class="cx"> // Because of driver bugs, exiting the program when there are active pbuffers
</span><span class="cx"> // can crash the X server (this has been observed with the official Nvidia drivers).
</span><span class="cx"> // We need to ensure that we clean everything up on exit. There are several reasons
</span><span class="lines">@@ -137,18 +108,14 @@
</span><span class="cx">     ActiveContextList&amp; contextList = activeContextList();
</span><span class="cx">     for (size_t i = 0; i &lt; contextList.size(); ++i)
</span><span class="cx">         delete contextList[i];
</span><del>-
-    cleanupSharedX11Display();
</del><span class="cx"> }
</span><span class="cx"> #endif // PLATFORM(X11)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;GLContext&gt; GLContext::createContextForWindow(GLNativeWindowType windowHandle, GLContext* sharingContext)
</span><span class="cx"> {
</span><del>-#if PLATFORM(GTK) &amp;&amp; PLATFORM(WAYLAND) &amp;&amp; !defined(GTK_API_VERSION_2) &amp;&amp; defined(GDK_WINDOWING_WAYLAND) &amp;&amp; USE(EGL)
-    GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
-
-    if (GDK_IS_WAYLAND_DISPLAY(display)) {
</del><ins>+#if PLATFORM(WAYLAND) &amp;&amp; USE(EGL)
+    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland) {
</ins><span class="cx">         if (auto eglContext = GLContextEGL::createContext(windowHandle, sharingContext))
</span><span class="cx">             return WTF::move(eglContext);
</span><span class="cx">         return nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPlatformDisplaycpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp (0 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -0,0 +1,88 @@
</span><ins>+/*
+ * Copyright (C) 2015 Igalia S.L
+ *
+ * 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 AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 OR ITS 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;PlatformDisplay.h&quot;
+
+#include &lt;mutex&gt;
+#include &lt;wtf/NeverDestroyed.h&gt;
+
+#if PLATFORM(X11)
+#include &quot;PlatformDisplayX11.h&quot;
+#endif
+
+#if PLATFORM(WAYLAND)
+#include &quot;PlatformDisplayWayland.h&quot;
+#endif
+
+#if PLATFORM(GTK)
+#include &lt;gdk/gdkx.h&gt;
+#endif
+
+#if PLATFORM(EFL) &amp;&amp; defined(HAVE_ECORE_X)
+#include &lt;Ecore_X.h&gt;
+#endif
+
+namespace WebCore {
+
+std::unique_ptr&lt;PlatformDisplay&gt; PlatformDisplay::createPlatformDisplay()
+{
+#if PLATFORM(GTK)
+#if defined(GTK_API_VERSION_2)
+    return std::make_unique&lt;PlatformDisplayX11&gt;(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()));
+#else
+    GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
+#if PLATFORM(X11)
+    if (GDK_IS_X11_DISPLAY(display))
+        return std::make_unique&lt;PlatformDisplayX11&gt;(GDK_DISPLAY_XDISPLAY(display));
+#endif
+#if PLATFORM(WAYLAND)
+    if (GDK_IS_WAYLAND_DISPLAY(display))
+        return PlatformDisplayWayland::create();
+#endif
+#endif
+#elif PLATFORM(EFL) &amp;&amp; defined(HAVE_ECORE_X)
+    return std::make_unique&lt;PlatformDisplayX11&gt;(static_cast&lt;Display*&gt;(ecore_x_display_get()));
+#endif
+
+#if PLATFORM(X11)
+    return std::make_unique&lt;PlatformDisplayX11&gt;();
+#endif
+
+    ASSERT_NOT_REACHED();
+    return nullptr;
+}
+
+PlatformDisplay&amp; PlatformDisplay::sharedDisplay()
+{
+    static std::once_flag onceFlag;
+    static std::unique_ptr&lt;PlatformDisplay&gt; display;
+    std::call_once(onceFlag, []{
+        display = createPlatformDisplay();
+    });
+    return *display;
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsPlatformDisplayh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/PlatformDisplay.h (0 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/PlatformDisplay.h                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/PlatformDisplay.h        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+/*
+ * Copyright (C) 2015 Igalia S.L
+ *
+ * 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 AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 OR ITS 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 PlatformDisplay_h
+#define PlatformDisplay_h
+
+#include &lt;wtf/Noncopyable.h&gt;
+#include &lt;wtf/TypeCasts.h&gt;
+
+namespace WebCore {
+
+class PlatformDisplay {
+    WTF_MAKE_NONCOPYABLE(PlatformDisplay); WTF_MAKE_FAST_ALLOCATED;
+public:
+    static PlatformDisplay&amp; sharedDisplay();
+    virtual ~PlatformDisplay() = default;
+
+    enum class Type {
+#if PLATFORM(X11)
+        X11,
+#endif
+#if PLATFORM(WAYLAND)
+        Wayland,
+#endif
+    };
+
+    virtual Type type() const = 0;
+
+protected:
+    PlatformDisplay() = default;
+
+private:
+    static std::unique_ptr&lt;PlatformDisplay&gt; createPlatformDisplay();
+};
+
+} // namespace WebCore
+
+#define SPECIALIZE_TYPE_TRAITS_PLATFORM_DISPLAY(ToClassName, DisplayType) \
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToClassName) \
+    static bool isType(const WebCore::PlatformDisplay&amp; display) { return display.type() == WebCore::PlatformDisplay::Type::DisplayType; } \
+SPECIALIZE_TYPE_TRAITS_END()
+
+#endif // PltformDisplay_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicseglGLContextEGLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -34,11 +34,12 @@
</span><span class="cx"> #include &quot;OpenGLShims.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if PLATFORM(GTK)
-#include &quot;GtkUtilities.h&quot;
-#if PLATFORM(WAYLAND) &amp;&amp; !defined(GTK_API_VERSION_2)
-#include &quot;WaylandDisplay.h&quot;
</del><ins>+#if PLATFORM(X11)
+#include &quot;PlatformDisplayX11.h&quot;
</ins><span class="cx"> #endif
</span><ins>+
+#if PLATFORM(WAYLAND)
+#include &quot;PlatformDisplayWayland.h&quot;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ACCELERATED_2D_CANVAS)
</span><span class="lines">@@ -64,13 +65,15 @@
</span><span class="cx">     static bool initialized = false;
</span><span class="cx">     if (!initialized) {
</span><span class="cx">         initialized = true;
</span><del>-#if PLATFORM(GTK) &amp;&amp; PLATFORM(WAYLAND) &amp;&amp; !defined(GTK_API_VERSION_2)
-        if (getDisplaySystemType() == DisplaySystemType::Wayland &amp;&amp; WaylandDisplay::instance())
-            gSharedEGLDisplay = eglGetDisplay(WaylandDisplay::instance()-&gt;nativeDisplay());
</del><ins>+
+        const auto&amp; sharedDisplay = PlatformDisplay::sharedDisplay();
+#if PLATFORM(WAYLAND)
+        if (is&lt;PlatformDisplayWayland&gt;(sharedDisplay))
+            gSharedEGLDisplay = eglGetDisplay(downcast&lt;PlatformDisplayWayland&gt;(sharedDisplay).native());
</ins><span class="cx">         else // Note that this branch continutes outside this #if-guarded segment.
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(X11)
</span><del>-            gSharedEGLDisplay = eglGetDisplay(GLContext::sharedX11Display());
</del><ins>+            gSharedEGLDisplay = eglGetDisplay(downcast&lt;PlatformDisplayX11&gt;(sharedDisplay).native());
</ins><span class="cx"> #else
</span><span class="cx">             gSharedEGLDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
</span><span class="cx"> #endif
</span><span class="lines">@@ -186,7 +189,8 @@
</span><span class="cx">     if (!eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &amp;depth))
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    Pixmap pixmap = XCreatePixmap(sharedX11Display(), DefaultRootWindow(sharedX11Display()), 1, 1, depth);
</del><ins>+    Display* x11Display = downcast&lt;PlatformDisplayX11&gt;(PlatformDisplay::sharedDisplay()).native();
+    Pixmap pixmap = XCreatePixmap(x11Display, DefaultRootWindow(x11Display), 1, 1, depth);
</ins><span class="cx">     if (!pixmap)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsglxGLContextGLXcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #if USE(GLX)
</span><span class="cx"> #include &quot;GraphicsContext3D.h&quot;
</span><span class="cx"> #include &quot;OpenGLShims.h&quot;
</span><ins>+#include &quot;PlatformDisplayX11.h&quot;
</ins><span class="cx"> #include &lt;GL/glx.h&gt;
</span><span class="cx"> #include &lt;cairo.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -33,7 +34,7 @@
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;GLContextGLX&gt; GLContextGLX::createWindowContext(XID window, GLContext* sharingContext)
</span><span class="cx"> {
</span><del>-    Display* display = sharedX11Display();
</del><ins>+    Display* display = downcast&lt;PlatformDisplayX11&gt;(PlatformDisplay::sharedDisplay()).native();
</ins><span class="cx">     XWindowAttributes attributes;
</span><span class="cx">     if (!XGetWindowAttributes(display, window, &amp;attributes))
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -72,7 +73,7 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     int returnedElements;
</span><del>-    Display* display = sharedX11Display();
</del><ins>+    Display* display = downcast&lt;PlatformDisplayX11&gt;(PlatformDisplay::sharedDisplay()).native();
</ins><span class="cx">     GLXFBConfig* configs = glXChooseFBConfig(display, 0, fbConfigAttributes, &amp;returnedElements);
</span><span class="cx">     if (!returnedElements) {
</span><span class="cx">         XFree(configs);
</span><span class="lines">@@ -112,7 +113,7 @@
</span><span class="cx">         0
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    Display* display = sharedX11Display();
</del><ins>+    Display* display = downcast&lt;PlatformDisplayX11&gt;(PlatformDisplay::sharedDisplay()).native();
</ins><span class="cx">     XVisualInfo* visualInfo = glXChooseVisual(display, DefaultScreen(display), visualAttributes);
</span><span class="cx">     if (!visualInfo)
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -142,9 +143,6 @@
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;GLContextGLX&gt; GLContextGLX::createContext(XID window, GLContext* sharingContext)
</span><span class="cx"> {
</span><del>-    if (!sharedX11Display())
-        return nullptr;
-
</del><span class="cx">     static bool initialized = false;
</span><span class="cx">     static bool success = true;
</span><span class="cx">     if (!initialized) {
</span><span class="lines">@@ -191,24 +189,25 @@
</span><span class="cx">     if (m_cairoDevice)
</span><span class="cx">         cairo_device_destroy(m_cairoDevice);
</span><span class="cx"> 
</span><ins>+    Display* display = downcast&lt;PlatformDisplayX11&gt;(PlatformDisplay::sharedDisplay()).native();
</ins><span class="cx">     if (m_context) {
</span><span class="cx">         // This may be necessary to prevent crashes with NVidia's closed source drivers. Originally
</span><span class="cx">         // from Mozilla's 3D canvas implementation at: http://bitbucket.org/ilmari/canvas3d/
</span><span class="cx">         glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
</span><del>-        glXMakeCurrent(sharedX11Display(), None, None);
-        glXDestroyContext(sharedX11Display(), m_context);
</del><ins>+        glXMakeCurrent(display, None, None);
+        glXDestroyContext(display, m_context);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (m_pbuffer) {
</span><del>-        glXDestroyPbuffer(sharedX11Display(), m_pbuffer);
</del><ins>+        glXDestroyPbuffer(display, m_pbuffer);
</ins><span class="cx">         m_pbuffer = 0;
</span><span class="cx">     }
</span><span class="cx">     if (m_glxPixmap) {
</span><del>-        glXDestroyGLXPixmap(sharedX11Display(), m_glxPixmap);
</del><ins>+        glXDestroyGLXPixmap(display, m_glxPixmap);
</ins><span class="cx">         m_glxPixmap = 0;
</span><span class="cx">     }
</span><span class="cx">     if (m_pixmap) {
</span><del>-        XFreePixmap(sharedX11Display(), m_pixmap);
</del><ins>+        XFreePixmap(display, m_pixmap);
</ins><span class="cx">         m_pixmap = 0;
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -226,7 +225,8 @@
</span><span class="cx">     int x, y;
</span><span class="cx">     Window rootWindow;
</span><span class="cx">     unsigned int width, height, borderWidth, depth;
</span><del>-    if (!XGetGeometry(sharedX11Display(), m_window, &amp;rootWindow, &amp;x, &amp;y, &amp;width, &amp;height, &amp;borderWidth, &amp;depth))
</del><ins>+    Display* display = downcast&lt;PlatformDisplayX11&gt;(PlatformDisplay::sharedDisplay()).native();
+    if (!XGetGeometry(display, m_window, &amp;rootWindow, &amp;x, &amp;y, &amp;width, &amp;height, &amp;borderWidth, &amp;depth))
</ins><span class="cx">         return IntSize();
</span><span class="cx"> 
</span><span class="cx">     return IntSize(width, height);
</span><span class="lines">@@ -240,19 +240,20 @@
</span><span class="cx">     if (glXGetCurrentContext() == m_context)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><ins>+    Display* display = downcast&lt;PlatformDisplayX11&gt;(PlatformDisplay::sharedDisplay()).native();
</ins><span class="cx">     if (m_window)
</span><del>-        return glXMakeCurrent(sharedX11Display(), m_window, m_context);
</del><ins>+        return glXMakeCurrent(display, m_window, m_context);
</ins><span class="cx"> 
</span><span class="cx">     if (m_pbuffer)
</span><del>-        return glXMakeCurrent(sharedX11Display(), m_pbuffer, m_context);
</del><ins>+        return glXMakeCurrent(display, m_pbuffer, m_context);
</ins><span class="cx"> 
</span><del>-    return ::glXMakeCurrent(sharedX11Display(), m_glxPixmap, m_context);
</del><ins>+    return ::glXMakeCurrent(display, m_glxPixmap, m_context);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GLContextGLX::swapBuffers()
</span><span class="cx"> {
</span><span class="cx">     if (m_window)
</span><del>-        glXSwapBuffers(sharedX11Display(), m_window);
</del><ins>+        glXSwapBuffers(downcast&lt;PlatformDisplayX11&gt;(PlatformDisplay::sharedDisplay()).native(), m_window);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GLContextGLX::waitNative()
</span><span class="lines">@@ -266,7 +267,7 @@
</span><span class="cx">         return m_cairoDevice;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ACCELERATED_2D_CANVAS)
</span><del>-    m_cairoDevice = cairo_glx_device_create(sharedX11Display(), m_context);
</del><ins>+    m_cairoDevice = cairo_glx_device_create(downcast&lt;PlatformDisplayX11&gt;(PlatformDisplay::sharedDisplay()).native(), m_context);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     return m_cairoDevice;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -71,6 +71,12 @@
</span><span class="cx"> #include &lt;gst/gl/egl/gstgldisplay_egl.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(X11)
+#include &quot;PlatformDisplayX11.h&quot;
+#elif PLATFORM(WAYLAND)
+#include &quot;PlatformDisplayWayland.h&quot;
+#endif
+
</ins><span class="cx"> // gstglapi.h may include eglplatform.h and it includes X.h, which
</span><span class="cx"> // defines None, breaking MediaPlayer::None enum
</span><span class="cx"> #if PLATFORM(X11) &amp;&amp; GST_GL_HAVE_PLATFORM_EGL
</span><span class="lines">@@ -228,12 +234,11 @@
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     if (!m_glDisplay) {
</span><ins>+        const auto&amp; sharedDisplay = PlatformDisplay::sharedDisplay();
</ins><span class="cx"> #if PLATFORM(X11)
</span><del>-        Display* display = GLContext::sharedX11Display();
-        m_glDisplay = GST_GL_DISPLAY(gst_gl_display_x11_new_with_display(display));
</del><ins>+        m_glDisplay = GST_GL_DISPLAY(gst_gl_display_x11_new_with_display(downcast&lt;PlatformDisplayX11&gt;(sharedDisplay).native()));
</ins><span class="cx"> #elif PLATFORM(WAYLAND)
</span><del>-        EGLDisplay display = WaylandDisplay::instance()-&gt;eglDisplay();
-        m_glDisplay = GST_GL_DISPLAY(gst_gl_display_egl_new_with_egl_display(display));
</del><ins>+        m_glDisplay = GST_GL_DISPLAY(gst_gl_display_egl_new_with_egl_display(downcast&lt;PlatformDisplayWayland&gt;(sharedDisplay).native()));
</ins><span class="cx"> #endif
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicssurfacesglxX11Helpercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;X11Helper.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;PlatformDisplayX11.h&quot;
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> // Used for handling XError.
</span><span class="lines">@@ -53,25 +55,6 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-struct DisplayConnection {
-    DisplayConnection()
-    {
-        m_display = XOpenDisplay(0);
-
-        if (!m_display)
-            LOG_ERROR(&quot;Failed to make connection with X&quot;);
-    }
-
-    ~DisplayConnection()
-    {
-        XCloseDisplay(m_display);
-    }
-
-    Display* display() { return m_display; }
-private:
-    Display* m_display;
-};
-
</del><span class="cx"> struct OffScreenRootWindow {
</span><span class="cx"> 
</span><span class="cx">     OffScreenRootWindow()
</span><span class="lines">@@ -331,9 +314,7 @@
</span><span class="cx"> 
</span><span class="cx"> Display* X11Helper::nativeDisplay()
</span><span class="cx"> {
</span><del>-    // Display connection will only be broken at program shutdown.
-    static DisplayConnection displayConnection;
-    return displayConnection.display();
</del><ins>+    return downcast&lt;PlatformDisplayX11&gt;(PlatformDisplay::sharedDisplay()).native();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Window X11Helper::offscreenRootWindow()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswaylandPlatformDisplayWaylandcppfromrev183730trunkSourceWebCoreplatformgraphicswaylandWaylandDisplaycpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp (from rev 183730, trunk/Source/WebCore/platform/graphics/wayland/WaylandDisplay.cpp) (0 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -0,0 +1,135 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 COMPUTER, 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 COMPUTER, 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;PlatformDisplayWayland.h&quot;
+
+#if PLATFORM(WAYLAND)
+
+#include &quot;GLContextEGL.h&quot;
+#include &quot;WaylandSurface.h&quot;
+#include &lt;cstring&gt;
+#include &lt;glib.h&gt;
+
+namespace WebCore {
+
+const struct wl_registry_listener PlatformDisplayWayland::m_registryListener = {
+    PlatformDisplayWayland::globalCallback,
+    PlatformDisplayWayland::globalRemoveCallback
+};
+
+void PlatformDisplayWayland::globalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t)
+{
+    auto display = static_cast&lt;PlatformDisplayWayland*&gt;(data);
+    if (!std::strcmp(interface, &quot;wl_compositor&quot;))
+        display-&gt;m_compositor = static_cast&lt;struct wl_compositor*&gt;(wl_registry_bind(registry, name, &amp;wl_compositor_interface, 1));
+    else if (!std::strcmp(interface, &quot;wl_webkitgtk&quot;))
+        display-&gt;m_webkitgtk = static_cast&lt;struct wl_webkitgtk*&gt;(wl_registry_bind(registry, name, &amp;wl_webkitgtk_interface, 1));
+}
+
+void PlatformDisplayWayland::globalRemoveCallback(void*, struct wl_registry*, uint32_t)
+{
+    // FIXME: if this can happen without the UI Process getting shut down
+    // we should probably destroy our cached display instance.
+}
+
+std::unique_ptr&lt;PlatformDisplayWayland&gt; PlatformDisplayWayland::create()
+{
+    struct wl_display* wlDisplay = wl_display_connect(&quot;webkitgtk-wayland-compositor-socket&quot;);
+    if (!wlDisplay)
+        return nullptr;
+
+    auto display = std::make_unique&lt;PlatformDisplayWayland&gt;(wlDisplay);
+    if (!display-&gt;isInitialized())
+        return nullptr;
+
+    return WTF::move(display);
+}
+
+PlatformDisplayWayland::PlatformDisplayWayland(struct wl_display* wlDisplay)
+    : m_display(wlDisplay)
+    , m_registry(wl_display_get_registry(m_display))
+    , m_eglConfigChosen(false)
+{
+    wl_registry_add_listener(m_registry, &amp;m_registryListener, this);
+    wl_display_roundtrip(m_display);
+
+    static const EGLint configAttributes[] = {
+        EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+        EGL_RED_SIZE, 1,
+        EGL_GREEN_SIZE, 1,
+        EGL_BLUE_SIZE, 1,
+        EGL_ALPHA_SIZE, 1,
+        EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+        EGL_NONE
+    };
+
+    m_eglDisplay = eglGetDisplay(m_display);
+    if (m_eglDisplay == EGL_NO_DISPLAY) {
+        g_warning(&quot;PlatformDisplayWayland initialization: failed to acquire EGL display.&quot;);
+        return;
+    }
+
+    if (eglInitialize(m_eglDisplay, 0, 0) == EGL_FALSE) {
+        g_warning(&quot;PlatformDisplayWayland initialization: failed to initialize the EGL display.&quot;);
+        return;
+    }
+
+    if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE) {
+        g_warning(&quot;PlatformDisplayWayland initialization: failed to set EGL_OPENGL_ES_API as the rendering API.&quot;);
+        return;
+    }
+
+    EGLint numberOfConfigs;
+    if (!eglChooseConfig(m_eglDisplay, configAttributes, &amp;m_eglConfig, 1, &amp;numberOfConfigs) || numberOfConfigs != 1) {
+        g_warning(&quot;PlatformDisplayWayland initialization: failed to find the desired EGL configuration.&quot;);
+        return;
+    }
+
+    m_eglConfigChosen = true;
+}
+
+std::unique_ptr&lt;WaylandSurface&gt; PlatformDisplayWayland::createSurface(const IntSize&amp; size, int widgetId)
+{
+    struct wl_surface* wlSurface = wl_compositor_create_surface(m_compositor);
+    // We keep the minimum size at 1x1px since Mesa returns null values in wl_egl_window_create() for zero width or height.
+    EGLNativeWindowType nativeWindow = wl_egl_window_create(wlSurface, std::max(1, size.width()), std::max(1, size.height()));
+
+    wl_webkitgtk_set_surface_for_widget(m_webkitgtk, wlSurface, widgetId);
+    wl_display_roundtrip(m_display);
+
+    return std::make_unique&lt;WaylandSurface&gt;(wlSurface, nativeWindow);
+}
+
+std::unique_ptr&lt;GLContextEGL&gt; PlatformDisplayWayland::createSharingGLContext()
+{
+    struct wl_surface* wlSurface = wl_compositor_create_surface(m_compositor);
+    EGLNativeWindowType nativeWindow = wl_egl_window_create(wlSurface, 1, 1);
+    return GLContextEGL::createWindowContext(nativeWindow, nullptr);
+}
+
+} // namespace WebCore
+
+#endif // PLATFORM(WAYLAND)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswaylandPlatformDisplayWaylandhfromrev183730trunkSourceWebCoreplatformgraphicswaylandWaylandDisplayh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.h (from rev 183730, trunk/Source/WebCore/platform/graphics/wayland/WaylandDisplay.h) (0 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.h                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.h        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 COMPUTER, 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 COMPUTER, 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  PlatformDisplayWayland_h
+#define  PlatformDisplayWayland_h
+
+#if PLATFORM(WAYLAND)
+
+#include &quot;PlatformDisplay.h&quot;
+#include &quot;WebKitGtkWaylandClientProtocol.h&quot;
+#include &lt;memory&gt;
+#include &lt;wayland-client.h&gt;
+#include &lt;wayland-egl.h&gt;
+#include &lt;EGL/egl.h&gt;
+
+namespace WebCore {
+
+class GLContextEGL;
+class IntSize;
+class WaylandSurface;
+
+class PlatformDisplayWayland final: public PlatformDisplay {
+public:
+    static std::unique_ptr&lt;PlatformDisplayWayland&gt; create();
+    virtual ~PlatformDisplayWayland();
+
+    struct wl_display* native() const { return m_display; }
+    EGLDisplay eglDisplay() const { return m_eglDisplay; }
+
+    std::unique_ptr&lt;WaylandSurface&gt; createSurface(const IntSize&amp;, int widgetID);
+
+    std::unique_ptr&lt;GLContextEGL&gt; createSharingGLContext();
+
+private:
+    static const struct wl_registry_listener m_registryListener;
+    static void globalCallback(void* data, struct wl_registry*, uint32_t name, const char* interface, uint32_t version);
+    static void globalRemoveCallback(void* data, struct wl_registry*, uint32_t name);
+
+    PlatformDisplayWayland(struct wl_display*);
+    bool isInitialized() { return m_compositor &amp;&amp; m_webkitgtk &amp;&amp; m_eglDisplay != EGL_NO_DISPLAY &amp;&amp; m_eglConfigChosen; }
+
+    Type type() const override { return PlatformDisplay::Type::Wayland; }
+
+    struct wl_display* m_display;
+    struct wl_registry* m_registry;
+    struct wl_compositor* m_compositor;
+    struct wl_webkitgtk* m_webkitgtk;
+
+    EGLDisplay m_eglDisplay;
+    EGLConfig m_eglConfig;
+    bool m_eglConfigChosen;
+};
+
+} // namespace WebCore
+
+#endif // PLATFORM(WAYLAND)
+
+#endif // PlatformDisplayWayland_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswaylandWaylandDisplaycpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/wayland/WaylandDisplay.cpp (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/wayland/WaylandDisplay.cpp        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebCore/platform/graphics/wayland/WaylandDisplay.cpp        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -1,143 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * 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 COMPUTER, 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 COMPUTER, 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;WaylandDisplay.h&quot;
-
-#if PLATFORM(WAYLAND)
-
-#include &quot;GLContextEGL.h&quot;
-#include &quot;WaylandSurface.h&quot;
-#include &lt;cstring&gt;
-#include &lt;glib.h&gt;
-
-namespace WebCore {
-
-const struct wl_registry_listener WaylandDisplay::m_registryListener = {
-    WaylandDisplay::globalCallback,
-    WaylandDisplay::globalRemoveCallback
-};
-
-void WaylandDisplay::globalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t)
-{
-    auto display = static_cast&lt;WaylandDisplay*&gt;(data);
-    if (!std::strcmp(interface, &quot;wl_compositor&quot;))
-        display-&gt;m_compositor = static_cast&lt;struct wl_compositor*&gt;(wl_registry_bind(registry, name, &amp;wl_compositor_interface, 1));
-    else if (!std::strcmp(interface, &quot;wl_webkitgtk&quot;))
-        display-&gt;m_webkitgtk = static_cast&lt;struct wl_webkitgtk*&gt;(wl_registry_bind(registry, name, &amp;wl_webkitgtk_interface, 1));
-}
-
-void WaylandDisplay::globalRemoveCallback(void*, struct wl_registry*, uint32_t)
-{
-    // FIXME: if this can happen without the UI Process getting shut down
-    // we should probably destroy our cached display instance.
-}
-
-WaylandDisplay* WaylandDisplay::instance()
-{
-    static WaylandDisplay* display = nullptr;
-    static bool initialized = false;
-    if (initialized)
-        return display;
-
-    initialized = true;
-    struct wl_display* wlDisplay = wl_display_connect(&quot;webkitgtk-wayland-compositor-socket&quot;);
-    if (!wlDisplay)
-        return nullptr;
-
-    display = new WaylandDisplay(wlDisplay);
-    if (!display-&gt;isInitialized()) {
-        delete display;
-        return nullptr;
-    }
-
-    return display;
-}
-
-WaylandDisplay::WaylandDisplay(struct wl_display* wlDisplay)
-    : m_display(wlDisplay)
-    , m_registry(wl_display_get_registry(m_display))
-    , m_eglConfigChosen(false)
-{
-    wl_registry_add_listener(m_registry, &amp;m_registryListener, this);
-    wl_display_roundtrip(m_display);
-
-    static const EGLint configAttributes[] = {
-        EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
-        EGL_RED_SIZE, 1,
-        EGL_GREEN_SIZE, 1,
-        EGL_BLUE_SIZE, 1,
-        EGL_ALPHA_SIZE, 1,
-        EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
-        EGL_NONE
-    };
-
-    m_eglDisplay = eglGetDisplay(m_display);
-    if (m_eglDisplay == EGL_NO_DISPLAY) {
-        g_warning(&quot;WaylandDisplay initialization: failed to acquire EGL display.&quot;);
-        return;
-    }
-
-    if (eglInitialize(m_eglDisplay, 0, 0) == EGL_FALSE) {
-        g_warning(&quot;WaylandDisplay initialization: failed to initialize the EGL display.&quot;);
-        return;
-    }
-
-    if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE) {
-        g_warning(&quot;WaylandDisplay initialization: failed to set EGL_OPENGL_ES_API as the rendering API.&quot;);
-        return;
-    }
-
-    EGLint numberOfConfigs;
-    if (!eglChooseConfig(m_eglDisplay, configAttributes, &amp;m_eglConfig, 1, &amp;numberOfConfigs) || numberOfConfigs != 1) {
-        g_warning(&quot;WaylandDisplay initialization: failed to find the desired EGL configuration.&quot;);
-        return;
-    }
-
-    m_eglConfigChosen = true;
-}
-
-std::unique_ptr&lt;WaylandSurface&gt; WaylandDisplay::createSurface(const IntSize&amp; size, int widgetId)
-{
-    struct wl_surface* wlSurface = wl_compositor_create_surface(m_compositor);
-    // We keep the minimum size at 1x1px since Mesa returns null values in wl_egl_window_create() for zero width or height.
-    EGLNativeWindowType nativeWindow = wl_egl_window_create(wlSurface, std::max(1, size.width()), std::max(1, size.height()));
-
-    wl_webkitgtk_set_surface_for_widget(m_webkitgtk, wlSurface, widgetId);
-    wl_display_roundtrip(m_display);
-
-    return std::make_unique&lt;WaylandSurface&gt;(wlSurface, nativeWindow);
-}
-
-std::unique_ptr&lt;GLContextEGL&gt; WaylandDisplay::createSharingGLContext()
-{
-    struct wl_surface* wlSurface = wl_compositor_create_surface(m_compositor);
-    EGLNativeWindowType nativeWindow = wl_egl_window_create(wlSurface, 1, 1);
-    return GLContextEGL::createWindowContext(nativeWindow, nullptr);
-}
-
-} // namespace WebCore
-
-#endif // PLATFORM(WAYLAND)
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswaylandWaylandDisplayh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/wayland/WaylandDisplay.h (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/wayland/WaylandDisplay.h        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebCore/platform/graphics/wayland/WaylandDisplay.h        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -1,77 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * 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 COMPUTER, 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 COMPUTER, 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  WaylandDisplay_h
-#define  WaylandDisplay_h
-
-#if PLATFORM(WAYLAND)
-
-#include &quot;WebKitGtkWaylandClientProtocol.h&quot;
-#include &lt;memory&gt;
-#include &lt;wayland-client.h&gt;
-
-#include &lt;wayland-egl.h&gt;
-#include &lt;EGL/egl.h&gt;
-
-namespace WebCore {
-
-class GLContextEGL;
-class IntSize;
-class WaylandSurface;
-
-class WaylandDisplay {
-public:
-    static WaylandDisplay* instance();
-
-    struct wl_display* nativeDisplay() const { return m_display; }
-    EGLDisplay eglDisplay() const { return m_eglDisplay; }
-
-    std::unique_ptr&lt;WaylandSurface&gt; createSurface(const IntSize&amp;, int widgetID);
-
-    std::unique_ptr&lt;GLContextEGL&gt; createSharingGLContext();
-
-private:
-    static const struct wl_registry_listener m_registryListener;
-    static void globalCallback(void* data, struct wl_registry*, uint32_t name, const char* interface, uint32_t version);
-    static void globalRemoveCallback(void* data, struct wl_registry*, uint32_t name);
-
-    WaylandDisplay(struct wl_display*);
-    bool isInitialized() { return m_compositor &amp;&amp; m_webkitgtk &amp;&amp; m_eglDisplay != EGL_NO_DISPLAY &amp;&amp; m_eglConfigChosen; }
-
-    struct wl_display* m_display;
-    struct wl_registry* m_registry;
-    struct wl_compositor* m_compositor;
-    struct wl_webkitgtk* m_webkitgtk;
-
-    EGLDisplay m_eglDisplay;
-    EGLConfig m_eglConfig;
-    bool m_eglConfigChosen;
-};
-
-} // namespace WebCore
-
-#endif // PLATFORM(WAYLAND)
-
-#endif // WaylandDisplay_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsx11PlatformDisplayX11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp (0 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+/*
+ * Copyright (C) 2015 Igalia S.L
+ *
+ * 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 AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 OR ITS 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;PlatformDisplayX11.h&quot;
+
+#if PLATFORM(X11)
+#include &lt;X11/Xlib.h&gt;
+
+namespace WebCore {
+
+PlatformDisplayX11::PlatformDisplayX11()
+    : m_display(XOpenDisplay(nullptr))
+    , m_ownedDisplay(true)
+{
+}
+
+PlatformDisplayX11::PlatformDisplayX11(Display* display)
+    : m_display(display)
+    , m_ownedDisplay(false)
+{
+}
+
+PlatformDisplayX11::~PlatformDisplayX11()
+{
+    if (m_ownedDisplay)
+        XCloseDisplay(m_display);
+}
+
+} // namespace WebCore
+
+#endif // PLATFORM(X11)
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsx11PlatformDisplayX11h"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h (0 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2015 Igalia S.L
+ *
+ * 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 AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 OR ITS 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 PlatformDisplayX11_h
+#define PlatformDisplayX11_h
+
+#if PLATFORM(X11)
+
+#include &quot;PlatformDisplay.h&quot;
+
+typedef struct _XDisplay Display;
+
+namespace WebCore {
+
+class PlatformDisplayX11 final : public PlatformDisplay {
+public:
+    PlatformDisplayX11();
+    PlatformDisplayX11(Display*);
+    virtual ~PlatformDisplayX11();
+
+    Display* native() const { return m_display; }
+
+private:
+    virtual Type type() const override { return PlatformDisplay::Type::X11; }
+
+    Display* m_display;
+    bool m_ownedDisplay;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_PLATFORM_DISPLAY(PlatformDisplayX11, X11)
+
+#endif // PLATFORM(X11)
+
+#endif // PlatformDisplayX11
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkGtkUtilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/GtkUtilities.cpp (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/GtkUtilities.cpp        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebCore/platform/gtk/GtkUtilities.cpp        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -24,13 +24,6 @@
</span><span class="cx"> #include &lt;wtf/gobject/GUniquePtr.h&gt;
</span><span class="cx"> #include &lt;wtf/gobject/GlibUtilities.h&gt;
</span><span class="cx"> 
</span><del>-#if PLATFORM(X11)
-#include &lt;gdk/gdkx.h&gt;
-#endif
-#if PLATFORM(WAYLAND) &amp;&amp; !defined(GTK_API_VERSION_2)
-#include &lt;gdk/gdkwayland.h&gt;
-#endif
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> IntPoint convertWidgetPointToScreenPoint(GtkWidget* widget, const IntPoint&amp; point)
</span><span class="lines">@@ -61,28 +54,6 @@
</span><span class="cx">     return gtk_widget_is_toplevel(widget) &amp;&amp; GTK_IS_WINDOW(widget) &amp;&amp; !GTK_IS_OFFSCREEN_WINDOW(widget);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-DisplaySystemType getDisplaySystemType()
-{
-#if defined(GTK_API_VERSION_2)
-    return DisplaySystemType::X11;
-#else
-    static DisplaySystemType type = [] {
-        GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
-#if PLATFORM(X11)
-        if (GDK_IS_X11_DISPLAY(display))
-            return DisplaySystemType::X11;
-#endif
-#if PLATFORM(WAYLAND)
-        if (GDK_IS_WAYLAND_DISPLAY(display))
-            return DisplaySystemType::Wayland;
-#endif
-        ASSERT_NOT_REACHED();
-        return DisplaySystemType::X11;
-    }();
-    return type;
-#endif
-}
-
</del><span class="cx"> #if defined(DEVELOPMENT_BUILD)
</span><span class="cx"> static CString topLevelPath()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkGtkUtilitiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/GtkUtilities.h (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/GtkUtilities.h        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebCore/platform/gtk/GtkUtilities.h        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -28,13 +28,6 @@
</span><span class="cx"> IntPoint convertWidgetPointToScreenPoint(GtkWidget*, const IntPoint&amp;);
</span><span class="cx"> bool widgetIsOnscreenToplevelWindow(GtkWidget*);
</span><span class="cx"> 
</span><del>-enum class DisplaySystemType {
-    X11,
-    Wayland
-};
-
-DisplaySystemType getDisplaySystemType();
-
</del><span class="cx"> #if defined(DEVELOPMENT_BUILD)
</span><span class="cx"> CString webkitBuildDirectory();
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebKit2/ChangeLog        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -1,5 +1,23 @@
</span><span class="cx"> 2015-05-03  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><ins>+        [GTK][EFL] Unify platform display handling
+        https://bugs.webkit.org/show_bug.cgi?id=144517
+
+        Reviewed by Martin Robinson.
+
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseRealize): Use PlatformDisplay::sharedDisplay()
+        to checkt the display type.
+        (webkitWebViewBaseCreateWebPage): Ditto.
+        * UIProcess/cairo/BackingStoreCairo.cpp:
+        (WebKit::BackingStore::createBackend): Pass the native X11 shared
+        display to BackingStoreBackendCairoX11.
+        * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
+        (WebKit::NetscapePlugin::x11HostDisplay): Return the native X11
+        shared display.
+
+2015-05-03  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
</ins><span class="cx">         Unreviewed. Fix Debug build with NETWORK_CACHE enabled and CACHE_PARTITIONING disabled.
</span><span class="cx"> 
</span><span class="cx">         * NetworkProcess/cache/NetworkCache.cpp:
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx"> #include &lt;WebCore/GtkVersioning.h&gt;
</span><span class="cx"> #include &lt;WebCore/NotImplemented.h&gt;
</span><span class="cx"> #include &lt;WebCore/PasteboardHelper.h&gt;
</span><ins>+#include &lt;WebCore/PlatformDisplay.h&gt;
</ins><span class="cx"> #include &lt;WebCore/RefPtrCairo.h&gt;
</span><span class="cx"> #include &lt;WebCore/Region.h&gt;
</span><span class="cx"> #include &lt;gdk/gdk.h&gt;
</span><span class="lines">@@ -320,8 +321,7 @@
</span><span class="cx">     WebKitWebViewBasePrivate* priv = webView-&gt;priv;
</span><span class="cx"> 
</span><span class="cx"> #if USE(REDIRECTED_XCOMPOSITE_WINDOW)
</span><del>-    GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
-    if (GDK_IS_X11_DISPLAY(display)) {
</del><ins>+    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11) {
</ins><span class="cx">         priv-&gt;redirectedWindow = RedirectedXCompositeWindow::create(
</span><span class="cx">             gtk_widget_get_parent_window(widget),
</span><span class="cx">             [webView] {
</span><span class="lines">@@ -1133,8 +1133,7 @@
</span><span class="cx"> #if PLATFORM(WAYLAND)
</span><span class="cx">     // FIXME: Accelerated compositing under Wayland is not yet supported.
</span><span class="cx">     // https://bugs.webkit.org/show_bug.cgi?id=115803
</span><del>-    GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
-    if (GDK_IS_WAYLAND_DISPLAY(display))
</del><ins>+    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland)
</ins><span class="cx">         preferences-&gt;setAcceleratedCompositingEnabled(false);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcesscairoBackingStoreCairocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebKit2/UIProcess/cairo/BackingStoreCairo.cpp        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK) &amp;&amp; PLATFORM(X11) &amp;&amp; defined(GDK_WINDOWING_X11)
</span><span class="cx"> #include &lt;WebCore/BackingStoreBackendCairoX11.h&gt;
</span><ins>+#include &lt;WebCore/PlatformDisplayX11.h&gt;
</ins><span class="cx"> #include &lt;gdk/gdkx.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -48,11 +49,12 @@
</span><span class="cx"> std::unique_ptr&lt;BackingStoreBackendCairo&gt; BackingStore::createBackend()
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(GTK) &amp;&amp; PLATFORM(X11)
</span><del>-    GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
-    if (GDK_IS_X11_DISPLAY(display)) {
</del><ins>+    const auto&amp; sharedDisplay = PlatformDisplay::sharedDisplay();
+    if (is&lt;PlatformDisplayX11&gt;(sharedDisplay)) {
</ins><span class="cx">         GdkVisual* visual = gtk_widget_get_visual(m_webPageProxy.viewWidget());
</span><span class="cx">         GdkScreen* screen = gdk_visual_get_screen(visual);
</span><del>-        return std::make_unique&lt;BackingStoreBackendCairoX11&gt;(GDK_SCREEN_XDISPLAY(screen), GDK_WINDOW_XID(gdk_screen_get_root_window(screen)),
</del><ins>+        ASSERT(downcast&lt;PlatformDisplayX11&gt;(sharedDisplay).native() == GDK_SCREEN_XDISPLAY(screen));
+        return std::make_unique&lt;BackingStoreBackendCairoX11&gt;(downcast&lt;PlatformDisplayX11&gt;(sharedDisplay).native(), GDK_WINDOW_XID(gdk_screen_get_root_window(screen)),
</ins><span class="cx">             GDK_VISUAL_XVISUAL(visual), gdk_visual_get_depth(visual), m_size, m_deviceScaleFactor);
</span><span class="cx">     }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsNetscapex11NetscapePluginX11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp (183730 => 183731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp        2015-05-03 10:14:55 UTC (rev 183730)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp        2015-05-03 15:20:34 UTC (rev 183731)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;WebEvent.h&quot;
</span><span class="cx"> #include &lt;WebCore/GraphicsContext.h&gt;
</span><span class="cx"> #include &lt;WebCore/NotImplemented.h&gt;
</span><ins>+#include &lt;WebCore/PlatformDisplayX11.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx"> #include &lt;gtk/gtk.h&gt;
</span><span class="lines">@@ -103,13 +104,7 @@
</span><span class="cx"> 
</span><span class="cx"> Display* NetscapePlugin::x11HostDisplay()
</span><span class="cx"> {
</span><del>-#if PLATFORM(GTK)
-    return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
-#elif PLATFORM(EFL) &amp;&amp; defined(HAVE_ECORE_X)
-    return static_cast&lt;Display*&gt;(ecore_x_display_get());
-#else
-    return 0;
-#endif
</del><ins>+    return downcast&lt;PlatformDisplayX11&gt;(PlatformDisplay::sharedDisplay()).native();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span></span></pre>
</div>
</div>

</body>
</html>