mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug 1497480 - Part 2: Make spellchecking to work in ShadowDOM after anchor navigates away from it; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D9543 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
383ec68585
commit
af96c255f6
@ -86,9 +86,6 @@ using namespace mozilla::dom;
|
||||
#define INLINESPELL_STARTED_TOPIC "inlineSpellChecker-spellCheck-started"
|
||||
#define INLINESPELL_ENDED_TOPIC "inlineSpellChecker-spellCheck-ended"
|
||||
|
||||
static bool ContentIsDescendantOf(nsINode* aPossibleDescendant,
|
||||
nsINode* aPossibleAncestor);
|
||||
|
||||
static const char kMaxSpellCheckSelectionSize[] =
|
||||
"extensions.spellcheck.inline.max-misspellings";
|
||||
static const PRTime kMaxSpellCheckTimeInUsec =
|
||||
@ -228,7 +225,8 @@ mozInlineSpellStatus::InitForNavigation(
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// the anchor node might not be in the DOM anymore, check
|
||||
if (root && aOldAnchorNode && ! ContentIsDescendantOf(aOldAnchorNode, root)) {
|
||||
if (root && aOldAnchorNode &&
|
||||
!nsContentUtils::ContentIsShadowIncludingDescendantOf(aOldAnchorNode, root)) {
|
||||
*aContinue = false;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1728,24 +1726,6 @@ mozInlineSpellChecker::SaveCurrentSelectionPosition()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// This is a copy of nsContentUtils::ContentIsDescendantOf. Another crime
|
||||
// for XPCOM's rap sheet
|
||||
bool // static
|
||||
ContentIsDescendantOf(nsINode* aPossibleDescendant,
|
||||
nsINode* aPossibleAncestor)
|
||||
{
|
||||
MOZ_ASSERT(aPossibleDescendant, "The possible descendant is null!");
|
||||
MOZ_ASSERT(aPossibleAncestor, "The possible ancestor is null!");
|
||||
|
||||
do {
|
||||
if (aPossibleDescendant == aPossibleAncestor)
|
||||
return true;
|
||||
aPossibleDescendant = aPossibleDescendant->GetParentNode();
|
||||
} while (aPossibleDescendant);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// mozInlineSpellChecker::HandleNavigationEvent
|
||||
//
|
||||
// Acts upon mouse clicks and keyboard navigation changes, spell checking
|
||||
|
Loading…
Reference in New Issue
Block a user