Title: [87117] trunk/Source/WebCore
Revision
87117
Author
[email protected]
Date
2011-05-23 18:58:41 -0700 (Mon, 23 May 2011)

Log Message

2011-05-22  MORITA Hajime  <[email protected]>

        Reviewed by Ryosuke Niwa.

        SUPPORT_AUTOCORRECTION_PANEL should be USE(AUTOCORRECTION_PANEL)
        https://bugs.webkit.org/show_bug.cgi?id=61181

        - Removed SUPPORT_AUTOCORRECTION_PANEL and REMOVE_MARKERS_UPON_EDITING from SpellingCorrectionController.h
        - Define WTF_USE_UNIFIED_TEXT_CHECKING and WTF_USE_AUTOMATIC_TEXT_REPLACEMENT at TextChecking.h

        No new tests. Just renaming a compilation conditional.

        * editing/Editor.cpp:
        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
        * editing/SpellingCorrectionCommand.cpp:
        (WebCore::SpellingCorrectionCommand::doApply):
        * editing/SpellingCorrectionController.cpp:
        * editing/SpellingCorrectionController.h:
        (WebCore::SpellingCorrectionController::shouldRemoveMarkersUponEditing):
        * loader/EmptyClients.h:
        * page/EditorClient.h:
        * platform/text/TextChecking.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (87116 => 87117)


--- trunk/Source/WebCore/ChangeLog	2011-05-24 01:56:11 UTC (rev 87116)
+++ trunk/Source/WebCore/ChangeLog	2011-05-24 01:58:41 UTC (rev 87117)
@@ -1,3 +1,26 @@
+2011-05-22  MORITA Hajime  <[email protected]>
+
+        Reviewed by Ryosuke Niwa.
+
+        SUPPORT_AUTOCORRECTION_PANEL should be USE(AUTOCORRECTION_PANEL)
+        https://bugs.webkit.org/show_bug.cgi?id=61181
+
+        - Removed SUPPORT_AUTOCORRECTION_PANEL and REMOVE_MARKERS_UPON_EDITING from SpellingCorrectionController.h
+        - Define WTF_USE_UNIFIED_TEXT_CHECKING and WTF_USE_AUTOMATIC_TEXT_REPLACEMENT at TextChecking.h
+
+        No new tests. Just renaming a compilation conditional.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
+        * editing/SpellingCorrectionCommand.cpp:
+        (WebCore::SpellingCorrectionCommand::doApply):
+        * editing/SpellingCorrectionController.cpp:
+        * editing/SpellingCorrectionController.h:
+        (WebCore::SpellingCorrectionController::shouldRemoveMarkersUponEditing):
+        * loader/EmptyClients.h:
+        * page/EditorClient.h:
+        * platform/text/TextChecking.h:
+
 2011-05-23  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r87007.

Modified: trunk/Source/WebCore/editing/Editor.cpp (87116 => 87117)


