Closed Bug 596333 Opened 14 years ago Closed 14 years ago

Automatic spell checking not always functional

Categories

(Core :: Spelling checker, defect)

defect
Not set
critical

Tracking

()

VERIFIED FIXED
mozilla2.0b7
Tracking Status
blocking2.0 --- betaN+

People

(Reporter: sciguyryan, Assigned: ehsan.akhgari)

References

Details

(Keywords: regression)

Attachments

(2 files, 2 obsolete files)

In the most recently Minefield hourly the automatic spell checking feature does not always funtction. Sometimes you have to manually check in order for spelling errors to be identified.

This could be due to some of the recently editor changes that landed.
blocking2.0: --- → ?
Summary: Automatic Spell checking Not Functional → Automatic spell checking not always functional
regression range
20100913162558 ccaffbc6a970 bad 
20100913165011 68033b993ed7 OK
Keywords: regression
Bug 240933 is the most likely cause here.
Blocks: 240933
Assignee: nobody → ehsan
Regression range: http://hg.mozilla.org/mozilla-central/pushloghtml?tochange=ccaffbc6a970&fromchange=68033b993ed7

I'm bisecting right now to figure out the offending changeset.
blocking2.0: ? → betaN+
It seems to me that the spell checker has been relying on a particular behavior from the editor when doing spell checking when typing.

What happens is that when you're typing, we don't spell check the word that the caret is on right now.  Therefore, (assuming that | represents the caret), when you're typing:

workd|

we won't spell check "workd".  When you press space, however:

workd |

the caret is no longer on the word, and we spell check the word immediately before the space.

The old behavior of the editor was that if you typed "workd ", it would inject five adjacent text nodes, each containing one of the letters.  Then, when this loop <http://mxr.mozilla.org/mozilla-central/source/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp#562> was executed for the first time, checkBeforeOffset would be 0 (being at the start of the text node containing " "), so ContainsDOMWordSeparator would return false, so we'd end up looking at the previous text nodes, which would mean that mSoftText would end up being "workd " and we'd end up checking "workd" for misspellings.

With 1f29b4fb184c, we only have a single textnode, which means that in the above loop, checkBeforeOffset would be 5, and ContainsDOMWordSeparator would return true, which causes us not to look at the entire text node, so mSoftText would be " ", and we would just skip over "workd" when spell checking.

I have a patch to correct this behavior, which I'll attach to this bug soon.
Attached patch Patch (v1) (obsolete) — Splinter Review
This patch special cases the situation where ContainsDOMWordSeparator finds the separator in the same node, and tries to find the previous word separator (or just use 0 in case we're after the first entered word) and look at that word as well.
Attachment #475557 - Flags: review?(roc)
When discussing this patch with Boris on IRC, he asked me what happens if you enter "workd" and then paste " x" (or "  x").  This got me thinking, and I think replacing checkBeforeOffset with firstOffsetInNode in the 2nd ContainsDOMWordSeparator call takes care of those paste cases.  I'll update the patch and the test shortly.
Attached patch Patch (v2)Splinter Review
Based on comment 7.
Attachment #475557 - Attachment is obsolete: true
Attachment #475588 - Flags: review?(roc)
Attached patch Part 2 (obsolete) — Splinter Review
Boris brought a good point to my attention, that my analysis in comment 7 will not be valid for "   x", for example.  The only good way to handle such cases would be to make ContainsDOMWordSeparator greedy.  This patch does that.
Attachment #475631 - Flags: review?(bzbarsky)
So if we enter that inner loop when i points to the last char of a run of whitespace that comes at the beginning of the text fragment, then we will exit the loop without changing i, right?  Is that desired?  Or do we want to set *aSeparatorOffset to 0 in that situation?
Attached patch Part 2Splinter Review
(In reply to comment #10)
> So if we enter that inner loop when i points to the last char of a run of
> whitespace that comes at the beginning of the text fragment, then we will exit
> the loop without changing i, right?  Is that desired?  Or do we want to set
> *aSeparatorOffset to 0 in that situation?

I'm not sure if it really matters, because if the string begins with whitespace, then by definition there's nothing before it which we may be missing, but yeah, I guess for consistency, we'd want to set *aSeparatorOffset to 0 in that case.
Attachment #475631 - Attachment is obsolete: true
Attachment #475867 - Flags: review?(bzbarsky)
Attachment #475631 - Flags: review?(bzbarsky)
Comment on attachment 475867 [details] [diff] [review]
Part 2

r=me
Attachment #475867 - Flags: review?(bzbarsky) → review+
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Seems to be working again. Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b7pre) Gecko/20100917 Firefox/4.0b7pre

I'll wait a day or so or let someone else confirm before marking this verified.
latest x64 build dates 16-Sep-2010 05:30

http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/

...so I cannot really check if this got solved. Can we please have an updated x64 build that includes the fix?

Thanx in advance.
...updated platform, since this happens for me in x64 Win7 as well.
Hardware: x86 → All
This is not x64 specific, it was a bug on all platforms and all architectures.
OS: Windows 7 → All
...I know, that's why I've set it to 'All' (it was set to 'x86' before). I still do not see a new win64 build available though (latest x64 build dates 16-Sep-2010 05:30 and still has the issue). Thus this is not fixed for win64.
(In reply to comment #18)
> ...I know, that's why I've set it to 'All' (it was set to 'x86' before). I
> still do not see a new win64 build available though (latest x64 build dates
> 16-Sep-2010 05:30 and still has the issue). Thus this is not fixed for win64.

Please file a bug in mozilla.org::Release Engineering about the Win64 builds not being available.  It doesn't have anything to do with this bug.
...did so: Bug 599559. Thanx for pointing to the right direction.
...and it's fixed in win64 too ;)
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: