Commit 2876864e authored by justin.garcia@apple.com's avatar justin.garcia@apple.com
Browse files

WebCore:

2008-10-28  Justin Garcia  <justin.garcia@apple.com>

        Reviewed by Darin Adler.

        <rdar://problem/5188560> REGRESSION: Spell checker doesn't clear spelling/grammar marker after error is marked as Ignored

        * editing/Editor.cpp:
        (WebCore::Editor::ignoreSpelling): Remove misspelling markers from the word.
        (WebCore::Editor::learnSpelling): Added a FIXME about <rdar://problem/5396072>, which 
        will probably require a change more complicated than just marking the learned word as 
        misspelled.  I'll address it with a separate patch.
        * editing/EditorCommand.cpp:
        (WebCore::executeIgnoreSpelling): Added.
        (WebCore::CommandEntry::): Added an entry for IgnoreSpelling.

WebKit/mac:

2008-10-28  Justin Garcia  <justin.garcia@apple.com>

        Reviewed by Darin Adler.
        
        <rdar://problem/5188560> REGRESSION: Spell checker doesn't clear spelling/grammar marker after error is marked as Ignored

        * WebView/WebHTMLView.mm: IgnoreSpelling is now a WebCore command.  That command handles
        calling back into WebKit to perform the cross platform work that was removed in this change.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37957 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ba054bbd
2008-10-28 Justin Garcia <justin.garcia@apple.com>
Reviewed by Darin Adler.
<rdar://problem/5188560> REGRESSION: Spell checker doesn't clear spelling/grammar marker after error is marked as Ignored
* editing/Editor.cpp:
(WebCore::Editor::ignoreSpelling): Remove misspelling markers from the word.
(WebCore::Editor::learnSpelling): Added a FIXME about <rdar://problem/5396072>, which
will probably require a change more complicated than just marking the learned word as
misspelled. I'll address it with a separate patch.
* editing/EditorCommand.cpp:
(WebCore::executeIgnoreSpelling): Added.
(WebCore::CommandEntry::): Added an entry for IgnoreSpelling.
2008-10-28 Cameron Zwarich <zwarich@apple.com>
 
Reviewed by Mark Rowe.
......
......@@ -1220,6 +1220,10 @@ void Editor::ignoreSpelling()
{
if (!client())
return;
RefPtr<Range> selectedRange = frame()->selection()->toRange();
if (selectedRange)
frame()->document()->removeMarkers(selectedRange.get(), DocumentMarker::Spelling);
String text = frame()->selectedText();
ASSERT(text.length() != 0);
......@@ -1230,6 +1234,9 @@ void Editor::learnSpelling()
{
if (!client())
return;
// FIXME: We don't call this on the Mac, and it should remove misppelling markers around the
// learned word, see <rdar://problem/5396072>.
String text = frame()->selectedText();
ASSERT(text.length() != 0);
......
......@@ -416,6 +416,12 @@ static bool executeForwardDelete(Frame* frame, Event*, EditorCommandSource sourc
return false;
}
static bool executeIgnoreSpelling(Frame* frame, Event*, EditorCommandSource, const String&)
{
frame->editor()->ignoreSpelling();
return true;
}
static bool executeIndent(Frame* frame, Event*, EditorCommandSource, const String&)
{
applyCommand(IndentOutdentCommand::create(frame->document(), IndentOutdentCommand::Indent));
......@@ -1182,6 +1188,7 @@ static const CommandMap& createCommandMap()
{ "FormatBlock", { executeFormatBlock, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
{ "ForwardDelete", { executeForwardDelete, supported, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
{ "HiliteColor", { executeBackColor, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
{ "IgnoreSpelling", { executeIgnoreSpelling, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
{ "Indent", { executeIndent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
{ "InsertBacktab", { executeInsertBacktab, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, isTextInsertion, doNotAllowExecutionWhenDisabled } },
{ "InsertHorizontalRule", { executeInsertHorizontalRule, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
......
2008-10-28 Justin Garcia <justin.garcia@apple.com>
Reviewed by Darin Adler.
<rdar://problem/5188560> REGRESSION: Spell checker doesn't clear spelling/grammar marker after error is marked as Ignored
* WebView/WebHTMLView.mm: IgnoreSpelling is now a WebCore command. That command handles
calling back into WebKit to perform the cross platform work that was removed in this change.
2008-10-28 Cameron Zwarich <zwarich@apple.com>
Reviewed by Mark Rowe.
......
......@@ -2212,6 +2212,7 @@ WEBCORE_COMMAND(deleteToEndOfParagraph)
WEBCORE_COMMAND(deleteToMark)
WEBCORE_COMMAND(deleteWordBackward)
WEBCORE_COMMAND(deleteWordForward)
WEBCORE_COMMAND(ignoreSpelling)
WEBCORE_COMMAND(indent)
WEBCORE_COMMAND(insertBacktab)
WEBCORE_COMMAND(insertLineBreak)
......@@ -4299,24 +4300,6 @@ NSStrokeColorAttributeName /* NSColor, default nil: same as foreground co
[self _changeSpellingToWord:[[sender selectedCell] stringValue]];
}
- (void)ignoreSpelling:(id)sender
{
COMMAND_PROLOGUE
NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
if (!checker) {
LOG_ERROR("No NSSpellChecker");
return;
}
NSString *stringToIgnore = [sender stringValue];
unsigned int length = [stringToIgnore length];
if (stringToIgnore && length > 0) {
[checker ignoreWord:stringToIgnore inSpellDocumentWithTag:[[self _webView] spellCheckerDocumentTag]];
// FIXME: Need to clear misspelling marker if the currently selected word is the one we are to ignore?
}
}
- (void)performFindPanelAction:(id)sender
{
COMMAND_PROLOGUE
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment