||Given a unicode string and an offset, find the beginning and end of the
next word. Return false, begin and end are -1 if there are no words
remaining in the string. This should really be folded into the
||This class is called by the editor to handle spellchecking after various
events. The main entrypoint is SpellCheckAfterEditorChange, which is called
when the text is changed.
It is VERY IMPORTANT that we do NOT do any operations that might cause DOM
notifications to be flushed when we are called from the editor. This is
because the call might originate from a frame, and flushing the
notifications might cause that frame to be deleted.
We post an event and do all of the spellchecking in that event handler.
We store all DOM pointers in ranges because they are kept up-to-date with
DOM changes that may have happened while the event was on the queue.
We also allow the spellcheck to be suspended and resumed later. This makes
large pastes or initializations with a lot of text not hang the browser UI.
An optimization is the mNeedsCheckAfterNavigation flag. This is set to
true when we get any change, and false once there is no possibility
something changed that we need to check on navigation. Navigation events
tend to be a little tricky because we want to check the current word on
exit if something has changed. If we navigate inside the word, we don't want
to do anything. As a result, this flag is cleared in FinishNavigationEvent
when we know that we are checking as a result of navigation.
||This class extracts text from the DOM and builds it into a single string.
The string includes whitespace breaks whereever non-inline elements begin
and end. This string is broken into "real words", following somewhat
complex rules; for example substrings that look like URLs or
email addresses are treated as single words, but otherwise many kinds of
punctuation are treated as word separators. GetNextWord provides a way
to iterate over these "real words".
The basic operation is:
1. Call Init with the editor that you're using.
2. Call SetPositionAndEnd to to initialize the current position inside the
previously given range and set where you want to stop spellchecking.
We'll stop at the word boundary after that. If SetEnd is not called,
we'll stop at the end of the root element.
3. Call GetNextWord over and over until it returns false.
||This is the most braindead implementation of a personal dictionary possible.
There is not much complexity needed, though. It could be made much faster,
and probably should, but I don't see much need for more in terms of
Allowing personal words to be associated with only certain dictionaries
Implement the suggestion record.
||Tells the spellchecker what document to check.
@param aDoc is the document to check.
@param aFromStartOfDoc If true, start check from beginning of document,
if false, start check from current cursor position.