| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Christian Dywan <christian@imendio.com> | 3 * Copyright (C) 2008 Christian Dywan <christian@imendio.com> |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 appendItem(OpenFrameItem); | 321 appendItem(OpenFrameItem); |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 } else { // Make an editing context menu | 324 } else { // Make an editing context menu |
| 325 SelectionController* selection = frame->selection(); | 325 SelectionController* selection = frame->selection(); |
| 326 bool inPasswordField = selection->isInPasswordField(); | 326 bool inPasswordField = selection->isInPasswordField(); |
| 327 | 327 |
| 328 if (!inPasswordField) { | 328 if (!inPasswordField) { |
| 329 // Consider adding spelling-related or grammar-related context menu
items (never both, since a single selected range | 329 // Consider adding spelling-related or grammar-related context menu
items (never both, since a single selected range |
| 330 // is never considered a misspelling and bad grammar at the same tim
e) | 330 // is never considered a misspelling and bad grammar at the same tim
e) |
| 331 bool misspelling = frame->editor()->isSelectionMisspelled(); | 331 bool misspelling; |
| 332 bool badGrammar = !misspelling && (frame->editor()->isGrammarCheckin
gEnabled() && frame->editor()->isSelectionUngrammatical()); | 332 bool badGrammar; |
| 333 | 333 Vector<String> guesses = frame->editor()->guessesForMisspelledOrUngr
ammaticalSelection(misspelling, badGrammar); |
| 334 if (misspelling || badGrammar) { | 334 if (misspelling || badGrammar) { |
| 335 Vector<String> guesses = misspelling ? frame->editor()->guessesF
orMisspelledSelection() | |
| 336 : frame->editor()->guessesForUngrammaticalSelection(); | |
| 337 size_t size = guesses.size(); | 335 size_t size = guesses.size(); |
| 338 if (size == 0) { | 336 if (size == 0) { |
| 339 // If there's bad grammar but no suggestions (e.g., repeated
word), just leave off the suggestions | 337 // If there's bad grammar but no suggestions (e.g., repeated
word), just leave off the suggestions |
| 340 // list and trailing separator rather than adding a "No Gues
ses Found" item (matches AppKit) | 338 // list and trailing separator rather than adding a "No Gues
ses Found" item (matches AppKit) |
| 341 if (misspelling) { | 339 if (misspelling) { |
| 342 appendItem(NoGuessesItem); | 340 appendItem(NoGuessesItem); |
| 343 appendItem(*separatorItem()); | 341 appendItem(*separatorItem()); |
| 344 } | 342 } |
| 345 } else { | 343 } else { |
| 346 for (unsigned i = 0; i < size; i++) { | 344 for (unsigned i = 0; i < size; i++) { |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 case ContextMenuItemBaseApplicationTag: | 646 case ContextMenuItemBaseApplicationTag: |
| 649 break; | 647 break; |
| 650 } | 648 } |
| 651 | 649 |
| 652 item.setChecked(shouldCheck); | 650 item.setChecked(shouldCheck); |
| 653 item.setEnabled(shouldEnable); | 651 item.setEnabled(shouldEnable); |
| 654 } | 652 } |
| 655 | 653 |
| 656 } | 654 } |
| 657 | 655 |
| OLD | NEW |