RESOLVED FIXED Bug 117620
Clicking on snapshotting plug-ins does not restart them
https://bugs.webkit.org/show_bug.cgi?id=117620
Summary Clicking on snapshotting plug-ins does not restart them
Dean Jackson
Reported 2013-06-13 17:58:21 PDT
If a plug-in is snapshotting and the user clicks on it, it should immediately restart. <rdar://problem/13821729>
Attachments
Patch (2.26 KB, patch)
2013-06-13 18:01 PDT, Dean Jackson
no flags
Patch (3.86 KB, patch)
2013-06-13 18:15 PDT, Dean Jackson
simon.fraser: review+
Dean Jackson
Comment 1 2013-06-13 18:01:49 PDT
Dean Jackson
Comment 2 2013-06-13 18:05:58 PDT
Comment on attachment 204657 [details] Patch Ignore this. I tried to sneak it by but it is bad coding.
Darin Adler
Comment 3 2013-06-13 18:08:41 PDT
Comment on attachment 204657 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=204657&action=review > Source/WebCore/html/HTMLPlugInElement.cpp:223 > + if (displayState() == WaitingForSnapshot && event->type() == eventNames().clickEvent && isPlugInImageElement()) { > + MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); > + if (mouseEvent->button() == LeftButton) { > + toHTMLPlugInImageElement(this)->userDidClickSnapshot(mouseEvent, false); > + event->setDefaultHandled(); > + return; > + } > + } defaultEventHandler is a virtual function. Why not put this code in the HTMLPlugInImageElement class in the first place instead of down casting?
Dean Jackson
Comment 4 2013-06-13 18:15:25 PDT
Dean Jackson
Comment 5 2013-06-13 18:17:59 PDT
(In reply to comment #3) > (From update of attachment 204657 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=204657&action=review > > > Source/WebCore/html/HTMLPlugInElement.cpp:223 > > + if (displayState() == WaitingForSnapshot && event->type() == eventNames().clickEvent && isPlugInImageElement()) { > > + MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); > > + if (mouseEvent->button() == LeftButton) { > > + toHTMLPlugInImageElement(this)->userDidClickSnapshot(mouseEvent, false); > > + event->setDefaultHandled(); > > + return; > > + } > > + } > > defaultEventHandler is a virtual function. Why not put this code in the HTMLPlugInImageElement class in the first place instead of down casting? Yeah... that's what I ended up doing. I'll even admit I thought of doing it up front :(
Simon Fraser (smfr)
Comment 6 2013-06-13 18:18:15 PDT
Comment on attachment 204658 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=204658&action=review > Source/WebCore/html/HTMLPlugInImageElement.cpp:716 > + if (displayState() == WaitingForSnapshot && event->type() == eventNames().clickEvent && isPlugInImageElement()) { I think this would be slightly clearer if you did the event->type() last.
Dean Jackson
Comment 7 2013-06-13 18:21:05 PDT
Darin Adler
Comment 8 2013-06-13 18:21:28 PDT
Comment on attachment 204658 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=204658&action=review > Source/WebCore/html/HTMLPlugInElement.h:83 > + virtual void defaultEventHandler(Event*); Should be protected, not public. And as long as you are touching it, should add OVERRIDE. > Source/WebCore/html/HTMLPlugInImageElement.h:128 > + virtual void defaultEventHandler(Event*); Should add OVERRIDE. Could be private instead of protected.
Dean Jackson
Comment 9 2013-06-14 10:10:50 PDT
Follow-up commit for Darin's comments: https://trac.webkit.org/r151599
Note You need to log in before you can comment on or make changes to this bug.