Skip to content

Commit

Permalink
Merge r178414 - [GTK] Do not resize the redirected XComposite window …
Browse files Browse the repository at this point in the history
…when not in accelerated compositing mode

https://bugs.webkit.org/show_bug.cgi?id=140353

Reviewed by Martin Robinson.

We create the redirected XComposite window unconditionally, but
with a size of 1x1 to save memory. However, we are always resizing
it, so in the end we always end up with a XWindow allocated for
the same size of the web view, even for web views that never enter
in accelerated compositing mode.

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewRenderAcceleratedCompositingResults): Resize the
RedirectedXCompositeWindow to the current web view size to ensure
the sizes match before drawing.
(resizeWebKitWebViewBaseFromAllocation): Only resize the
RedirectedXCompositeWindow when in accelerated compositing mode.
* UIProcess/gtk/RedirectedXCompositeWindow.cpp:
(WebKit::RedirectedXCompositeWindow::resize): Return early if the
given size is the current size.

Canonical link: https://commits.webkit.org/154760.292@webkitgtk/2.6
git-svn-id: https://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@178502 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos committed Jan 15, 2015
1 parent 0100336 commit bc27ea5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp
Expand Up @@ -174,6 +174,9 @@ RedirectedXCompositeWindow::~RedirectedXCompositeWindow()

void RedirectedXCompositeWindow::resize(const IntSize& size)
{
if (size == m_size)
return;

Display* display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
XResizeWindow(display, m_window, size.width(), size.height());

Expand Down
23 changes: 23 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,26 @@
2015-01-14 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] Do not resize the redirected XComposite window when not in accelerated compositing mode
https://bugs.webkit.org/show_bug.cgi?id=140353

Reviewed by Martin Robinson.

We create the redirected XComposite window unconditionally, but
with a size of 1x1 to save memory. However, we are always resizing
it, so in the end we always end up with a XWindow allocated for
the same size of the web view, even for web views that never enter
in accelerated compositing mode.

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewRenderAcceleratedCompositingResults): Resize the
RedirectedXCompositeWindow to the current web view size to ensure
the sizes match before drawing.
(resizeWebKitWebViewBaseFromAllocation): Only resize the
RedirectedXCompositeWindow when in accelerated compositing mode.
* UIProcess/gtk/RedirectedXCompositeWindow.cpp:
(WebKit::RedirectedXCompositeWindow::resize): Return early if the
given size is the current size.

2014-12-11 Alexey Proskuryakov <ap@apple.com>

REGRESSION (Async Text Input): Text input method state is not reset when reloading a page
Expand Down
24 changes: 16 additions & 8 deletions Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
Expand Up @@ -436,6 +436,8 @@ static void webkitWebViewBaseConstructed(GObject* object)
#if USE(TEXTURE_MAPPER_GL)
static bool webkitWebViewRenderAcceleratedCompositingResults(WebKitWebViewBase* webViewBase, DrawingAreaProxyImpl* drawingArea, cairo_t* cr, GdkRectangle* clipRect)
{
ASSERT(drawingArea);

if (!drawingArea->isInAcceleratedCompositingMode())
return false;

Expand All @@ -446,10 +448,14 @@ static bool webkitWebViewRenderAcceleratedCompositingResults(WebKitWebViewBase*
if (!priv->redirectedWindow)
return false;

cairo_rectangle(cr, clipRect->x, clipRect->y, clipRect->width, clipRect->height);
cairo_surface_t* surface = priv->redirectedWindow->cairoSurfaceForWidget(GTK_WIDGET(webViewBase));
cairo_set_source_surface(cr, surface, 0, 0);
cairo_fill(cr);
priv->redirectedWindow->resize(drawingArea->size());

if (cairo_surface_t* surface = priv->redirectedWindow->cairoSurfaceForWidget(GTK_WIDGET(webViewBase))) {
cairo_rectangle(cr, clipRect->x, clipRect->y, clipRect->width, clipRect->height);
cairo_set_source_surface(cr, surface, 0, 0);
cairo_fill(cr);
}

return true;
#else
return false;
Expand Down Expand Up @@ -545,13 +551,15 @@ static void resizeWebKitWebViewBaseFromAllocation(WebKitWebViewBase* webViewBase
gtk_widget_size_allocate(priv->authenticationDialog, &childAllocation);
}

DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());

#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
if (sizeChanged && webViewBase->priv->redirectedWindow)
webViewBase->priv->redirectedWindow->resize(viewRect.size());
if (sizeChanged && priv->redirectedWindow && drawingArea && drawingArea->isInAcceleratedCompositingMode())
priv->redirectedWindow->resize(viewRect.size());
#endif

if (priv->pageProxy->drawingArea())
priv->pageProxy->drawingArea()->setSize(viewRect.size(), IntSize(), IntSize());
if (drawingArea)
drawingArea->setSize(viewRect.size(), IntSize(), IntSize());

#if !GTK_CHECK_VERSION(3, 13, 4)
webkitWebViewBaseNotifyResizerSize(webViewBase);
Expand Down

0 comments on commit bc27ea5

Please sign in to comment.