Bug 1771448 - part 4: Rename HTMLEditor::GetActiveEditingHost to ComputeEditingHost r=m_kato
It's currently computes the corresponding editing host from the focus node of `Selection` with climbing up the DOM tree. So, it does not just return a stored element. Therefore, some callers use it multiple times. For avoiding it, we should rename it to explain that it computes the editing host. Note that I think that we should make it takes a node to compute editing host without `Selection` for solving the case of no selection ranges. Therefore, I don't like to include more information into the name. Differential Revision: https://phabricator.services.mozilla.com/D147504
This commit is contained in:
@@ -411,7 +411,7 @@ class MOZ_STACK_CLASS
|
||||
HTMLBRElement*
|
||||
HTMLEditor::HTMLWithContextInserter::GetInvisibleBRElementAtPoint(
|
||||
const EditorDOMPoint& aPointToInsert) const {
|
||||
WSRunScanner wsRunScannerAtInsertionPoint(mHTMLEditor.GetActiveEditingHost(),
|
||||
WSRunScanner wsRunScannerAtInsertionPoint(mHTMLEditor.ComputeEditingHost(),
|
||||
aPointToInsert);
|
||||
if (wsRunScannerAtInsertionPoint.EndsByInvisibleBRElement()) {
|
||||
return wsRunScannerAtInsertionPoint.EndReasonBRElementPtr();
|
||||
@@ -471,7 +471,7 @@ HTMLEditor::HTMLWithContextInserter::GetNewCaretPointAfterInsertingHTML(
|
||||
|
||||
// Make sure we don't end up with selection collapsed after an invisible
|
||||
// `<br>` element.
|
||||
Element* editingHost = mHTMLEditor.GetActiveEditingHost();
|
||||
Element* editingHost = mHTMLEditor.ComputeEditingHost();
|
||||
WSRunScanner wsRunScannerAtCaret(editingHost, pointToPutCaret);
|
||||
if (wsRunScannerAtCaret
|
||||
.ScanPreviousVisibleNodeOrBlockBoundaryFrom(pointToPutCaret)
|
||||
@@ -706,7 +706,7 @@ nsresult HTMLEditor::HTMLWithContextInserter::Run(
|
||||
}
|
||||
|
||||
Element* editingHost =
|
||||
mHTMLEditor.GetActiveEditingHost(HTMLEditor::LimitInBodyElement::No);
|
||||
mHTMLEditor.ComputeEditingHost(HTMLEditor::LimitInBodyElement::No);
|
||||
if (NS_WARN_IF(!editingHost)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user