Changeset 177075 in webkit


Ignore:
Timestamp:
Dec 10, 2014 9:42:55 AM (9 years ago)
Author:
Martin Robinson
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.isorce@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:
Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r177073 r177075  
     12014-12-10  Julien Isorce  <j.isorce@samsung.com>
     2
     3        [GTK] Enable depth 32 for the RedirectedXCompositeWindow
     4        https://bugs.webkit.org/show_bug.cgi?id=139028
     5
     6        On gtk/X11, the layout compositing is done in the web process.
     7        If one needs to handle alpha with the rest of the application
     8        then it is not enough to make to browser's window as RGBA.
     9        The shared redirected window needs to be RGBA as well.
     10        (The shared X composite window between UIProcess and WebProcess).
     11
     12        This allows an end-to-end RGBA solution when the application
     13        wants to interact with the alpha channel at compositing time.
     14        For example for transparent Web UI.
     15
     16        Reviewed by Martin Robinson.
     17
     18        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
     19        (webkitWebViewBaseRealize):
     20        (webkitWebViewBaseConstructed):
     21        (webkitWebViewRenderAcceleratedCompositingResults):
     22        (webkitWebViewBaseUpdatePreferences):
     23        (webkitWebViewBaseCreateWebPage):
     24        * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
     25        (WebKit::RedirectedXCompositeWindow::create):
     26        (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow):
     27        * UIProcess/gtk/RedirectedXCompositeWindow.h:
     28
    1292014-12-09  Claudio Saavedra  <csaavedra@igalia.com> and Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
    230
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp

    r176954 r177075  
    256256static void webkitWebViewBaseRealize(GtkWidget* widget)
    257257{
     258#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
     259    GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
     260    if (GDK_IS_X11_DISPLAY(display)) {
     261        WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv;
     262        GdkWindow* parentWindow = gtk_widget_get_parent_window(widget);
     263        priv->redirectedWindow = RedirectedXCompositeWindow::create(
     264            GDK_DISPLAY_XDISPLAY(display),
     265            parentWindow ? GDK_WINDOW_XID(parentWindow) : 0,
     266            IntSize(1, 1),
     267            [widget] {
     268                gtk_widget_queue_draw(widget);
     269            });
     270        if (priv->redirectedWindow) {
     271            DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());
     272            drawingArea->setNativeSurfaceHandleForCompositing(priv->redirectedWindow->windowID());
     273        }
     274        webkitWebViewBaseUpdatePreferences(WEBKIT_WEB_VIEW_BASE(widget));
     275    }
     276#endif
     277
    258278    gtk_widget_set_realized(widget, TRUE);
    259279
     
    428448    WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(object)->priv;
    429449    priv->pageClient = PageClientImpl::create(viewWidget);
    430 
    431 #if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
    432     GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
    433     if (GDK_IS_X11_DISPLAY(display))
    434         priv->redirectedWindow = RedirectedXCompositeWindow::create(GDK_DISPLAY_XDISPLAY(display), IntSize(1, 1), [viewWidget] { gtk_widget_queue_draw(viewWidget); });
    435 #endif
    436 
    437450    priv->authenticationDialog = 0;
    438451}
     
    454467        cairo_rectangle(cr, clipRect->x, clipRect->y, clipRect->width, clipRect->height);
    455468        cairo_set_source_surface(cr, surface, 0, 0);
     469        cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
    456470        cairo_fill(cr);
    457471    }
     
    10281042
    10291043#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
    1030     if (priv->redirectedWindow)
    1031         return;
    1032 #endif
    1033 
    1034     priv->pageProxy->preferences().setAcceleratedCompositingEnabled(false);
     1044    bool acceleratedCompositingEnabled = priv->redirectedWindow ? true : false;
     1045#else
     1046    bool acceleratedCompositingEnabled = false;
     1047#endif
     1048
     1049    priv->pageProxy->preferences().setAcceleratedCompositingEnabled(acceleratedCompositingEnabled);
    10351050}
    10361051
     
    10551070
    10561071    priv->inputMethodFilter.setPage(priv->pageProxy.get());
    1057 
    1058 #if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
    1059     if (priv->redirectedWindow) {
    1060         DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());
    1061         drawingArea->setNativeSurfaceHandleForCompositing(priv->redirectedWindow->windowID());
    1062     }
    1063 #endif
    10641072
    10651073#if HAVE(GTK_SCALE_FACTOR)
  • trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp

    r176016 r177075  
    127127}
    128128
    129 std::unique_ptr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(Display* display, const IntSize& size, std::function<void()> damageNotify)
    130 {
    131     return supportsXDamageAndXComposite(display) ? std::unique_ptr<RedirectedXCompositeWindow>(new RedirectedXCompositeWindow(display, size, damageNotify)) : nullptr;
    132 }
    133 
    134 RedirectedXCompositeWindow::RedirectedXCompositeWindow(Display* display, const IntSize& size, std::function<void()> damageNotify)
     129std::unique_ptr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(Display* display, Window parent, const IntSize& size, std::function<void()> damageNotify)
     130{
     131    return supportsXDamageAndXComposite(display) ? std::unique_ptr<RedirectedXCompositeWindow>(new RedirectedXCompositeWindow(display, parent, size, damageNotify)) : nullptr;
     132}
     133
     134RedirectedXCompositeWindow::RedirectedXCompositeWindow(Display* display, Window parent, const IntSize& size, std::function<void()> damageNotify)
    135135    : m_display(display)
    136136    , m_size(size)
     
    147147    windowAttributes.override_redirect = True;
    148148    m_parentWindow = XCreateWindow(display,
    149         RootWindowOfScreen(screen),
     149        parent ? parent : RootWindowOfScreen(screen),
    150150        WidthOfScreen(screen) + 1, 0, 1, 1,
    151151        0,
     
    156156        &windowAttributes);
    157157    XMapWindow(display, m_parentWindow);
     158
     159    // The top parent is only necessary to copy from parent the visual and depth at creation time.
     160    if (parent)
     161        XReparentWindow(display, m_parentWindow, RootWindowOfScreen(screen), WidthOfScreen(screen) + 1, 0);
    158162
    159163    windowAttributes.event_mask = StructureNotifyMask;
  • trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.h

    r176118 r177075  
    4343class RedirectedXCompositeWindow {
    4444public:
    45     static std::unique_ptr<RedirectedXCompositeWindow> create(Display*, const WebCore::IntSize&, std::function<void()> damageNotify);
     45    static std::unique_ptr<RedirectedXCompositeWindow> create(Display*, Window parent, const WebCore::IntSize&, std::function<void()> damageNotify);
    4646    ~RedirectedXCompositeWindow();
    4747
     
    5151
    5252private:
    53     RedirectedXCompositeWindow(Display*, const WebCore::IntSize&, std::function<void()> damageNotify);
     53    RedirectedXCompositeWindow(Display*, Window parent, const WebCore::IntSize&, std::function<void()> damageNotify);
    5454    void cleanupPixmapAndPixmapSurface();
    5555
Note: See TracChangeset for help on using the changeset viewer.