[Coordinated Graphics] Separate CoordinatedLayerTreeHost into CoordinatedLayerTreeHost and CompositingCoordinator
https://bugs.webkit.org/show_bug.cgi?id=104360

Reviewed by NOBODY (OOPS!).

The CoordinatedLayerTreeHost has too many responsibilities. It
implements LayerTreeHost, GraphicsLayerClient,
CoordinatedGraphicsLayerClient, CoordinatedImageBacking::Client,
UpdateAtlas::Client, GraphicsLayerFactory and
WebCustomFilterProgramProxyClient.

This refactoring reduces the responsibilities of CoordinatedLayerTreeHost.

This patch introduces a new class called CompositingCoordinator, which
takes the responsibility of managing compositing resources in
WebProcess.

CoordinatedLayerTreeHost now takes a part for scheduling and IPC
specific parts.

No new tests, covered by existing tests.
[WK2][GTK] Let DrawingArea manage setAcceleratedCompositingWindowId
https://bugs.webkit.org/show_bug.cgi?id=117230

Reviewed by NOBODY (OOPS!).

This is a preparation patch for Threaded Coordinated Graphics.

LayerTreeHostGtk uses a native window handle to make glContext for
accelerated compositing. Therefore it is natural for DrawingArea to take
responsibility for the native window handle. And, in Coordinated
Graphics case, WebPage creates LayerTreeHost before receiving a native
window handle from UIProcess. Therefore we need a method to set the
native window handle to already created LayerTreeHost.

This patch uses DrawingAreaProxy::setNativeCompositingSurfaceHandle
instead of WebCoreProxy::setAcceleratedCompositingWindowId to set window
ID for accelerated compositing.

Also, this patch renames the setAcceleratedCompositingWindowId with a
more generic name, setNativeCompositingSurfaceHandle.

No new tests. No change in functionality.
Implement ThreadSafeCoordinatedSurface.

Reviewed by NOBODY (OOPS!).

Additional information of the change such as approach, rationale. Please add per-function descriptions below (OOPS!).
[WK1][GTK] Add support to use Threaded Coordinated Graphics.
https://bugs.webkit.org/show_bug.cgi?id=117227

Reviewed by NOBODY (OOPS!).

This patch adds supports for the tiled backing store and the threaded
coordinated graphics, because coordianted graphics is
tightly coupled with tiled backing store.

By implementing ThreadedCoordinatedCompositor, accelerated compositing
using Coordinated Graphics in WebKit1 Gtk+ is enabled.
ThreadedCoordinatedCompositor sends commands to CoordinatedCompositingThread
which owns actual run-loop for compositing.

This patch also adds ThreadedCompositingContext in WebKit/gtk/WebCoreSupport,
to bind with webkit1 gtk port.

Threaded compositing is disabled as a default. To enable this feature,
--enable-threaded-compositor option should be passed to build script.

If we use threaded compositor without thread-safe XCB connection,
it corrupts xcb's message queue, and terminates the process.

To fix this problem, we needed to call XInitThreads before calling
gtk_init().

No new test, because it is in experimental stage.
[WK2][GTK] Implement threaded compositing for WebKit2 Gtk.
https://bugs.webkit.org/show_bug.cgi?id=100341

Reviewed by NOBODY (OOPS!).

By implementing ThreadedCoordinatedLayerTreeHost, this patch supports
threaded compositor for WK2. In this initial implementation, threaded
compositor only supports fixedLayout.

COORDINATED_GRAPHICS_IPC is introduced to classify IPC specific codes
from Coordinated Graphics.

Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp :
    Calls XInitThreads to use thread-safe xlib.

No new tests, this is an experimental feature.
[WK2][GTK] Apply scroll-offset and scale to mouse event in UIProcess.
https://bugs.webkit.org/show_bug.cgi?id=117232

Reviewed by NOBODY (OOPS!).

We need to apply scrolling and scaling to mouse event when we are in
delegatedScrolling. To do that, scroll-offset should be cached in
WebPageProxy, because mouse event should be transformed at its creation
time.

No new tests, covered by existing tests.