Bug 1943226 - Make nsFrameSelection treat limiters are elements r=jjaschke,dom-core

`nsFrameSelection::GetLimiter()` is not `nullptr` only when it's an instance for
an independent selection of a text control.  In the case, it's set to the editor
root anonymous `<div>` of the text control.  Despite the name, this is already
optimized only for this purpose in `nsFrameSelection::NodeIsInLimiters()`.
Thus, we don't have any problems to make this clearer for the other developers
with renaming some parameter names.

`nsFrameSelection::GetAncestorLimiter()` is also always an `Element`.  So,
we can change this to `Element` too.

Differential Revision: https://phabricator.services.mozilla.com/D235254
This commit is contained in:
Masayuki Nakano
2025-01-24 02:53:07 +00:00
parent 5e9b04cd87
commit 2b503ca56d
12 changed files with 114 additions and 71 deletions

View File

@@ -1063,7 +1063,7 @@ nsresult HTMLEditor::CollapseSelectionToEndOfLastLeafNodeOfDocument() const {
}
void HTMLEditor::InitializeSelectionAncestorLimit(
nsIContent& aAncestorLimit) const {
Element& aAncestorLimit) const {
MOZ_ASSERT(IsEditActionDataAvailable());
// Hack for initializing selection.
@@ -7450,7 +7450,7 @@ void HTMLEditor::NotifyEditingHostMaybeChanged() {
}
// Compute current editing host.
nsIContent* editingHost = ComputeEditingHost();
Element* const editingHost = ComputeEditingHost();
if (NS_WARN_IF(!editingHost)) {
return;
}