Bug 1705598 - part 7: Make `WSRunScanner::GetRangeContainingInvisibleWhiteSpacesAtRangeBoundaries()` take editing host instead of `HTMLEditor` r=m_kato

Depends on D112507

Differential Revision: https://phabricator.services.mozilla.com/D112508
This commit is contained in:
Masayuki Nakano 2021-04-19 23:25:47 +00:00
Родитель 7c39f920b9
Коммит 16c03a3b47
3 изменённых файлов: 6 добавлений и 7 удалений

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

@ -2903,7 +2903,8 @@ HTMLEditor::AutoDeleteRangesHandler::ComputeRangesToDeleteNonCollapsedRanges(
EditorDOMRange firstRange(aRangesToDelete.FirstRangeRef());
EditorDOMRange extendedRange =
WSRunScanner::GetRangeContainingInvisibleWhiteSpacesAtRangeBoundaries(
aHTMLEditor, EditorDOMRange(aRangesToDelete.FirstRangeRef()));
aHTMLEditor.GetActiveEditingHost(),
EditorDOMRange(aRangesToDelete.FirstRangeRef()));
if (firstRange != extendedRange) {
nsresult rv = aRangesToDelete.FirstRangeRef()->SetStartAndEnd(
extendedRange.StartRef().ToRawRangeBoundary(),

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

@ -3566,15 +3566,13 @@ EditorDOMRange WSRunScanner::GetRangeForDeletingBlockElementBoundaries(
// static
EditorDOMRange
WSRunScanner::GetRangeContainingInvisibleWhiteSpacesAtRangeBoundaries(
const HTMLEditor& aHTMLEditor, const EditorDOMRange& aRange) {
Element* aEditingHost, const EditorDOMRange& aRange) {
MOZ_ASSERT(aRange.IsPositionedAndValid());
MOZ_ASSERT(aRange.EndRef().IsSetAndValid());
MOZ_ASSERT(aRange.StartRef().IsSetAndValid());
const Element* editingHost = aHTMLEditor.GetActiveEditingHost();
EditorDOMRange result;
TextFragmentData textFragmentDataAtStart(aRange.StartRef(), editingHost);
TextFragmentData textFragmentDataAtStart(aRange.StartRef(), aEditingHost);
if (NS_WARN_IF(!textFragmentDataAtStart.IsInitialized())) {
return EditorDOMRange(); // TODO: Make here return error with Err.
}
@ -3607,7 +3605,7 @@ WSRunScanner::GetRangeContainingInvisibleWhiteSpacesAtRangeBoundaries(
result.SetStart(aRange.StartRef());
}
TextFragmentData textFragmentDataAtEnd(aRange.EndRef(), editingHost);
TextFragmentData textFragmentDataAtEnd(aRange.EndRef(), aEditingHost);
if (NS_WARN_IF(!textFragmentDataAtEnd.IsInitialized())) {
return EditorDOMRange(); // TODO: Make here return error with Err.
}

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

@ -419,7 +419,7 @@ class MOZ_STACK_CLASS WSRunScanner final {
* extended range if range boundaries of aRange are in invisible white-spaces.
*/
static EditorDOMRange GetRangeContainingInvisibleWhiteSpacesAtRangeBoundaries(
const HTMLEditor& aHTMLEditor, const EditorDOMRange& aRange);
dom::Element* aEditingHost, const EditorDOMRange& aRange);
/**
* GetPrecedingBRElementUnlessVisibleContentFound() scans a `<br>` element