Title: [150601] branches/safari-537.43-branch/Source

Diff

Modified: branches/safari-537.43-branch/Source/WebCore/ChangeLog (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebCore/ChangeLog	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebCore/ChangeLog	2013-05-23 18:51:57 UTC (rev 150601)
@@ -1,3 +1,27 @@
+2013-05-23  Lucas Forschler  <[email protected]>
+
+        Merge r150556
+
+    2013-05-22  Dean Jackson  <[email protected]>
+
+            Don't snapshot plugins that can't be snapshotted
+            https://bugs.webkit.org/show_bug.cgi?id=116490
+
+            Reviewed by Tim Horton.
+
+            Some plugins, such as QuickTime, don't support snapshotting. We're
+            planning on another way to capture snapshots, but in the meantime make
+            sure that they don't fail to initialise because they were told to
+            not use accelerated rendering.
+
+            * WebCore.exp.in: Export restartSnapshottedPlugin so that it can be used from WK2.
+            * html/HTMLPlugInImageElement.cpp:
+            (WebCore::HTMLPlugInImageElement::restartSimilarPlugIns): Don't set the play state before restarting.
+            (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): Make sure we indicated that this snapshotted plugin was clicked.
+            * html/HTMLPlugInImageElement.h: Move restartSnapshottedPlugin from protected to public.
+            * rendering/RenderSnapshottedPlugIn.cpp:
+            (WebCore::RenderSnapshottedPlugIn::handleEvent): Don't set play state here. Let the restart functions do it.
+
 2013-05-22  Lucas Forschler  <[email protected]>
 
         Merge r150490

Modified: branches/safari-537.43-branch/Source/WebCore/WebCore.exp.in (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebCore/WebCore.exp.in	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebCore/WebCore.exp.in	2013-05-23 18:51:57 UTC (rev 150601)
@@ -724,6 +724,7 @@
 __ZN7WebCore21resourceLoadSchedulerEv
 __ZN7WebCore21setGlobalIconDatabaseEPNS_16IconDatabaseBaseE
 __ZN7WebCore21setPlatformStrategiesEPNS_18PlatformStrategiesE
+__ZN7WebCore22HTMLPlugInImageElement24restartSnapshottedPlugInEv
 __ZN7WebCore22HTMLPlugInImageElement29setIsPrimarySnapshottedPlugInEb
 __ZN7WebCore22RuntimeEnabledFeatures22isCSSExclusionsEnabledE
 __ZN7WebCore22RuntimeEnabledFeatures40isLangAttributeAwareFormControlUIEnabledE

Modified: branches/safari-537.43-branch/Source/WebCore/html/HTMLPlugInImageElement.cpp (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebCore/html/HTMLPlugInImageElement.cpp	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebCore/html/HTMLPlugInImageElement.cpp	2013-05-23 18:51:57 UTC (rev 150601)
@@ -475,7 +475,6 @@
         HTMLPlugInImageElement* plugInToRestart = similarPlugins[i].get();
         if (plugInToRestart->displayState() <= HTMLPlugInElement::DisplayingSnapshot) {
             LOG(Plugins, "%p Plug-in looks similar to a restarted plug-in. Restart.", plugInToRestart);
-            plugInToRestart->setDisplayState(Playing);
             plugInToRestart->restartSnapshottedPlugIn();
         }
         plugInToRestart->m_snapshotDecision = NeverSnapshot;
@@ -493,6 +492,8 @@
 
     LOG(Plugins, "%p User clicked on snapshotted plug-in. Restart.", this);
     restartSnapshottedPlugIn();
+    if (forwardEvent)
+        setDisplayState(HTMLPlugInElement::RestartingWithPendingMouseClick);
     restartSimilarPlugIns();
 }
 

Modified: branches/safari-537.43-branch/Source/WebCore/html/HTMLPlugInImageElement.h (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebCore/html/HTMLPlugInImageElement.h	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebCore/html/HTMLPlugInImageElement.h	2013-05-23 18:51:57 UTC (rev 150601)
@@ -77,6 +77,7 @@
     void userDidClickSnapshot(PassRefPtr<MouseEvent>, bool forwardEvent);
     void checkSnapshotStatus();
     Image* snapshotImage() const { return m_snapshotImage.get(); }
+    void restartSnapshottedPlugIn();
 
     // Plug-in URL might not be the same as url() with overriding parameters.
     void subframeLoaderWillCreatePlugIn(const KURL& plugInURL);
@@ -121,7 +122,6 @@
 
     virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
 
-    void restartSnapshottedPlugIn();
     virtual bool isRestartedPlugin() const OVERRIDE { return m_isRestartedPlugin; }
 
 private:

Modified: branches/safari-537.43-branch/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp	2013-05-23 18:51:57 UTC (rev 150601)
@@ -175,7 +175,6 @@
     if (event->type() == eventNames().clickEvent || (m_isPotentialMouseActivation && event->type() == eventNames().mouseupEvent)) {
         m_isPotentialMouseActivation = false;
         bool clickWasOnOverlay = plugInImageElement()->partOfSnapshotOverlay(event->target()->toNode());
-        plugInImageElement()->setDisplayState(clickWasOnOverlay ? HTMLPlugInElement::Restarting : HTMLPlugInElement::RestartingWithPendingMouseClick);
         plugInImageElement()->userDidClickSnapshot(mouseEvent, !clickWasOnOverlay);
         event->setDefaultHandled();
     } else if (event->type() == eventNames().mousedownEvent) {

Modified: branches/safari-537.43-branch/Source/WebKit2/ChangeLog (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebKit2/ChangeLog	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebKit2/ChangeLog	2013-05-23 18:51:57 UTC (rev 150601)
@@ -1,5 +1,45 @@
 2013-05-23  Lucas Forschler  <[email protected]>
 
+        Merge r150556
+
+    2013-05-22  Dean Jackson  <[email protected]>
+
+            Don't snapshot plugins that can't be snapshotted
+            https://bugs.webkit.org/show_bug.cgi?id=116490
+
+            Reviewed by Tim Horton.
+
+            Some plugins, such as QuickTime, don't support snapshotting. We're
+            planning on another way to capture snapshots, but in the meantime make
+            sure that they don't fail to initialise because they were told to
+            not use accelerated rendering.
+
+            Expose a new message on the plugins so that they can tell the PluginView
+            if they support snapshotting or not.
+
+            * PluginProcess/PluginControllerProxy.cpp:
+            (WebKit::PluginControllerProxy::supportsSnapshotting): New method.
+            * PluginProcess/PluginControllerProxy.h: Ditto.
+            * PluginProcess/PluginControllerProxy.messages.in: Message signature.
+
+            * WebProcess/Plugins/Netscape/NetscapePlugin.h: Add supportsSnapshotting.
+            * WebProcess/Plugins/PDF/SimplePDFPlugin.h: Ditto.
+            * WebProcess/Plugins/Plugin.h: Ditto - pure virtual here.
+
+            * WebProcess/Plugins/PluginProxy.cpp:
+            (WebKit::PluginProxy::supportsSnapshotting): Send the message to the plugin process and return the results.
+            * WebProcess/Plugins/PluginProxy.h:
+
+            * WebProcess/Plugins/PluginView.cpp:
+            (WebKit::PluginView::didInitializePlugin): If the snapshotting plugin has a layer, make
+                sure to add it to the tree.
+            (WebKit::PluginView::isAcceleratedCompositingEnabled): Snapshotting plugins can use
+                accelerated compositing, just like normal plugins.
+            (WebKit::PluginView::pluginSnapshotTimerFired): If the plugin doesn't allow snapshotting,
+                immediately restart it.
+
+2013-05-23  Lucas Forschler  <[email protected]>
+
         Merge r150543
 
     2013-05-22  Anders Carlsson  <[email protected]>

Modified: branches/safari-537.43-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2013-05-23 18:51:57 UTC (rev 150601)
@@ -545,6 +545,11 @@
     paint();
 }
 
+void PluginControllerProxy::supportsSnapshotting(bool& isSupported)
+{
+    isSupported = m_plugin->supportsSnapshotting();
+}
+
 void PluginControllerProxy::snapshot(ShareableBitmap::Handle& backingStoreHandle)
 {
     ASSERT(m_plugin);

Modified: branches/safari-537.43-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.h (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2013-05-23 18:51:57 UTC (rev 150601)
@@ -142,6 +142,7 @@
     void isEditingCommandEnabled(const String&, bool&);
     void handlesPageScaleFactor(bool&);
     void paintEntirePlugin();
+    void supportsSnapshotting(bool&);
     void snapshot(ShareableBitmap::Handle& backingStoreHandle);
     void setFocus(bool);
     void didUpdate();

Modified: branches/safari-537.43-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in	2013-05-23 18:51:57 UTC (rev 150601)
@@ -112,9 +112,12 @@
     SetLayerHostingMode(uint32_t layerHostingMode)
 #endif
 
+    # Does the plugin support snapshotting?
+    SupportsSnapshotting() -> (bool isSupported)
+
     # Return a snapshot of the plugin.
     Snapshot() -> (WebKit::ShareableBitmap::Handle backingStoreHandle)
-    
+
     # Sent when storage blocking policy changes
     StorageBlockingStateChanged(bool storageBlockingEnabled)
 

Modified: branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2013-05-23 18:51:57 UTC (rev 150601)
@@ -245,7 +245,7 @@
     virtual WebCore::Scrollbar* horizontalScrollbar();
     virtual WebCore::Scrollbar* verticalScrollbar();
 
-    bool supportsSnapshotting() const;
+    virtual bool supportsSnapshotting() const;
 
     // Convert the given point from plug-in coordinates to root view coordinates.
     virtual WebCore::IntPoint convertToRootView(const WebCore::IntPoint&) const OVERRIDE;

Modified: branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/PDF/SimplePDFPlugin.h (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/PDF/SimplePDFPlugin.h	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/PDF/SimplePDFPlugin.h	2013-05-23 18:51:57 UTC (rev 150601)
@@ -100,6 +100,7 @@
     virtual void destroy();
     virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRectInWindowCoordinates);
     virtual void updateControlTints(WebCore::GraphicsContext*);
+    virtual bool supportsSnapshotting() const { return false; }
     virtual PassRefPtr<ShareableBitmap> snapshot();
 #if PLATFORM(MAC)
     virtual PlatformLayer* pluginLayer();

Modified: branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h	2013-05-23 18:51:57 UTC (rev 150601)
@@ -118,6 +118,9 @@
     // Invalidate native tintable controls. The passed-in context is in window coordinates.
     virtual void updateControlTints(WebCore::GraphicsContext*);
 
+    // Returns whether the plug-in supports snapshotting or not.
+    virtual bool supportsSnapshotting() const = 0;
+
     // Tells the plug-in to draw itself into a bitmap, and return that.
     virtual PassRefPtr<ShareableBitmap> snapshot() = 0;
 
@@ -125,7 +128,7 @@
     // If a plug-in is using the Core Animation drawing model, this returns its plug-in layer.
     virtual PlatformLayer* pluginLayer() = 0;
 #endif
-    
+
     // Returns whether the plug-in is transparent or not.
     virtual bool isTransparent() = 0;
 

Modified: branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2013-05-23 18:51:57 UTC (rev 150601)
@@ -229,6 +229,18 @@
     }
 }
 
+bool PluginProxy::supportsSnapshotting() const
+{
+    if (m_waitingOnAsynchronousInitialization)
+        return false;
+
+    bool isSupported = false;
+    if (!m_connection->connection()->sendSync(Messages::PluginControllerProxy::SupportsSnapshotting(), Messages::PluginControllerProxy::SupportsSnapshotting::Reply(isSupported), m_pluginInstanceID))
+        return false;
+
+    return isSupported;
+}
+
 PassRefPtr<ShareableBitmap> PluginProxy::snapshot()
 {
     ShareableBitmap::Handle snapshotStoreHandle;

Modified: branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2013-05-23 18:51:57 UTC (rev 150601)
@@ -76,6 +76,7 @@
 
     virtual void destroy();
     virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect);
+    virtual bool supportsSnapshotting() const;
     virtual PassRefPtr<ShareableBitmap> snapshot();
 #if PLATFORM(MAC)
     virtual PlatformLayer* pluginLayer();

Modified: branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (150600 => 150601)


--- branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-05-23 18:51:00 UTC (rev 150600)
+++ branches/safari-537.43-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-05-23 18:51:57 UTC (rev 150601)
@@ -575,17 +575,19 @@
 
 #if PLATFORM(MAC)
     if (m_pluginElement->displayState() < HTMLPlugInElement::Restarting) {
+        if (m_plugin->pluginLayer() && frame()) {
+            frame()->view()->enterCompositingMode();
+            m_pluginElement->setNeedsStyleRecalc(SyntheticStyleChange);
+        }
         if (frame() && !frame()->settings()->maximumPlugInSnapshotAttempts()) {
             m_pluginElement->setDisplayState(HTMLPlugInElement::DisplayingSnapshot);
             return;
         }
         m_pluginSnapshotTimer.restart();
     } else {
-        if (m_plugin->pluginLayer()) {
-            if (frame()) {
-                frame()->view()->enterCompositingMode();
-                m_pluginElement->setNeedsStyleRecalc(SyntheticStyleChange);
-            }
+        if (m_plugin->pluginLayer() && frame()) {
+            frame()->view()->enterCompositingMode();
+            m_pluginElement->setNeedsStyleRecalc(SyntheticStyleChange);
         }
         if (m_pluginElement->displayState() == HTMLPlugInElement::RestartingWithPendingMouseClick)
             m_pluginElement->dispatchPendingMouseClick();
@@ -1383,8 +1385,6 @@
     if (!settings)
         return false;
 
-    if (m_pluginElement->displayState() < HTMLPlugInElement::Restarting)
-        return false;
     return settings->acceleratedCompositingEnabled();
 }
 
@@ -1634,6 +1634,11 @@
 {
     ASSERT(m_plugin);
 
+    if (m_pluginElement->isPlugInImageElement() && !m_plugin->supportsSnapshotting()) {
+        toHTMLPlugInImageElement(m_pluginElement.get())->restartSnapshottedPlugIn();
+        return;
+    }
+
     // Snapshot might be 0 if plugin size is 0x0.
     RefPtr<ShareableBitmap> snapshot = m_plugin->snapshot();
     RefPtr<Image> snapshotImage;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to