[GTK] Switch to a backing store approach for painting WebKitWebView
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Oct 2011 16:29:33 +0000 (16:29 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Oct 2011 16:29:33 +0000 (16:29 +0000)
commitd5812b22e34b0cebbca0eebc17f5322607929c28
treea4f10c8ac82469b6d1a130a154040e98bc01d4fc
parent42698a9c2e372e97980a0f6cf41f9885c4296f55
[GTK] Switch to a backing store approach for painting WebKitWebView
https://bugs.webkit.org/show_bug.cgi?id=70213

Reviewed by Gustavo Noronha Silva.

Source/WebCore:

No new tests. The changes to WebCore should not change
behavior. The changes in WebKit are covered by existing
tests.

* platform/cairo/WidgetBackingStore.h:
(WebCore::WidgetBackingStore::size): Added this getter for the size.
* platform/cairo/WidgetBackingStoreCairo.cpp:
(WebCore::WidgetBackingStore::WidgetBackingStore): Initialize size.
* platform/graphics/cairo/CairoUtilities.cpp:
(WebCore::copyRectFromCairoSurfaceToContext): Added this new helper.
(WebCore::copyRectFromOneSurfaceToAnother): Use the new helper.
* platform/graphics/cairo/CairoUtilities.h:
* platform/gtk/GtkWidgetBackingStoreX11.cpp:
(WebCore::WidgetBackingStore::WidgetBackingStore): Initialize the size.

Source/WebKit/gtk:

Paint the WebView into a backing store. This prevents expose events from
triggering a layout, making scrolling and resizing much smoother.

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::ChromeClient): Initialize new members.
(WebKit::repaintEverythingSoonTimeout): Added this helper which repaints
the WebView more quickly during resize events.
(WebKit::clipOutOldWidgetArea): Clips out the old widget area, so that we
can clear out invalid pixels when growing the widget into a pre-existing
backing store.
(WebKit::clearEverywhereInBackingStore): Clear out the entire backing store.
(WebKit::ChromeClient::widgetSizeChanged): Handle widget size changes by
intelligently resizing or reusing the existing backing store.
(WebKit::coalesceRectsIfPossible): Moved this method from webkitwebview.cpp.
(WebKit::paintWebView): Moved this method from webkitwebview.cpp.
(WebKit::ChromeClient::performAllPendingScrolls): If there are any pending
scrolling operations, perform them by scrolling the backing store.
(WebKit::ChromeClient::paint): Added this timer callback, which paints the
WebView after a short timeout.
(WebKit::ChromeClient::invalidateWindow): No need to do anything here any longer.
(WebKit::ChromeClient::invalidateContentsAndWindow): Now unite the rect with
the existing dirty region and queue the paint timeout.
(WebKit::ChromeClient::scroll): Now just queue a scroll event in the repaint timeout.
Intelligently calculate the area to move and the dirty area using code derived
from WebKit2.
* WebCoreSupport/ChromeClientGtk.h: Added new method definitions and also use
the WebCore namespace to avoid lots of uses of "WebCore::".
* webkit/webkitwebview.cpp:
(webkit_web_view_draw): Now just blit the backing store into the widget.
(webkit_web_view_expose): Ditto.
(webkit_web_view_size_allocate): Let the ChromeClient know the widget size changed.
(webkit_web_view_init): Turn off GDK double buffering as we have our own double
buffer.
* webkit/webkitwebviewprivate.h: Add the backing store member.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@98827 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/cairo/WidgetBackingStore.h
Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp
Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp
Source/WebCore/platform/graphics/cairo/CairoUtilities.h
Source/WebCore/platform/gtk/GtkWidgetBackingStoreX11.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
Source/WebKit/gtk/webkit/webkitwebview.cpp
Source/WebKit/gtk/webkit/webkitwebviewprivate.h