Changeset 83492 in webkit


Ignore:
Timestamp:
Apr 11, 2011 1:56:32 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-11 Jia Pu <jpu@apple.com>

Reviewed by Adele Peterson.

Shouldn't carry out autocorrection when start typing a new word
https://bugs.webkit.org/show_bug.cgi?id=58241
<rdar://problem/9264736>

See WebCore/ChangeLog for detail.

  • platform/mac-leopard/Skipped:
  • platform/mac-snowleopard/Skipped:
  • platform/mac-tiger/Skipped:
  • platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.checksum: Added.
  • platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.png: Added.
  • platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.txt: Added.
  • platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html: Added.
  • platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.checksum: Added.
  • platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.png: Added.
  • platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.txt: Added.
  • platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html: Added.

2011-04-11 Jia Pu <jpu@apple.com>

Reviewed by Adele Peterson.

Shouldn't carry out autocorrection when start typing a new word
https://bugs.webkit.org/show_bug.cgi?id=58241
<rdar://problem/9264736>

Tests: platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html

platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html

In TypingCommand::markMisspellingsAfterTyping(), we want to call Editor::markMisspellingsAfterTypingToWord()
only when the typing command is an insertion command, and preceding word contains at least one non-whitespace
character.

  • editing/Editor.cpp: (WebCore::Editor::markMisspellingsAfterTypingToWord):
  • editing/Editor.h:
  • editing/TypingCommand.cpp: (WebCore::TypingCommand::markMisspellingsAfterTyping):
