[TBS][FIX] Revert "Never blit invalid tile areas to screen"

This reverts commit f54485f870902d7c6bc9c13e0f0c12969d4be387.

Turns out that if invalidations are quick enough we may never have fully
valid contents in the backing store at drawing time: drawing those
contents one frame late seems better than not drawing anything at all.

This is particularly visible on http://www.smashcat.org/av/canvas_test/
where we often fail to blit anything to the screen for a few seconds
even though we are able to render to the backing store at ~5fps.

Since commit 25df468b52, the original reason why this commit was
introduced is no more (avoid glitches with position:fixed elements when
scrolling), so we can safely revert it.
[TBS] Don't bother ensuring valid tiles if the page is not fully loaded

When the contents are changing fast (eg. during page load) invalidations
keep hitting the backing store.

Since we're forcing layout/rendering on every scroll event to properly
account for position:fixed elements this means that the we force a
costly layout operation, not just a rendering.

Since we know that during page load we may likely end up in this
situation, avoid forcing the relayout from scroll events: this may
produce some temporary visual glitches when scrolling a not-fully-loaded
page with position:fixed elements where they get scrolled with the page,
but it's not worse than blocking the whole browser in lots of expensive
layout operations (and the page is likely to be half built anyway).
[FIX] Choose priorities closer to GDK_PRIORITY_REDRAW for timers and frames

We changed some event priorities to give more importance to the redraw
cycle over internal tasks, making sure that video frames don't starve
redraws and that JS cannot starve videos.

This commit streamlines two previous patches to have a more compact
priority distribution, such that:

priority(redraw)
  == GDK_PRIORITY_REDRAW      == G_PRIORITY_HIGH_IDLE+20 == 120 >
priority(video frames)
  == GDK_PRIORITY_REDRAW + 10 == G_PRIORITY_HIGH_IDLE+30 == 130 >
priority(internal timers)
  == GDK_PRIORITY_REDRAW + 20 == G_PRIORITY_HIGH_IDLE+40 == 140

(Small numbers have higher priority)

This should probably get folded with the original commits:
32497e29f3ba [SharedTimerGtk] set a lower priority than the gstreamer player
3a0830257566 [VideoSinkGStreamer] Lower video frame callback priority
[Soup] Lower the priority of network data callbacks

When a resource has been downloaded completely, callbacks usually invoke
ResourceLoader::didFinishLoading() which will carry on with potentially
expensive tasks such as executing JS, recomputing styles and layout when
receiving new CSS data, etc.

Since these tasks are run synchronously, they can block the mainloop
for a long period of time, up to a handful of seconds on machines with
slow CPUs.

By reducing the priority with which these callbacks are executed, we
ensure that there are no outstanding tasks (eg. input, redraw, internal
timers) before starting those potentially blocking operations.

For the GTK port we now have:

priority(input)
  == GDK_PRIORITY_EVENTS      == G_PRIORITY_DEFAULT      ==   0 >
priority(redraw)
  == GDK_PRIORITY_REDRAW      == G_PRIORITY_HIGH_IDLE+20 == 120 >
priority(video frames)
  == GDK_PRIORITY_REDRAW + 10 == G_PRIORITY_HIGH_IDLE+30 == 130 >
priority(internal timers)
  == GDK_PRIORITY_REDRAW + 20 == G_PRIORITY_HIGH_IDLE+40 == 140 >
priority(network completion)
  == GDK_PRIORITY_REDRAW + 30 == G_PRIORITY_HIGH_IDLE+50 == 150
[webkitwebview] Add canary to prevent starving lower prio sources

Add a timeout source running with priority just below the redraw one
(GDK_PRIORITY_REDRAW+1, lower values gets serviced first) to make sure
that failing to keep up with animations won't completely starve other
sources like internal/JS timers and network data completion operations.

If we detect that the source has been starved, reschedule the painting
to give a chance to other sources to run.
[TBS] Don't force coverWithTilesIfNeeded() during document load

While the document is loaded progressively the contents size is expected
to change a lot. Since for hit-testing purpose every mouse movements
calls Document::updateLayout(), this may lead to
coverWithTilesIfNeeded() causing a full rendering several time during
load, degrading performance considerably.
[ChromeClientGtk] Suspend JS, animations and relayouts when scrolling

When a scroll is initiated and the document is not fully loaded, we now
try to suspend as many activities (like JavaScript, animations and
relayouts) as possible to free some CPU and make scrolling more
responsive.

We then reactivate everything once no scroll has been performed for some
arbitrary delay (currently set to 0.5s).
[TBS][FIX] Revert "Don't bother ensuring valid tiles if the page is not fully loaded"

This reverts commit f58e048463dc6cba647d2434a4f3f7f5742197dc.

Now that with the previous commit we're preventing layout from happening
during scroll while the document is loading, updating the tiles is no
longer prohibitively costly and we can afford to do it for each scroll
motion.
[DiskMemoryCache][MemoryPressureHandler] Destroy threads when they're useless.

DiskMemoryCache and MemoryPressureHandler create threads to run their functionalities through,
there is nowhere destroying them.
[DiskImageCache] Don't use diskImageCache for gif animation.

DiskImageCache creates cache files for every single frame of gif animation.
It makes system pretty busy and causes conflicts with existing cache files.
[DirectPaint] Do not intersect video rect against player size

This is needed cause the player size is always the video size, but does
not consider any padding/offset used on the video frame.

The video rect should be considered the invalidated area on direct
paint, which also includes any frame around the video.
[DirectPaint] Use frameView to paint video/player even no controls are visible

This is needed cause player->paint does not consider any offset
inside the video content box area, thus painting the video in the
wrong position.
[DirectPaint] Also apply scale to GC when no player is available
[GraphicsContextCairo] Also translate video/skip rect when translating GC

This is specially needed when drawing a video inside an iframe for
example where the GC is translated to a position relative to the iframe
(instead of absolute), thus causing issues when skipping the video area
when doing a fillRect().