Commit e04d7acb authored by jbroman@chromium.org's avatar jbroman@chromium.org

Revert of HTMLPlugInElement: Use custom focus logic only when there is a...

Revert of HTMLPlugInElement: Use custom focus logic only when there is a plugin. (patchset #1 id:1 of https://codereview.chromium.org/717193003/)

Reason for revert:
probable cause of use-after-free:
https://code.google.com/p/chromium/issues/detail?id=433357

Original issue's description:
> HTMLPlugInElement: Use custom focus logic only when there is a plugin.
> 
> This allows focus to enter and leave plugin placeholders, so that constituent
> elements (such as a close button) can be keyboard-focused.
> 
> TEST=fast/plugins/plugin/placeholder-focus.html
> BUG=364716
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=185290

TBR=mkwst@chromium.org,esprehn@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=364716

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

git-svn-id: svn://svn.chromium.org/blink/trunk@185383 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8f305b2c
Ensures that elements within a plugin placeholder can be keyboard focused.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS document.activeElement is input1
PASS shadowRoot1.activeElement is null
PASS document.activeElement is plugin1
PASS shadowRoot1.activeElement is non-null.
PASS document.activeElement is input1
PASS shadowRoot1.activeElement is null
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<div id="description"></div>
<div id="console"></div>
<input id="input1">
<object id="plugin1" type="application/x-fake-plugin"></object>
<script>
description('Ensures that elements within a plugin placeholder can be keyboard focused.');
// Close buttons are focusable, so we expect focus to move into and out of the placeholder.
var input1 = document.getElementById("input1");
var plugin1 = document.getElementById("plugin1");
internals.forcePluginPlaceholder(plugin1, { closeable: true });
var shadowRoot1 = internals.youngestShadowRoot(plugin1);
input1.focus();
shouldBe("document.activeElement", "input1");
shouldBeNull("shadowRoot1.activeElement");
eventSender.keyDown("\t");
shouldBe("document.activeElement", "plugin1");
shouldBeNonNull("shadowRoot1.activeElement");
eventSender.keyDown("\t", ["shiftKey"]);
shouldBe("document.activeElement", "input1");
shouldBeNull("shadowRoot1.activeElement");
document.activeElement.blur();
</script>
......@@ -390,18 +390,14 @@ RenderPart* HTMLPlugInElement::renderPartForJSBindings() const
bool HTMLPlugInElement::isKeyboardFocusable() const
{
if (useFallbackContent() || usePlaceholderContent())
return HTMLElement::isKeyboardFocusable();
if (!document().isActive())
return false;
return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(pluginWidget())->supportsKeyboardFocus();
}
bool HTMLPlugInElement::hasCustomFocusLogic() const
{
return renderer() && renderer()->isEmbeddedObject();
return !hasAuthorShadowRoot();
}
bool HTMLPlugInElement::isPluginElement() const
......
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