[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 15:12:30 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 08abac6749bdd16ca9b55a042150fa2ee40b37c7
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 28 23:45:26 2010 +0000

    2010-10-28  Jia Pu  <jpu at apple.com>
    
            Reviewed by Dan Bernstein.
    
            Editing a word with misspell or autocorrection underline should remove the underline when the editing changes the word.
            https://bugs.webkit.org/show_bug.cgi?id=48078
            <rdar://problem/8579155>
    
            * platform/mac-leopard/Skipped: New tests don't apply to this platform.
            * platform/mac-snowleopard/Skipped: Ditto.
            * platform/mac-tiger/Skipped: Ditto.
            * platform/mac-wk2/Skipped: Ditto.
            * platform/mac/editing/spelling/autocorrection-delete-expected.checksum: Updated expected test result.
            * platform/mac/editing/spelling/autocorrection-delete-expected.png: Ditto.
            * platform/mac/editing/spelling/editing-multiple-words-with-markers-expected.txt: Added.
            * platform/mac/editing/spelling/editing-multiple-words-with-markers.html: Added.
            * platform/mac/editing/spelling/editing-word-with-marker-1-expected.txt: Added.
            * platform/mac/editing/spelling/editing-word-with-marker-1.html: Added.
            * platform/mac/editing/spelling/editing-word-with-marker-2-expected.txt: Added.
            * platform/mac/editing/spelling/editing-word-with-marker-2.html: Added.
    2010-10-28  Jia Pu  <jpu at apple.com>
    
            Reviewed by Dan Bernstein.
    
            Editing a word with misspell or autocorrection underline should remove the underline when the editing changes the word.
            https://bugs.webkit.org/show_bug.cgi?id=48078
            <rdar://problem/8579155>
    
            Tests: platform/mac/editing/spelling/editing-multiple-words-with-markers.html
                   platform/mac/editing/spelling/editing-word-with-marker-1.html
                   platform/mac/editing/spelling/editing-word-with-marker-2.html
    
            This patch is part of on-going improvement of autocorrection feature on Mac OS X. When an editing
            occurs, if it affects words (by deleting/inserting characters, spliting word, merging words) that
            have Spelling and/or CorrectionIndicator markers, we want to remove the markers. If subsequntial
            spelling checking finds spelling error in newlly formed words, it will add the markers back in.
    
            * dom/DocumentMarker.h: Changed MarkerType to bit masks to make search multiple types easier.
    
            * dom/DocumentMarkerController.cpp: Refactored two removeMarkers() methods to support remove
              markers with specific type from a node.
            (WebCore::DocumentMarkerController::removeMarkers): Changed signature to remove marker with specific type.
            (WebCore::DocumentMarkerController::removeMarkersFromMarkerMapVectorPair): Refactoring.
            (WebCore::DocumentMarkerController::hasMarkers): Convenience method to search markers in range.
    
            * dom/DocumentMarkerController.h: Added new methods and matched new signature of removeMarkers().
    
            * editing/Editor.cpp:
            (WebCore::Editor::respondToChangedContents): Remove existing markers if the change formed new word.
            (WebCore::Editor::cut): Remove markers on words that will be modified by this editing.
            (WebCore::Editor::paste): Ditto.
            (WebCore::Editor::pasteAsPlainText): Ditto.
            (WebCore::Editor::removeSpellAndCorrectionMarkersFromWordsToBeEdited): Main logic for removing
              markers on words affected by editing.
    
            * editing/Editor.h: Added removeSpellAndCorrectionMarkersFromWordsToBeEdited().  Added
              REMOVE_MARKERS_UPON_EDITING and SUPPORT_AUTOCORRECTION_PANEL macro to improve readability.
    
            * editing/TypingCommand.cpp:
            (WebCore::TypingCommand::insertText): Remove markers on words that will be modified by this editing.
            (WebCore::TypingCommand::deleteKeyPressed): Ditto.
            (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70826 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 505da4c..fc47e46 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,24 @@
+2010-10-28  Jia Pu  <jpu at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Editing a word with misspell or autocorrection underline should remove the underline when the editing changes the word.
+        https://bugs.webkit.org/show_bug.cgi?id=48078
+        <rdar://problem/8579155>
+
+        * platform/mac-leopard/Skipped: New tests don't apply to this platform.
+        * platform/mac-snowleopard/Skipped: Ditto.
+        * platform/mac-tiger/Skipped: Ditto.
+        * platform/mac-wk2/Skipped: Ditto.
+        * platform/mac/editing/spelling/autocorrection-delete-expected.checksum: Updated expected test result.
+        * platform/mac/editing/spelling/autocorrection-delete-expected.png: Ditto.
+        * platform/mac/editing/spelling/editing-multiple-words-with-markers-expected.txt: Added.
+        * platform/mac/editing/spelling/editing-multiple-words-with-markers.html: Added.
+        * platform/mac/editing/spelling/editing-word-with-marker-1-expected.txt: Added.
+        * platform/mac/editing/spelling/editing-word-with-marker-1.html: Added.
+        * platform/mac/editing/spelling/editing-word-with-marker-2-expected.txt: Added.
+        * platform/mac/editing/spelling/editing-word-with-marker-2.html: Added.
+
 2010-10-28  Brian Weinstein  <bweinstein at apple.com>
 
         Reviewed by Brady Eidson.
diff --git a/LayoutTests/platform/mac-leopard/Skipped b/LayoutTests/platform/mac-leopard/Skipped
index d8b03dc..d987e75 100644
--- a/LayoutTests/platform/mac-leopard/Skipped
+++ b/LayoutTests/platform/mac-leopard/Skipped
@@ -102,6 +102,9 @@ platform/mac/editing/spelling/autocorrection-simple.html
 platform/mac/editing/spelling/click-autocorrected-word.html
 platform/mac/editing/spelling/delete-into-autocorrected-word.html
 platform/mac/editing/spelling/delete-into-misspelled-word.html
+platform/mac/editing/spelling/editing-multiple-words-with-markers.html
+platform/mac/editing/spelling/editing-word-with-marker-1.html
+platform/mac/editing/spelling/editing-word-with-marker-2.html
 platform/mac/editing/spelling/forward-delete-into-autocorrected-word.html
 platform/mac/editing/spelling/move-cursor-around-misspelled-word.html
 platform/mac/editing/spelling/move-cursor-to-autocorrected-word.html
diff --git a/LayoutTests/platform/mac-snowleopard/Skipped b/LayoutTests/platform/mac-snowleopard/Skipped
index e1ae38c..b19a3b4 100644
--- a/LayoutTests/platform/mac-snowleopard/Skipped
+++ b/LayoutTests/platform/mac-snowleopard/Skipped
@@ -137,6 +137,9 @@ platform/mac/editing/spelling/autocorrection-simple.html
 platform/mac/editing/spelling/click-autocorrected-word.html
 platform/mac/editing/spelling/delete-into-autocorrected-word.html
 platform/mac/editing/spelling/delete-into-misspelled-word.html
+platform/mac/editing/spelling/editing-multiple-words-with-markers.html
+platform/mac/editing/spelling/editing-word-with-marker-1.html
+platform/mac/editing/spelling/editing-word-with-marker-2.html
 platform/mac/editing/spelling/forward-delete-into-autocorrected-word.html
 platform/mac/editing/spelling/move-cursor-around-misspelled-word.html
 platform/mac/editing/spelling/move-cursor-to-autocorrected-word.html
diff --git a/LayoutTests/platform/mac-tiger/Skipped b/LayoutTests/platform/mac-tiger/Skipped
index a09713f..b3f2c48 100644
--- a/LayoutTests/platform/mac-tiger/Skipped
+++ b/LayoutTests/platform/mac-tiger/Skipped
@@ -212,6 +212,9 @@ platform/mac/editing/spelling/autocorrection-simple.html
 platform/mac/editing/spelling/click-autocorrected-word.html
 platform/mac/editing/spelling/delete-into-autocorrected-word.html
 platform/mac/editing/spelling/delete-into-misspelled-word.html
+platform/mac/editing/spelling/editing-multiple-words-with-markers.html
+platform/mac/editing/spelling/editing-word-with-marker-1.html
+platform/mac/editing/spelling/editing-word-with-marker-2.html
 platform/mac/editing/spelling/forward-delete-into-autocorrected-word.html
 platform/mac/editing/spelling/move-cursor-around-misspelled-word.html
 platform/mac/editing/spelling/move-cursor-to-autocorrected-word.html
diff --git a/LayoutTests/platform/mac-wk2/Skipped b/LayoutTests/platform/mac-wk2/Skipped
index c682448..d396a12 100644
--- a/LayoutTests/platform/mac-wk2/Skipped
+++ b/LayoutTests/platform/mac-wk2/Skipped
@@ -481,6 +481,9 @@ platform/mac/editing/spelling/autocorrection-simple.html
 platform/mac/editing/spelling/click-autocorrected-word.html
 platform/mac/editing/spelling/delete-into-autocorrected-word.html
 platform/mac/editing/spelling/delete-into-misspelled-word.html
+platform/mac/editing/spelling/editing-multiple-words-with-markers.html
+platform/mac/editing/spelling/editing-word-with-marker-1.html
+platform/mac/editing/spelling/editing-word-with-marker-2.html
 platform/mac/editing/spelling/forward-delete-into-autocorrected-word.html
 platform/mac/editing/spelling/move-cursor-around-misspelled-word.html
 platform/mac/editing/spelling/move-cursor-to-autocorrected-word.html
diff --git a/LayoutTests/platform/mac/editing/spelling/autocorrection-delete-expected.checksum b/LayoutTests/platform/mac/editing/spelling/autocorrection-delete-expected.checksum
index af08fca..aa0b65c 100644
--- a/LayoutTests/platform/mac/editing/spelling/autocorrection-delete-expected.checksum
+++ b/LayoutTests/platform/mac/editing/spelling/autocorrection-delete-expected.checksum
@@ -1 +1 @@
-a7f7bb68b8cb6b37695a4e7b4f69a847
\ No newline at end of file
+39685c692f4697ce0b957e38a07a2357
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/editing/spelling/autocorrection-delete-expected.png b/LayoutTests/platform/mac/editing/spelling/autocorrection-delete-expected.png
index ca1293f..556ed39 100644
Binary files a/LayoutTests/platform/mac/editing/spelling/autocorrection-delete-expected.png and b/LayoutTests/platform/mac/editing/spelling/autocorrection-delete-expected.png differ
diff --git a/LayoutTests/platform/mac/editing/spelling/editing-multiple-words-with-markers-expected.txt b/LayoutTests/platform/mac/editing/spelling/editing-multiple-words-with-markers-expected.txt
new file mode 100644
index 0000000..c3beed3
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/editing-multiple-words-with-markers-expected.txt
@@ -0,0 +1,7 @@
+The test verified that when multiple words are modified by one editing command, their Spelling and Autocorrection markers are removed. When manully testing, type "it's a meagesga meagesga", then select and delete "esga meag", you should see the remaing text without any underline.
+
+
+SUCCESS
+SUCCESS
+SUCCESS
+
diff --git a/LayoutTests/platform/mac/editing/spelling/editing-multiple-words-with-markers.html b/LayoutTests/platform/mac/editing/spelling/editing-multiple-words-with-markers.html
new file mode 100644
index 0000000..b12a966
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/editing-multiple-words-with-markers.html
@@ -0,0 +1,85 @@
+<html>
+<head>
+<script src=../../../../editing/editing.js language="javascript" type="text/javascript"></script>
+<title>Editing multiple words with markers test</title>
+</head>
+<body>
+<p>The test verified that when multiple words are modified by one editing command, their Spelling and 
+Autocorrection markers are removed. When manully testing, type "it's a meagesga meagesga", then 
+select and delete "esga meag", you should see the remaing text without any underline.</p>
+<textarea id="test" cols="80" rows="10"></textarea>
+<div id="console"></div>
+<script language="javascript" type="text/javascript">
+function resetText() {
+    document.getElementById('test').focus();
+    execSelectAllCommand();
+    execDeleteCommand();
+    typeCharacterCommand('i');
+    typeCharacterCommand('t');
+    typeCharacterCommand('\'');
+    typeCharacterCommand('s');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('a');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('m');
+    typeCharacterCommand('e');
+    typeCharacterCommand('a');
+    typeCharacterCommand('g');
+    typeCharacterCommand('e');
+    typeCharacterCommand('s');
+    typeCharacterCommand('g');
+    typeCharacterCommand('a');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('m');
+    typeCharacterCommand('e');
+    typeCharacterCommand('a');
+    typeCharacterCommand('g');
+    typeCharacterCommand('e');
+    typeCharacterCommand('s');
+    typeCharacterCommand('g');
+    typeCharacterCommand('a');
+    typeCharacterCommand(' ');
+}
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+}
+
+textarea = document.getElementById('test');
+
+resetText();
+textarea.setSelectionRange(11, 20);
+execDeleteCommand();
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(7,4) == 0 && window.layoutTestController.hasSpellingMarker(11,4) == 0) {
+        document.getElementById('console').innerHTML = 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = "FAILURE. The word 'meagesga' has underline.<br>";
+    }
+}
+
+resetText();
+textarea.setSelectionRange(11, 16);
+execDeleteCommand();
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(7,4) == 0 && window.layoutTestController.hasSpellingMarker(11,8) == 0) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The word 'meagmeagesga' has underline.<br>";
+    }
+}
+
+resetText();
+textarea.setSelectionRange(15, 20);
+execDeleteCommand();
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(7,8) == 0 && window.layoutTestController.hasSpellingMarker(15,4) == 0) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The word 'meagesgaesga' has underline.<br>";
+    }
+}
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/editing/spelling/editing-word-with-marker-1-expected.txt b/LayoutTests/platform/mac/editing/spelling/editing-word-with-marker-1-expected.txt
new file mode 100644
index 0000000..7d1e2eb
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/editing-word-with-marker-1-expected.txt
@@ -0,0 +1,15 @@
+The test verified that when a word is modified, its Spelling and Autocorrection Markers are removed. When manully testing, type "it's a meagesga", then edit the word "meagesga". You should see the underline under the modified "meagesga" disppears after editing.
+
+
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+
diff --git a/LayoutTests/platform/mac/editing/spelling/editing-word-with-marker-1.html b/LayoutTests/platform/mac/editing/spelling/editing-word-with-marker-1.html
new file mode 100644
index 0000000..6e7dc08
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/editing-word-with-marker-1.html
@@ -0,0 +1,176 @@
+<html>
+<head>
+<script src=../../../../editing/editing.js language="javascript" type="text/javascript"></script>
+<title>Editing word with marker test 1</title>
+</head>
+<body>
+<p>The test verified that when a word is modified, its Spelling and Autocorrection Markers are removed.
+When manully testing, type "it's a meagesga", then edit the word "meagesga". You should see the 
+underline under the modified "meagesga" disppears after editing.</p>
+<textarea id="test" cols="80" rows="10"></textarea>
+<div id="console"></div>
+<script language="javascript" type="text/javascript">
+function resetText() {
+    document.getElementById('test').focus();
+    execSelectAllCommand();
+    execDeleteCommand();
+    typeCharacterCommand('i');
+    typeCharacterCommand('t');
+    typeCharacterCommand('\'');
+    typeCharacterCommand('s');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('a');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('m');
+    typeCharacterCommand('e');
+    typeCharacterCommand('a');
+    typeCharacterCommand('g');
+    typeCharacterCommand('e');
+    typeCharacterCommand('s');
+    typeCharacterCommand('g');
+    typeCharacterCommand('a');
+    typeCharacterCommand(' ');
+}
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+}
+
+resetText();
+textarea = document.getElementById('test');
+textarea.focus();
+textarea.setSelectionRange(14, 15);
+execDeleteCommand();
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(7,7) == 0) {
+        document.getElementById('console').innerHTML = 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = "FAILURE. The word 'meagesg' has underline.<br>";
+    }
+}
+
+// Testing deletion at various location.
+resetText();
+textarea.setSelectionRange(6, 6);
+execForwardDeleteCommand();
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(6,8) == 0) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The word 'ameagesga' has underline.<br>";
+    }
+}
+
+resetText();
+textarea.setSelectionRange(7, 7);
+execForwardDeleteCommand();
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(7,7) == 0) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The word 'eagesga' has underline.<br>";
+    }
+}
+
+resetText();
+textarea.setSelectionRange(10, 10);
+typeCharacterCommand(' ');
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(7,3) == 0 && window.layoutTestController.hasSpellingMarker(11,5) == 0) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The segment 'mea gesga' has underline.<br>";
+    }
+}
+
+resetText();
+textarea.setSelectionRange(10, 13);
+execDeleteCommand();
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(7,5) == 0) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The word 'meaga' has underline.<br>";
+    }
+}
+
+resetText();
+textarea.setSelectionRange(10, 13);
+typeCharacterCommand(' ');
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(7,3) == 0 && window.layoutTestController.hasSpellingMarker(11,2) == 0) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The segment 'mea ga' has underline.<br>";
+    }
+}
+
+// Testing appending non-whitespace character.
+resetText();
+textarea.setSelectionRange(7, 7);
+typeCharacterCommand('a');
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(8,8) == 0) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The word 'ameagesga' has underline.<br>";
+    }
+}
+
+resetText();
+textarea.setSelectionRange(15, 15);
+typeCharacterCommand('a');
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(7,8) == 0) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The word 'meagesgaa' has underline.<br>";
+    }
+}
+
+// Testing pasting.
+resetText();
+textarea = document.getElementById('test');
+textarea.setSelectionRange(0,4);
+execCopyCommand();
+textarea.setSelectionRange(7, 7);
+execPasteCommand();
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(11,8) == 0) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The word 'meagesga' has underline.<br>";
+    }
+}
+
+resetText();
+textarea = document.getElementById('test');
+textarea.setSelectionRange(0,4);
+execCopyCommand();
+textarea.setSelectionRange(15, 15);
+execPasteCommand();
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(7,8) == 0) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The word 'meagesga' has underline.<br>";
+    }
+}
+
+resetText();
+textarea = document.getElementById('test');
+textarea.setSelectionRange(0,4);
+execCopyCommand();
+textarea.setSelectionRange(10, 10);
+execPasteCommand();
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(7,3) == 0 && window.layoutTestController.hasSpellingMarker(15,5) == 0) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The word 'meait\'sgesga' has underline.<br>";
+    }
+}
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/editing/spelling/editing-word-with-marker-2-expected.txt b/LayoutTests/platform/mac/editing/spelling/editing-word-with-marker-2-expected.txt
new file mode 100644
index 0000000..b492a13
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/editing-word-with-marker-2-expected.txt
@@ -0,0 +1,6 @@
+The test verified that when appending a whitespace before or after a word, its Spelling and Autocorrection markers are remain. When manully testing, type "it's a meagesga", then add whitespace before or after "meagesga". You should see the underline on "meagesga".
+
+
+SUCCESS
+SUCCESS
+
diff --git a/LayoutTests/platform/mac/editing/spelling/editing-word-with-marker-2.html b/LayoutTests/platform/mac/editing/spelling/editing-word-with-marker-2.html
new file mode 100644
index 0000000..e0e0ec8
--- /dev/null
+++ b/LayoutTests/platform/mac/editing/spelling/editing-word-with-marker-2.html
@@ -0,0 +1,65 @@
+<html>
+<head>
+<script src=../../../../editing/editing.js language="javascript" type="text/javascript"></script>
+<title>Editing word with marker test 2</title>
+</head>
+<body>
+<p>The test verified that when appending a whitespace before or after a word, its Spelling and 
+Autocorrection markers are remain.
+When manully testing, type "it's a meagesga", then add whitespace before or after "meagesga". 
+You should see the underline on "meagesga".</p>
+<textarea id="test" cols="80" rows="10"></textarea>
+<div id="console"></div>
+<script language="javascript" type="text/javascript">
+function resetText() {
+    document.getElementById('test').focus();
+    execSelectAllCommand();
+    execDeleteCommand();
+    typeCharacterCommand('i');
+    typeCharacterCommand('t');
+    typeCharacterCommand('\'');
+    typeCharacterCommand('s');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('a');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('m');
+    typeCharacterCommand('e');
+    typeCharacterCommand('a');
+    typeCharacterCommand('g');
+    typeCharacterCommand('e');
+    typeCharacterCommand('s');
+    typeCharacterCommand('g');
+    typeCharacterCommand('a');
+    typeCharacterCommand(' ');
+}
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+}
+
+resetText();
+textarea = document.getElementById('test');
+textarea.setSelectionRange(7,7);
+typeCharacterCommand(' ');
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(8,8) == 1) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The word 'meagesga' doesn't have underline.<br>";
+    }
+}
+
+resetText();
+textarea = document.getElementById('test');
+textarea.setSelectionRange(15,15);
+typeCharacterCommand(' ');
+if (window.layoutTestController && window.layoutTestController.hasSpellingMarker) {
+    if (window.layoutTestController.hasSpellingMarker(7,8) == 1) {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + 'SUCCESS<br>';
+    } else {
+        document.getElementById('console').innerHTML = document.getElementById('console').innerHTML + "FAILURE. The word 'meagesga' doesn't have underline.<br>";
+    }
+}
+</script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2fa6cab..4027407 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,46 @@
+2010-10-28  Jia Pu  <jpu at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Editing a word with misspell or autocorrection underline should remove the underline when the editing changes the word.
+        https://bugs.webkit.org/show_bug.cgi?id=48078
+        <rdar://problem/8579155>
+
+        Tests: platform/mac/editing/spelling/editing-multiple-words-with-markers.html
+               platform/mac/editing/spelling/editing-word-with-marker-1.html
+               platform/mac/editing/spelling/editing-word-with-marker-2.html
+
+        This patch is part of on-going improvement of autocorrection feature on Mac OS X. When an editing
+        occurs, if it affects words (by deleting/inserting characters, spliting word, merging words) that
+        have Spelling and/or CorrectionIndicator markers, we want to remove the markers. If subsequntial
+        spelling checking finds spelling error in newlly formed words, it will add the markers back in.
+
+        * dom/DocumentMarker.h: Changed MarkerType to bit masks to make search multiple types easier.
+
+        * dom/DocumentMarkerController.cpp: Refactored two removeMarkers() methods to support remove
+          markers with specific type from a node.
+        (WebCore::DocumentMarkerController::removeMarkers): Changed signature to remove marker with specific type.
+        (WebCore::DocumentMarkerController::removeMarkersFromMarkerMapVectorPair): Refactoring.
+        (WebCore::DocumentMarkerController::hasMarkers): Convenience method to search markers in range.
+
+        * dom/DocumentMarkerController.h: Added new methods and matched new signature of removeMarkers().
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::respondToChangedContents): Remove existing markers if the change formed new word.
+        (WebCore::Editor::cut): Remove markers on words that will be modified by this editing.
+        (WebCore::Editor::paste): Ditto.
+        (WebCore::Editor::pasteAsPlainText): Ditto.
+        (WebCore::Editor::removeSpellAndCorrectionMarkersFromWordsToBeEdited): Main logic for removing 
+          markers on words affected by editing.
+
+        * editing/Editor.h: Added removeSpellAndCorrectionMarkersFromWordsToBeEdited().  Added
+          REMOVE_MARKERS_UPON_EDITING and SUPPORT_AUTOCORRECTION_PANEL macro to improve readability.
+
+        * editing/TypingCommand.cpp:
+        (WebCore::TypingCommand::insertText): Remove markers on words that will be modified by this editing.
+        (WebCore::TypingCommand::deleteKeyPressed): Ditto.
+        (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto.
+
 2010-10-28  Brian Weinstein  <bweinstein at apple.com>
 
         Reviewed by Brady Eidson.
diff --git a/WebCore/dom/DocumentMarker.h b/WebCore/dom/DocumentMarker.h
index dd5e981..2be60f8 100644
--- a/WebCore/dom/DocumentMarker.h
+++ b/WebCore/dom/DocumentMarker.h
@@ -33,18 +33,17 @@ namespace WebCore {
 // It also optionally includes a flag specifying whether the match is active, which is ignored
 // for all types other than type TextMatch.
 struct DocumentMarker {
-
     enum MarkerType {
-        AllMarkers  = -1,
-        Spelling,
-        Grammar,
-        TextMatch,
-        Replacement,
-        CorrectionIndicator,
-        RejectedCorrection
+        Spelling = 1 << 0,
+        Grammar = 1 << 1,
+        TextMatch = 1 << 2,
+        Replacement = 1 << 3,
+        CorrectionIndicator = 1 << 4,
+        RejectedCorrection = 1 << 5,
+        AllMarkers = Spelling | Grammar | TextMatch | Replacement | CorrectionIndicator | RejectedCorrection
     };
-
     MarkerType type;
+    typedef unsigned MarkerTypes;
     unsigned startOffset;
     unsigned endOffset;
     String description;
diff --git a/WebCore/dom/DocumentMarkerController.cpp b/WebCore/dom/DocumentMarkerController.cpp
index 2b7fd85..3b7abcc 100644
--- a/WebCore/dom/DocumentMarkerController.cpp
+++ b/WebCore/dom/DocumentMarkerController.cpp
@@ -321,15 +321,11 @@ Vector<IntRect> DocumentMarkerController::renderedRectsForMarkers(DocumentMarker
     return result;
 }
 
-void DocumentMarkerController::removeMarkers(Node* node)
+void DocumentMarkerController::removeMarkers(Node* node, DocumentMarker::MarkerType markerType)
 {
-    MarkerMap::iterator i = m_markers.find(node);
-    if (i != m_markers.end()) {
-        delete i->second;
-        m_markers.remove(i);
-        if (RenderObject* renderer = node->renderer())
-            renderer->repaint();
-    }
+    MarkerMap::iterator iterator = m_markers.find(node);
+    if (iterator != m_markers.end())
+        removeMarkersFromMarkerMapVectorPair(node, iterator->second, markerType);
 }
 
 void DocumentMarkerController::removeMarkers(DocumentMarker::MarkerType markerType)
@@ -339,10 +335,21 @@ void DocumentMarkerController::removeMarkers(DocumentMarker::MarkerType markerTy
     MarkerMap::iterator end = markerMapCopy.end();
     for (MarkerMap::iterator i = markerMapCopy.begin(); i != end; ++i) {
         Node* node = i->first.get();
-        bool nodeNeedsRepaint = false;
-
-        // inner loop: process each marker in the current node
         MarkerMapVectorPair* vectorPair = i->second;
+        removeMarkersFromMarkerMapVectorPair(node, vectorPair, markerType);
+    }
+}
+
+// This function may release node and vectorPair.
+void DocumentMarkerController::removeMarkersFromMarkerMapVectorPair(Node* node, MarkerMapVectorPair* vectorPair, DocumentMarker::MarkerType markerType)
+{
+    if (markerType == DocumentMarker::AllMarkers) {
+        delete vectorPair;
+        m_markers.remove(node);
+        if (RenderObject* renderer = node->renderer())
+            renderer->repaint();
+    } else {
+        bool needsRepaint = false;
         Vector<DocumentMarker>& markers = vectorPair->first;
         Vector<IntRect>& rects = vectorPair->second;
         ASSERT(markers.size() == rects.size());
@@ -350,7 +357,7 @@ void DocumentMarkerController::removeMarkers(DocumentMarker::MarkerType markerTy
             DocumentMarker marker = markers[i];
 
             // skip nodes that are not of the specified type
-            if (marker.type != markerType && markerType != DocumentMarker::AllMarkers) {
+            if (marker.type != markerType) {
                 ++i;
                 continue;
             }
@@ -358,13 +365,13 @@ void DocumentMarkerController::removeMarkers(DocumentMarker::MarkerType markerTy
             // pitch the old marker
             markers.remove(i);
             rects.remove(i);
-            nodeNeedsRepaint = true;
-            // markerIterator now points to the next node
+            needsRepaint = true;
+            // i now is the index of the next marker
         }
 
-        // Redraw the node if it changed. Do this before the node is removed from m_markers, since 
+        // Redraw the node if it changed. Do this before the node is removed from m_markers, since
         // m_markers might contain the last reference to the node.
-        if (nodeNeedsRepaint) {
+        if (needsRepaint) {
             RenderObject* renderer = node->renderer();
             if (renderer)
                 renderer->repaint();
@@ -524,4 +531,40 @@ void DocumentMarkerController::setMarkersActive(Node* node, unsigned startOffset
         node->renderer()->repaint();
 }
 
+bool DocumentMarkerController::hasMarkers(Range* range, DocumentMarker::MarkerTypes markerTypes)
+{
+    if (m_markers.isEmpty())
+        return false;
+
+    Node* startContainer = range->startContainer();
+    ASSERT(startContainer);
+    Node* endContainer = range->endContainer();
+    ASSERT(endContainer);
+
+    Node* pastLastNode = range->pastLastNode();
+    for (Node* node = range->firstNode(); node != pastLastNode; node = node->traverseNextNode()) {
+        Vector<DocumentMarker> markers = markersForNode(node);
+        Vector<DocumentMarker>::const_iterator end = markers.end();
+        for (Vector<DocumentMarker>::const_iterator it = markers.begin(); it != end; ++it) {
+            if (!(markerTypes & it->type))
+                continue;
+            if (node == startContainer && node == endContainer) {
+                // The range spans only one node.
+                if (it->endOffset > static_cast<unsigned>(range->startOffset()) && it->startOffset < static_cast<unsigned>(range->endOffset()))
+                    return true;
+            } else {
+                if (node == startContainer) {
+                    if (it->endOffset > static_cast<unsigned>(range->startOffset()))
+                        return true;
+                } else if (node == endContainer) {
+                    if (it->startOffset < static_cast<unsigned>(range->endOffset()))
+                        return true;
+                } else
+                    return true;
+            }
+        }
+    }
+    return false;
+}
+
 } // namespace WebCore
diff --git a/WebCore/dom/DocumentMarkerController.h b/WebCore/dom/DocumentMarkerController.h
index 8921baa..96fb7f3 100644
--- a/WebCore/dom/DocumentMarkerController.h
+++ b/WebCore/dom/DocumentMarkerController.h
@@ -46,10 +46,11 @@ public:
     void addMarker(Range*, DocumentMarker::MarkerType, String description = String());
     void addMarker(Node*, DocumentMarker);
     void copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstNode, int delta, DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
+    bool hasMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers);
     void removeMarkers(Range*, DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
     void removeMarkers(Node*, unsigned startOffset, int length, DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
     void removeMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
-    void removeMarkers(Node*);
+    void removeMarkers(Node*, DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
     void repaintMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers);
     void setRenderedRectForMarker(Node*, const DocumentMarker&, const IntRect&);
     void invalidateRenderedRectsForMarkersInRect(const IntRect&);
@@ -65,6 +66,7 @@ private:
     typedef std::pair<Vector<DocumentMarker>, Vector<IntRect> > MarkerMapVectorPair;
     typedef HashMap<RefPtr<Node>, MarkerMapVectorPair*> MarkerMap;
     MarkerMap m_markers;
+    void removeMarkersFromMarkerMapVectorPair(Node*, MarkerMapVectorPair*, DocumentMarker::MarkerType);
 };
 
 } // namespace WebCore
diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp
index 2e58389..169b765 100644
--- a/WebCore/editing/Editor.cpp
+++ b/WebCore/editing/Editor.cpp
@@ -468,9 +468,13 @@ void Editor::respondToChangedContents(const VisibleSelection& endingSelection)
         if (node)
             m_frame->document()->axObjectCache()->postNotification(node->renderer(), AXObjectCache::AXValueChanged, false);
     }
-    
+
+#if REMOVE_MARKERS_UPON_EDITING
+    removeSpellAndCorrectionMarkersFromWordsToBeEdited(true);
+#endif
+
     if (client())
-        client()->respondToChangedContents();  
+        client()->respondToChangedContents();
 }
 
 const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
@@ -1154,6 +1158,9 @@ void Editor::cut()
     }
     RefPtr<Range> selection = selectedRange();
     if (shouldDeleteRange(selection.get())) {
+#if REMOVE_MARKERS_UPON_EDITING
+        removeSpellAndCorrectionMarkersFromWordsToBeEdited(true);
+#endif
         if (isNodeInTextFormControl(m_frame->selection()->start().node()))
             Pasteboard::generalPasteboard()->writePlainText(selectedText());
         else
@@ -1192,6 +1199,9 @@ void Editor::paste()
         return; // DHTML did the whole operation
     if (!canPaste())
         return;
+#if REMOVE_MARKERS_UPON_EDITING
+    removeSpellAndCorrectionMarkersFromWordsToBeEdited(false);
+#endif
     CachedResourceLoader* loader = m_frame->document()->cachedResourceLoader();
     loader->setAllowStaleResources(true);
     if (m_frame->selection()->isContentRichlyEditable())
@@ -1207,6 +1217,9 @@ void Editor::pasteAsPlainText()
         return;
     if (!canPaste())
         return;
+#if REMOVE_MARKERS_UPON_EDITING
+    removeSpellAndCorrectionMarkersFromWordsToBeEdited(false);
+#endif
     pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
 }
 
@@ -2902,6 +2915,101 @@ bool Editor::isShowingCorrectionPanel()
     return false;
 }
 
+void Editor::removeSpellAndCorrectionMarkersFromWordsToBeEdited(bool doNotRemoveIfSelectionAtWordBoundary)
+{
+    // We want to remove the markers from a word if an editing command will change the word. This can happen in one of
+    // several scenarios:
+    // 1. Insert in the middle of a word.
+    // 2. Appending non whitespace at the beginning of word.
+    // 3. Appending non whitespace at the end of word.
+    // Note that, appending only whitespaces at the beginning or end of word won't change the word, so we don't need to
+    // remove the markers on that word.
+    // Of course, if current selection is a range, we potentially will edit two words that fall on the boundaries of
+    // selection, and remove words between the selection boundaries.
+    //
+    VisiblePosition startOfSelection = frame()->selection()->selection().start();
+    VisiblePosition endOfSelection = frame()->selection()->selection().end();
+    if (startOfSelection.isNull())
+        return;
+    // First word is the word that ends after or on the start of selection.
+    VisiblePosition startOfFirstWord = startOfWord(startOfSelection, LeftWordIfOnBoundary);
+    VisiblePosition endOfFirstWord = endOfWord(startOfSelection, LeftWordIfOnBoundary);
+    // Last word is the word that begins before or on the end of selection
+    VisiblePosition startOfLastWord = startOfWord(endOfSelection, RightWordIfOnBoundary);
+    VisiblePosition endOfLastWord = endOfWord(endOfSelection, RightWordIfOnBoundary);
+
+    // This can be the case if the end of selection is at the end of document.
+    if (endOfLastWord.deepEquivalent().anchorType() != Position::PositionIsOffsetInAnchor) {
+        startOfLastWord = startOfWord(frame()->selection()->selection().start(), LeftWordIfOnBoundary);
+        endOfLastWord = endOfWord(frame()->selection()->selection().start(), LeftWordIfOnBoundary);
+    }
+
+    // If doNotRemoveIfSelectionAtWordBoundary is true, and first word ends at the start of selection,
+    // we choose next word as the first word.
+    if (doNotRemoveIfSelectionAtWordBoundary && endOfFirstWord == startOfSelection) {
+        startOfFirstWord = nextWordPosition(startOfFirstWord);
+        if (startOfFirstWord == endOfSelection)
+            return;
+        endOfFirstWord = endOfWord(startOfFirstWord, RightWordIfOnBoundary);
+        if (endOfFirstWord.deepEquivalent().anchorType() != Position::PositionIsOffsetInAnchor)
+            return;
+    }
+
+    // If doNotRemoveIfSelectionAtWordBoundary is true, and last word begins at the end of selection,
+    // we choose previous word as the last word.
+    if (doNotRemoveIfSelectionAtWordBoundary && startOfLastWord == endOfSelection) {
+        startOfLastWord = previousWordPosition(startOfLastWord);
+        endOfLastWord = endOfWord(startOfLastWord, RightWordIfOnBoundary);
+        if (endOfLastWord == startOfFirstWord)
+            return;
+    }
+
+    // Now we remove markers on everything between startOfFirstWord and endOfLastWord.
+    // However, if an autocorrection change a single word to multiple words, we want to remove correction mark from all the
+    // resulted words even we only edit one of them. For example, assuming autocorrection changes "avantgarde" to "avant
+    // garde", we will have CorrectionIndicator marker on both words and on the whitespace between them. If we then edit garde,
+    // we would like to remove the marker from word "avant" and whitespace as well. So we need to get the continous range of
+    // of marker that contains the word in question, and remove marker on that whole range.
+    Document* document = m_frame->document();
+    RefPtr<Range> wordRange = Range::create(document, startOfFirstWord.deepEquivalent(), endOfLastWord.deepEquivalent());
+    RefPtr<Range> rangeOfFirstWord = Range::create(document, startOfFirstWord.deepEquivalent(), endOfFirstWord.deepEquivalent());
+    RefPtr<Range> rangeOfLastWord = Range::create(document, startOfLastWord.deepEquivalent(), endOfLastWord.deepEquivalent());
+
+    typedef pair<RefPtr<Range>, DocumentMarker::MarkerType> RangeMarkerPair;
+    // It's probably unsafe to remove marker while iterating a vector of markers. So we store the markers and ranges that we want to remove temporarily. Then remove them at the end of function.
+    // To avoid allocation on the heap, Give markersToRemove a small inline capacity
+    Vector<RangeMarkerPair, 16> markersToRemove;
+    for (TextIterator textIterator(wordRange.get()); !textIterator.atEnd(); textIterator.advance()) {
+        Node* node = textIterator.node();
+        if (node == startOfFirstWord.deepEquivalent().containerNode() || node == endOfLastWord.deepEquivalent().containerNode()) {
+            // First word and last word can belong to the same node
+            bool processFirstWord = node == startOfFirstWord.deepEquivalent().containerNode() && document->markers()->hasMarkers(rangeOfFirstWord.get(), DocumentMarker::Spelling | DocumentMarker::CorrectionIndicator);
+            bool processLastWord = node == endOfLastWord.deepEquivalent().containerNode() && document->markers()->hasMarkers(rangeOfLastWord.get(), DocumentMarker::Spelling | DocumentMarker::CorrectionIndicator);
+            // Take note on the markers whose range overlaps with the range of the first word or the last word.
+            Vector<DocumentMarker> markers = document->markers()->markersForNode(node);
+            for (size_t i = 0; i < markers.size(); ++i) {
+                DocumentMarker marker = markers[i];
+                if (processFirstWord && static_cast<int>(marker.endOffset) > startOfFirstWord.deepEquivalent().offsetInContainerNode() && (marker.type == DocumentMarker::Spelling || marker.type == DocumentMarker::CorrectionIndicator)) {
+                    RefPtr<Range> markerRange = Range::create(document, node, marker.startOffset, node, marker.endOffset);
+                    markersToRemove.append(std::make_pair(markerRange, marker.type));
+                }
+                if (processLastWord && static_cast<int>(marker.startOffset) <= endOfLastWord.deepEquivalent().offsetInContainerNode() && (marker.type == DocumentMarker::Spelling || marker.type == DocumentMarker::CorrectionIndicator)) {
+                    RefPtr<Range> markerRange = Range::create(document, node, marker.startOffset, node, marker.endOffset);
+                    markersToRemove.append(std::make_pair(markerRange, marker.type));
+                }
+            }
+        } else {
+            document->markers()->removeMarkers(node, DocumentMarker::Spelling);
+            document->markers()->removeMarkers(node, DocumentMarker::CorrectionIndicator);
+        }
+    }
+
+    // Actually remove the markers.
+    Vector<RangeMarkerPair>::const_iterator pairEnd = markersToRemove.end();
+    for (Vector<RangeMarkerPair>::const_iterator pairIterator = markersToRemove.begin(); pairIterator != pairEnd; ++pairIterator)
+        document->markers()->removeMarkers(pairIterator->first.get(), pairIterator->second);
+}
+
 PassRefPtr<Range> Editor::rangeForPoint(const IntPoint& windowPoint)
 {
     Document* document = m_frame->documentAtPoint(windowPoint);
diff --git a/WebCore/editing/Editor.h b/WebCore/editing/Editor.h
index 0ad4737..e942560 100644
--- a/WebCore/editing/Editor.h
+++ b/WebCore/editing/Editor.h
@@ -34,6 +34,17 @@
 #include "EditorInsertAction.h"
 #include "SelectionController.h"
 
+#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+// Some platforms provide UI for suggesting autocorrection.
+#define SUPPORT_AUTOCORRECTION_PANEL 1
+// Some platforms use spelling and autocorrection markers to provide visual cue.
+// On such platform, if word with marker is edited, we need to remove the marker.
+#define REMOVE_MARKERS_UPON_EDITING 1
+#else
+#define SUPPORT_AUTOCORRECTION_PANEL 0
+#define REMOVE_MARKERS_UPON_EDITING 0
+#endif /* #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) */
+
 #if PLATFORM(MAC) && !defined(__OBJC__)
 class NSDictionary;
 typedef int NSWritingDirection;
@@ -362,6 +373,7 @@ public:
 #endif
 
     bool selectionStartHasSpellingMarkerFor(int from, int length) const;
+    void removeSpellAndCorrectionMarkersFromWordsToBeEdited(bool doNotRemoveIfSelectionAtWordBoundary);
 
 private:
     Frame* m_frame;
diff --git a/WebCore/editing/TypingCommand.cpp b/WebCore/editing/TypingCommand.cpp
index 60b3f7b..d78708b 100644
--- a/WebCore/editing/TypingCommand.cpp
+++ b/WebCore/editing/TypingCommand.cpp
@@ -131,14 +131,18 @@ void TypingCommand::insertText(Document* document, const String& text, bool sele
 
 void TypingCommand::insertText(Document* document, const String& text, const VisibleSelection& selectionForInsertion, bool selectInsertedText, bool insertedTextIsComposition)
 {
+#if REMOVE_MARKERS_UPON_EDITING
+    if (!text.isEmpty())
+        document->frame()->editor()->removeSpellAndCorrectionMarkersFromWordsToBeEdited(isSpaceOrNewline(text.characters()[0]));
+#endif
+
     ASSERT(document);
-    
+
     RefPtr<Frame> frame = document->frame();
     ASSERT(frame);
-    
+
     VisibleSelection currentSelection = frame->selection()->selection();
     bool changeSelection = currentSelection != selectionForInsertion;
-    
     String newText = text;
     Node* startNode = selectionForInsertion.start().node();
     
@@ -419,9 +423,12 @@ bool TypingCommand::makeEditableRootEmpty()
 
 void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing)
 {
+#if REMOVE_MARKERS_UPON_EDITING
+    document()->frame()->editor()->removeSpellAndCorrectionMarkersFromWordsToBeEdited(false);
+#endif
     VisibleSelection selectionToDelete;
     VisibleSelection selectionAfterUndo;
-    
+
     switch (endingSelection().selectionType()) {
     case VisibleSelection::RangeSelection:
         selectionToDelete = endingSelection();
@@ -515,6 +522,9 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing)
 
 void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity, bool killRing)
 {
+#if REMOVE_MARKERS_UPON_EDITING
+    document()->frame()->editor()->removeSpellAndCorrectionMarkersFromWordsToBeEdited(false);
+#endif
     VisibleSelection selectionToDelete;
     VisibleSelection selectionAfterUndo;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list