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

mitz at apple.com mitz at apple.com
Wed Dec 22 15:30:03 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit f82f4ad63ecc306c612e0a718e24e9471c7f790d
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 5 03:48:05 2010 +0000

    reversion bubble in WebViews
    https://bugs.webkit.org/show_bug.cgi?id=47630
    <rdar://problem/8530960>
    
    Patch by Jia Pu <jpu at apple.com> on 2010-11-04
    Reviewed by Dan Bernstein.
    
    WebCore:
    
    Added manual test:
    manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html
    manual-tests/autocorrection/delete-to-dismiss-reversion.html
    manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html
    manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html
    manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html
    
    We can only manully test this feature for two reasons:
    1. On Mac OS X, the result of spell checking is partly determined by past user usage. We can't
       realiably generating test cases until we can disable user custom data during spell checking.
    2. To exerciese this feature, we need a minimum of 0.3 second delay using WebCore timer.
    
    This patch is to add reversion to correction panel. It consists of following major code changes:
    1. Collected all autocorrection related member variables in Editor into a CorrectionPanelInfo
       class to improve readability.
    2. Changed signature of Editor::startCorrectionPanelTimer() to allow caller to specify the
       type of correction panel--regular correction or reversion.
    3. Made necessary changes to adopt reversion API in AppKit.
    4. Use SUPPORT_CORRECTION_PANEL macro to improve readability.
    
    * GNUmakefile.am: Added CorrectionPanelInfo.h.
    * WebCore.gypi: Ditto.
    * WebCore.pro: Ditto.
    * WebCore.vcproj/WebCore.vcproj: Ditto.
    * WebCore.xcodeproj/project.pbxproj:
    * editing/CorrectionPanelInfo.h: Added.
    * editing/Editor.cpp:
    (WebCore::Editor::respondToChangedSelection): Start correction panel timer for reversion when
      the new selection is a caret selection at end of a previously corrected word.
    (WebCore::Editor::appliedEditing): Stop timer at the beginning of the method instead of at the end.
    (WebCore::Editor::~Editor): Adopted new method dismissCorrectionPanel().
    (WebCore::Editor::markMisspellingsAfterTypingToPosition): Adopted new method applyCorrectionPanelInfo().
    (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Code change for new m_correctionPanelInfo
      member variable.
    (WebCore::Editor::correctionPanelTimerFired): Change to handle reversion panel type.
    (WebCore::Editor::handleRejectedCorrection): Ditto.
    (WebCore::Editor::startCorrectionPanelTimer): Changed signature to allow passing in panel type.
    (WebCore::Editor::stopCorrectionPanelTimer): Adopted macro SUPPORT_CORRECTION_PANEL.
    (WebCore::Editor::handleCancelOperation): Ditto.
    (WebCore::Editor::isShowingCorrectionPanel): Ditto.
    (WebCore::Editor::dismissCorrectionPanel): Update m_correctionPanelInfo when correction panel
      is dismissed.
    (WebCore::Editor::applyCorrectionPanelInfo): Factored out code that applies autocorrection.
    (WebCore::Editor::changeSelectionAfterCommand): Adopt macro SUPPORT_CORRECTION_PANEL.
    * editing/Editor.h: Adopted CorrectionPanelInfo and add new member methods.
    * editing/EditorCommand.cpp: Adopted macro SUPPORT_CORRECTION_PANEL
    (WebCore::createCommandMap):
    * editing/TypingCommand.cpp: Adopted macro SUPPORT_CORRECTION_PANEL and new signature of
      startCorrectionPanelTimer().
    (WebCore::TypingCommand::markMisspellingsAfterTyping):
    * loader/EmptyClients.h:
    (WebCore::EmptyEditorClient::showCorrectionPanel): Adopted new signature of base class method.
    (WebCore::EmptyEditorClient::dismissCorrectionPanel):  Ditto.
    * manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html: Added.
    * manual-tests/autocorrection/delete-to-dismiss-reversion.html: Added.
    * manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html: Added.
    * manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html: Added.
    * manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html: Added.
    * page/EditorClient.h: Changed signature of showCorrectionPanel() and dismissCorrectionPanel().
    * platform/graphics/mac/GraphicsContextMac.mm: Added comment to improve readability.
    (WebCore::GraphicsContext::drawLineForTextChecking):
    
    WebKit/mac:
    
    This patch is to add reversion to correction panel. Please see WebCore/ChangeLog for detail.
    
    * WebCoreSupport/WebEditorClient.h: Adopted new signature of base class method.
    * WebCoreSupport/WebEditorClient.mm: Adopted new signature of base class method. And code
      change to use new reversion API in AppKit.
    (WebEditorClient::WebEditorClient):
    (WebEditorClient::~WebEditorClient):
    (WebEditorClient::respondToChangedSelection):
    (WebEditorClient::showCorrectionPanel):
    (WebEditorClient::dismissCorrectionPanel):
    (WebEditorClient::isShowingCorrectionPanel):
    
    WebKit2:
    
    This patch is to add reversion to correction panel. Please see WebCore/ChangeLog for detail.
    
    * WebProcess/WebCoreSupport/WebEditorClient.h: Adopted new signature of base class method.
    * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: Ditto.
    (WebKit::WebEditorClient::showCorrectionPanel):
    (WebKit::WebEditorClient::dismissCorrectionPanel):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71385 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 90e89ae..bf169ce 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,73 @@
+2010-11-04  Jia Pu  <jpu at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        reversion bubble in WebViews
+        https://bugs.webkit.org/show_bug.cgi?id=47630
+        <rdar://problem/8530960>
+
+        Added manual test:
+        manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html
+        manual-tests/autocorrection/delete-to-dismiss-reversion.html
+        manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html
+        manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html
+        manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html
+
+        We can only manully test this feature for two reasons:
+        1. On Mac OS X, the result of spell checking is partly determined by past user usage. We can't
+           realiably generating test cases until we can disable user custom data during spell checking.
+        2. To exerciese this feature, we need a minimum of 0.3 second delay using WebCore timer.
+
+        This patch is to add reversion to correction panel. It consists of following major code changes:
+        1. Collected all autocorrection related member variables in Editor into a CorrectionPanelInfo
+           class to improve readability.
+        2. Changed signature of Editor::startCorrectionPanelTimer() to allow caller to specify the
+           type of correction panel--regular correction or reversion.
+        3. Made necessary changes to adopt reversion API in AppKit.
+        4. Use SUPPORT_CORRECTION_PANEL macro to improve readability.
+
+        * GNUmakefile.am: Added CorrectionPanelInfo.h.
+        * WebCore.gypi: Ditto.
+        * WebCore.pro: Ditto.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+        * WebCore.xcodeproj/project.pbxproj:
+        * editing/CorrectionPanelInfo.h: Added.
+        * editing/Editor.cpp:
+        (WebCore::Editor::respondToChangedSelection): Start correction panel timer for reversion when
+          the new selection is a caret selection at end of a previously corrected word.
+        (WebCore::Editor::appliedEditing): Stop timer at the beginning of the method instead of at the end.
+        (WebCore::Editor::~Editor): Adopted new method dismissCorrectionPanel().
+        (WebCore::Editor::markMisspellingsAfterTypingToPosition): Adopted new method applyCorrectionPanelInfo().
+        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Code change for new m_correctionPanelInfo
+          member variable.
+        (WebCore::Editor::correctionPanelTimerFired): Change to handle reversion panel type.
+        (WebCore::Editor::handleRejectedCorrection): Ditto.
+        (WebCore::Editor::startCorrectionPanelTimer): Changed signature to allow passing in panel type.
+        (WebCore::Editor::stopCorrectionPanelTimer): Adopted macro SUPPORT_CORRECTION_PANEL.
+        (WebCore::Editor::handleCancelOperation): Ditto.
+        (WebCore::Editor::isShowingCorrectionPanel): Ditto.
+        (WebCore::Editor::dismissCorrectionPanel): Update m_correctionPanelInfo when correction panel
+          is dismissed.
+        (WebCore::Editor::applyCorrectionPanelInfo): Factored out code that applies autocorrection.
+        (WebCore::Editor::changeSelectionAfterCommand): Adopt macro SUPPORT_CORRECTION_PANEL.
+        * editing/Editor.h: Adopted CorrectionPanelInfo and add new member methods.
+        * editing/EditorCommand.cpp: Adopted macro SUPPORT_CORRECTION_PANEL
+        (WebCore::createCommandMap):
+        * editing/TypingCommand.cpp: Adopted macro SUPPORT_CORRECTION_PANEL and new signature of
+          startCorrectionPanelTimer().
+        (WebCore::TypingCommand::markMisspellingsAfterTyping):
+        * loader/EmptyClients.h:
+        (WebCore::EmptyEditorClient::showCorrectionPanel): Adopted new signature of base class method.
+        (WebCore::EmptyEditorClient::dismissCorrectionPanel):  Ditto.
+        * manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html: Added.
+        * manual-tests/autocorrection/delete-to-dismiss-reversion.html: Added.
+        * manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html: Added.
+        * manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html: Added.
+        * manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html: Added.
+        * page/EditorClient.h: Changed signature of showCorrectionPanel() and dismissCorrectionPanel().
+        * platform/graphics/mac/GraphicsContextMac.mm: Added comment to improve readability.
+        (WebCore::GraphicsContext::drawLineForTextChecking):
+
 2010-11-04  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Dave Hyatt.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index f8d5a2f..6461e5d 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -1281,6 +1281,7 @@ webcore_sources += \
 	WebCore/editing/CompositeEditCommand.h \
 	WebCore/editing/CreateLinkCommand.cpp \
 	WebCore/editing/CreateLinkCommand.h \
+	WebCore/editing/CorrectionPanelInfo.h \
 	WebCore/editing/DeleteButtonController.cpp \
 	WebCore/editing/DeleteButtonController.h \
 	WebCore/editing/DeleteButton.cpp \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index af9b705..15fa44b 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -1367,6 +1367,7 @@
             'editing/BreakBlockquoteCommand.h',
             'editing/CompositeEditCommand.cpp',
             'editing/CompositeEditCommand.h',
+            'editing/CorrectionPanelInfo.h',
             'editing/CreateLinkCommand.cpp',
             'editing/CreateLinkCommand.h',
             'editing/DeleteButton.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 5f0ed3a..18f40c4 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -1693,6 +1693,7 @@ HEADERS += \
     editing/ApplyStyleCommand.h \
     editing/BreakBlockquoteCommand.h \
     editing/CompositeEditCommand.h \
+    editing/CorrectionPanelInfo.h \
     editing/CreateLinkCommand.h \
     editing/DeleteButtonController.h \
     editing/DeleteButton.h \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 1b1e104..b4e23b9 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -45912,6 +45912,10 @@
 				>
 			</File>
 			<File
+			RelativePath="..\editing\CorrectionPanelInfo.h"
+				>
+			</File>
+			<File
 				RelativePath="..\editing\CreateLinkCommand.cpp"
 				>
 				<FileConfiguration
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 72032c8..d73731c 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -4675,6 +4675,7 @@
 		B776D43D1104527500BEB0EC /* PrintContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B776D43C1104527500BEB0EC /* PrintContext.cpp */; };
 		B885E8D411E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B885E8D211E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp */; };
 		B885E8D511E06DD2009FFBF4 /* InspectorApplicationCacheAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = B885E8D311E06DD2009FFBF4 /* InspectorApplicationCacheAgent.h */; settings = {ATTRIBUTES = (); }; };
