Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Handle focusability for plugin elements which has browsing context
https://bugs.webkit.org/show_bug.cgi?id=259420 Reviewed by Ryosuke Niwa. This patch aligns WebKit with Blink / Chromium. Merge: https://chromium.googlesource.com/chromium/src.git/+/a2c82afad86cf4f85f91df76f858434b15fe6b13 If `object` or `embed` has HTML/SVG contents, focus navigation within documents under these elements should work. This has been working fine for `iframe`'s. The FocusController code checks for FrameOwnerElement, which is parent of `iframe`, `object`, and `embed` if it is isKeyboardFocusable() and has contentFrame(). HTMLPluginElement::isKeyboardFocsuable() didn't handle the cases with HTML/SVG contents, only considered plugins. * Source/WebCore/html/HTMLPlugInElement.cpp: (HTMLPlugInElement::isKeyboardFocusable): As above for focusability * Source/WebCore/html/HTMLFrameOwnerElement.h: Move 'isKeyboardFocusable' from private to protected * LayoutTests/fast/dom/focus-navigation-in-plugin.html: Add Test Case * LayoutTests/fast/dom/resources/plugin-focus-subframe.html: Add Test Case resource * LayoutTests/fast/dom/focus-navigation-in-plugin-expected.txt: Add Test Case Expectation * LayoutTests/platform/ios/TestExpectations: Added test to skip on iOS since it does not support 'keyDown' Canonical link: https://commits.webkit.org/266286@main
- Loading branch information
1 parent
0ddbfa3
commit 61a5480
Showing
6 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
|
||
PASS Focus should navigate to <object>/<embed> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<input id="outer-before"> | ||
<object data="resources/plugin-focus-subframe.html" type="text/html" id="obj"></object> | ||
<embed src="resources/plugin-focus-subframe.html" type="text/html" id="emb"></embed> | ||
<input id="outer-after"> | ||
<script> | ||
function PressTab() { | ||
eventSender.keyDown('\t'); | ||
} | ||
function PressShiftTab() { | ||
eventSender.keyDown('\t', ['shiftKey']); | ||
} | ||
function testFocusNavigation() { | ||
test(() => { | ||
var before = document.querySelector('#outer-before'); | ||
var after = document.querySelector('#outer-after'); | ||
before.focus(); | ||
// 'plugin-focus-subframe.html' has 2 focus areas. | ||
var expected = ['outer-before', 'obj', 'obj', 'emb', 'emb', 'outer-after']; | ||
var i; | ||
for (i = 0; i < 5; ++i) { | ||
assert_equals(document.activeElement.id, expected[i]); | ||
PressTab(); | ||
} | ||
assert_equals(document.activeElement, after, '#after'); | ||
expected.reverse(); | ||
for (i = 0; i < 5; ++i) { | ||
assert_equals(document.activeElement.id, expected[i]); | ||
PressShiftTab(); | ||
} | ||
assert_equals(document.activeElement, before, '#before'); | ||
}, "Focus should navigate to <object>/<embed>"); | ||
} | ||
if (window.testRunner) { | ||
window.addEventListener('load', testFocusNavigation, false); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<input placeholder="subframe-before"> | ||
<input placeholder="subframe-after"> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters