Title: [151599] trunk/Source/WebCore
Revision
151599
Author
[email protected]
Date
2013-06-14 10:09:49 -0700 (Fri, 14 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>

Follow-up review comments from Darin Adler, with some
discussion on IRC.

Sprinkle OVERRIDE on virtual functions where needed. Also
make sure that the Event is a MouseEvent before casting to it.

* html/HTMLPlugInElement.h: Move defaultEventHandler back to protected and add OVERRIDE.
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::defaultEventHandler): Check for MouseEvent and
use toMouseEvent().
* html/HTMLPlugInImageElement.h: Sprinkle some OVERRIDEs, and move defaultEventHandler
to private.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (151598 => 151599)


--- trunk/Source/WebCore/ChangeLog	2013-06-14 16:52:40 UTC (rev 151598)
+++ trunk/Source/WebCore/ChangeLog	2013-06-14 17:09:49 UTC (rev 151599)
@@ -1,3 +1,22 @@
+2013-06-14  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>
+
+        Follow-up review comments from Darin Adler, with some
+        discussion on IRC.
+
+        Sprinkle OVERRIDE on virtual functions where needed. Also
+        make sure that the Event is a MouseEvent before casting to it.
+
+        * html/HTMLPlugInElement.h: Move defaultEventHandler back to protected and add OVERRIDE.
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::defaultEventHandler): Check for MouseEvent and
+        use toMouseEvent().
+        * html/HTMLPlugInImageElement.h: Sprinkle some OVERRIDEs, and move defaultEventHandler
+        to private.
+
 2013-06-14  Timothy Hatcher  <[email protected]>
 
         Remove front-end from the WebCore Xcode project.

Modified: trunk/Source/WebCore/html/HTMLPlugInElement.h (151598 => 151599)


--- trunk/Source/WebCore/html/HTMLPlugInElement.h	2013-06-14 16:52:40 UTC (rev 151598)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.h	2013-06-14 17:09:49 UTC (rev 151599)
@@ -80,8 +80,6 @@
 
     virtual bool isPlugInImageElement() const { return false; }
 
-    virtual void defaultEventHandler(Event*);
-
 protected:
     HTMLPlugInElement(const QualifiedName& tagName, Document*);
 
@@ -91,6 +89,8 @@
 
     virtual bool useFallbackContent() const { return false; }
 
+    virtual void defaultEventHandler(Event*) OVERRIDE;
+
     // Subclasses should use guardedDispatchBeforeLoadEvent instead of calling dispatchBeforeLoadEvent directly.
     bool guardedDispatchBeforeLoadEvent(const String& sourceURL);
 
@@ -106,7 +106,7 @@
     virtual bool supportsFocus() const OVERRIDE;
 
     virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE;
-    virtual bool isPluginElement() const;
+    virtual bool isPluginElement() const OVERRIDE;
 
     RefPtr<JSC::Bindings::Instance> m_instance;
 #if ENABLE(NETSCAPE_PLUGIN_API)

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (151598 => 151599)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2013-06-14 16:52:40 UTC (rev 151598)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2013-06-14 17:09:49 UTC (rev 151599)
@@ -713,8 +713,8 @@
 {
     RenderObject* r = renderer();
     if (r && r->isEmbeddedObject()) {
-        if (isPlugInImageElement() && displayState() == WaitingForSnapshot && event->type() == eventNames().clickEvent) {
-            MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
+        if (isPlugInImageElement() && displayState() == WaitingForSnapshot && event->isMouseEvent() && event->type() == eventNames().clickEvent) {
+            MouseEvent* mouseEvent = toMouseEvent(event);
             if (mouseEvent->button() == LeftButton) {
                 userDidClickSnapshot(mouseEvent, true);
                 event->setDefaultHandled();
@@ -724,5 +724,5 @@
     }
     HTMLPlugInElement::defaultEventHandler(event);
 }
-    
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.h (151598 => 151599)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.h	2013-06-14 16:52:40 UTC (rev 151598)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.h	2013-06-14 17:09:49 UTC (rev 151599)
@@ -125,15 +125,13 @@
 
     virtual bool isRestartedPlugin() const OVERRIDE { return m_isRestartedPlugin; }
 
-    virtual void defaultEventHandler(Event*);
-
 private:
-    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
-    virtual bool willRecalcStyle(StyleChange);
+    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE;
+    virtual bool willRecalcStyle(StyleChange) OVERRIDE;
 
     void didAddUserAgentShadowRoot(ShadowRoot*) OVERRIDE;
 
-    virtual void finishParsingChildren();
+    virtual void finishParsingChildren() OVERRIDE;
 
     void updateWidgetIfNecessary();
 
@@ -149,6 +147,8 @@
 
     void removeSnapshotTimerFired(Timer<HTMLPlugInImageElement>*);
 
+    virtual void defaultEventHandler(Event*) OVERRIDE;
+
     bool m_needsWidgetUpdate;
     bool m_shouldPreferPlugInsForImages;
     bool m_needsDocumentActivationCallbacks;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to