Location:
trunk
Files:
8 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r83487 r83492  
     12011-04-11  Jia Pu  <jpu@apple.com>
     2
     3        Reviewed by Adele Peterson.
     4
     5        Shouldn't carry out autocorrection when start typing a new word
     6        https://bugs.webkit.org/show_bug.cgi?id=58241
     7        <rdar://problem/9264736>
     8
     9        See WebCore/ChangeLog for detail.
     10
     11        * platform/mac-leopard/Skipped:
     12        * platform/mac-snowleopard/Skipped:
     13        * platform/mac-tiger/Skipped:
     14        * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.checksum: Added.
     15        * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.png: Added.
     16        * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1-expected.txt: Added.
     17        * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html: Added.
     18        * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.checksum: Added.
     19        * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.png: Added.
     20        * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2-expected.txt: Added.
     21        * platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html: Added.
     22
    1232011-04-11  Ryosuke Niwa  <rniwa@webkit.org>
    224
  • trunk/LayoutTests/platform/mac-leopard/Skipped

    r83465 r83492  
    110110
    111111# Disable spelling tests for autocorrection panel
     112platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html
     113platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html
    112114platform/mac/editing/spelling/autocorrection-contraction.html
    113115platform/mac/editing/spelling/autocorrection-delete.html
  • trunk/LayoutTests/platform/mac-snowleopard/Skipped

    r83214 r83492  
    132132
    133133# Disable spelling tests for autocorrection panel
     134platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html
     135platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html
    134136platform/mac/editing/spelling/autocorrection-contraction.html
    135137platform/mac/editing/spelling/autocorrection-delete.html
  • trunk/LayoutTests/platform/mac-tiger/Skipped

    r80023 r83492  
    214214
    215215# Disable spelling tests for autocorrection panel
     216platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html
     217platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html
    216218platform/mac/editing/spelling/autocorrection-contraction.html
    217219platform/mac/editing/spelling/autocorrection-delete.html
  • trunk/Source/WebCore/ChangeLog

    r83491 r83492  
     12011-04-11  Jia Pu  <jpu@apple.com>
     2
     3        Reviewed by Adele Peterson.
     4
     5        Shouldn't carry out autocorrection when start typing a new word
     6        https://bugs.webkit.org/show_bug.cgi?id=58241
     7        <rdar://problem/9264736>
     8
     9        Tests: platform/mac/editing/spelling/autocorrection-at-beginning-of-word-1.html
     10               platform/mac/editing/spelling/autocorrection-at-beginning-of-word-2.html
     11
     12        In TypingCommand::markMisspellingsAfterTyping(), we want to call Editor::markMisspellingsAfterTypingToWord()
     13        only when the typing command is an insertion command, and preceding word contains at least one non-whitespace
     14        character.
     15
     16        * editing/Editor.cpp:
     17        (WebCore::Editor::markMisspellingsAfterTypingToWord):
     18        * editing/Editor.h:
     19        * editing/TypingCommand.cpp:
     20        (WebCore::TypingCommand::markMisspellingsAfterTyping):
     21
    1222011-04-11  Vsevolod Vlasov  <vsevik@chromium.org>
    223
  • trunk/Source/WebCore/editing/Editor.cpp

    r83347 r83492  
    19701970}
    19711971
    1972 void Editor::markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping)
     1972void Editor::markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping, bool doReplacement)
    19731973{
    19741974#if USE(UNIFIED_TEXT_CHECKING)
     
    19801980
    19811981#if USE(AUTOMATIC_TEXT_REPLACEMENT)
    1982     if (isAutomaticQuoteSubstitutionEnabled()
    1983         || isAutomaticLinkDetectionEnabled()
    1984         || isAutomaticDashSubstitutionEnabled()
    1985         || isAutomaticTextReplacementEnabled()
    1986         || ((textCheckingOptions & MarkSpelling) && isAutomaticSpellingCorrectionEnabled()))
     1982    if (doReplacement
     1983        && (isAutomaticQuoteSubstitutionEnabled()
     1984            || isAutomaticLinkDetectionEnabled()
     1985            || isAutomaticDashSubstitutionEnabled()
     1986            || isAutomaticTextReplacementEnabled()
     1987            || ((textCheckingOptions & MarkSpelling) && isAutomaticSpellingCorrectionEnabled())))
    19871988        textCheckingOptions |= PerformReplacement;
    19881989#endif
  • trunk/Source/WebCore/editing/Editor.h

    r83344 r83492  
    220220    bool isSpellCheckingEnabledInFocusedNode() const;
    221221    bool isSpellCheckingEnabledFor(Node*) const;
    222     void markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping);
     222    void markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping, bool doReplacement);
    223223    void markMisspellings(const VisibleSelection&, RefPtr<Range>& firstMisspellingRange);
    224224    void markBadGrammar(const VisibleSelection&);
  • trunk/Source/WebCore/editing/TypingCommand.cpp

    r83344 r83492  
    4040#include "RenderObject.h"
    4141#include "SelectionController.h"
     42#include "TextIterator.h"
    4243#include "VisiblePosition.h"
    4344#include "htmlediting.h"
     
    341342        VisiblePosition p1 = startOfWord(previous, LeftWordIfOnBoundary);
    342343        VisiblePosition p2 = startOfWord(start, LeftWordIfOnBoundary);
    343         if (p1 != p2)
    344             document()->frame()->editor()->markMisspellingsAfterTypingToWord(p1, endingSelection());
    345         else if (commandType == TypingCommand::InsertText)
     344        if (p1 != p2) {
     345            RefPtr<Range> range = makeRange(p1, p2);
     346            String strippedPreviousWord;
     347            if (range && (commandType == TypingCommand::InsertText || commandType == TypingCommand::InsertLineBreak || commandType == TypingCommand::InsertParagraphSeparator || commandType == TypingCommand::InsertParagraphSeparatorInQuotedContent))
     348                strippedPreviousWord = plainText(range.get()).stripWhiteSpace();
     349            document()->frame()->editor()->markMisspellingsAfterTypingToWord(p1, endingSelection(), !strippedPreviousWord.isEmpty());
     350        } else if (commandType == TypingCommand::InsertText)
    346351            document()->frame()->editor()->startCorrectionPanelTimer();
    347352    }
Note: See TracChangeset for help on using the changeset viewer.