Bug 1633448: part 1) Move `Selection::SubtractRange` to `StyledRanges`. r=smaug

`StyledRanges should have as few dependencies to `Selection` as
possible.

Differential Revision: https://phabricator.services.mozilla.com/D72688
This commit is contained in:
Mirko Brodesser 2020-04-27 19:26:25 +00:00
Родитель d3c30177b9
Коммит b94b69e3a4
2 изменённых файлов: 6 добавлений и 4 удалений

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

@ -729,8 +729,9 @@ int32_t Selection::StyledRanges::FindInsertionPoint(
// difference to aOutput. It is assumed that the caller has checked that
// aRange and aSubtract do indeed overlap
nsresult Selection::SubtractRange(StyledRange& aRange, nsRange& aSubtract,
nsTArray<StyledRange>* aOutput) {
// static
nsresult Selection::StyledRanges::SubtractRange(
StyledRange& aRange, nsRange& aSubtract, nsTArray<StyledRange>* aOutput) {
nsRange* range = aRange.mRange;
if (NS_WARN_IF(!range->IsPositioned())) {

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

@ -152,8 +152,6 @@ class Selection final : public nsSupportsWeakReference,
MOZ_CAN_RUN_SCRIPT nsresult
ScrollIntoView(SelectionRegion aRegion, ScrollAxis aVertical = ScrollAxis(),
ScrollAxis aHorizontal = ScrollAxis(), int32_t aFlags = 0);
static nsresult SubtractRange(StyledRange& aRange, nsRange& aSubtract,
nsTArray<StyledRange>* aOutput);
private:
static bool AreUserSelectedRangesNonEmpty(
@ -837,6 +835,9 @@ class Selection final : public nsSupportsWeakReference,
void MaybeFocusCommonEditingHost(PresShell* aPresShell) const;
static nsresult SubtractRange(StyledRange& aRange, nsRange& aSubtract,
nsTArray<StyledRange>* aOutput);
// These are the ranges inside this selection. They are kept sorted in order
// of DOM start position.
//