--- trunk/Source/WebCore/editing/Editor.cpp	2011-05-24 01:56:11 UTC (rev 87116)
+++ trunk/Source/WebCore/editing/Editor.cpp	2011-05-24 01:58:41 UTC (rev 87117)
@@ -2221,7 +2221,9 @@
                 continue;
 
             if (shouldShowCorrectionPanel) {
-                ASSERT(SUPPORT_AUTOCORRECTION_PANEL);
+#if !USE(AUTOCORRECTION_PANEL)
+                ASSERT_NOT_REACHED();
+#endif
                 // shouldShowCorrectionPanel can be true only when the panel is available.
                 if (resultLocation + resultLength == spellingRangeEndOffset) {
                     // We only show the correction panel on the last word.

Modified: trunk/Source/WebCore/editing/SpellingCorrectionCommand.cpp (87116 => 87117)


--- trunk/Source/WebCore/editing/SpellingCorrectionCommand.cpp	2011-05-24 01:56:11 UTC (rev 87116)
+++ trunk/Source/WebCore/editing/SpellingCorrectionCommand.cpp	2011-05-24 01:58:41 UTC (rev 87117)
@@ -37,7 +37,7 @@
 
 namespace WebCore {
 
-#if SUPPORT_AUTOCORRECTION_PANEL
+#if USE(AUTOCORRECTION_PANEL)
 // On Mac OS X, we use this command to keep track of user undoing a correction for the first time.
 // This information is needed by spell checking service to update user specific data.
 class SpellingCorrectionRecordUndoCommand : public SimpleEditCommand {
@@ -96,7 +96,7 @@
         return;
 
     applyCommandToComposite(SetSelectionCommand::create(m_selectionToBeCorrected, FrameSelection::SpellCorrectionTriggered | FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle));
-#if SUPPORT_AUTOCORRECTION_PANEL
+#if USE(AUTOCORRECTION_PANEL)
     applyCommandToComposite(SpellingCorrectionRecordUndoCommand::create(document(), m_corrected, m_correction));
 #endif
     applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment, ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting, EditActionPaste));

Modified: trunk/Source/WebCore/editing/SpellingCorrectionController.cpp (87116 => 87117)


--- trunk/Source/WebCore/editing/SpellingCorrectionController.cpp	2011-05-24 01:56:11 UTC (rev 87116)
+++ trunk/Source/WebCore/editing/SpellingCorrectionController.cpp	2011-05-24 01:58:41 UTC (rev 87117)
@@ -48,7 +48,7 @@
 using namespace std;
 using namespace WTF;
 
-#if SUPPORT_AUTOCORRECTION_PANEL
+#if USE(AUTOCORRECTION_PANEL)
 
 static const Vector<DocumentMarker::MarkerType>& markerTypesForAutocorrection()
 {

Modified: trunk/Source/WebCore/editing/SpellingCorrectionController.h (87116 => 87117)


--- trunk/Source/WebCore/editing/SpellingCorrectionController.h	2011-05-24 01:56:11 UTC (rev 87116)
+++ trunk/Source/WebCore/editing/SpellingCorrectionController.h	2011-05-24 01:58:41 UTC (rev 87117)
@@ -26,17 +26,6 @@
 #ifndef SpellingCorrectionController_h
 #define SpellingCorrectionController_h
 
-#if PLATFORM(MAC) && !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_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-
 #include "DocumentMarker.h"
 #include "Range.h"
 #include "Timer.h"
@@ -73,7 +62,7 @@
     ReasonForDismissingCorrectionPanelAccepted
 };
 
-#if SUPPORT_AUTOCORRECTION_PANEL
+#if USE(AUTOCORRECTION_PANEL)
 #define UNLESS_ENABLED(functionBody) ;
 #else
 #define UNLESS_ENABLED(functionBody) functionBody
@@ -110,7 +99,7 @@
     bool hasPendingCorrection() const UNLESS_ENABLED({ return false; })
     bool isSpellingMarkerAllowed(PassRefPtr<Range> misspellingRange) const UNLESS_ENABLED({ UNUSED_PARAM(misspellingRange); return true; })
     bool isAutomaticSpellingCorrectionEnabled() UNLESS_ENABLED({ return false; })
-    bool shouldRemoveMarkersUponEditing() { return REMOVE_MARKERS_UPON_EDITING; }
+    bool shouldRemoveMarkersUponEditing();
 
     void correctionPanelTimerFired(Timer<SpellingCorrectionController>*) UNLESS_ENABLED({})
     void recordAutocorrectionResponseReversed(const String& replacedString, PassRefPtr<Range> replacementRange) UNLESS_ENABLED({ UNUSED_PARAM(replacedString); UNUSED_PARAM(replacementRange); })
@@ -122,7 +111,7 @@
     bool processMarkersOnTextToBeReplacedByResult(const TextCheckingResult*, Range* rangeToBeReplaced, const String& stringToBeReplaced) UNLESS_ENABLED({ UNUSED_PARAM(rangeToBeReplaced); UNUSED_PARAM(stringToBeReplaced); return true; });
     void deletedAutocorrectionAtPosition(const Position&, const String& originalString) UNLESS_ENABLED({ UNUSED_PARAM(originalString); })
 
-#if SUPPORT_AUTOCORRECTION_PANEL
+#if USE(AUTOCORRECTION_PANEL)
 private:
     void recordAutocorrectionResponseReversed(const String& replacedString, const String& replacementString);
 
@@ -151,6 +140,15 @@
 
 #undef UNLESS_ENABLED
 
+inline bool SpellingCorrectionController::shouldRemoveMarkersUponEditing()
+{
+#if USE(MARKER_REMOVAL_UPON_EDITING)
+    return true;
+#else
+    return false;
+#endif
+}
+
 } // namespace WebCore
 
 #endif // SpellingCorrectionController_h

Modified: trunk/Source/WebCore/loader/EmptyClients.h (87116 => 87117)


--- trunk/Source/WebCore/loader/EmptyClients.h	2011-05-24 01:56:11 UTC (rev 87116)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2011-05-24 01:58:41 UTC (rev 87117)
@@ -516,7 +516,7 @@
 #endif
     TextCheckerClient* textChecker() { return &m_textCheckerClient; }
 
-#if SUPPORT_AUTOCORRECTION_PANEL
+#if USE(AUTOCORRECTION_PANEL)
     virtual void showCorrectionPanel(CorrectionPanelInfo::PanelType, const FloatRect&, const String&, const String&, const Vector<String>&) { }
     virtual void dismissCorrectionPanel(ReasonForDismissingCorrectionPanel) { }
     virtual String dismissCorrectionPanelSoon(ReasonForDismissingCorrectionPanel) { return String(); }

Modified: trunk/Source/WebCore/page/EditorClient.h (87116 => 87117)


--- trunk/Source/WebCore/page/EditorClient.h	2011-05-24 01:56:11 UTC (rev 87116)
+++ trunk/Source/WebCore/page/EditorClient.h	2011-05-24 01:58:41 UTC (rev 87117)
@@ -155,7 +155,7 @@
         AutocorrectionReverted
     };
 
-#if SUPPORT_AUTOCORRECTION_PANEL
+#if USE(AUTOCORRECTION_PANEL)
     virtual void showCorrectionPanel(CorrectionPanelInfo::PanelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacmentString, const Vector<String>& alternativeReplacementStrings) = 0;
     virtual void dismissCorrectionPanel(ReasonForDismissingCorrectionPanel) = 0;
     virtual String dismissCorrectionPanelSoon(ReasonForDismissingCorrectionPanel) = 0;

Modified: trunk/Source/WebCore/platform/text/TextChecking.h (87116 => 87117)


--- trunk/Source/WebCore/platform/text/TextChecking.h	2011-05-24 01:56:11 UTC (rev 87116)
+++ trunk/Source/WebCore/platform/text/TextChecking.h	2011-05-24 01:58:41 UTC (rev 87117)
@@ -40,6 +40,14 @@
 #define WTF_USE_AUTOMATIC_TEXT_REPLACEMENT 1
 #endif
 
+#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+// Some platforms provide UI for suggesting autocorrection.
+#define WTF_USE_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 WTF_USE_MARKER_REMOVAL_UPON_EDITING 1
+#endif // #if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+
 enum TextCheckingType {
     TextCheckingTypeSpelling    = 1 << 1,
     TextCheckingTypeGrammar     = 1 << 2,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to