+		B8A6A6D5127B338D008673BA /* CorrectionPanelInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = B8A6A6D4127B338D008673BA /* CorrectionPanelInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC00F0040E0A185500FD04E3 /* DOMFile.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00EFFE0E0A185500FD04E3 /* DOMFile.h */; };
 		BC00F0050E0A185500FD04E3 /* DOMFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */; };
 		BC00F0060E0A185500FD04E3 /* DOMFileInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00F0000E0A185500FD04E3 /* DOMFileInternal.h */; };
@@ -10684,6 +10685,7 @@
 		B776D43C1104527500BEB0EC /* PrintContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrintContext.cpp; sourceTree = "<group>"; };
 		B885E8D211E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorApplicationCacheAgent.cpp; sourceTree = "<group>"; };
 		B885E8D311E06DD2009FFBF4 /* InspectorApplicationCacheAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorApplicationCacheAgent.h; sourceTree = "<group>"; };
+		B8A6A6D4127B338D008673BA /* CorrectionPanelInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CorrectionPanelInfo.h; sourceTree = "<group>"; };
 		BC00EFFE0E0A185500FD04E3 /* DOMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFile.h; sourceTree = "<group>"; };
 		BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMFile.mm; sourceTree = "<group>"; };
 		BC00F0000E0A185500FD04E3 /* DOMFileInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFileInternal.h; sourceTree = "<group>"; };
@@ -14508,6 +14510,7 @@
 				93309D8C099E64910056E581 /* BreakBlockquoteCommand.h */,
 				93309D8D099E64910056E581 /* CompositeEditCommand.cpp */,
 				93309D8E099E64910056E581 /* CompositeEditCommand.h */,
+				B8A6A6D4127B338D008673BA /* CorrectionPanelInfo.h */,
 				D0B0556709C6700100307E43 /* CreateLinkCommand.cpp */,
 				D0B0556609C6700100307E43 /* CreateLinkCommand.h */,
 				1C4C8F630AD8655D009475CE /* DeleteButton.cpp */,
@@ -21309,6 +21312,7 @@
 				6E67D2A71280E8A4008758F7 /* Extensions3DOpenGL.h in Headers */,
 				6E67D2A91280E8BD008758F7 /* Extensions3D.h in Headers */,
 				93F6F1EE127F70B10055CB06 /* WebGLContextEvent.h in Headers */,
