Title: [152679] branches/safari-537-branch

Diff

Modified: branches/safari-537-branch/LayoutTests/ChangeLog (152678 => 152679)


--- branches/safari-537-branch/LayoutTests/ChangeLog	2013-07-16 00:00:22 UTC (rev 152678)
+++ branches/safari-537-branch/LayoutTests/ChangeLog	2013-07-16 00:04:16 UTC (rev 152679)
@@ -1,5 +1,20 @@
 2013-07-15  Lucas Forschler  <[email protected]>
 
+        Merge r152580
+
+    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-15  Lucas Forschler  <[email protected]>
+
         Merge r152573
 
     2013-07-10  Oliver Hunt  <[email protected]>

Copied: branches/safari-537-branch/LayoutTests/platform/mac-wk2/plugins/snapshotting/quicktime-plugin-snapshotted-expected.txt (from rev 152580, trunk/LayoutTests/platform/mac-wk2/plugins/snapshotting/quicktime-plugin-snapshotted-expected.txt) (0 => 152679)


--- branches/safari-537-branch/LayoutTests/platform/mac-wk2/plugins/snapshotting/quicktime-plugin-snapshotted-expected.txt	                        (rev 0)
+++ branches/safari-537-branch/LayoutTests/platform/mac-wk2/plugins/snapshotting/quicktime-plugin-snapshotted-expected.txt	2013-07-16 00:04:16 UTC (rev 152679)
@@ -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

Copied: branches/safari-537-branch/LayoutTests/plugins/snapshotting/quicktime-plugin-snapshotted.html (from rev 152580, trunk/LayoutTests/plugins/snapshotting/quicktime-plugin-snapshotted.html) (0 => 152679)


--- branches/safari-537-branch/LayoutTests/plugins/snapshotting/quicktime-plugin-snapshotted.html	                        (rev 0)
+++ branches/safari-537-branch/LayoutTests/plugins/snapshotting/quicktime-plugin-snapshotted.html	2013-07-16 00:04:16 UTC (rev 152679)
@@ -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: branches/safari-537-branch/Source/WebCore/ChangeLog (152678 => 152679)


--- branches/safari-537-branch/Source/WebCore/ChangeLog	2013-07-16 00:00:22 UTC (rev 152678)
+++ branches/safari-537-branch/Source/WebCore/ChangeLog	2013-07-16 00:04:16 UTC (rev 152679)
@@ -1,5 +1,30 @@
 2013-07-15  Lucas Forschler  <[email protected]>
 
+        Merge r152580
+
+    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-15  Lucas Forschler  <[email protected]>
+
         Merge r152568
 
     2013-07-11  Andreas Kling  <[email protected]>

Modified: branches/safari-537-branch/Source/WebCore/html/HTMLPlugInImageElement.cpp (152678 => 152679)


--- branches/safari-537-branch/Source/WebCore/html/HTMLPlugInImageElement.cpp	2013-07-16 00:00:22 UTC (rev 152678)
+++ branches/safari-537-branch/Source/WebCore/html/HTMLPlugInImageElement.cpp	2013-07-16 00:04:16 UTC (rev 152679)
@@ -389,6 +389,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: branches/safari-537-branch/Source/WebCore/plugins/PluginViewBase.h (152678 => 152679)


--- branches/safari-537-branch/Source/WebCore/plugins/PluginViewBase.h	2013-07-16 00:00:22 UTC (rev 152678)
+++ branches/safari-537-branch/Source/WebCore/plugins/PluginViewBase.h	2013-07-16 00:04:16 UTC (rev 152679)
@@ -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: branches/safari-537-branch/Source/WebCore/rendering/RenderLayerBacking.cpp (152678 => 152679)


--- branches/safari-537-branch/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-07-16 00:00:22 UTC (rev 152678)
+++ branches/safari-537-branch/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-07-16 00:04:16 UTC (rev 152679)
@@ -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: branches/safari-537-branch/Source/WebKit2/ChangeLog (152678 => 152679)


--- branches/safari-537-branch/Source/WebKit2/ChangeLog	2013-07-16 00:00:22 UTC (rev 152678)
+++ branches/safari-537-branch/Source/WebKit2/ChangeLog	2013-07-16 00:04:16 UTC (rev 152679)
@@ -1,5 +1,24 @@
 2013-07-15  Lucas Forschler  <[email protected]>
 
+        Merge r152580
+
+    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-15  Lucas Forschler  <[email protected]>
+
         Merge r152520
 
     2013-07-09  Jer Noble  <[email protected]>

Modified: branches/safari-537-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (152678 => 152679)


--- branches/safari-537-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-07-16 00:00:22 UTC (rev 152678)
+++ branches/safari-537-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-07-16 00:04:16 UTC (rev 152679)
@@ -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: branches/safari-537-branch/Source/WebKit2/WebProcess/Plugins/PluginView.h (152678 => 152679)


--- branches/safari-537-branch/Source/WebKit2/WebProcess/Plugins/PluginView.h	2013-07-16 00:00:22 UTC (rev 152678)
+++ branches/safari-537-branch/Source/WebKit2/WebProcess/Plugins/PluginView.h	2013-07-16 00:04:16 UTC (rev 152679)
@@ -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&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to