Bug 13940 - Enabling spellchecking slows down selection even when nothing is editable
Summary: Enabling spellchecking slows down selection even when nothing is editable
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 523.x (Safari 3)
Hardware: All All
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2007-05-30 14:06 PDT by Brett Wilson (Google)
Modified: 2007-05-31 10:10 PDT (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Brett Wilson (Google) 2007-05-30 14:06:23 PDT
Frame::respondToChangedSelection asks if the current webview has spellchecking enabled and then triggers a lot of extra logic involving computing ranges, adding and removing markers, checking words, etc. This happens even when the selection isn't over a form control that can have spellchecking.

For example, go to a relatively complex page with few form controls like Google News. Select some text in one of the blurbs and scrub the mouse around. If isContinuousSpellCheckingEnabled returns true, the selection is dramatically slower than if it returns false.
Comment 1 Justin Garcia 2007-05-30 16:33:25 PDT
If the selection is not editable then all we do is [from Frame.cpp]:

if (RefPtr<Range> wordRange = newAdjacentWords.toRange())
    document()->removeMarkers(wordRange.get(), DocumentMarker::Spelling);
if (RefPtr<Range> sentenceRange = newSelectedSentence.toRange())
    document()->removeMarkers(sentenceRange.get(), DocumentMarker::Grammar);

Which will do very little work since the selections newSelected{Word, Sentence} are both empty.


if (!isContinuousSpellCheckingEnabled)
if (!isContinuousGrammarCheckingEnabled)

Which will also do very little since there will be no markers.

I can't reproduce the slowness you describe.  Are you using the latest nightly?
Comment 2 Brett Wilson (Google) 2007-05-31 10:10:25 PDT
This is fixed when I synced, the version I was using was a little older. The old version checked isContinuousSpellCheckingEnabled and did a lot of work. The latest version now checks the selection's editableness before doing the hard part.