WebCore:
authorsullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Dec 2006 22:34:54 +0000 (22:34 +0000)
committersullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Dec 2006 22:34:54 +0000 (22:34 +0000)
        Reviewed by Adam

        New context-menu mechanism fix for:
        <rdar://problem/4864351> Should leave out "No Guesses Found" from context menu for bad grammar

        * platform/ContextMenu.cpp:
        (WebCore::ContextMenu::populate):
        Leave out "No Guesses Found" and separator for grammar-checking case.

WebKit:

        Reviewed by Adam

        Old context-menu mechanism fix for:
        <rdar://problem/4864351> Should leave out "No Guesses Found" from context menu for bad grammar

        * DefaultDelegates/WebDefaultContextMenuDelegate.m:
        (-[WebDefaultUIDelegate editingContextMenuItemsForElement:defaultMenuItems:]):
        Leave out "No Guesses Found" and separator for grammar-checking case.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@18033 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/ContextMenu.cpp
WebKit/ChangeLog
WebKit/DefaultDelegates/WebDefaultContextMenuDelegate.m
WebKit/WebKit.xcodeproj/project.pbxproj

index 0a71d8a2740c5a21d20a8c473aa116176cfb9a84..b941b9a46f0440ae44118de62935620266bbd17d 100644 (file)
@@ -1,3 +1,14 @@
+2006-12-05  John Sullivan  <sullivan@apple.com>
+
+        Reviewed by Adam
+
+        New context-menu mechanism fix for:
+        <rdar://problem/4864351> Should leave out "No Guesses Found" from context menu for bad grammar
+
+        * platform/ContextMenu.cpp:
+        (WebCore::ContextMenu::populate):
+        Leave out "No Guesses Found" and separator for grammar-checking case.
+
 2006-12-05  Rob Buis  <buis@kde.org>
 
         Reviewed by Mitz.
index 220f985e84a2254b350d2e5b357bb5acdc4b5e86..9d7e2b19b07e0b924ca7ca31ef6f273729416e7f 100644 (file)
@@ -231,9 +231,14 @@ void ContextMenu::populate()
             if (misspelling || badGrammar) {
                 Vector<String> guesses = misspelling ? frame->guessesForMisspelledSelection() : frame->guessesForUngrammaticalSelection();
                 size_t size = guesses.size();
-                if (size == 0)
-                    appendItem(NoGuessesFoundItem);
-                else {
+                if (size == 0) {
+                    // If there's bad grammar but no suggestions (e.g., repeated word), just leave off the suggestions
+                    // list and trailing separator rather than adding a "No Guesses Found" item (matches AppKit)
+                    if (misspelling) {
+                        appendItem(NoGuessesFoundItem);
+                        appendItem(SeparatorItem);
+                    }
+                } else {
                     for (unsigned i = 0; i < size; i++) {
                         const String &guess = guesses[i];
                         if (!guess.isEmpty()) {
@@ -241,9 +246,9 @@ void ContextMenu::populate()
                             appendItem(item);
                         }
                     }
+                    appendItem(SeparatorItem);                    
                 }
                 
-                appendItem(SeparatorItem);
                 if (misspelling) {
                     appendItem(IgnoreSpellingItem);
                     appendItem(LearnSpellingItem);
index dce97c434f980dde10bfc0b6813d4cb1d635cb87..64afe4a9d4356b656b92cdb7b8a59158e6d1150c 100644 (file)
@@ -1,3 +1,14 @@
+2006-12-05  John Sullivan  <sullivan@apple.com>
+
+        Reviewed by Adam
+        
+        Old context-menu mechanism fix for:
+        <rdar://problem/4864351> Should leave out "No Guesses Found" from context menu for bad grammar
+
+        * DefaultDelegates/WebDefaultContextMenuDelegate.m:
+        (-[WebDefaultUIDelegate editingContextMenuItemsForElement:defaultMenuItems:]):
+        Leave out "No Guesses Found" and separator for grammar-checking case.
+
 2006-12-05  John Sullivan  <sullivan@apple.com>
 
         build fix
index 052df9f4c38f89708dfd74d6d2be6eed0de27edd..52f10889262c83e8a1c6ff68c598b4ac60a1c29f 100644 (file)
@@ -312,6 +312,9 @@ static NSString *localizedMenuTitleFromAppKit(NSString *key, NSString *comment)
             // to WebCore soon where we won't have to do this.
             Vector<WebCore::String> guesses = core(webFrame)->guessesForUngrammaticalSelection();
             size_t count = guesses.size();
+            
+            // If there's bad grammar but no suggestions (e.g., repeated word), just leave off the suggestions
+            // list and trailing separator rather than adding a "No Guesses Found" item (matches AppKit)
             if (count > 0) {
                 for (unsigned i = 0; i < count; ++i) {
                     NSString *string = guesses.at(i);
@@ -319,10 +322,8 @@ static NSString *localizedMenuTitleFromAppKit(NSString *key, NSString *comment)
                     [item setTitle:string];
                     [menuItems addObject:item];
                 }
-            } else {
-                [menuItems addObject:[self menuItemWithTag:WebMenuItemTagNoGuessesFound target:nil representedObject:element]];
+                [menuItems addObject:[NSMenuItem separatorItem]];
             }
-            [menuItems addObject:[NSMenuItem separatorItem]];
             [menuItems addObject:[self menuItemWithTag:WebMenuItemTagIgnoreGrammar target:nil representedObject:element]];
             [menuItems addObject:[NSMenuItem separatorItem]];
 #endif
index 70721131a0f35d80c9e6f9cc329eb84f4e9ea4c7..83e7dfc6cd54ddf2478d6b70f18bddab8b211444 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
                        projectRoot = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                9398100A0824BF01008DF038 /* WebKit */,
                        );