зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1700051: part 44) Reduce `mozInlineSpellStatus::PositionToCollapsedRange` to `static` method. r=smaug
Potentially, this changes behavior, but it shouldn't. Historically, creating a `nsRange` needed the Document, but it doesn't anymore. Differential Revision: https://phabricator.services.mozilla.com/D113300
This commit is contained in:
Родитель
64526e2041
Коммит
ab4f8bcdcd
|
@ -136,8 +136,8 @@ mozInlineSpellStatus::CreateForEditorChange(
|
|||
&aSpellChecker, deleted ? eOpChangeDelete : eOpChange, false, 0}};
|
||||
|
||||
// save the anchor point as a range so we can find the current word later
|
||||
status->mAnchorRange =
|
||||
status->PositionToCollapsedRange(aAnchorNode, aAnchorOffset);
|
||||
status->mAnchorRange = mozInlineSpellStatus::PositionToCollapsedRange(
|
||||
aAnchorNode, aAnchorOffset);
|
||||
if (NS_WARN_IF(!status->mAnchorRange)) {
|
||||
return Err(NS_ERROR_FAILURE);
|
||||
}
|
||||
|
@ -251,12 +251,13 @@ mozInlineSpellStatus::CreateForNavigation(
|
|||
}
|
||||
|
||||
status->mOldNavigationAnchorRange =
|
||||
status->PositionToCollapsedRange(aOldAnchorNode, aOldAnchorOffset);
|
||||
mozInlineSpellStatus::PositionToCollapsedRange(aOldAnchorNode,
|
||||
aOldAnchorOffset);
|
||||
if (NS_WARN_IF(!status->mOldNavigationAnchorRange)) {
|
||||
return Err(NS_ERROR_FAILURE);
|
||||
}
|
||||
status->mAnchorRange =
|
||||
status->PositionToCollapsedRange(aNewAnchorNode, aNewAnchorOffset);
|
||||
status->mAnchorRange = mozInlineSpellStatus::PositionToCollapsedRange(
|
||||
aNewAnchorNode, aNewAnchorOffset);
|
||||
if (NS_WARN_IF(!status->mAnchorRange)) {
|
||||
return Err(NS_ERROR_FAILURE);
|
||||
}
|
||||
|
@ -467,9 +468,10 @@ Document* mozInlineSpellStatus::GetDocument() const {
|
|||
// position. We use ranges to store DOM positions becuase they stay
|
||||
// updated as the DOM is changed.
|
||||
|
||||
// static
|
||||
already_AddRefed<nsRange> mozInlineSpellStatus::PositionToCollapsedRange(
|
||||
nsINode* aNode, uint32_t aOffset) const {
|
||||
if (NS_WARN_IF(!aNode) || NS_WARN_IF(!GetDocument())) {
|
||||
nsINode* aNode, uint32_t aOffset) {
|
||||
if (NS_WARN_IF(!aNode)) {
|
||||
return nullptr;
|
||||
}
|
||||
IgnoredErrorResult ignoredError;
|
||||
|
|
|
@ -131,8 +131,8 @@ class mozInlineSpellStatus {
|
|||
nsresult FillNoCheckRangeFromAnchor(mozInlineSpellWordUtil& aWordUtil);
|
||||
|
||||
mozilla::dom::Document* GetDocument() const;
|
||||
already_AddRefed<nsRange> PositionToCollapsedRange(nsINode* aNode,
|
||||
uint32_t aOffset) const;
|
||||
static already_AddRefed<nsRange> PositionToCollapsedRange(nsINode* aNode,
|
||||
uint32_t aOffset);
|
||||
};
|
||||
|
||||
class mozInlineSpellChecker final : public nsIInlineSpellChecker,
|
||||
|
|
Загрузка…
Ссылка в новой задаче