WebCore:
[WebKit-https.git] / WebCore / platform / ContextMenu.cpp
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);