Backed out 3 changesets (bug 1604140) for multiple failures. CLOSED TREE

Backed out changeset 59fc63dfa309 (bug 1604140)
Backed out changeset cc54269377f2 (bug 1604140)
Backed out changeset 8897a2187a95 (bug 1604140)
This commit is contained in:
Csoregi Natalia 2020-02-13 11:55:36 +02:00
Родитель 2ab02cf31b
Коммит ff0444bf80
4 изменённых файлов: 20 добавлений и 190 удалений

Просмотреть файл

@ -3282,21 +3282,19 @@ nsresult nsFocusManager::GetNextTabbableContent(
nsIContent** aResultContent) {
*aResultContent = nullptr;
if (!aStartContent) {
return NS_OK;
}
nsCOMPtr<nsIContent> startContent = aStartContent;
if (!startContent) return NS_OK;
nsIContent* startContent = aStartContent;
nsIContent* currentTopLevelScopeOwner = GetTopLevelScopeOwner(startContent);
nsIContent* currentTopLevelScopeOwner = GetTopLevelScopeOwner(aStartContent);
LOGCONTENTNAVIGATION("GetNextTabbable: %s", startContent);
LOGCONTENTNAVIGATION("GetNextTabbable: %s", aStartContent);
LOGFOCUSNAVIGATION((" tabindex: %d", aCurrentTabIndex));
// If startContent is a shadow host or slot in forward navigation,
// search in scope owned by startContent
if (aForward && IsHostOrSlot(startContent)) {
// If aStartContent is a shadow host or slot in forward navigation,
// search in scope owned by aStartContent
if (aForward && IsHostOrSlot(aStartContent)) {
nsIContent* contentToFocus = GetNextTabbableContentInScope(
startContent, startContent, aOriginalStartContent, aForward,
aStartContent, aStartContent, aOriginalStartContent, aForward,
aForward ? 1 : 0, aIgnoreTabIndex, aForDocumentNavigation,
true /* aSkipOwner */);
if (contentToFocus) {
@ -3305,11 +3303,11 @@ nsresult nsFocusManager::GetNextTabbableContent(
}
}
// If startContent is in a scope owned by Shadow DOM search from scope
// including startContent
if (nsIContent* owner = FindScopeOwner(startContent)) {
// If aStartContent is in a scope owned by Shadow DOM search from scope
// including aStartContent
if (nsIContent* owner = FindScopeOwner(aStartContent)) {
nsIContent* contentToFocus = GetNextTabbableContentInAncestorScopes(
owner, &startContent, aOriginalStartContent, aForward,
owner, &aStartContent, aOriginalStartContent, aForward,
&aCurrentTabIndex, aIgnoreTabIndex, aForDocumentNavigation);
if (contentToFocus) {
NS_ADDREF(*aResultContent = contentToFocus);
@ -3319,16 +3317,15 @@ nsresult nsFocusManager::GetNextTabbableContent(
// If we reach here, it means no next tabbable content in shadow DOM.
// We need to continue searching in light DOM, starting at the top level
// shadow host in light DOM (updated startContent) and its tabindex
// shadow host in light DOM (updated aStartContent) and its tabindex
// (updated aCurrentTabIndex).
MOZ_ASSERT(!FindScopeOwner(startContent),
"startContent should not be owned by Shadow DOM at this point");
MOZ_ASSERT(!FindScopeOwner(aStartContent),
"aStartContent should not be owned by Shadow DOM at this point");
nsPresContext* presContext = aPresShell->GetPresContext();
bool getNextFrame = true;
nsCOMPtr<nsIContent> iterStartContent = startContent;
nsIContent* topLevelScopeStartContent = startContent;
nsCOMPtr<nsIContent> iterStartContent = aStartContent;
// Iterate tab index to find corresponding contents
while (1) {
nsIFrame* frame = iterStartContent->GetPrimaryFrame();
@ -3404,16 +3401,15 @@ nsresult nsFocusManager::GetNextTabbableContent(
}
}
nsIContent* oldTopLevelScopeOwner = nullptr;
// Walk frames to find something tabbable matching aCurrentTabIndex
while (frame) {
// Try to find the topmost scope owner, since we want to skip the node
// that is not owned by document in frame traversal.
nsIContent* currentContent = frame->GetContent();
if (currentTopLevelScopeOwner) {
oldTopLevelScopeOwner = currentTopLevelScopeOwner;
nsIContent* oldTopLevelScopeOwner = currentTopLevelScopeOwner;
if (!aForward || currentTopLevelScopeOwner != currentContent) {
currentTopLevelScopeOwner = GetTopLevelScopeOwner(currentContent);
}
currentTopLevelScopeOwner = GetTopLevelScopeOwner(currentContent);
if (currentTopLevelScopeOwner &&
currentTopLevelScopeOwner == oldTopLevelScopeOwner) {
// We're within non-document scope, continue.
@ -3443,7 +3439,7 @@ nsresult nsFocusManager::GetNextTabbableContent(
// will be selected again.
bool validPopup = true;
if (!aForward) {
nsIContent* content = topLevelScopeStartContent;
nsIContent* content = aStartContent;
while (content) {
if (content == currentContent) {
validPopup = false;

Просмотреть файл

@ -785,97 +785,6 @@
input1.remove();
}
// Bug 1604140
function testTabbingThroughScrollableShadowHost() {
opener.is(document.activeElement, document.body.firstChild,
"body's first child should have focus.");
let aboveFirstHost = document.createElement("div");
aboveFirstHost.tabIndex = 0;
aboveFirstHost.onfocus = focusLogger;
document.body.appendChild(aboveFirstHost);
let firstHost = document.createElement("div");
firstHost.style = "overflow: scroll";
document.body.appendChild(firstHost);
let firstShadow = firstHost.attachShadow({mode: "open"});
let divInFirstShadow = document.createElement("div");
divInFirstShadow.tabIndex = 0;
divInFirstShadow.onfocus = focusLogger;
firstShadow.appendChild(divInFirstShadow);
let aboveSecondHost = document.createElement("div");
aboveSecondHost.tabIndex = 0;
aboveSecondHost.onfocus = focusLogger;
document.body.appendChild(aboveSecondHost);
let secondHost = document.createElement("div");
secondHost.style = "overflow: scroll";
secondHost.tabIndex = 0;
secondHost.onfocus = focusLogger;
document.body.appendChild(secondHost);
let secondShadow = secondHost.attachShadow({mode: "open"});
let divInSecondShadow = document.createElement("div");
divInSecondShadow.tabIndex = 0;
divInSecondShadow.onfocus = focusLogger;
secondShadow.appendChild(divInSecondShadow);
let belowSecondHost = document.createElement("div");
belowSecondHost.tabIndex = 0;
belowSecondHost.onfocus = focusLogger;
document.body.appendChild(belowSecondHost);
document.body.offsetLeft;
synthesizeKey("KEY_Tab");
opener.is(lastFocusTarget, aboveFirstHost, "Should have focused div above first host element. (1)");
synthesizeKey("KEY_Tab");
opener.is(lastFocusTarget, divInFirstShadow, "Should have focused div in first shadow dom. (2)");
synthesizeKey("KEY_Tab");
opener.is(lastFocusTarget, aboveSecondHost, "Should have focused div above second host element. (3)");
synthesizeKey("KEY_Tab");
opener.is(lastFocusTarget, secondHost, "Should have focused second host element. (4)");
synthesizeKey("KEY_Tab");
opener.is(lastFocusTarget, divInSecondShadow, "Should have focused div in second shadow dom. (5)");
synthesizeKey("KEY_Tab");
opener.is(lastFocusTarget, belowSecondHost, "Should have focused div below second host. (6)");
// Backwards
synthesizeKey("KEY_Tab", {shiftKey: true});
opener.is(lastFocusTarget, divInSecondShadow, "Should have focused div in second shadow dom. (7)");
synthesizeKey("KEY_Tab", {shiftKey: true});
// focus is already on second host, so lastFocusTarget won't get updated.
opener.is(document.activeElement, secondHost, "Should have focused second host element. (8)");
opener.is(secondShadow.activeElement, null, "Focus should have left div in second shadow dom. (8)");
synthesizeKey("KEY_Tab", {shiftKey: true});
opener.is(lastFocusTarget, aboveSecondHost, "Should have focused div above second host element. (9)");
synthesizeKey("KEY_Tab", {shiftKey: true});
opener.is(lastFocusTarget, divInFirstShadow, "Should have focused div in first shadow dom. (10)");
synthesizeKey("KEY_Tab", {shiftKey: true});
opener.is(lastFocusTarget, aboveFirstHost, "Should have focused div above first host element. (11)");
synthesizeKey("KEY_Tab", {shiftKey: true});
opener.is(document.activeElement, document.body.firstChild,
"body's first child should have focus.");
aboveFirstHost.remove();
firstHost.remove();
aboveSecondHost.remove();
secondHost.remove();
belowSecondHost.remove();
}
function testDeeplyNestedShadowTree() {
opener.is(document.activeElement, document.body.firstChild, "body's first child should have focus.");
var host1 = document.createElement("test-node");
@ -969,7 +878,6 @@
testTabbingThroughSlotInLightDOM();
testTabbingThroughFocusableSlotInLightDOM();
testTabbingThroughScrollableShadowDOM();
testTabbingThroughScrollableShadowHost();
testDeeplyNestedShadowTree();
testBackwardsTabbingWithSlotsWithoutFocusableContent();

Просмотреть файл

@ -1,38 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: focus - the sequential focus navigation order with shadow dom and scrollable/non-focusable host</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus-navigation">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/shadow-utils.js"></script>
<body>
<script>
// Structure:
// <div #aboveHost tabindex=0>
// <div #host style="overflow: scroll">
// #shadowRoot
// <div #aboveSlot tabindex=0>
// <slot #slotAbove tabindex=0>
// (slotted) <div #slottedAbove tabindex=0>
// <slot #slotBelow tabindex=0>
// (slotted) <div #slottedBelow tabindex=0>
// <div #belowSlot tabindex=0>
// <div #belowHost tabindex=0>
promise_test(() => {
let elementsInFlatTreeOrder;
let [aboveHost, host, aboveSlot, slotAbove, slottedAbove, slotBelow, slottedBelow, belowSlot, belowHost] =
elementsInFlatTreeOrder = prepareDOM(document.body, false);
setTabIndex(elementsInFlatTreeOrder, 0);
removeTabIndex([host]);
host.style = "overflow: scroll";
resetFocus();
// Focus should move in flat tree order since every one of them has tabindex ==0,
// but doesn't include #slot since it's not rendered and #host since its tabindex is not set
// (but #host is considered as 0 in focus scope navigation, keeping the flat tree order for the shadow root's descendants).
return assertFocusOrder(elementsInFlatTreeOrder.filter(el => (el !== slotAbove && el !== slotBelow && el !== host)));
}, "Order when all tabindex=0 except scrollable host (tabindex not set)");
</script>
</body>

Просмотреть файл

@ -1,36 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: focus - the sequential focus navigation order with shadow dom and host is scrollable</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus-navigation">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/shadow-utils.js"></script>
<body>
<script>
// Structure:
// <div #aboveHost tabindex=0>
// <div #host tabindex=0 style="overflow: scroll">
// #shadowRoot
// <div #aboveSlot tabindex=0>
// <slot #slotAbove tabindex=0>
// (slotted) <div #slottedAbove tabindex=0>
// <slot #slotBelow tabindex=0>
// (slotted) <div #slottedBelow tabindex=0>
// <div #belowSlot tabindex=0>
// <div #belowHost tabindex=0>
promise_test(() => {
let elementsInFlatTreeOrder;
let [aboveHost, host, aboveSlot, slotAbove, slottedAbove, slotBelow, slottedBelow, belowSlot, belowHost] =
elementsInFlatTreeOrder = prepareDOM(document.body, false);
setTabIndex(elementsInFlatTreeOrder, 0);
host.style = "overflow: scroll";
resetFocus();
// Focus should move in flat tree order since every one of them has tabindex==0,
// but doesn't include slots.
return assertFocusOrder(elementsInFlatTreeOrder.filter(el => (el !== slotAbove && el !== slotBelow)));
}, "Order when all tabindex=0 and host is scrollable");
</script>
</body>