- Revision
- 177075
- Author
- mrobin...@webkit.org
- Date
- 2014-12-10 09:42:55 -0800 (Wed, 10 Dec 2014)
Log Message
[GTK] Enable depth 32 for the RedirectedXCompositeWindow
https://bugs.webkit.org/show_bug.cgi?id=139028
On gtk/X11, the layout compositing is done in the web process.
If one needs to handle alpha with the rest of the application
then it is not enough to make to browser's window as RGBA.
The shared redirected window needs to be RGBA as well.
(The shared X composite window between UIProcess and WebProcess).
This allows an end-to-end RGBA solution when the application
wants to interact with the alpha channel at compositing time.
For example for transparent Web UI.
Patch by Julien Isorce <j.iso...@samsung.com> on 2014-12-10
Reviewed by Martin Robinson.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseRealize):
(webkitWebViewBaseConstructed):
(webkitWebViewRenderAcceleratedCompositingResults):
(webkitWebViewBaseUpdatePreferences):
(webkitWebViewBaseCreateWebPage):
* UIProcess/gtk/RedirectedXCompositeWindow.cpp:
(WebKit::RedirectedXCompositeWindow::create):
(WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow):
* UIProcess/gtk/RedirectedXCompositeWindow.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (177074 => 177075)
--- trunk/Source/WebKit2/ChangeLog 2014-12-10 17:42:45 UTC (rev 177074)
+++ trunk/Source/WebKit2/ChangeLog 2014-12-10 17:42:55 UTC (rev 177075)
@@ -1,3 +1,31 @@
+2014-12-10 Julien Isorce <j.iso...@samsung.com>
+
+ [GTK] Enable depth 32 for the RedirectedXCompositeWindow
+ https://bugs.webkit.org/show_bug.cgi?id=139028
+
+ On gtk/X11, the layout compositing is done in the web process.
+ If one needs to handle alpha with the rest of the application
+ then it is not enough to make to browser's window as RGBA.
+ The shared redirected window needs to be RGBA as well.
+ (The shared X composite window between UIProcess and WebProcess).
+
+ This allows an end-to-end RGBA solution when the application
+ wants to interact with the alpha channel at compositing time.
+ For example for transparent Web UI.
+
+ Reviewed by Martin Robinson.
+
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (webkitWebViewBaseRealize):
+ (webkitWebViewBaseConstructed):
+ (webkitWebViewRenderAcceleratedCompositingResults):
+ (webkitWebViewBaseUpdatePreferences):
+ (webkitWebViewBaseCreateWebPage):
+ * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
+ (WebKit::RedirectedXCompositeWindow::create):
+ (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow):
+ * UIProcess/gtk/RedirectedXCompositeWindow.h:
+
2014-12-09 Claudio Saavedra <csaave...@igalia.com> and Gustavo Noronha Silva <gustavo.noro...@collabora.com>
[GTK][WK2] Add HTML5 Notifications support
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (177074 => 177075)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp 2014-12-10 17:42:45 UTC (rev 177074)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp 2014-12-10 17:42:55 UTC (rev 177075)
@@ -255,6 +255,26 @@
static void webkitWebViewBaseRealize(GtkWidget* widget)
{
+#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
+ GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
+ if (GDK_IS_X11_DISPLAY(display)) {
+ WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv;
+ GdkWindow* parentWindow = gtk_widget_get_parent_window(widget);
+ priv->redirectedWindow = RedirectedXCompositeWindow::create(
+ GDK_DISPLAY_XDISPLAY(display),
+ parentWindow ? GDK_WINDOW_XID(parentWindow) : 0,
+ IntSize(1, 1),
+ [widget] {
+ gtk_widget_queue_draw(widget);
+ });
+ if (priv->redirectedWindow) {
+ DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());
+ drawingArea->setNativeSurfaceHandleForCompositing(priv->redirectedWindow->windowID());
+ }
+ webkitWebViewBaseUpdatePreferences(WEBKIT_WEB_VIEW_BASE(widget));
+ }
+#endif
+
gtk_widget_set_realized(widget, TRUE);
GtkAllocation allocation;
@@ -427,13 +447,6 @@
WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(object)->priv;
priv->pageClient = PageClientImpl::create(viewWidget);
-
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
- GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
- if (GDK_IS_X11_DISPLAY(display))
- priv->redirectedWindow = RedirectedXCompositeWindow::create(GDK_DISPLAY_XDISPLAY(display), IntSize(1, 1), [viewWidget] { gtk_widget_queue_draw(viewWidget); });
-#endif
-
priv->authenticationDialog = 0;
}
@@ -453,6 +466,7 @@
if (cairo_surface_t* surface = priv->redirectedWindow->surface()) {
cairo_rectangle(cr, clipRect->x, clipRect->y, clipRect->width, clipRect->height);
cairo_set_source_surface(cr, surface, 0, 0);
+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
cairo_fill(cr);
}
@@ -1027,11 +1041,12 @@
WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
- if (priv->redirectedWindow)
- return;
+ bool acceleratedCompositingEnabled = priv->redirectedWindow ? true : false;
+#else
+ bool acceleratedCompositingEnabled = false;
#endif
- priv->pageProxy->preferences().setAcceleratedCompositingEnabled(false);
+ priv->pageProxy->preferences().setAcceleratedCompositingEnabled(acceleratedCompositingEnabled);
}
#if HAVE(GTK_SCALE_FACTOR)
@@ -1055,13 +1070,6 @@
priv->inputMethodFilter.setPage(priv->pageProxy.get());
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
- if (priv->redirectedWindow) {
- DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());
- drawingArea->setNativeSurfaceHandleForCompositing(priv->redirectedWindow->windowID());
- }
-#endif
-
#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)));
Modified: trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp (177074 => 177075)
--- trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp 2014-12-10 17:42:45 UTC (rev 177074)
+++ trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp 2014-12-10 17:42:55 UTC (rev 177075)
@@ -126,12 +126,12 @@
return true;
}
-std::unique_ptr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(Display* display, const IntSize& size, std::function<void()> damageNotify)
+std::unique_ptr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(Display* display, Window parent, const IntSize& size, std::function<void()> damageNotify)
{
- return supportsXDamageAndXComposite(display) ? std::unique_ptr<RedirectedXCompositeWindow>(new RedirectedXCompositeWindow(display, size, damageNotify)) : nullptr;
+ return supportsXDamageAndXComposite(display) ? std::unique_ptr<RedirectedXCompositeWindow>(new RedirectedXCompositeWindow(display, parent, size, damageNotify)) : nullptr;
}
-RedirectedXCompositeWindow::RedirectedXCompositeWindow(Display* display, const IntSize& size, std::function<void()> damageNotify)
+RedirectedXCompositeWindow::RedirectedXCompositeWindow(Display* display, Window parent, const IntSize& size, std::function<void()> damageNotify)
: m_display(display)
, m_size(size)
, m_window(0)
@@ -146,7 +146,7 @@
XSetWindowAttributes windowAttributes;
windowAttributes.override_redirect = True;
m_parentWindow = XCreateWindow(display,
- RootWindowOfScreen(screen),
+ parent ? parent : RootWindowOfScreen(screen),
WidthOfScreen(screen) + 1, 0, 1, 1,
0,
CopyFromParent,
@@ -156,6 +156,10 @@
&windowAttributes);
XMapWindow(display, m_parentWindow);
+ // The top parent is only necessary to copy from parent the visual and depth at creation time.
+ if (parent)
+ XReparentWindow(display, m_parentWindow, RootWindowOfScreen(screen), WidthOfScreen(screen) + 1, 0);
+
windowAttributes.event_mask = StructureNotifyMask;
windowAttributes.override_redirect = False;
m_window = XCreateWindow(display,
Modified: trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.h (177074 => 177075)
--- trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.h 2014-12-10 17:42:45 UTC (rev 177074)
+++ trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.h 2014-12-10 17:42:55 UTC (rev 177075)
@@ -42,7 +42,7 @@
class RedirectedXCompositeWindow {
public:
- static std::unique_ptr<RedirectedXCompositeWindow> create(Display*, const WebCore::IntSize&, std::function<void()> damageNotify);
+ static std::unique_ptr<RedirectedXCompositeWindow> create(Display*, Window parent, const WebCore::IntSize&, std::function<void()> damageNotify);
~RedirectedXCompositeWindow();
Window windowID() const { return m_window; }
@@ -50,7 +50,7 @@
cairo_surface_t* surface();
private:
- RedirectedXCompositeWindow(Display*, const WebCore::IntSize&, std::function<void()> damageNotify);
+ RedirectedXCompositeWindow(Display*, Window parent, const WebCore::IntSize&, std::function<void()> damageNotify);
void cleanupPixmapAndPixmapSurface();
Display* m_display;