HTMLPluginElement's state should be Playing before firing mouse click event.
authorroger_fong@apple.com <roger_fong@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Jul 2013 19:30:59 +0000 (19:30 +0000)
committerroger_fong@apple.com <roger_fong@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Jul 2013 19:30:59 +0000 (19:30 +0000)
commit581d149a4680c4daf145238677f3093cc3159108
treefd2222c7941ed5b9c8a04382f60ecbaedc96b50b
parent18b2b44c5da6a79f345a72d9a3f2ad62b64a0bb9
HTMLPluginElement's state should be Playing before firing mouse click event.
https://bugs.webkit.org/show_bug.cgi?id=118398.
<rdar://problem/14262126>

Reviewed by Dean Jackson.

Test: plugins/snapshotting/plugin-receives-click-event.html

* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::simulatedMouseClickTimerFired):
The defaultEventHandler returns early if the state is not Playing.
This is because we only want the plugin to deal with user interaction normally if the
plugin is actually enabled (not being snapshotted).
When we click on the snapshotted plugin to start it, we mimic what would happen to the plugin
normally by dispatching another click event on top of where we just clicked.
However, we were sending the click event before setting the state to Playing which meant that our
simulated click was not being handled.
We should be setting this state before sending the click, not after.
* platform/mac-wk2/plugins/snapshotting/plugin-receives-click-event-expected.txt: Added.
* plugins/snapshotting/plugin-receives-click-event.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@152541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/plugins/snapshotting/plugin-receives-click-event-expected.txt [new file with mode: 0644]
LayoutTests/plugins/snapshotting/plugin-receives-click-event.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLPlugInImageElement.cpp