Changeset 203496 in webkit
- Timestamp:
- Jul 21, 2016 12:18:03 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r203495 r203496 1 2016-07-21 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Web view background colors don't work in accelerated compositing mode 4 https://bugs.webkit.org/show_bug.cgi?id=159455 5 6 Reviewed by Michael Catanzaro. 7 8 In non AC mode it's the drawing area backing store the one drawing the background, and the web process just 9 renders into a transparent bitmap. In AC mode we need to make the redirected window pixmap transparent for the 10 web process to render there, and let the web view fill the background color before rendering the redirected 11 window pixmap on top. To be able to make the redirected window surface transparent, we need to ensure the parent 12 window has an RGBA visual, even when setting a fully opaque background, because we still need the web process 13 to render on the transparent xwindow. 14 15 * UIProcess/API/gtk/WebKitWebView.cpp: Update documentation of webkit_web_view_set_background_color() since now 16 it's required to set the RGBA visual even for opaque colors in case AC mode is enabled. 17 * UIProcess/API/gtk/WebKitWebViewBase.cpp: 18 (webkitWebViewRenderAcceleratedCompositingResults): When a background color has been set, fill it before 19 rendering the redirected window surface. 20 * UIProcess/gtk/RedirectedXCompositeWindow.cpp: 21 (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Mark the surface as dirty after every damage 22 event, since the web process has modified it. 23 (WebKit::RedirectedXCompositeWindow::surface): Initialize the surface after creating it, to avoid flickering and 24 rendering artifacts when waiting for the first damage event from the web process. 25 * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp: 26 (WebKit::LayerTreeHostGtk::compositeLayersToContext): Use a fully transparent color to clear the context when the page 27 is resized or when a view background color has been set. 28 1 29 2016-07-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 30 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
r202242 r203496 3516 3516 * specifies a background color, it will take precedence over the @rgba color. 3517 3517 * By default the @web_view background color is opaque white. 3518 * If the @rgba color is not fully opaque,the parent window must have a RGBA visual and3519 * #GtkWidget:app-paintable property set to %TRUE , for the transparencies to work.3518 * Note that the parent window must have a RGBA visual and 3519 * #GtkWidget:app-paintable property set to %TRUE for backgrounds colors to work. 3520 3520 * 3521 3521 * <informalexample><programlisting> … … 3524 3524 * { 3525 3525 * WebKitWebView *web_view; 3526 * 3527 * if (rgba->alpha < 1) { 3528 * GdkScreen *screen = gtk_window_get_screen (GTK_WINDOW (window)); 3529 * GdkVisual *rgba_visual = gdk_screen_get_rgba_visual (screen); 3530 * 3531 * if (!rgba_visual) 3532 * return; 3533 * 3534 * gtk_widget_set_visual (GTK_WIDGET (window), rgba_visual); 3535 * gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE); 3536 * } 3526 * GdkScreen *screen = gtk_window_get_screen (GTK_WINDOW (window)); 3527 * GdkVisual *rgba_visual = gdk_screen_get_rgba_visual (screen); 3528 * 3529 * if (!rgba_visual) 3530 * return; 3531 * 3532 * gtk_widget_set_visual (GTK_WIDGET (window), rgba_visual); 3533 * gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE); 3537 3534 * 3538 3535 * web_view = browser_window_get_web_view (window); -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
r203495 r203496 593 593 if (cairo_surface_t* surface = priv->redirectedWindow->surface()) { 594 594 cairo_save(cr); 595 596 if (!priv->pageProxy->drawsBackground()) { 597 const WebCore::Color& color = priv->pageProxy->backgroundColor(); 598 if (color.hasAlpha()) { 599 cairo_rectangle(cr, clipRect->x, clipRect->y, clipRect->width, clipRect->height); 600 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); 601 cairo_fill(cr); 602 } 603 604 if (color.alpha() > 0) { 605 setSourceRGBAFromColor(cr, color); 606 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); 607 cairo_rectangle(cr, clipRect->x, clipRect->y, clipRect->width, clipRect->height); 608 cairo_fill(cr); 609 } 610 } 611 595 612 cairo_rectangle(cr, clipRect->x, clipRect->y, clipRect->width, clipRect->height); 596 613 cairo_set_source_surface(cr, surface, 0, 0); 597 cairo_set_operator(cr, CAIRO_OPERATOR_ SOURCE);614 cairo_set_operator(cr, CAIRO_OPERATOR_OVER); 598 615 cairo_fill(cr); 616 599 617 cairo_restore(cr); 600 618 } -
trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp
r203495 r203496 190 190 XMapWindow(m_display, m_window.get()); 191 191 192 xDamageNotifier().add(m_window.get(), WTFMove(damageNotify)); 192 xDamageNotifier().add(m_window.get(), [this, damageNotify = WTFMove(damageNotify)] { 193 // The surface has been modified by the web process, mark it as dirty. 194 if (m_surface) 195 cairo_surface_mark_dirty(m_surface.get()); 196 damageNotify(); 197 }); 193 198 194 199 while (1) { … … 270 275 271 276 RefPtr<cairo_t> cr = adoptRef(cairo_create(newSurface.get())); 272 cairo_set_source_rgb(cr.get(), 1, 1, 1); 277 if (!m_webPage.drawsBackground()) 278 cairo_set_operator(cr.get(), CAIRO_OPERATOR_CLEAR); 279 else 280 setSourceRGBAFromColor(cr.get(), m_webPage.backgroundColor()); 273 281 cairo_paint(cr.get()); 274 282 … … 278 286 // pixmap to the new one to properly initialize it. 279 287 if (m_surface) { 288 cairo_set_operator(cr.get(), CAIRO_OPERATOR_OVER); 280 289 cairo_set_source_surface(cr.get(), m_surface.get(), 0, 0); 281 290 cairo_paint(cr.get()); -
trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp
r202621 r203496 314 314 IntSize contextSize = m_context->defaultFrameBufferSize(); 315 315 glViewport(0, 0, contextSize.width(), contextSize.height()); 316 317 if (purpose == ForResize) { 318 glClearColor(1, 1, 1, 0); 316 if (purpose == ForResize || !m_webPage.drawsBackground()) { 317 glClearColor(0, 0, 0, 0); 319 318 glClear(GL_COLOR_BUFFER_BIT); 320 319 } -
trunk/Tools/ChangeLog
r203489 r203496 1 2016-07-21 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Web view background colors don't work in accelerated compositing mode 4 https://bugs.webkit.org/show_bug.cgi?id=159455 5 6 Reviewed by Michael Catanzaro. 7 8 Set always RGBA visual to the view widget when setting a background color. 9 10 * MiniBrowser/gtk/BrowserWindow.c: 11 (browser_window_set_background_color): 12 1 13 2016-07-20 Youenn Fablet <youenn@apple.com> 2 14 -
trunk/Tools/MiniBrowser/gtk/BrowserWindow.c
r203271 r203496 1070 1070 return; 1071 1071 1072 if (rgba->alpha < 1) { 1073 GdkVisual *rgbaVisual = gdk_screen_get_rgba_visual(gtk_window_get_screen(GTK_WINDOW(window))); 1074 if (!rgbaVisual) 1075 return; 1076 1077 gtk_widget_set_visual(GTK_WIDGET(window), rgbaVisual); 1078 gtk_widget_set_app_paintable(GTK_WIDGET(window), TRUE); 1079 } 1072 GdkVisual *rgbaVisual = gdk_screen_get_rgba_visual(gtk_window_get_screen(GTK_WINDOW(window))); 1073 if (!rgbaVisual) 1074 return; 1075 1076 gtk_widget_set_visual(GTK_WIDGET(window), rgbaVisual); 1077 gtk_widget_set_app_paintable(GTK_WIDGET(window), TRUE); 1080 1078 1081 1079 webkit_web_view_set_background_color(webView, rgba);
Note: See TracChangeset
for help on using the changeset viewer.