зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1633448: part 7) Add `StyledRanges::UnregisterSelection`. r=hsivonen
One step closer towards privatizing `StyledRanges::mRanges`. Depends on D73234 Differential Revision: https://phabricator.services.mozilla.com/D73430
This commit is contained in:
Родитель
c6b90540b1
Коммит
c4ed6f536e
|
@ -541,10 +541,7 @@ Selection::~Selection() { Disconnect(); }
|
||||||
void Selection::Disconnect() {
|
void Selection::Disconnect() {
|
||||||
SetAnchorFocusRange(-1);
|
SetAnchorFocusRange(-1);
|
||||||
|
|
||||||
uint32_t count = mStyledRanges.mRanges.Length();
|
mStyledRanges.UnregisterSelection();
|
||||||
for (uint32_t i = 0; i < count; ++i) {
|
|
||||||
mStyledRanges.mRanges[i].mRange->UnregisterSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mAutoScrollTimer) {
|
if (mAutoScrollTimer) {
|
||||||
mAutoScrollTimer->Stop();
|
mAutoScrollTimer->Stop();
|
||||||
|
@ -1109,8 +1106,8 @@ nsresult Selection::RemoveCollapsedRanges() {
|
||||||
nsresult Selection::Clear(nsPresContext* aPresContext) {
|
nsresult Selection::Clear(nsPresContext* aPresContext) {
|
||||||
SetAnchorFocusRange(-1);
|
SetAnchorFocusRange(-1);
|
||||||
|
|
||||||
|
mStyledRanges.UnregisterSelection();
|
||||||
for (uint32_t i = 0; i < mStyledRanges.mRanges.Length(); ++i) {
|
for (uint32_t i = 0; i < mStyledRanges.mRanges.Length(); ++i) {
|
||||||
mStyledRanges.mRanges[i].mRange->UnregisterSelection();
|
|
||||||
SelectFrames(aPresContext, mStyledRanges.mRanges[i].mRange, false);
|
SelectFrames(aPresContext, mStyledRanges.mRanges[i].mRange, false);
|
||||||
}
|
}
|
||||||
mStyledRanges.mRanges.Clear();
|
mStyledRanges.mRanges.Clear();
|
||||||
|
@ -1749,6 +1746,13 @@ void Selection::SetAncestorLimiter(nsIContent* aLimiter) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Selection::StyledRanges::UnregisterSelection() {
|
||||||
|
uint32_t count = mRanges.Length();
|
||||||
|
for (uint32_t i = 0; i < count; ++i) {
|
||||||
|
mRanges[i].mRange->UnregisterSelection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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++) {
|
||||||
|
|
|
@ -841,6 +841,8 @@ class Selection final : public nsSupportsWeakReference,
|
||||||
static nsresult SubtractRange(StyledRange& aRange, nsRange& aSubtract,
|
static nsresult SubtractRange(StyledRange& aRange, nsRange& aSubtract,
|
||||||
nsTArray<StyledRange>* aOutput);
|
nsTArray<StyledRange>* aOutput);
|
||||||
|
|
||||||
|
void UnregisterSelection();
|
||||||
|
|
||||||
// These are the ranges inside this selection. They are kept sorted in order
|
// These are the ranges inside this selection. They are kept sorted in order
|
||||||
// of DOM start position.
|
// of DOM start position.
|
||||||
//
|
//
|
||||||
|
|
Загрузка…
Ссылка в новой задаче