Diff
Modified: trunk/LayoutTests/ChangeLog (152579 => 152580)
--- trunk/LayoutTests/ChangeLog 2013-07-11 22:33:11 UTC (rev 152579)
+++ trunk/LayoutTests/ChangeLog 2013-07-11 23:53:40 UTC (rev 152580)
@@ -1,3 +1,14 @@
+2013-07-10 Roger Fong <[email protected]>
+
+ Plugins that don't support snapshotting should not all autostart.
+ https://bugs.webkit.org/show_bug.cgi?id=118572
+ <rdar://problem/14324391>.
+
+ Reviewed by Dean Jackson.
+
+ * platform/mac-wk2/plugins/snapshotting/quicktime-plugin-snapshotted-expected.txt: Added.
+ * plugins/snapshotting/quicktime-plugin-snapshotted.html: Added.
+
2013-07-11 Mario Sanchez Prada <[email protected]>
[GTK] Unreviewed gardening. Added expected failures after r152574.
Added: trunk/LayoutTests/platform/mac-wk2/plugins/snapshotting/quicktime-plugin-snapshotted-expected.txt (0 => 152580)
--- trunk/LayoutTests/platform/mac-wk2/plugins/snapshotting/quicktime-plugin-snapshotted-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/plugins/snapshotting/quicktime-plugin-snapshotted-expected.txt 2013-07-11 23:53:40 UTC (rev 152580)
@@ -0,0 +1,14 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {P} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 784x36
+ text run at (0,0) width 407: "This test ensures that quicktime plugins can also be snapshotted. "
+ text run at (407,0) width 377: "We make the plugin here to small to be primary plugin, thus"
+ text run at (0,18) width 159: "it should get snapshotted."
+ RenderBlock (anonymous) at (0,52) size 784x300
+ RenderText {#text} at (0,0) size 0x0
+layer at (8,60) size 300x300
+ RenderEmbeddedObject {EMBED} at (0,0) size 300x300
Added: trunk/LayoutTests/plugins/snapshotting/quicktime-plugin-snapshotted.html (0 => 152580)
--- trunk/LayoutTests/plugins/snapshotting/quicktime-plugin-snapshotted.html (rev 0)
+++ trunk/LayoutTests/plugins/snapshotting/quicktime-plugin-snapshotted.html 2013-07-11 23:53:40 UTC (rev 152580)
@@ -0,0 +1,13 @@
+<p>This test ensures that quicktime plugins can also be snapshotted.
+We make the plugin here too small to be the primary plugin, thus it should get snapshotted.</p>
+<script>
+if (window.testRunner) {
+ window.internals.settings.setPlugInSnapshottingEnabled(true);
+ window.internals.settings.setMaximumPlugInSnapshotAttempts(0);
+ testRunner.waitUntilDone();
+ setTimeout(function () {
+ testRunner.notifyDone();
+ }, 500);
+}
+</script>
+<embed src="" width="300" height="300"></embed>
Modified: trunk/Source/WebCore/ChangeLog (152579 => 152580)
--- trunk/Source/WebCore/ChangeLog 2013-07-11 22:33:11 UTC (rev 152579)
+++ trunk/Source/WebCore/ChangeLog 2013-07-11 23:53:40 UTC (rev 152580)
@@ -1,3 +1,24 @@
+2013-07-10 Roger Fong <[email protected]>
+
+ Plugins that don't support snapshotting should not all autostart.
+ https://bugs.webkit.org/show_bug.cgi?id=118572
+ <rdar://problem/14324391>.
+
+ Reviewed by Dean Jackson.
+
+ Test: plugins/snapshotting/quicktime-plugin-snapshotted.html
+
+ * html/HTMLPlugInImageElement.cpp:
+ (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): Pass in information about whether or not a snapshot exists
+ to the shadow dom.
+ * plugins/PluginViewBase.h:
+ (WebCore::PluginViewBase::shouldNotAddLayer): This method determines whether or not we should add the plugin's layer to the tree.
+ It should not be added if the plugin is in it's snapshotted state but does not actually support snapshotting.
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): We should only add the layer to the tree when the plugin
+ is actually playing. Otherwise we run into an issue where the contents of the layer initially appear on the screen briefly
+ on page load before we display the substitute for a plugin that doesn't support snapshotting.
+
2013-07-11 Dan Bernstein <[email protected]>
[mac] No API for getting the page visibility state of a WebView
Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (152579 => 152580)
--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp 2013-07-11 22:33:11 UTC (rev 152579)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp 2013-07-11 23:53:40 UTC (rev 152580)
@@ -384,6 +384,10 @@
argList.append(toJS(exec, globalObject, root));
argList.append(jsString(exec, titleText(page, mimeType)));
argList.append(jsString(exec, subtitleText(page, mimeType)));
+
+ // This parameter determines whether or not the snapshot overlay should always be visible over the plugin snapshot.
+ // If no snapshot was found then we want the overlay to be visible.
+ argList.append(JSC::jsBoolean(!m_snapshotImage));
// It is expected the JS file provides a createOverlay(shadowRoot, title, subtitle) function.
JSC::JSObject* overlay = globalObject->get(exec, JSC::Identifier(exec, "createOverlay")).toObject(exec);
Modified: trunk/Source/WebCore/plugins/PluginViewBase.h (152579 => 152580)
--- trunk/Source/WebCore/plugins/PluginViewBase.h 2013-07-11 22:33:11 UTC (rev 152579)
+++ trunk/Source/WebCore/plugins/PluginViewBase.h 2013-07-11 23:53:40 UTC (rev 152580)
@@ -69,6 +69,7 @@
virtual bool shouldAllowNavigationFromDrags() const { return false; }
virtual bool isPluginViewBase() const { return true; }
+ virtual bool shouldNotAddLayer() const { return false; }
protected:
explicit PluginViewBase(PlatformWidget widget = 0) : Widget(widget) { }
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (152579 => 152580)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-07-11 22:33:11 UTC (rev 152579)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-07-11 23:53:40 UTC (rev 152580)
@@ -565,7 +565,8 @@
if (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing()) {
PluginViewBase* pluginViewBase = toPluginViewBase(toRenderWidget(renderer)->widget());
- m_graphicsLayer->setContentsToMedia(pluginViewBase->platformLayer());
+ if (!pluginViewBase->shouldNotAddLayer())
+ m_graphicsLayer->setContentsToMedia(pluginViewBase->platformLayer());
}
#if ENABLE(VIDEO)
else if (renderer->isVideo()) {
Modified: trunk/Source/WebKit2/ChangeLog (152579 => 152580)
--- trunk/Source/WebKit2/ChangeLog 2013-07-11 22:33:11 UTC (rev 152579)
+++ trunk/Source/WebKit2/ChangeLog 2013-07-11 23:53:40 UTC (rev 152580)
@@ -1,3 +1,18 @@
+2013-07-10 Roger Fong <[email protected]>
+
+ Plugins that don't support snapshotting should not all autostart.
+ https://bugs.webkit.org/show_bug.cgi?id=118572
+ <rdar://problem/14324391>.
+
+ Reviewed by Dean Jackson.
+
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::PluginView::shouldNotAddLayer): This method determines whether or not we should add the plugin's layer to the tree.
+ It should not be added if the plugin is in it's snapshotted state but does not actually support snapshotting.
+ (WebKit::PluginView::pluginSnapshotTimerFired): If the plugin does not support snapshotting go straight
+ to the the DisplayingSnapshot state.
+ * WebProcess/Plugins/PluginView.h:
+
2013-07-11 Jessie Berlin <[email protected]>
WebResourceCacheManager::cfURLCacheHostNamesWithCallback leaks an array (pointed out by the
Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (152579 => 152580)
--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2013-07-11 22:33:11 UTC (rev 152579)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2013-07-11 23:53:40 UTC (rev 152580)
@@ -924,6 +924,11 @@
return m_plugin->shouldAllowNavigationFromDrags();
}
+bool PluginView::shouldNotAddLayer() const
+{
+ return m_pluginElement->displayState() < HTMLPlugInElement::Restarting && !m_plugin->supportsSnapshotting();
+}
+
PassRefPtr<SharedBuffer> PluginView::liveResourceData() const
{
if (!m_isInitialized || !m_plugin)
@@ -1652,27 +1657,25 @@
{
ASSERT(m_plugin);
- if (m_pluginElement->isPlugInImageElement() && !m_plugin->supportsSnapshotting()) {
- toHTMLPlugInImageElement(m_pluginElement.get())->restartSnapshottedPlugIn();
- return;
- }
+ if (m_plugin->supportsSnapshotting()) {
+ // Snapshot might be 0 if plugin size is 0x0.
+ RefPtr<ShareableBitmap> snapshot = m_plugin->snapshot();
+ RefPtr<Image> snapshotImage;
+ if (snapshot)
+ snapshotImage = snapshot->createImage();
+ m_pluginElement->updateSnapshot(snapshotImage.get());
- // Snapshot might be 0 if plugin size is 0x0.
- RefPtr<ShareableBitmap> snapshot = m_plugin->snapshot();
- RefPtr<Image> snapshotImage;
- if (snapshot)
- snapshotImage = snapshot->createImage();
- m_pluginElement->updateSnapshot(snapshotImage.get());
-
#if PLATFORM(MAC)
- unsigned maximumSnapshotRetries = frame() ? frame()->settings()->maximumPlugInSnapshotAttempts() : 0;
- if (snapshotImage && isAlmostSolidColor(static_cast<BitmapImage*>(snapshotImage.get())) && m_countSnapshotRetries < maximumSnapshotRetries) {
- ++m_countSnapshotRetries;
- m_pluginSnapshotTimer.restart();
- return;
+ unsigned maximumSnapshotRetries = frame() ? frame()->settings()->maximumPlugInSnapshotAttempts() : 0;
+ if (snapshotImage && isAlmostSolidColor(static_cast<BitmapImage*>(snapshotImage.get())) && m_countSnapshotRetries < maximumSnapshotRetries) {
+ ++m_countSnapshotRetries;
+ m_pluginSnapshotTimer.restart();
+ return;
+ }
+#endif
}
-#endif
-
+ // Even if there is no snapshot we still set the state to DisplayingSnapshot
+ // since we just want to display the default empty box.
m_pluginElement->setDisplayState(HTMLPlugInElement::DisplayingSnapshot);
}
Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h (152579 => 152580)
--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h 2013-07-11 22:33:11 UTC (rev 152579)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h 2013-07-11 23:53:40 UTC (rev 152580)
@@ -154,6 +154,7 @@
virtual bool shouldAlwaysAutoStart() const OVERRIDE;
virtual void beginSnapshottingRunningPlugin() OVERRIDE;
virtual bool shouldAllowNavigationFromDrags() const OVERRIDE;
+ virtual bool shouldNotAddLayer() const OVERRIDE;
// WebCore::Widget
virtual void setFrameRect(const WebCore::IntRect&);