+				B8A6A6D5127B338D008673BA /* CorrectionPanelInfo.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/editing/CorrectionPanelInfo.h b/WebCore/editing/CorrectionPanelInfo.h
new file mode 100644
index 0000000..2caac17
--- /dev/null
+++ b/WebCore/editing/CorrectionPanelInfo.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CorrectionPanelInfo_h
+#define CorrectionPanelInfo_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)
+
+#include "Range.h"
+
+namespace WebCore {
+
+struct CorrectionPanelInfo {
+    enum PanelType {
+        PanelTypeCorrection = 0,
+        PanelTypeReversion
+    };
+
+    RefPtr<Range> m_rangeToBeReplaced;
+    String m_replacedString;
+    String m_replacementString;
+    PanelType m_panelType;
+    bool m_isActive;
+};
+
+enum CorrectionWasRejectedOrNot { CorrectionWasNotRejected, CorrectionWasRejected };
+
+} // namespace WebCore
+
+#endif // CorrectionPanelInfo_h
diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp
index 74b165c..4ae4924 100644
--- a/WebCore/editing/Editor.cpp
+++ b/WebCore/editing/Editor.cpp
@@ -457,9 +457,53 @@ bool Editor::shouldShowDeleteInterface(HTMLElement* element) const
 
 void Editor::respondToChangedSelection(const VisibleSelection& oldSelection)
 {
+#if SUPPORT_AUTOCORRECTION_PANEL
+    VisibleSelection currentSelection(frame()->selection()->selection());
+    if (currentSelection != oldSelection) {
+        stopCorrectionPanelTimer();
+        dismissCorrectionPanel(CorrectionWasNotRejected);
+    }
+#endif // SUPPORT_AUTOCORRECTION_PANEL
+
     if (client())
         client()->respondToChangedSelection();
     m_deleteButtonController->respondToChangedSelection(oldSelection);
+
+#if SUPPORT_AUTOCORRECTION_PANEL
+    // When user moves caret to the end of autocorrected word and pauses, we show the panel
+    // containing the original pre-correction word so that user can quickly revert the
+    // undesired autocorrection. Here, we start correction panel timer once we confirm that
+    // the new caret position is at the end of a word.
+    if (!currentSelection.isCaret() || currentSelection == oldSelection)
+        return;
+
+    VisiblePosition selectionPosition = currentSelection.start();
+    VisiblePosition endPositionOfWord = endOfWord(selectionPosition, LeftWordIfOnBoundary);
+    if (selectionPosition != endPositionOfWord)
+        return;
+
+    Position position = endPositionOfWord.deepEquivalent();
+    if (position.anchorType() != Position::PositionIsOffsetInAnchor)
+        return;
+
+    Node* node = position.containerNode();
+    int endOffset = position.offsetInContainerNode();
+    Vector<DocumentMarker> markers = node->document()->markers()->markersForNode(node);
+    size_t markerCount = markers.size();
+    for (size_t i = 0; i < markerCount; ++i) {
+        const DocumentMarker& marker = markers[i];
+        if (marker.type == DocumentMarker::CorrectionIndicator && static_cast<int>(marker.endOffset) == endOffset) {
+            RefPtr<Range> wordRange = Range::create(frame()->document(), node, marker.startOffset, node, marker.endOffset);
+            String currentWord = plainText(wordRange.get());
+            if (currentWord.length() > 0 && marker.description.length() > 0) {
+                m_correctionPanelInfo.m_rangeToBeReplaced = wordRange;
+                m_correctionPanelInfo.m_replacementString = marker.description;
+                startCorrectionPanelTimer(CorrectionPanelInfo::PanelTypeReversion);
+            }
+            break;
+        }
+    }
+#endif // SUPPORT_AUTOCORRECTION_PANEL
 }
 
 void Editor::respondToChangedContents(const VisibleSelection& endingSelection)
@@ -998,10 +1042,13 @@ static void dispatchEditableContentChangedEvents(const EditCommand& command)
 
 void Editor::appliedEditing(PassRefPtr<EditCommand> cmd)
 {
+    // We may start reversion panel timer in respondToChangedSelection().
+    // So we stop the timer for current panel before calling changeSelectionAfterCommand() later in this method.
+    stopCorrectionPanelTimer();
     m_frame->document()->updateLayout();
-    
+
     dispatchEditableContentChangedEvents(*cmd);
-    
+
     VisibleSelection newSelection(cmd->endingSelection());
     // Don't clear the typing style with this selection change.  We do those things elsewhere if necessary.
     changeSelectionAfterCommand(newSelection, false, false);
@@ -1020,7 +1067,6 @@ void Editor::appliedEditing(PassRefPtr<EditCommand> cmd)
             client()->registerCommandForUndo(m_lastEditCommand);
     }
     respondToChangedContents(newSelection);
-    stopCorrectionPanelTimer();
 }
 
 void Editor::unappliedEditing(PassRefPtr<EditCommand> cmd)
@@ -1068,9 +1114,8 @@ Editor::Editor(Frame* frame)
 
 Editor::~Editor()
 {
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    if (client())
-        client()->dismissCorrectionPanel(true);
+#if SUPPORT_AUTOCORRECTION_PANEL
+    dismissCorrectionPanel(CorrectionWasNotRejected);
 #endif
 }
 
@@ -1967,47 +2012,10 @@ void Editor::markMisspellingsAndBadGrammar(const VisibleSelection &movingSelecti
 void Editor::markMisspellingsAfterTypingToPosition(const VisiblePosition &p)
 {
 #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
-#if !defined(BUILDING_ON_SNOW_LEOPARD)
+#if SUPPORT_AUTOCORRECTION_PANEL
     // Apply pending autocorrection before next round of spell checking.
-    bool didApplyCorrection = false;
-    if (m_rangeToBeReplacedByCorrection) {
-        ExceptionCode ec = 0;
-        RefPtr<Range> paragraphRangeContainingCorrection = m_rangeToBeReplacedByCorrection->cloneRange(ec);
-        if (!ec) {
-            setStart(paragraphRangeContainingCorrection.get(), startOfParagraph(m_rangeToBeReplacedByCorrection->startPosition()));
-            setEnd(paragraphRangeContainingCorrection.get(), endOfParagraph(m_rangeToBeReplacedByCorrection->endPosition()));
-            // After we replace the word at range m_rangeToBeReplacedByCorrection, we need to add 
-            // autocorrection underline at that range. However, once the replacement took place, the
-            // value of m_rangeToBeReplacedByCorrection is not valid anymore. So before we carry out
-            // the replacement, we need to store the start position of m_rangeToBeReplacedByCorrection
-            // relative to the start position of the containing paragraph. We use correctionStartOffsetInParagraph
-            // to store this value. In order to obtain this offset, we need to first create a range
-            // which spans from the start of paragraph to the start position of m_rangeToBeReplacedByCorrection.
-            RefPtr<Range> correctionStartOffsetInParagraphAsRange = Range::create(paragraphRangeContainingCorrection->startContainer(ec)->document(), paragraphRangeContainingCorrection->startPosition(), paragraphRangeContainingCorrection->startPosition());
-            if (!ec) {
-                Position startPositionOfRangeToBeReplaced = m_rangeToBeReplacedByCorrection->startPosition();
-                correctionStartOffsetInParagraphAsRange->setEnd(startPositionOfRangeToBeReplaced.containerNode(), startPositionOfRangeToBeReplaced.computeOffsetInContainerNode(), ec);
-                if (!ec) {
-                    // Take note of the location of autocorrection so that we can add marker after the replacement took place.
-                    int correctionStartOffsetInParagraph = TextIterator::rangeLength(correctionStartOffsetInParagraphAsRange.get());
-                    Position caretPosition = m_frame->selection()->selection().end();
-                    RefPtr<Range> rangeToBeReplaced = m_rangeToBeReplacedByCorrection->cloneRange(ec);
-                    VisibleSelection selectionToReplace(rangeToBeReplaced.get(), DOWNSTREAM);
-                    if (m_frame->selection()->shouldChangeSelection(selectionToReplace)) {
-                        m_frame->selection()->setSelection(selectionToReplace);
-                        replaceSelectionWithText(m_correctionReplacementString, false, false);
-                        caretPosition.moveToOffset(caretPosition.offsetInContainerNode() + m_correctionReplacementString.length() - m_stringToBeReplacedByCorrection.length());
-                        RefPtr<Range> replacementRange = TextIterator::subrange(paragraphRangeContainingCorrection.get(), correctionStartOffsetInParagraph, m_correctionReplacementString.length());
-                        replacementRange->startContainer()->document()->markers()->addMarker(replacementRange.get(), DocumentMarker::Replacement, m_correctionReplacementString);
-                        replacementRange->startContainer()->document()->markers()->addMarker(replacementRange.get(), DocumentMarker::CorrectionIndicator);
-                        m_frame->selection()->moveTo(caretPosition, false);
-                        didApplyCorrection = true;
-                    }
-                }
-            }
-        }
-        m_rangeToBeReplacedByCorrection.clear();
-    }
+    applyCorrectionPanelInfo(true);
+    m_correctionPanelInfo.m_rangeToBeReplaced.clear();
 #endif
 
     TextCheckingOptions textCheckingOptions = 0;
@@ -2243,7 +2251,7 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh
     }
     client()->checkTextOfParagraph(paragraphString.characters(), paragraphLength, checkingTypes, results);
 
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if SUPPORT_AUTOCORRECTION_PANEL
     // If this checking is only for showing correction panel, we shouldn't bother to mark misspellings.
     if (shouldShowCorrectionPanel)
         shouldMarkSpelling = false;
@@ -2328,7 +2336,7 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh
                 } else if (canEdit() && shouldInsertText(result->replacement, rangeToReplace.get(), EditorInsertActionTyped)) {
                     if (result->type == TextCheckingTypeCorrection)
                         replacedString = plainText(rangeToReplace.get());
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if SUPPORT_AUTOCORRECTION_PANEL
                     if (shouldShowCorrectionPanel && resultLocation + resultLength == spellingRangeEndOffset && result->type == TextCheckingTypeCorrection) {
                         // We only show the correction panel on the last word.
                         Vector<FloatQuad> textQuads;
@@ -2337,10 +2345,11 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh
                         FloatRect totalBoundingBox;
                         for (Vector<FloatQuad>::const_iterator it = textQuads.begin(); it < end; ++it)
                             totalBoundingBox.unite(it->boundingBox());
-                        m_rangeToBeReplacedByCorrection = rangeToReplace;
-                        m_stringToBeReplacedByCorrection = replacedString;
-                        m_correctionReplacementString = result->replacement;
-                        client()->showCorrectionPanel(totalBoundingBox, m_stringToBeReplacedByCorrection, result->replacement, this);
+                        m_correctionPanelInfo.m_rangeToBeReplaced = rangeToReplace;
+                        m_correctionPanelInfo.m_replacedString = replacedString;
+                        m_correctionPanelInfo.m_replacementString = result->replacement;
+                        m_correctionPanelInfo.m_isActive = true;
+                        client()->showCorrectionPanel(m_correctionPanelInfo.m_panelType, totalBoundingBox, m_correctionPanelInfo.m_replacedString, result->replacement, this);
                         doReplacement = false;
                     }
 #endif
@@ -2354,7 +2363,7 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh
                             // Add a marker so that corrections can easily be undone and won't be re-corrected.
                             RefPtr<Range> replacedRange = TextIterator::subrange(paragraphRange.get(), resultLocation, replacementLength);
                             replacedRange->startContainer()->document()->markers()->addMarker(replacedRange.get(), DocumentMarker::Replacement, replacedString);
-                            replacedRange->startContainer()->document()->markers()->addMarker(replacedRange.get(), DocumentMarker::CorrectionIndicator);
+                            replacedRange->startContainer()->document()->markers()->addMarker(replacedRange.get(), DocumentMarker::CorrectionIndicator, replacedString);
                         }
                     }
                 }
@@ -2417,60 +2426,97 @@ void Editor::markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelec
 
 void Editor::correctionPanelTimerFired(Timer<Editor>*)
 {
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
-    VisibleSelection selection(frame()->selection()->selection());
-    VisiblePosition start(selection.start(), selection.affinity());
-    VisiblePosition p = startOfWord(start, LeftWordIfOnBoundary);
-    VisibleSelection adjacentWords = VisibleSelection(p, start);
-    markAllMisspellingsAndBadGrammarInRanges(MarkSpelling | ShowCorrectionPanel, adjacentWords.toNormalizedRange().get(), 0);
+#if SUPPORT_AUTOCORRECTION_PANEL
+    if (m_correctionPanelInfo.m_panelType == CorrectionPanelInfo::PanelTypeCorrection) {
+        VisibleSelection selection(frame()->selection()->selection());
+        VisiblePosition start(selection.start(), selection.affinity());
+        VisiblePosition p = startOfWord(start, LeftWordIfOnBoundary);
+        VisibleSelection adjacentWords = VisibleSelection(p, start);
+        markAllMisspellingsAndBadGrammarInRanges(MarkSpelling | ShowCorrectionPanel, adjacentWords.toNormalizedRange().get(), 0);
+    } else {
+        String currentWord = plainText(m_correctionPanelInfo.m_rangeToBeReplaced.get());
+        Vector<FloatQuad> textQuads;
+        m_correctionPanelInfo.m_rangeToBeReplaced->getBorderAndTextQuads(textQuads);
+        Vector<FloatQuad>::const_iterator end = textQuads.end();
+        FloatRect totalBoundingBox;
+        for (Vector<FloatQuad>::const_iterator it = textQuads.begin(); it < end; ++it)
+            totalBoundingBox.unite(it->boundingBox());
+        m_correctionPanelInfo.m_isActive = true;
+        m_correctionPanelInfo.m_replacedString = currentWord;
+        client()->showCorrectionPanel(m_correctionPanelInfo.m_panelType, totalBoundingBox, m_correctionPanelInfo.m_replacedString, m_correctionPanelInfo.m_replacementString, this);
+    }
 #endif
 }
 
 void Editor::handleRejectedCorrection()
 {
-    Range* replacedRange = m_rangeToBeReplacedByCorrection.get();
+    Range* replacedRange = m_correctionPanelInfo.m_rangeToBeReplaced.get();
     if (!replacedRange || m_frame->document() != replacedRange->ownerDocument())
         return;
 
-    replacedRange->startContainer()->document()->markers()->addMarker(replacedRange, DocumentMarker::RejectedCorrection, m_stringToBeReplacedByCorrection);
-    m_rangeToBeReplacedByCorrection.clear();
+    if (m_correctionPanelInfo.m_panelType == CorrectionPanelInfo::PanelTypeCorrection)
+        replacedRange->startContainer()->document()->markers()->addMarker(replacedRange, DocumentMarker::RejectedCorrection, m_correctionPanelInfo.m_replacedString);
+    else {
+        m_correctionPanelInfo.m_isActive = false;
+        applyCorrectionPanelInfo(false);
+    }
+    m_correctionPanelInfo.m_rangeToBeReplaced.clear();
 }
 
-void Editor::startCorrectionPanelTimer()
+void Editor::startCorrectionPanelTimer(CorrectionPanelInfo::PanelType type)
 {
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    static const double correctionPanelTimerInterval = 0.3;
+#if SUPPORT_AUTOCORRECTION_PANEL
+    const double correctionPanelTimerInterval = 0.3;
     if (isAutomaticSpellingCorrectionEnabled()) {
-        m_rangeToBeReplacedByCorrection.clear();
+        if (type == CorrectionPanelInfo::PanelTypeCorrection)
+            // If type is PanelTypeReversion, then the new range has been set. So we shouldn't clear it.
+            m_correctionPanelInfo.m_rangeToBeReplaced.clear();
+        m_correctionPanelInfo.m_panelType = type;
         m_correctionPanelTimer.startOneShot(correctionPanelTimerInterval);
     }
+#else
+    UNUSED_PARAM(type);
 #endif
 }
 
 void Editor::stopCorrectionPanelTimer()
 {
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if SUPPORT_AUTOCORRECTION_PANEL
     m_correctionPanelTimer.stop();
 #endif
 }
 
 void Editor::handleCancelOperation()
 {
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if SUPPORT_AUTOCORRECTION_PANEL
+    if (!m_correctionPanelInfo.m_isActive)
+        return;
+    m_correctionPanelInfo.m_isActive = false;
     if (client())
-        client()->dismissCorrectionPanel(false);
+        client()->dismissCorrectionPanel(CorrectionWasRejected);
 #endif
 }
 
 bool Editor::isShowingCorrectionPanel()
 {
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if SUPPORT_AUTOCORRECTION_PANEL
     if (client())
         return client()->isShowingCorrectionPanel();
 #endif
     return false;
 }
 
+void Editor::dismissCorrectionPanel(CorrectionWasRejectedOrNot correctionWasRejectedOrNot)
+{
+#if SUPPORT_AUTOCORRECTION_PANEL
+    if (!m_correctionPanelInfo.m_isActive)
+        return;
+    m_correctionPanelInfo.m_isActive = false;
+    m_correctionPanelInfo.m_rangeToBeReplaced.clear();
+    if (client())
+        client()->dismissCorrectionPanel(correctionWasRejectedOrNot);
+#endif
+}
 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
@@ -2568,6 +2614,54 @@ void Editor::removeSpellAndCorrectionMarkersFromWordsToBeEdited(bool doNotRemove
         document->markers()->removeMarkers(pairIterator->first.get(), pairIterator->second);
 }
 
+void Editor::applyCorrectionPanelInfo(bool addCorrectionIndicatorMarker)
+{
+    if (!m_correctionPanelInfo.m_rangeToBeReplaced)
+        return;
+
+    ExceptionCode ec = 0;
+    RefPtr<Range> paragraphRangeContainingCorrection = m_correctionPanelInfo.m_rangeToBeReplaced->cloneRange(ec);
+    if (ec)
+        return;
+
+    setStart(paragraphRangeContainingCorrection.get(), startOfParagraph(m_correctionPanelInfo.m_rangeToBeReplaced->startPosition()));
+    setEnd(paragraphRangeContainingCorrection.get(), endOfParagraph(m_correctionPanelInfo.m_rangeToBeReplaced->endPosition()));
+
+    // After we replace the word at range m_rangeToBeReplaced, we need to add markers to that range.
+    // However, once the replacement took place, the value of m_rangeToBeReplaced is not valid anymore.
+    // So before we carry out the replacement, we need to store the start position of m_rangeToBeReplaced
+    // relative to the start position of the containing paragraph. We use correctionStartOffsetInParagraph
+    // to store this value. In order to obtain this offset, we need to first create a range
+    // which spans from the start of paragraph to the start position of m_rangeToBeReplaced.
+    RefPtr<Range> correctionStartOffsetInParagraphAsRange = Range::create(paragraphRangeContainingCorrection->startContainer(ec)->document(), paragraphRangeContainingCorrection->startPosition(), paragraphRangeContainingCorrection->startPosition());
+    if (ec)
+        return;
+
+    Position startPositionOfRangeToBeReplaced = m_correctionPanelInfo.m_rangeToBeReplaced->startPosition();
+    correctionStartOffsetInParagraphAsRange->setEnd(startPositionOfRangeToBeReplaced.containerNode(), startPositionOfRangeToBeReplaced.computeOffsetInContainerNode(), ec);
+    if (ec)
+        return;
+
+    // Take note of the location of autocorrection so that we can add marker after the replacement took place.
+    int correctionStartOffsetInParagraph = TextIterator::rangeLength(correctionStartOffsetInParagraphAsRange.get());
+    Position caretPosition = m_frame->selection()->selection().end();
+
+    // Clone the range, since the caller of this method may want to keep the original range around.
+    RefPtr<Range> rangeToBeReplaced = m_correctionPanelInfo.m_rangeToBeReplaced->cloneRange(ec);
+    VisibleSelection selectionToReplace(rangeToBeReplaced.get(), DOWNSTREAM);
+    if (m_frame->selection()->shouldChangeSelection(selectionToReplace)) {
+        m_frame->selection()->setSelection(selectionToReplace);
+        replaceSelectionWithText(m_correctionPanelInfo.m_replacementString, false, false);
+        caretPosition.moveToOffset(caretPosition.offsetInContainerNode() + m_correctionPanelInfo.m_replacementString.length() - m_correctionPanelInfo.m_replacedString.length());
+        setEnd(paragraphRangeContainingCorrection.get(), endOfParagraph(caretPosition));
+        RefPtr<Range> replacementRange = TextIterator::subrange(paragraphRangeContainingCorrection.get(), correctionStartOffsetInParagraph, m_correctionPanelInfo.m_replacementString.length());
+        replacementRange->startContainer()->document()->markers()->addMarker(replacementRange.get(), DocumentMarker::Replacement, m_correctionPanelInfo.m_replacementString);
+        if (addCorrectionIndicatorMarker)
+            replacementRange->startContainer()->document()->markers()->addMarker(replacementRange.get(), DocumentMarker::CorrectionIndicator, m_correctionPanelInfo.m_replacedString);
+        m_frame->selection()->moveTo(caretPosition, false);
+    }
+}
+
 PassRefPtr<Range> Editor::rangeForPoint(const IntPoint& windowPoint)
 {
     Document* document = m_frame->documentAtPoint(windowPoint);
@@ -2834,7 +2928,7 @@ void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, b
     if (newSelection.start().isOrphan() || newSelection.end().isOrphan())
         return;
 
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if SUPPORT_AUTOCORRECTION_PANEL
     // Check to see if the command introduced paragraph separator. If it did, we remove existing autocorrection underlines.
     // This is in consistency with the behavior in AppKit
     if (!inSameParagraph(m_frame->selection()->selection().visibleStart(), newSelection.visibleEnd()))
diff --git a/WebCore/editing/Editor.h b/WebCore/editing/Editor.h
index 8bf1ea5..24cdaf1 100644
--- a/WebCore/editing/Editor.h
+++ b/WebCore/editing/Editor.h
@@ -28,23 +28,13 @@
 
 #include "ClipboardAccessPolicy.h"
 #include "Color.h"
+#include "CorrectionPanelInfo.h"
 #include "EditAction.h"
 #include "EditingBehavior.h"
 #include "EditorDeleteAction.h"
 #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;
@@ -323,7 +313,7 @@ public:
     void addToKillRing(Range*, bool prepend);
 
     void handleCancelOperation();
-    void startCorrectionPanelTimer();
+    void startCorrectionPanelTimer(CorrectionPanelInfo::PanelType);
     void handleRejectedCorrection();
     bool isShowingCorrectionPanel();
 
@@ -389,9 +379,7 @@ private:
     bool m_shouldStartNewKillRingSequence;
     bool m_shouldStyleWithCSS;
     OwnPtr<KillRing> m_killRing;
-    RefPtr<Range> m_rangeToBeReplacedByCorrection;
-    String m_stringToBeReplacedByCorrection;
-    String m_correctionReplacementString;
+    CorrectionPanelInfo m_correctionPanelInfo;
     Timer<Editor> m_correctionPanelTimer;
     VisibleSelection m_mark;
     bool m_areMarkedTextMatchesHighlighted;
@@ -418,6 +406,8 @@ private:
     void correctionPanelTimerFired(Timer<Editor>*);
     Node* findEventTargetFromSelection() const;
     void stopCorrectionPanelTimer();
+    void dismissCorrectionPanel(CorrectionWasRejectedOrNot);
+    void applyCorrectionPanelInfo(bool addCorrectionIndicatorMarker);
 };
 
 inline void Editor::setStartNewKillRingSequence(bool flag)
diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp
index 85becd5..d3ae222 100644
--- a/WebCore/editing/EditorCommand.cpp
+++ b/WebCore/editing/EditorCommand.cpp
@@ -1074,7 +1074,7 @@ static bool executeYankAndSelect(Frame* frame, Event*, EditorCommandSource, cons
     return true;
 }
 
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if SUPPORT_AUTOCORRECTION_PANEL
 static bool executeCancelOperation(Frame* frame, Event*, EditorCommandSource, const String&)
 {
     frame->editor()->handleCancelOperation();
@@ -1124,7 +1124,7 @@ static bool supportedPaste(Frame* frame, EditorCommandSource source)
     return false;
 }
 
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if SUPPORT_AUTOCORRECTION_PANEL
 static bool supportedDismissCorrectionPanel(Frame* frame, EditorCommandSource source)
 {
     return supportedFromMenuOrKeyBinding(frame, source) && frame->editor()->isShowingCorrectionPanel();
@@ -1506,7 +1506,7 @@ static const CommandMap& createCommandMap()
         { "Unselect", { executeUnselect, supported, enabledVisibleSelection, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
         { "Yank", { executeYank, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
         { "YankAndSelect", { executeYankAndSelect, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if SUPPORT_AUTOCORRECTION_PANEL
         { "CancelOperation", { executeCancelOperation, supportedDismissCorrectionPanel, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
 #endif
     };
diff --git a/WebCore/editing/TypingCommand.cpp b/WebCore/editing/TypingCommand.cpp
index d78708b..9165a3e 100644
--- a/WebCore/editing/TypingCommand.cpp
+++ b/WebCore/editing/TypingCommand.cpp
@@ -311,9 +311,9 @@ void TypingCommand::markMisspellingsAfterTyping(ETypingCommand commandType)
         VisiblePosition p2 = startOfWord(start, LeftWordIfOnBoundary);
         if (p1 != p2)
             document()->frame()->editor()->markMisspellingsAfterTypingToPosition(p1);
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if SUPPORT_AUTOCORRECTION_PANEL
         else if (commandType == TypingCommand::InsertText)
-            document()->frame()->editor()->startCorrectionPanelTimer();
+            document()->frame()->editor()->startCorrectionPanelTimer(CorrectionPanelInfo::PanelTypeCorrection);
 #else
     UNUSED_PARAM(commandType);
 #endif
diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h
index f2d9123..cf98f29 100644
--- a/WebCore/loader/EmptyClients.h
+++ b/WebCore/loader/EmptyClients.h
@@ -478,9 +478,9 @@ public:
 #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
     virtual void checkTextOfParagraph(const UChar*, int, uint64_t, Vector<TextCheckingResult>&) { };
 #endif
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    virtual void showCorrectionPanel(const FloatRect&, const String&, const String&, Editor*) { }
-    virtual void dismissCorrectionPanel(bool) { }
+#if SUPPORT_AUTOCORRECTION_PANEL
+    virtual void showCorrectionPanel(CorrectionPanelInfo::PanelType, const FloatRect&, const String&, const String&, Editor*) { }
+    virtual void dismissCorrectionPanel(CorrectionWasRejectedOrNot) { }
     virtual bool isShowingCorrectionPanel() { return false; }
 #endif
     virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&) { }
diff --git a/WebCore/manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html b/WebCore/manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html
new file mode 100644
index 0000000..b8521c0
--- /dev/null
+++ b/WebCore/manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html
@@ -0,0 +1,49 @@
+<html>
+<head>
+
+<style>
+.editing {
+    border: 2px solid red;
+    padding: 12px;
+    font-size: 24px;
+}
+</style>
+<script src=../../../LayoutTests/editing/editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+function editingTest() {
+    typeCharacterCommand('t');
+    typeCharacterCommand('h');
+    typeCharacterCommand('e');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('m');
+    typeCharacterCommand('e');
+    typeCharacterCommand('s');
+    typeCharacterCommand('a');
+    typeCharacterCommand('g');
+    typeCharacterCommand('e');
+    typeCharacterCommand(' ');
+    execMoveSelectionBackwardByCharacterCommand();
+}
+
+</script>
+
+<title>Continue Typing to Dismiss Reversion Panel Test</title>
+</head>
+<body>
+<div><p>This test verifies that, after reversion panel is shown, continue typing will dismiss the reversion panel.</p>
+<p>After seeing the reversion panel, start typing (excluding whitespace). You should see the panel being
+dismissed once you start typing.</p>
+<p  style="color:green">Note, this test can fail due to user specific spell checking data. If the user has previously 
+frequently revert 'message' to 'mesage'. To fix this, remove all files in ~/Library/Spelling, then kill AppleSpell.service process.</p>
+<div contenteditable id="root" class="editing">
+<span id="test"></span>
+</div>
+
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
diff --git a/WebCore/manual-tests/autocorrection/delete-to-dismiss-reversion.html b/WebCore/manual-tests/autocorrection/delete-to-dismiss-reversion.html
new file mode 100644
index 0000000..c39b2ac
--- /dev/null
+++ b/WebCore/manual-tests/autocorrection/delete-to-dismiss-reversion.html
@@ -0,0 +1,49 @@
+<html>
+<head>
+
+<style>
+.editing {
+    border: 2px solid red;
+    padding: 12px;
+    font-size: 24px;
+}
+</style>
+<script src=../../../LayoutTests/editing/editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+function editingTest() {
+    typeCharacterCommand('t');
+    typeCharacterCommand('h');
+    typeCharacterCommand('e');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('m');
+    typeCharacterCommand('e');
+    typeCharacterCommand('s');
+    typeCharacterCommand('a');
+    typeCharacterCommand('g');
+    typeCharacterCommand('e');
+    typeCharacterCommand(' ');
+    execMoveSelectionBackwardByCharacterCommand();
+}
+
+</script>
+
+<title>Delete to Dismiss Reversion Panel Test</title>
+</head>
+<body>
+<div><p>This test verifies that, after reversion panel is shown, continue deleting the word will dismiss the reversion panel.</p>
+<p>After seeing the reversion panel, start deleting the corrected word character by character. You should see the panel being
+dismissed once you start deleting.</p>
+<p  style="color:green">Note, this test can fail due to user specific spell checking data. If the user has previously 
+frequently revert 'message' to 'mesage'. To fix this, remove all files in ~/Library/Spelling, then kill AppleSpell.service process.</p>
+<div contenteditable id="root" class="editing">
+<span id="test"></span>
+</div>
+
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
diff --git a/WebCore/manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html b/WebCore/manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html
new file mode 100644
index 0000000..320ed8c
--- /dev/null
+++ b/WebCore/manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html
@@ -0,0 +1,49 @@
+<html>
+<head>
+
+<style>
+.editing {
+    border: 2px solid red;
+    padding: 12px;
+    font-size: 24px;
+}
+</style>
+<script src=../../../LayoutTests/editing/editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+function editingTest() {
+    typeCharacterCommand('t');
+    typeCharacterCommand('h');
+    typeCharacterCommand('e');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('m');
+    typeCharacterCommand('e');
+    typeCharacterCommand('s');
+    typeCharacterCommand('a');
+    typeCharacterCommand('g');
+    typeCharacterCommand('e');
+    typeCharacterCommand(' ');
+    execDeleteCommand();
+}
+
+</script>
+
+<title>Delete to End of Word to Show Reversion Panel Test</title>
+</head>
+<body>
+<div><p>This test verifies that reversion panel is shown when user moves carret to previously corrected word using delete key.</p>
+<p>After seeing the reversion panel, press ESC key, then space key. You should see the phrase "the mesage" 
+where "mesage" has red mispell underline. </p>
+<p  style="color:green">Note, this test can fail due to user specific spell checking data. If the user has previously 
+frequently revert 'message' to 'mesage'. To fix this, remove all files in ~/Library/Spelling, then kill AppleSpell.service process.</p>
+<div contenteditable id="root" class="editing">
+<span id="test"></span>
+</div>
+
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
diff --git a/WebCore/manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html b/WebCore/manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html
new file mode 100644
index 0000000..8ca2a6b
--- /dev/null
+++ b/WebCore/manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html
@@ -0,0 +1,49 @@
+<html>
+<head>
+
+<style>
+.editing {
+    border: 2px solid red;
+    padding: 12px;
+    font-size: 24px;
+}
+</style>
+<script src=../../../LayoutTests/editing/editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+function editingTest() {
+    typeCharacterCommand('t');
+    typeCharacterCommand('h');
+    typeCharacterCommand('e');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('m');
+    typeCharacterCommand('e');
+    typeCharacterCommand('s');
+    typeCharacterCommand('a');
+    typeCharacterCommand('g');
+    typeCharacterCommand('e');
+    typeCharacterCommand(' ');
+    execMoveSelectionBackwardByCharacterCommand();
+}
+
+</script>
+
+<title>Move to End of Word to Show Reversion Panel Test</title>
+</head>
+<body>
+<div><p>This test verifies that reversion panel is shown when user moves carret to previously corrected word</p>
+<p>After seeing the reversion panel, press ESC key, then space key. You should see the phrase "the mesage" 
+where "mesage" has red mispell underline. </p>
+<p  style="color:green">Note, this test can fail due to user specific spell checking data. If the user has previously 
+frequently revert 'message' to 'mesage'. To fix this, remove all files in ~/Library/Spelling, then kill AppleSpell.service process.</p>
+<div contenteditable id="root" class="editing">
+<span id="test"></span>
+</div>
+
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
diff --git a/WebCore/manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html b/WebCore/manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html
new file mode 100644
index 0000000..eeea0f7
--- /dev/null
+++ b/WebCore/manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html
@@ -0,0 +1,50 @@
+<html>
+<head>
+
+<style>
+.editing {
+    border: 2px solid red;
+    padding: 12px;
+    font-size: 24px;
+}
+</style>
+<script src=../../../LayoutTests/editing/editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+function editingTest() {
+    typeCharacterCommand('t');
+    typeCharacterCommand('h');
+    typeCharacterCommand('e');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('m');
+    typeCharacterCommand('e');
+    typeCharacterCommand('s');
+    typeCharacterCommand('a');
+    typeCharacterCommand('g');
+    typeCharacterCommand('e');
+    typeCharacterCommand(' ');
+    execMoveSelectionBackwardByCharacterCommand();
+}
+
+</script>
+
+<title>Type Whitespace to Dismiss Reversion Panel Test</title>
+</head>
+<body>
+<div><p>This test verifies that, after reversion panel is shown, typing whitespace will dismiss the reversion panel.
+It also keep the existing autocorrection underline.</p>
+<p>After seeing the reversion panel, type whitespace. You should see the panel being dismissed once you start typing.
+However, the word "message" still has blue underline.</p>
+<p  style="color:green">Note, this test can fail due to user specific spell checking data. If the user has previously 
+frequently revert 'message' to 'mesage'. To fix this, remove all files in ~/Library/Spelling, then kill AppleSpell.service process.</p>
+<div contenteditable id="root" class="editing">
+<span id="test"></span>
+</div>
+
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
diff --git a/WebCore/page/EditorClient.h b/WebCore/page/EditorClient.h
index 97b0902..61bdd41 100644
--- a/WebCore/page/EditorClient.h
+++ b/WebCore/page/EditorClient.h
@@ -27,6 +27,7 @@
 #ifndef EditorClient_h
 #define EditorClient_h
 
+#include "CorrectionPanelInfo.h"
 #include "EditorInsertAction.h"
 #include "FloatRect.h"
 #include "PlatformString.h"
@@ -188,9 +189,9 @@ public:
     virtual void checkTextOfParagraph(const UChar* text, int length, uint64_t checkingTypes, Vector<TextCheckingResult>& results) = 0;
 #endif
 
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    virtual void showCorrectionPanel(const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacmentString, Editor*) = 0;
-    virtual void dismissCorrectionPanel(bool correctionAccepted) = 0;
+#if SUPPORT_AUTOCORRECTION_PANEL
+    virtual void showCorrectionPanel(CorrectionPanelInfo::PanelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacmentString, Editor*) = 0;
+    virtual void dismissCorrectionPanel(CorrectionWasRejectedOrNot) = 0;
     virtual bool isShowingCorrectionPanel() = 0;
 #endif
 
diff --git a/WebCore/platform/graphics/mac/GraphicsContextMac.mm b/WebCore/platform/graphics/mac/GraphicsContextMac.mm
index aa754f2..15cae20 100644
--- a/WebCore/platform/graphics/mac/GraphicsContextMac.mm
+++ b/WebCore/platform/graphics/mac/GraphicsContextMac.mm
@@ -147,6 +147,7 @@ void GraphicsContext::drawLineForTextChecking(const IntPoint& point, int width,
             break;
         }
 #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+        // To support correction panel.
         case TextCheckingReplacementLineStyle:
         {
             // Constants for spelling pattern color.
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 7f676e4..2502d41 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,23 @@
+2010-11-04  Jia Pu  <jpu at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        reversion bubble in WebViews
+        https://bugs.webkit.org/show_bug.cgi?id=47630
+        <rdar://problem/8530960>
+
+        This patch is to add reversion to correction panel. Please see WebCore/ChangeLog for detail.
+
+        * WebCoreSupport/WebEditorClient.h: Adopted new signature of base class method.
+        * WebCoreSupport/WebEditorClient.mm: Adopted new signature of base class method. And code
+          change to use new reversion API in AppKit.
+        (WebEditorClient::WebEditorClient):
+        (WebEditorClient::~WebEditorClient):
+        (WebEditorClient::respondToChangedSelection):
+        (WebEditorClient::showCorrectionPanel):
+        (WebEditorClient::dismissCorrectionPanel):
+        (WebEditorClient::isShowingCorrectionPanel):
+
 2010-11-04  Mike Thole  <mthole at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.h b/WebKit/mac/WebCoreSupport/WebEditorClient.h
index ad324b9..23cf312 100644
--- a/WebKit/mac/WebCoreSupport/WebEditorClient.h
+++ b/WebKit/mac/WebCoreSupport/WebEditorClient.h
@@ -133,8 +133,8 @@ public:
     virtual void willSetInputMethodState();
     virtual void setInputMethodState(bool enabled);
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    virtual void showCorrectionPanel(const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, WebCore::Editor*);
-    virtual void dismissCorrectionPanel(bool correctionAccepted);
+    virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, WebCore::Editor*);
+    virtual void dismissCorrectionPanel(WebCore::CorrectionWasRejectedOrNot);
     virtual bool isShowingCorrectionPanel();
 #endif
 private:
@@ -146,6 +146,6 @@ private:
     bool m_haveUndoRedoOperations;
 
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    NSInteger m_correctionPanelTag;
+    BOOL m_correctionPanelIsShown;
 #endif
 };
diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/WebKit/mac/WebCoreSupport/WebEditorClient.mm
index 2bf3259..39b511e 100644
--- a/WebKit/mac/WebCoreSupport/WebEditorClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebEditorClient.mm
@@ -186,7 +186,7 @@ WebEditorClient::WebEditorClient(WebView *webView)
     , m_undoTarget([[[WebEditorUndoTarget alloc] init] autorelease])
     , m_haveUndoRedoOperations(false)
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    , m_correctionPanelTag(InvalidCorrectionPanelTag)
+    , m_correctionPanelIsShown(false)
 #endif
 {
 }
@@ -194,7 +194,7 @@ WebEditorClient::WebEditorClient(WebView *webView)
 WebEditorClient::~WebEditorClient()
 {
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    dismissCorrectionPanel(true);
+    dismissCorrectionPanel(WebCore::CorrectionWasNotRejected);
 #endif
 }
 
@@ -310,10 +310,6 @@ void WebEditorClient::respondToChangedSelection()
 {
     [m_webView _selectionChanged];
 
-#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    dismissCorrectionPanel(true);
-#endif
-
     // FIXME: This quirk is needed due to <rdar://problem/5009625> - We can phase it out once Aperture can adopt the new behavior on their end
     if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_APERTURE_QUIRK) && [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.Aperture"])
         return;
@@ -860,8 +856,8 @@ void WebEditorClient::updateSpellingUIWithGrammarString(const String& badGrammar
 }
 
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-void WebEditorClient::showCorrectionPanel(const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, Editor* editor) {
-    dismissCorrectionPanel(true);
+void WebEditorClient::showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType panelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, Editor* editor) {
+    dismissCorrectionPanel(WebCore::CorrectionWasNotRejected);
 
     NSRect boundingBoxAsNSRect = boundingBoxOfReplacedString;
     NSRect webViewFrame = m_webView.frame;
@@ -871,25 +867,33 @@ void WebEditorClient::showCorrectionPanel(const FloatRect& boundingBoxOfReplaced
     NSString *replacedStringAsNSString = replacedString;
     NSString *replacementStringAsNSString = replacementString;
 
-    m_correctionPanelTag = [[NSSpellChecker sharedSpellChecker] showCorrection:replacementStringAsNSString forStringInRect:boundingBoxAsNSRect view:m_webView completionHandler:^(BOOL accepted) {
-        if (!accepted) {
+    m_correctionPanelIsShown = YES;
+    NSCorrectionBubbleType bubbleType = panelType == WebCore::CorrectionPanelInfo::PanelTypeCorrection ? NSCorrectionBubbleTypeCorrection : NSCorrectionBubbleTypeReversion;
+    [[NSSpellChecker sharedSpellChecker] showCorrectionBubbleOfType:bubbleType primaryString:replacementStringAsNSString alternativeStrings:nil forStringInRect:boundingBoxAsNSRect view:m_webView completionHandler:^(NSString *acceptedString) {
+        if (!acceptedString && bubbleType == NSCorrectionBubbleTypeCorrection) {
             [[NSSpellChecker sharedSpellChecker] recordResponse:NSCorrectionResponseRejected toCorrection:replacementStringAsNSString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:[m_webView spellCheckerDocumentTag]];
             editor->handleRejectedCorrection();
+        } else if (acceptedString && bubbleType == NSCorrectionBubbleTypeReversion) {
+            [[NSSpellChecker sharedSpellChecker] recordResponse:NSCorrectionResponseReverted toCorrection:replacedStringAsNSString forWord:replacementStringAsNSString language:nil inSpellDocumentWithTag:[m_webView spellCheckerDocumentTag]];
+            editor->handleRejectedCorrection();
         }
     }];
 }
 
-void WebEditorClient::dismissCorrectionPanel(bool correctionAccepted)
+void WebEditorClient::dismissCorrectionPanel(WebCore::CorrectionWasRejectedOrNot correctionWasRejectedOrNot)
 {
-    if (m_correctionPanelTag != InvalidCorrectionPanelTag) {
-        [[NSSpellChecker sharedSpellChecker] dismissCorrection:m_correctionPanelTag acceptCorrection:correctionAccepted];
-        m_correctionPanelTag = InvalidCorrectionPanelTag;
+    if (isShowingCorrectionPanel()) {
+        if (correctionWasRejectedOrNot == CorrectionWasRejected)
+            [[NSSpellChecker sharedSpellChecker] cancelCorrectionBubbleForView:m_webView];
+        else
+            [[NSSpellChecker sharedSpellChecker] dismissCorrectionBubbleForView:m_webView];
+        m_correctionPanelIsShown = NO;
     }
 }
 
 bool WebEditorClient::isShowingCorrectionPanel()
 {
-    return m_correctionPanelTag != InvalidCorrectionPanelTag;
+    return m_correctionPanelIsShown;
 }
 #endif
 
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index d8578e2..72a1674 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,18 @@
+2010-11-04  Jia Pu  <jpu at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        reversion bubble in WebViews
+        https://bugs.webkit.org/show_bug.cgi?id=47630
+        <rdar://problem/8530960>
+
+        This patch is to add reversion to correction panel. Please see WebCore/ChangeLog for detail.
+
+        * WebProcess/WebCoreSupport/WebEditorClient.h: Adopted new signature of base class method.
+        * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: Ditto.
+        (WebKit::WebEditorClient::showCorrectionPanel):
+        (WebKit::WebEditorClient::dismissCorrectionPanel):
+
 2010-11-04  Kenneth Rohde Christiansen  <kenneth at webkit.org>
 
         Reviewed by David Hyatt.
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
index 4b1f99c..62a5ed2 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
+++ b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
@@ -134,8 +134,8 @@ private:
     virtual void willSetInputMethodState();
     virtual void setInputMethodState(bool enabled);
 #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    virtual void showCorrectionPanel(const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, WebCore::Editor*);
-    virtual void dismissCorrectionPanel(bool correctionAccepted);
+    virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, WebCore::Editor*);
+    virtual void dismissCorrectionPanel(WebCore::CorrectionWasRejectedOrNot);
     virtual bool isShowingCorrectionPanel();
 #endif
     WebPage* m_page;
diff --git a/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
index fba0194..badc301 100644
--- a/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
+++ b/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
@@ -223,12 +223,12 @@ void WebEditorClient::checkTextOfParagraph(const UChar *, int length, uint64_t,
 #endif
 
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-void WebEditorClient::showCorrectionPanel(const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, WebCore::Editor*)
+void WebEditorClient::showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType type, const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, WebCore::Editor*)
 {
     notImplemented();
 }
 
-void WebEditorClient::dismissCorrectionPanel(bool correctionAccepted)
+void WebEditorClient::dismissCorrectionPanel(WebCore::CorrectionWasRejectedOrNot)
 {
     notImplemented();
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list