Bug 1633448: part 10) Add `StyledRanges::Clear`. r=hsivonen

Differential Revision: https://phabricator.services.mozilla.com/D73433
This commit is contained in:
Mirko Brodesser 2020-05-04 10:11:13 +00:00
Родитель d0cba89c40
Коммит 2d12323c40
2 изменённых файлов: 5 добавлений и 1 удалений

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

@ -1115,7 +1115,7 @@ nsresult Selection::Clear(nsPresContext* aPresContext) {
for (uint32_t i = 0; i < mStyledRanges.Length(); ++i) { for (uint32_t i = 0; i < mStyledRanges.Length(); ++i) {
SelectFrames(aPresContext, mStyledRanges.mRanges[i].mRange, false); SelectFrames(aPresContext, mStyledRanges.mRanges[i].mRange, false);
} }
mStyledRanges.mRanges.Clear(); mStyledRanges.Clear();
// Reset direction so for more dependable table selection range handling // Reset direction so for more dependable table selection range handling
SetDirection(eDirNext); SetDirection(eDirNext);
@ -1758,6 +1758,8 @@ void Selection::StyledRanges::UnregisterSelection() {
} }
} }
void Selection::StyledRanges::Clear() { mRanges.Clear(); }
StyledRange* Selection::StyledRanges::FindRangeData(nsRange* aRange) { StyledRange* Selection::StyledRanges::FindRangeData(nsRange* aRange) {
NS_ENSURE_TRUE(aRange, nullptr); NS_ENSURE_TRUE(aRange, nullptr);
for (uint32_t i = 0; i < mRanges.Length(); i++) { for (uint32_t i = 0; i < mRanges.Length(); i++) {

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

@ -756,6 +756,8 @@ class Selection final : public nsSupportsWeakReference,
void Disconnect(); void Disconnect();
struct StyledRanges { struct StyledRanges {
void Clear();
StyledRange* FindRangeData(nsRange* aRange); StyledRange* FindRangeData(nsRange* aRange);
using Elements = AutoTArray<StyledRange, 1>; using Elements = AutoTArray<StyledRange, 1>;