Bug 1429656 - Implement ShadowRoot.activeElement

Tag #1375
This commit is contained in:
Matt A. Tobin 2020-06-13 08:23:21 -04:00 committed by Roy Tam
commit 693a79ca08
14 changed files with 88 additions and 72 deletions

View file

@ -813,10 +813,11 @@ nsFocusManager::ContentRemoved(nsIDocument* aDocument, nsIContent* aContent)
if (!window)
return NS_OK;
// if the content is currently focused in the window, or is an ancestor
// of the currently focused element, reset the focus within that window.
// if the content is currently focused in the window, or is an
// shadow-including inclusive ancestor of the currently focused element,
// reset the focus within that window.
nsIContent* content = window->GetFocusedNode();
if (content && nsContentUtils::ContentIsDescendantOf(content, aContent)) {
if (content && nsContentUtils::ContentIsHostIncludingDescendantOf(content, aContent)) {
bool shouldShowFocusRing = window->ShouldShowFocusRing();
window->SetFocusedNode(nullptr);