Title: [151576] trunk/Source/WebCore
Revision
151576
Author
[email protected]
Date
2013-06-13 18:20:44 -0700 (Thu, 13 Jun 2013)

Log Message

Clicking on snapshotting plug-ins does not restart them
https://bugs.webkit.org/show_bug.cgi?id=117620
<rdar://problem/13821729>

Reviewed by Simon Fraser.

HTMLPlugInElement has an event handler which would return
immediately if the element was not snapshotted, restarting
or playing. There is a case it missed, which was snapshotting
(WaitingForSnapshot to be precise). If we get a click in this
state then it should immediately restart.

* html/HTMLPlugInElement.h: Move defaultEventHandler to public (we call it from the child class).
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::defaultEventHandler): If there is a click on a snapshotting
plug-in, then call restart.
* html/HTMLPlugInImageElement.h: Virtual defaultEventHandler declaration.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (151575 => 151576)


--- trunk/Source/WebCore/ChangeLog	2013-06-14 00:39:36 UTC (rev 151575)
+++ trunk/Source/WebCore/ChangeLog	2013-06-14 01:20:44 UTC (rev 151576)
@@ -1,3 +1,23 @@
+2013-06-13  Dean Jackson  <[email protected]>
+
+        Clicking on snapshotting plug-ins does not restart them
+        https://bugs.webkit.org/show_bug.cgi?id=117620
+        <rdar://problem/13821729>
+
+        Reviewed by Simon Fraser.
+
+        HTMLPlugInElement has an event handler which would return
+        immediately if the element was not snapshotted, restarting
+        or playing. There is a case it missed, which was snapshotting
+        (WaitingForSnapshot to be precise). If we get a click in this
+        state then it should immediately restart.
+
+        * html/HTMLPlugInElement.h: Move defaultEventHandler to public (we call it from the child class).
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::defaultEventHandler): If there is a click on a snapshotting
+        plug-in, then call restart.
+        * html/HTMLPlugInImageElement.h: Virtual defaultEventHandler declaration.
+
 2013-06-13  Zoltan Horvath  <[email protected]>
 
         Use borderAndPadding[Before,After]() instead of border[Before,After]() + padding[Before,After]()

Modified: trunk/Source/WebCore/html/HTMLPlugInElement.h (151575 => 151576)


--- trunk/Source/WebCore/html/HTMLPlugInElement.h	2013-06-14 00:39:36 UTC (rev 151575)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.h	2013-06-14 01:20:44 UTC (rev 151576)
@@ -80,6 +80,8 @@
 
     virtual bool isPlugInImageElement() const { return false; }
 
+    virtual void defaultEventHandler(Event*);
+
 protected:
     HTMLPlugInElement(const QualifiedName& tagName, Document*);
 
@@ -99,8 +101,6 @@
 
     virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
 
-    virtual void defaultEventHandler(Event*);
-
     virtual RenderWidget* renderWidgetForJSBindings() const = 0;
 
     virtual bool supportsFocus() const OVERRIDE;

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (151575 => 151576)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2013-06-14 00:39:36 UTC (rev 151575)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2013-06-14 01:20:44 UTC (rev 151576)
@@ -23,6 +23,8 @@
 
 #include "Chrome.h"
 #include "ChromeClient.h"
+#include "Event.h"
+#include "EventHandler.h"
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
@@ -707,4 +709,20 @@
     }
 }
 
+void HTMLPlugInImageElement::defaultEventHandler(Event* event)
+{
+    RenderObject* r = renderer();
+    if (r && r->isEmbeddedObject()) {
+        if (isPlugInImageElement() && displayState() == WaitingForSnapshot && event->type() == eventNames().clickEvent) {
+            MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
+            if (mouseEvent->button() == LeftButton) {
+                userDidClickSnapshot(mouseEvent, true);
+                event->setDefaultHandled();
+                return;
+            }
+        }
+    }
+    HTMLPlugInElement::defaultEventHandler(event);
+}
+    
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.h (151575 => 151576)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.h	2013-06-14 00:39:36 UTC (rev 151575)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.h	2013-06-14 01:20:44 UTC (rev 151576)
@@ -125,6 +125,8 @@
 
     virtual bool isRestartedPlugin() const OVERRIDE { return m_isRestartedPlugin; }
 
+    virtual void defaultEventHandler(Event*);
+
 private:
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     virtual bool willRecalcStyle(StyleChange);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to