Bug 1624633: part 9) Move `FindRangeData`. r=hsivonen

Differential Revision: https://phabricator.services.mozilla.com/D68225

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mirko Brodesser 2020-03-27 11:05:48 +00:00
Родитель d9c76a1049
Коммит 8429b643fd
2 изменённых файлов: 9 добавлений и 8 удалений

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

@ -1637,7 +1637,7 @@ UniquePtr<SelectionDetails> Selection::LookUpSelection(
newHead->mStart = start;
newHead->mEnd = end;
newHead->mSelectionType = aSelectionType;
StyledRange* rd = FindRangeData(range);
StyledRange* rd = mStyledRanges.FindRangeData(range);
if (rd) {
newHead->mTextRangeStyle = rd->mTextRangeStyle;
}
@ -1725,11 +1725,12 @@ void Selection::SetAncestorLimiter(nsIContent* aLimiter) {
}
}
StyledRange* Selection::FindRangeData(nsRange* aRange) {
StyledRange* Selection::StyledRanges::FindRangeData(nsRange* aRange) {
NS_ENSURE_TRUE(aRange, nullptr);
for (uint32_t i = 0; i < mStyledRanges.mRanges.Length(); i++) {
if (mStyledRanges.mRanges[i].mRange == aRange)
return &mStyledRanges.mRanges[i];
for (uint32_t i = 0; i < mRanges.Length(); i++) {
if (mRanges[i].mRange == aRange) {
return &mRanges[i];
}
}
return nullptr;
}
@ -1737,7 +1738,7 @@ StyledRange* Selection::FindRangeData(nsRange* aRange) {
nsresult Selection::SetTextRangeStyle(nsRange* aRange,
const TextRangeStyle& aTextRangeStyle) {
NS_ENSURE_ARG_POINTER(aRange);
StyledRange* rd = FindRangeData(aRange);
StyledRange* rd = mStyledRanges.FindRangeData(aRange);
if (rd) {
rd->mTextRangeStyle = aTextRangeStyle;
}

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

@ -740,8 +740,6 @@ class Selection final : public nsSupportsWeakReference,
bool* aDidAddRange,
int32_t* aOutIndex);
StyledRange* FindRangeData(nsRange* aRange);
Document* GetDocument() const;
nsPIDOMWindowOuter* GetWindow() const;
HTMLEditor* GetHTMLEditor() const;
@ -749,6 +747,8 @@ class Selection final : public nsSupportsWeakReference,
void Disconnect();
struct StyledRanges {
StyledRange* FindRangeData(nsRange* aRange);
nsresult RemoveRangeAndUnregisterSelection(nsRange& aRange);
/**