Cross fade into restarted plugin
https://bugs.webkit.org/show_bug.cgi?id=113868

Reviewed by Tim Horton.

Source/WebCore:

Allow a restarted plugin to fade in over its snapshot, avoiding the abrupt
flash of empty content. The WebCore part of this patch marks the plugin
element as restarted, and draws the snapshot for a short amount of time
as the plugin is restarting. After the plugin has reappeared, we stop drawing
the snapshot.

There is a little bit of drive-by whitespace removal in HTMLPlugInImageElement.

* html/HTMLPlugInElement.h:
(WebCore::HTMLPlugInElement::restartedPlugin): New method indicating if the plugin has been restarted.
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): Initialise new timer and member variable.
(WebCore::HTMLPlugInImageElement::setDisplayState): If we are moving into a restarting state, make sure
    to remember this and also start a timer so that we show the snapshot for while.
(WebCore::HTMLPlugInImageElement::removeSnapshotTimerFired): No need to draw the snapshot from here on.
* html/HTMLPlugInImageElement.h:
(HTMLPlugInImageElement): Member variable to remember if we've restarted.
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::paintContents): Only exit early from the paint if we're not a restarting
    plugin, otherwise we do want to draw the snapshot if there is one.
* rendering/RenderLayerBacking.cpp:
(WebCore::isRestartedPlugin): Detects a restarted plugin.
(WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer): Don't become a simple container
    compositing layer if you're a restarted plugin.

Source/WebKit2:

Add a new plugin process type that indicates this is a plugin that
has been restarted from snapshotting. On Apple ports, this allows
us to animate the appearance of the plugin so that it crossfades
with the snapshot. Other ports will have to add their own fading.

* PluginProcess/PluginProcess.h: New Type: TypeRestartedProcess.
* WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
(WebKit::PluginProxy::pluginLayer): When the plugin's CALayer is created, if it
    is a restarted plugin, add an opacity animation to fade it in.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createPlugin): Mark restarted plugins with the new process type.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147579 268f45cc-cd09-0410-ab3c-d52691b4dbfc