mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1735446 - part 5: Make nsIInlineSpellChecker
use unsigned long
as offset in node r=m_kato
It has two methods which take (signed) `long` argument to specify offset in a DOM node, but it's declared as "unsigned long" in the standards. And now, they work with rewritten Selection API which take `uint32_t` so that they should use `unsigned long` for making the handling simpler and safer. Differential Revision: https://phabricator.services.mozilla.com/D131034
This commit is contained in:
parent
82e2013683
commit
2214b0dc00
@ -24,9 +24,11 @@ interface nsIInlineSpellChecker : nsISupports
|
||||
|
||||
void spellCheckRange(in Range aSelection);
|
||||
|
||||
Range getMisspelledWord(in Node aNode, in long aOffset);
|
||||
Range getMisspelledWord(in Node aNode, in unsigned long aOffset);
|
||||
[can_run_script]
|
||||
void replaceWord(in Node aNode, in long aOffset, in AString aNewword);
|
||||
void replaceWord(in Node aNode,
|
||||
in unsigned long aOffset,
|
||||
in AString aNewword);
|
||||
void addWordToDictionary(in AString aWord);
|
||||
void removeWordFromDictionary(in AString aWord);
|
||||
|
||||
|
@ -906,7 +906,7 @@ nsresult mozInlineSpellChecker::SpellCheckRange(nsRange* aRange) {
|
||||
// mozInlineSpellChecker::GetMisspelledWord
|
||||
|
||||
NS_IMETHODIMP
|
||||
mozInlineSpellChecker::GetMisspelledWord(nsINode* aNode, int32_t aOffset,
|
||||
mozInlineSpellChecker::GetMisspelledWord(nsINode* aNode, uint32_t aOffset,
|
||||
nsRange** newword) {
|
||||
if (NS_WARN_IF(!aNode)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
@ -921,7 +921,7 @@ mozInlineSpellChecker::GetMisspelledWord(nsINode* aNode, int32_t aOffset,
|
||||
// mozInlineSpellChecker::ReplaceWord
|
||||
|
||||
NS_IMETHODIMP
|
||||
mozInlineSpellChecker::ReplaceWord(nsINode* aNode, int32_t aOffset,
|
||||
mozInlineSpellChecker::ReplaceWord(nsINode* aNode, uint32_t aOffset,
|
||||
const nsAString& aNewWord) {
|
||||
if (NS_WARN_IF(!mEditorBase) || NS_WARN_IF(aNewWord.IsEmpty())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -1715,14 +1715,13 @@ nsresult mozInlineSpellChecker::ResumeCheck(
|
||||
// static
|
||||
nsresult mozInlineSpellChecker::IsPointInSelection(Selection& aSelection,
|
||||
nsINode* aNode,
|
||||
int32_t aOffset,
|
||||
uint32_t aOffset,
|
||||
nsRange** aRange) {
|
||||
*aRange = nullptr;
|
||||
|
||||
nsTArray<nsRange*> ranges;
|
||||
nsresult rv = aSelection.GetRangesForIntervalArray(
|
||||
aNode, AssertedCast<uint32_t>(aOffset), aNode,
|
||||
static_cast<uint32_t>(aOffset), true, &ranges);
|
||||
nsresult rv = aSelection.GetRangesForIntervalArray(aNode, aOffset, aNode,
|
||||
aOffset, true, &ranges);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (ranges.Length() == 0) return NS_OK; // no matches
|
||||
|
@ -251,7 +251,7 @@ class mozInlineSpellChecker final : public nsIInlineSpellChecker,
|
||||
// helper routine to determine if a point is inside of the passed in
|
||||
// selection.
|
||||
static nsresult IsPointInSelection(mozilla::dom::Selection& aSelection,
|
||||
nsINode* aNode, int32_t aOffset,
|
||||
nsINode* aNode, uint32_t aOffset,
|
||||
nsRange** aRange);
|
||||
|
||||
nsresult CleanupRangesInSelection(mozilla::dom::Selection* aSelection);
|
||||
|
Loading…
Reference in New Issue
Block a user