Commit f84c4108 authored by teravest@chromium.org's avatar teravest@chromium.org

Revert "Change event handling order in HTMLPlugInElement."

This reverts commit fada04e1ba92f2e951341da3ef52145dc96297bf.

This change affected the behavior of flash on google maps. I'm reverting this
for now to get rid of this regression. I hope to address this in a future change
by altering this behavior only for non-Flash PPAPI applications.

BUG=324351,356089
TBR=eseidel

Review URL: https://codereview.chromium.org/212893005

git-svn-id: svn://svn.chromium.org/blink/trunk@170336 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e4fae21f
<html>
<head>
<script>
var success;
function clickHandler(event) {
success = true;
}
function runTest() {
success = false;
var container = document.getElementById('container');
container.addEventListener('click', clickHandler, false);
var plugin = document.getElementById('testPlugin');
// We have to simulate a mousedown event here instead of click
// because click events aren't sent down to plugins.
var evt = document.createEvent('MouseEvent');
evt.initMouseEvent('mousedown', true, true, window, 0,
0, 0, 0, 0,
false, false, false, false,
0, null);
plugin.dispatchEvent(evt);
if (success) {
document.getElementById('result').innerHTML="Failure, click not filtered";
} else {
document.getElementById('result').innerHTML="Success.";
}
testRunner.dumpAsText();
}
</script>
</head>
<body onload="runTest();">
<p>The support of event filtering for plugins.</p>
<div id="result">Failure, test didn't run</div>
<div id="container">
<object id="testPlugin" type="application/x-webkit-test-netscape"
width="400" height="400" windowedPlugin="false" alwaysFilterEvents="true">plugin didn't load.</object>
</div>
</body>
</html>
...@@ -257,16 +257,18 @@ void HTMLPlugInElement::collectStyleForPresentationAttribute(const QualifiedName ...@@ -257,16 +257,18 @@ void HTMLPlugInElement::collectStyleForPresentationAttribute(const QualifiedName
} }
} }
void HTMLPlugInElement::handleLocalEvents(Event* event) void HTMLPlugInElement::defaultEventHandler(Event* event)
{ {
HTMLFrameOwnerElement::handleLocalEvents(event);
// Firefox seems to use a fake event listener to dispatch events to plug-in // Firefox seems to use a fake event listener to dispatch events to plug-in
// (tested with mouse events only). This is observable via different order // (tested with mouse events only). This is observable via different order
// of events - in Firefox, event listeners specified in HTML attributes // of events - in Firefox, event listeners specified in HTML attributes
// fires first, then an event gets dispatched to plug-in, and only then // fires first, then an event gets dispatched to plug-in, and only then
// other event listeners fire. Hopefully, this difference does not matter in // other event listeners fire. Hopefully, this difference does not matter in
// practice. // practice.
// FIXME: Mouse down and scroll events are passed down to plug-in via custom
// code in EventHandler; these code paths should be united.
RenderObject* r = renderer(); RenderObject* r = renderer();
if (!r || !r->isWidget()) if (!r || !r->isWidget())
return; return;
...@@ -280,6 +282,9 @@ void HTMLPlugInElement::handleLocalEvents(Event* event) ...@@ -280,6 +282,9 @@ void HTMLPlugInElement::handleLocalEvents(Event* event)
if (!widget) if (!widget)
return; return;
widget->handleEvent(event); widget->handleEvent(event);
if (event->defaultHandled())
return;
HTMLFrameOwnerElement::defaultEventHandler(event);
} }
RenderWidget* HTMLPlugInElement::renderWidgetForJSBindings() const RenderWidget* HTMLPlugInElement::renderWidgetForJSBindings() const
......
...@@ -93,7 +93,7 @@ private: ...@@ -93,7 +93,7 @@ private:
// Node functions: // Node functions:
virtual bool canContainRangeEndPoint() const OVERRIDE { return false; } virtual bool canContainRangeEndPoint() const OVERRIDE { return false; }
virtual bool willRespondToMouseClickEvents() OVERRIDE FINAL; virtual bool willRespondToMouseClickEvents() OVERRIDE FINAL;
virtual void handleLocalEvents(Event*) OVERRIDE FINAL; virtual void defaultEventHandler(Event*) OVERRIDE FINAL;
virtual void attach(const AttachContext& = AttachContext()) OVERRIDE FINAL; virtual void attach(const AttachContext& = AttachContext()) OVERRIDE FINAL;
virtual void detach(const AttachContext& = AttachContext()) OVERRIDE FINAL; virtual void detach(const AttachContext& = AttachContext()) OVERRIDE FINAL;
virtual void finishParsingChildren() OVERRIDE FINAL; virtual void finishParsingChildren() OVERRIDE FINAL;
......
...@@ -712,10 +712,8 @@ void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) ...@@ -712,10 +712,8 @@ void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event)
} }
WebCursorInfo cursorInfo; WebCursorInfo cursorInfo;
if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { if (m_webPlugin->handleInputEvent(webEvent, cursorInfo))
event->stopPropagation();
event->setDefaultHandled(); event->setDefaultHandled();
}
// A windowless plugin can change the cursor in response to a mouse move // A windowless plugin can change the cursor in response to a mouse move
// event. We need to reflect the changed cursor in the frame view as the // event. We need to reflect the changed cursor in the frame view as the
...@@ -759,10 +757,8 @@ void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) ...@@ -759,10 +757,8 @@ void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event)
return; return;
WebCursorInfo cursorInfo; WebCursorInfo cursorInfo;
if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { if (m_webPlugin->handleInputEvent(webEvent, cursorInfo))
event->stopPropagation();
event->setDefaultHandled(); event->setDefaultHandled();
}
} }
void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event) void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event)
...@@ -804,10 +800,8 @@ void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event) ...@@ -804,10 +800,8 @@ void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event)
view->client()->handleCurrentKeyboardEvent(); view->client()->handleCurrentKeyboardEvent();
WebCursorInfo cursorInfo; WebCursorInfo cursorInfo;
if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { if (m_webPlugin->handleInputEvent(webEvent, cursorInfo))
event->stopPropagation();
event->setDefaultHandled(); event->setDefaultHandled();
}
} }
void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event)
...@@ -824,10 +818,8 @@ void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) ...@@ -824,10 +818,8 @@ void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event)
focusPlugin(); focusPlugin();
WebCursorInfo cursorInfo; WebCursorInfo cursorInfo;
if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { if (m_webPlugin->handleInputEvent(webEvent, cursorInfo))
event->stopPropagation();
event->setDefaultHandled(); event->setDefaultHandled();
}
// FIXME: Can a plugin change the cursor from a touch-event callback? // FIXME: Can a plugin change the cursor from a touch-event callback?
return; return;
} }
...@@ -852,7 +844,6 @@ void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) ...@@ -852,7 +844,6 @@ void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event)
return; return;
WebCursorInfo cursorInfo; WebCursorInfo cursorInfo;
if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) {
event->stopPropagation();
event->setDefaultHandled(); event->setDefaultHandled();
return; return;
} }
...@@ -875,10 +866,8 @@ void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) ...@@ -875,10 +866,8 @@ void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event)
return; return;
WebCursorInfo cursorInfo; WebCursorInfo cursorInfo;
if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { if (m_webPlugin->handleInputEvent(webEvent, cursorInfo))
event->stopPropagation();
event->setDefaultHandled(); event->setDefaultHandled();
}
} }
void WebPluginContainerImpl::focusPlugin() void WebPluginContainerImpl::focusPlugin()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment