- Revision
- 87429
- Author
- [email protected]
- Date
- 2011-05-26 14:04:32 -0700 (Thu, 26 May 2011)
Log Message
2011-05-02 Robert Hogan <[email protected]>
Reviewed by Adam Roben.
[Qt] Allow popup windows from plugins when initiated by a user gesture
https://bugs.webkit.org/show_bug.cgi?id=41292
* platform/qt/Skipped: Unskip plugin-initiate-popup-window.html
* platform/qt/plugins/plugin-initiate-popup-window-expected.txt: Copied from LayoutTests/platform/mac/plugins/plugin-initiate-popup-window-expected.txt.
* plugins/plugin-initiate-popup-window.html: Plugins are only windowless
by default on OSX, so make the plugins windowless explicitly.
2011-05-02 Robert Hogan <[email protected]>
Reviewed by Adam Roben.
[Qt] Allow popup windows from plugins when initiated by a user gesture
https://bugs.webkit.org/show_bug.cgi?id=41292
If the event is from a user gesture and the plugin doesn't support
NPN_PushPopupsEnabledState() and NPN_PopPopupsEnabledState(), allow popups.
* plugins/qt/PluginViewQt.cpp:
(WebCore::PluginView::dispatchNPEvent):
2011-05-02 Robert Hogan <[email protected]>
Reviewed by Adam Roben.
[Qt] Allow popup windows from plugins when initiated by a user gesture
https://bugs.webkit.org/show_bug.cgi?id=41292
Support parameters introduced in plugin-initiate-popup-window.html
* DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp:
(webkit_test_plugin_new_instance):
(webkit_test_plugin_handle_event):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (87428 => 87429)
--- trunk/LayoutTests/ChangeLog 2011-05-26 20:49:24 UTC (rev 87428)
+++ trunk/LayoutTests/ChangeLog 2011-05-26 21:04:32 UTC (rev 87429)
@@ -1,3 +1,16 @@
+2011-05-02 Robert Hogan <[email protected]>
+
+ Reviewed by Adam Roben.
+
+ [Qt] Allow popup windows from plugins when initiated by a user gesture
+
+ https://bugs.webkit.org/show_bug.cgi?id=41292
+
+ * platform/qt/Skipped: Unskip plugin-initiate-popup-window.html
+ * platform/qt/plugins/plugin-initiate-popup-window-expected.txt: Copied from LayoutTests/platform/mac/plugins/plugin-initiate-popup-window-expected.txt.
+ * plugins/plugin-initiate-popup-window.html: Plugins are only windowless
+ by default on OSX, so make the plugins windowless explicitly.
+
2011-05-26 Mihai Parparita <[email protected]>
Reviewed by Adam Barth.
Modified: trunk/LayoutTests/platform/qt/Skipped (87428 => 87429)
--- trunk/LayoutTests/platform/qt/Skipped 2011-05-26 20:49:24 UTC (rev 87428)
+++ trunk/LayoutTests/platform/qt/Skipped 2011-05-26 21:04:32 UTC (rev 87429)
@@ -356,9 +356,6 @@
# ---- plugins rendered in incorrect position ?
plugins/embed-attributes-style.html
-# https://bugs.webkit.org/show_bug.cgi?id=41292
-plugins/plugin-initiate-popup-window.html
-
# https://bugs.webkit.org/show_bug.cgi?id=60722
http/tests/plugins/plugin-document-has-focus.html
Added: trunk/LayoutTests/platform/qt/plugins/plugin-initiate-popup-window-expected.txt (0 => 87429)
--- trunk/LayoutTests/platform/qt/plugins/plugin-initiate-popup-window-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/qt/plugins/plugin-initiate-popup-window-expected.txt 2011-05-26 21:04:32 UTC (rev 87429)
@@ -0,0 +1,17 @@
+CONSOLE MESSAGE: line 17: window count: 1
+CONSOLE MESSAGE: line 0: PLUGIN: getFocusEvent
+CONSOLE MESSAGE: line 0: PLUGIN: mouseDown at (12, 12)
+CONSOLE MESSAGE: line 30: window count: 2
+CONSOLE MESSAGE: line 0: PLUGIN: mouseUp at (12, 12)
+CONSOLE MESSAGE: line 0: PLUGIN: loseFocusEvent
+CONSOLE MESSAGE: line 0: PLUGIN: getFocusEvent
+CONSOLE MESSAGE: line 0: PLUGIN: mouseDown at (52, 12)
+CONSOLE MESSAGE: line 0: PLUGIN: mouseUp at (52, 12)
+CONSOLE MESSAGE: line 0: PLUGIN: keyDown 'p'
+CONSOLE MESSAGE: line 52: window count: 3
+CONSOLE MESSAGE: line 0: PLUGIN: keyUp 'p'
+
+
+Specify a script and a mouse/keyboard event to the plugin. The specified script will be evaluated in the browser when the specified event is received by the plugin. The test is for bug https://bugs.webkit.org/show_bug.cgi?id=41292.
+Opening window by mouse down is PASSED
+Opening window by key down is PASSED
Property changes on: trunk/LayoutTests/platform/qt/plugins/plugin-initiate-popup-window-expected.txt
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/LayoutTests/plugins/plugin-initiate-popup-window.html (87428 => 87429)
--- trunk/LayoutTests/plugins/plugin-initiate-popup-window.html 2011-05-26 20:49:24 UTC (rev 87428)
+++ trunk/LayoutTests/plugins/plugin-initiate-popup-window.html 2011-05-26 21:04:32 UTC (rev 87429)
@@ -65,8 +65,8 @@
</script>
</head>
<body _onload_="window.setTimeout(test, 0);">
-<embed type="application/x-webkit-test-netscape" width=100 height=40 evaluatescript="mouse::popup_by_mousedown()"></embed><br>
-<embed type="application/x-webkit-test-netscape" width=100 height=40 evaluatescript="key::popup_by_keydown()"></embed><br>
+<embed type="application/x-webkit-test-netscape" width=100 height=40 evaluatescript="mouse::popup_by_mousedown()" windowedplugin="false"></embed><br>
+<embed type="application/x-webkit-test-netscape" width=100 height=40 evaluatescript="key::popup_by_keydown()" windowedplugin="false"></embed><br>
Specify a script and a mouse/keyboard event to the plugin. The specified script will be evaluated in the browser when the specified event is received by the plugin. The test is for bug https://bugs.webkit.org/show_bug.cgi?id=41292.<br>
Opening window by mouse down is <span id="mousedown_output">FAILED</span><br>
Opening window by key down is <span id="keydown_output">FAILED</span>
Modified: trunk/Source/WebCore/ChangeLog (87428 => 87429)
--- trunk/Source/WebCore/ChangeLog 2011-05-26 20:49:24 UTC (rev 87428)
+++ trunk/Source/WebCore/ChangeLog 2011-05-26 21:04:32 UTC (rev 87429)
@@ -1,3 +1,17 @@
+2011-05-02 Robert Hogan <[email protected]>
+
+ Reviewed by Adam Roben.
+
+ [Qt] Allow popup windows from plugins when initiated by a user gesture
+
+ https://bugs.webkit.org/show_bug.cgi?id=41292
+
+ If the event is from a user gesture and the plugin doesn't support
+ NPN_PushPopupsEnabledState() and NPN_PopPopupsEnabledState(), allow popups.
+
+ * plugins/qt/PluginViewQt.cpp:
+ (WebCore::PluginView::dispatchNPEvent):
+
2011-05-26 Leandro Gracia Gil <[email protected]>
Reviewed by Dmitry Titov.
Modified: trunk/Source/WebCore/plugins/qt/PluginViewQt.cpp (87428 => 87429)
--- trunk/Source/WebCore/plugins/qt/PluginViewQt.cpp 2011-05-26 20:49:24 UTC (rev 87428)
+++ trunk/Source/WebCore/plugins/qt/PluginViewQt.cpp 2011-05-26 21:04:32 UTC (rev 87429)
@@ -384,6 +384,14 @@
if (!m_plugin->pluginFuncs()->event)
return false;
+ bool shouldPop = false;
+
+ if (m_plugin->pluginFuncs()->version < NPVERS_HAS_POPUPS_ENABLED_STATE
+ && (event.type == ButtonRelease || event.type == 3 /*KeyRelease*/)) {
+ pushPopupsEnabledState(true);
+ shouldPop = true;
+ }
+
PluginView::setCurrentPluginView(this);
#if USE(JSC)
JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly);
@@ -393,6 +401,9 @@
setCallingPlugin(false);
PluginView::setCurrentPluginView(0);
+ if (shouldPop)
+ popPopupsEnabledState();
+
return accepted;
}
Modified: trunk/Tools/ChangeLog (87428 => 87429)
--- trunk/Tools/ChangeLog 2011-05-26 20:49:24 UTC (rev 87428)
+++ trunk/Tools/ChangeLog 2011-05-26 21:04:32 UTC (rev 87429)
@@ -1,3 +1,17 @@
+2011-05-02 Robert Hogan <[email protected]>
+
+ Reviewed by Adam Roben.
+
+ [Qt] Allow popup windows from plugins when initiated by a user gesture
+
+ https://bugs.webkit.org/show_bug.cgi?id=41292
+
+ Support parameters introduced in plugin-initiate-popup-window.html
+
+ * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp:
+ (webkit_test_plugin_new_instance):
+ (webkit_test_plugin_handle_event):
+
2011-05-26 Mihai Parparita <[email protected]>
Reviewed by Adam Barth.
Modified: trunk/Tools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp (87428 => 87429)
--- trunk/Tools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp 2011-05-26 20:49:24 UTC (rev 87428)
+++ trunk/Tools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp 2011-05-26 21:04:32 UTC (rev 87429)
@@ -109,6 +109,17 @@
browser->setvalue(instance, NPPVpluginWindowBool, windowed);
} else if (!strcasecmp(argn[i], "onPaintEvent") && !obj->onPaintEvent)
obj->_onPaintEvent_ = strdup(argv[i]);
+ else if (!strcasecmp(argn[i], "evaluatescript")) {
+ char* script = argv[i];
+ if (script == strstr(script, "mouse::")) {
+ obj->mouseDownForEvaluateScript = true;
+ obj->evaluateScriptOnMouseDownOrKeyDown = strdup(script + sizeof("mouse::") - 1);
+ } else if (script == strstr(script, "key::"))
+ obj->evaluateScriptOnMouseDownOrKeyDown = strdup(script + sizeof("key::") - 1);
+ // When testing evaluate script on mouse-down or key-down, allow event logging to handle events.
+ if (obj->evaluateScriptOnMouseDownOrKeyDown)
+ obj->eventLogging = true;
+ }
}
browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
@@ -301,6 +312,8 @@
case ButtonPress:
if (obj->eventLogging)
pluginLog(instance, "mouseDown at (%d, %d)", evt->xbutton.x, evt->xbutton.y);
+ if (obj->evaluateScriptOnMouseDownOrKeyDown && obj->mouseDownForEvaluateScript)
+ executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
break;
case KeyRelease:
if (obj->eventLogging)
@@ -309,6 +322,8 @@
case KeyPress:
if (obj->eventLogging)
pluginLog(instance, "keyDown '%c'", keyEventToChar(&evt->xkey));
+ if (obj->evaluateScriptOnMouseDownOrKeyDown && !obj->mouseDownForEvaluateScript)
+ executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
break;
case MotionNotify:
case EnterNotify: