Commit f4cbf34c authored by adele@apple.com's avatar adele@apple.com

WebCore:

2009-04-27  Douglas R. Davidson  <ddavidso@apple.com>

        Implement the editing mechanisms and add context menu items for
        <rdar://problem/6724106> WebViews need to implement text checking

        Reviewed by Justin Garcia.

        * editing/Editor.cpp:
        * editing/Editor.h:
        * editing/TypingCommand.cpp:
        * loader/EmptyClients.h:
        * page/ContextMenuController.cpp:
        * page/EditorClient.h:
        * page/mac/WebCoreViewFactory.h:
        * platform/ContextMenu.cpp:
        * platform/ContextMenuItem.h:
        * platform/LocalizedStrings.h:
        * platform/mac/LocalizedStringsMac.mm:

WebKit:

2009-04-27  Douglas R. Davidson  <ddavidso@apple.com>

        Add localizable strings for 
        <rdar://problem/6724106> WebViews need to implement text checking

        Reviewed by Justin Garcia.

        * English.lproj/Localizable.strings:

WebKit/mac:

2009-04-27  Douglas R. Davidson  <ddavidso@apple.com>

        Add the various switches and context menu items needed for
        <rdar://problem/6724106> WebViews need to implement text checking
        and adopt updatePanels in place of old SPI _updateGrammar.

        Reviewed by Justin Garcia.

        * WebCoreSupport/WebContextMenuClient.mm:
        (fixMenusReceivedFromOldClients):
        * WebCoreSupport/WebEditorClient.h:
        * WebCoreSupport/WebEditorClient.mm:
        (WebEditorClient::uppercaseWord):
        (WebEditorClient::lowercaseWord):
        (WebEditorClient::capitalizeWord):
        (WebEditorClient::showSubstitutionsPanel):
        (WebEditorClient::substitutionsPanelIsShowing):
        (WebEditorClient::toggleSmartInsertDelete):
        (WebEditorClient::isAutomaticQuoteSubstitutionEnabled):
        (WebEditorClient::toggleAutomaticQuoteSubstitution):
        (WebEditorClient::isAutomaticLinkDetectionEnabled):
        (WebEditorClient::toggleAutomaticLinkDetection):
        (WebEditorClient::isAutomaticDashSubstitutionEnabled):
        (WebEditorClient::toggleAutomaticDashSubstitution):
        (WebEditorClient::isAutomaticTextReplacementEnabled):
        (WebEditorClient::toggleAutomaticTextReplacement):
        (WebEditorClient::isAutomaticSpellingCorrectionEnabled):
        (WebEditorClient::toggleAutomaticSpellingCorrection):
        (WebEditorClient::checkTextOfParagraph):
        * WebCoreSupport/WebViewFactory.mm:
        (-[WebViewFactory contextMenuItemTagShowColors]):
        (-[WebViewFactory contextMenuItemTagCorrectSpellingAutomatically]):
        (-[WebViewFactory contextMenuItemTagSubstitutionsMenu]):
        (-[WebViewFactory contextMenuItemTagShowSubstitutions:]):
        (-[WebViewFactory contextMenuItemTagSmartCopyPaste]):
        (-[WebViewFactory contextMenuItemTagSmartQuotes]):
        (-[WebViewFactory contextMenuItemTagSmartDashes]):
        (-[WebViewFactory contextMenuItemTagSmartLinks]):
        (-[WebViewFactory contextMenuItemTagTextReplacement]):
        (-[WebViewFactory contextMenuItemTagTransformationsMenu]):
        (-[WebViewFactory contextMenuItemTagMakeUpperCase]):
        (-[WebViewFactory contextMenuItemTagMakeLowerCase]):
        (-[WebViewFactory contextMenuItemTagCapitalize]):
        * WebView/WebHTMLView.mm:
        (-[WebHTMLView validateUserInterfaceItemWithoutDelegate:]):
        (-[WebHTMLView isAutomaticQuoteSubstitutionEnabled]):
        (-[WebHTMLView setAutomaticQuoteSubstitutionEnabled:]):
        (-[WebHTMLView toggleAutomaticQuoteSubstitution:]):
        (-[WebHTMLView isAutomaticLinkDetectionEnabled]):
        (-[WebHTMLView setAutomaticLinkDetectionEnabled:]):
        (-[WebHTMLView toggleAutomaticLinkDetection:]):
        (-[WebHTMLView isAutomaticDashSubstitutionEnabled]):
        (-[WebHTMLView setAutomaticDashSubstitutionEnabled:]):
        (-[WebHTMLView toggleAutomaticDashSubstitution:]):
        (-[WebHTMLView isAutomaticTextReplacementEnabled]):
        (-[WebHTMLView setAutomaticTextReplacementEnabled:]):
        (-[WebHTMLView toggleAutomaticTextReplacement:]):
        (-[WebHTMLView isAutomaticSpellingCorrectionEnabled]):
        (-[WebHTMLView setAutomaticSpellingCorrectionEnabled:]):
        (-[WebHTMLView toggleAutomaticSpellingCorrection:]):
        * WebView/WebHTMLViewInternal.h:
        * WebView/WebPreferenceKeysPrivate.h:
        * WebView/WebUIDelegatePrivate.h:
        * WebView/WebView.mm:
        (-[WebViewPrivate init]):
        (-[WebView validateUserInterfaceItemWithoutDelegate:]):
        (-[WebView setGrammarCheckingEnabled:]):
        (-[WebView isAutomaticQuoteSubstitutionEnabled]):
        (-[WebView isAutomaticLinkDetectionEnabled]):
        (-[WebView isAutomaticDashSubstitutionEnabled]):
        (-[WebView isAutomaticTextReplacementEnabled]):
        (-[WebView isAutomaticSpellingCorrectionEnabled]):
        (-[WebView setAutomaticQuoteSubstitutionEnabled:]):
        (-[WebView toggleAutomaticQuoteSubstitution:]):
        (-[WebView setAutomaticLinkDetectionEnabled:]):
        (-[WebView toggleAutomaticLinkDetection:]):
        (-[WebView setAutomaticDashSubstitutionEnabled:]):
        (-[WebView toggleAutomaticDashSubstitution:]):
        (-[WebView setAutomaticTextReplacementEnabled:]):
        (-[WebView toggleAutomaticTextReplacement:]):
        (-[WebView setAutomaticSpellingCorrectionEnabled:]):
        (-[WebView toggleAutomaticSpellingCorrection:]):
        * WebView/WebViewPrivate.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@42911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 85f803c6
2009-04-27 Douglas R. Davidson <ddavidso@apple.com>
Implement the editing mechanisms and add context menu items for
<rdar://problem/6724106> WebViews need to implement text checking
Reviewed by Justin Garcia.
* editing/Editor.cpp:
* editing/Editor.h:
* editing/TypingCommand.cpp:
* loader/EmptyClients.h:
* page/ContextMenuController.cpp:
* page/EditorClient.h:
* page/mac/WebCoreViewFactory.h:
* platform/ContextMenu.cpp:
* platform/ContextMenuItem.h:
* platform/LocalizedStrings.h:
* platform/mac/LocalizedStringsMac.mm:
2009-04-27 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey Garen.
This diff is collapsed.
......@@ -200,6 +200,25 @@ public:
void markMisspellings(const VisibleSelection&);
void markBadGrammar(const VisibleSelection&);
void markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelection, bool markGrammar, const VisibleSelection& grammarSelection);
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
void uppercaseWord();
void lowercaseWord();
void capitalizeWord();
void showSubstitutionsPanel();
bool substitutionsPanelIsShowing();
void toggleSmartInsertDelete();
bool isAutomaticQuoteSubstitutionEnabled();
void toggleAutomaticQuoteSubstitution();
bool isAutomaticLinkDetectionEnabled();
void toggleAutomaticLinkDetection();
bool isAutomaticDashSubstitutionEnabled();
void toggleAutomaticDashSubstitution();
bool isAutomaticTextReplacementEnabled();
void toggleAutomaticTextReplacement();
bool isAutomaticSpellingCorrectionEnabled();
void toggleAutomaticSpellingCorrection();
void markAllMisspellingsAndBadGrammarInRanges(Range* spellingRange, bool markGrammar, Range* grammarRange, bool performTextCheckingReplacements);
#endif
void advanceToNextMisspelling(bool startBeforeSelection = false);
void showSpellingGuessPanel();
bool spellingPanelIsShowing();
......
......@@ -299,8 +299,9 @@ void TypingCommand::markMisspellingsAfterTyping()
void TypingCommand::typingAddedToOpenCommand()
{
markMisspellingsAfterTyping();
document()->frame()->editor()->appliedEditing(this);
// Since the spellchecking code may also perform corrections and other replacements, it should happen after the typing changes.
markMisspellingsAfterTyping();
}
void TypingCommand::insertText(const String &text, bool selectInsertedText)
......
......@@ -340,13 +340,31 @@ public:
#ifdef BUILDING_ON_TIGER
virtual NSArray* pasteboardTypesForSelection(Frame*) { return 0; }
#endif
#endif
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
virtual void uppercaseWord() { }
virtual void lowercaseWord() { }
virtual void capitalizeWord() { }
virtual void showSubstitutionsPanel(bool) { }
virtual bool substitutionsPanelIsShowing() { return false; }
virtual void toggleSmartInsertDelete() { }
virtual bool isAutomaticQuoteSubstitutionEnabled() { return false; }
virtual void toggleAutomaticQuoteSubstitution() { }
virtual bool isAutomaticLinkDetectionEnabled() { return false; }
virtual void toggleAutomaticLinkDetection() { }
virtual bool isAutomaticDashSubstitutionEnabled() { return false; }
virtual void toggleAutomaticDashSubstitution() { }
virtual bool isAutomaticTextReplacementEnabled() { return false; }
virtual void toggleAutomaticTextReplacement() { }
virtual bool isAutomaticSpellingCorrectionEnabled() { return false; }
virtual void toggleAutomaticSpellingCorrection() { }
#endif
virtual void ignoreWordInSpellDocument(const String&) { }
virtual void learnWord(const String&) { }
virtual void checkSpellingOfString(const UChar*, int, int*, int*) { }
virtual void checkGrammarOfString(const UChar*, int, Vector<GrammarDetail>&, int*, int*) { }
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
virtual void checkSpellingAndGrammarOfParagraph(const UChar*, int, bool, Vector<TextCheckingResult>&) { }
virtual void checkTextOfParagraph(const UChar*, int, uint64_t, Vector<TextCheckingResult>&) { };
#endif
virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&) { }
virtual void updateSpellingUIWithMisspelledWord(const String&) { }
......
......@@ -294,6 +294,38 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
case ContextMenuItemTagShowColors:
frame->editor()->showColorPanel();
break;
#endif
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
case ContextMenuItemTagMakeUpperCase:
frame->editor()->uppercaseWord();
break;
case ContextMenuItemTagMakeLowerCase:
frame->editor()->lowercaseWord();
break;
case ContextMenuItemTagCapitalize:
frame->editor()->capitalizeWord();
break;
case ContextMenuItemTagShowSubstitutions:
frame->editor()->showSubstitutionsPanel();
break;
case ContextMenuItemTagSmartCopyPaste:
frame->editor()->toggleSmartInsertDelete();
break;
case ContextMenuItemTagSmartQuotes:
frame->editor()->toggleAutomaticQuoteSubstitution();
break;
case ContextMenuItemTagSmartDashes:
frame->editor()->toggleAutomaticDashSubstitution();
break;
case ContextMenuItemTagSmartLinks:
frame->editor()->toggleAutomaticLinkDetection();
break;
case ContextMenuItemTagTextReplacement:
frame->editor()->toggleAutomaticTextReplacement();
break;
case ContextMenuItemTagCorrectSpellingAutomatically:
frame->editor()->toggleAutomaticSpellingCorrection();
break;
#endif
case ContextMenuItemTagInspectElement:
if (Page* page = frame->page())
......
......@@ -61,11 +61,22 @@ struct GrammarDetail {
String userDescription;
};
enum TextCheckingType {
TextCheckingTypeSpelling = 1 << 1,
TextCheckingTypeGrammar = 1 << 2,
TextCheckingTypeLink = 1 << 5,
TextCheckingTypeQuote = 1 << 6,
TextCheckingTypeDash = 1 << 7,
TextCheckingTypeReplacement = 1 << 8,
TextCheckingTypeCorrection = 1 << 9
};
struct TextCheckingResult {
int resultType; // 1 for spelling, 2 for grammar
TextCheckingType type;
int location;
int length;
Vector<GrammarDetail> details;
String replacement;
};
class EditorClient {
......@@ -133,12 +144,31 @@ public:
#endif
#endif
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
virtual void uppercaseWord() = 0;
virtual void lowercaseWord() = 0;
virtual void capitalizeWord() = 0;
virtual void showSubstitutionsPanel(bool show) = 0;
virtual bool substitutionsPanelIsShowing() = 0;
virtual void toggleSmartInsertDelete() = 0;
virtual bool isAutomaticQuoteSubstitutionEnabled() = 0;
virtual void toggleAutomaticQuoteSubstitution() = 0;
virtual bool isAutomaticLinkDetectionEnabled() = 0;
virtual void toggleAutomaticLinkDetection() = 0;
virtual bool isAutomaticDashSubstitutionEnabled() = 0;
virtual void toggleAutomaticDashSubstitution() = 0;
virtual bool isAutomaticTextReplacementEnabled() = 0;
virtual void toggleAutomaticTextReplacement() = 0;
virtual bool isAutomaticSpellingCorrectionEnabled() = 0;
virtual void toggleAutomaticSpellingCorrection() = 0;
#endif
virtual void ignoreWordInSpellDocument(const String&) = 0;
virtual void learnWord(const String&) = 0;
virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) = 0;
virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
virtual void checkSpellingAndGrammarOfParagraph(const UChar* text, int length, bool checkGrammar, Vector<TextCheckingResult>& results) = 0;
virtual void checkTextOfParagraph(const UChar* text, int length, uint64_t checkingTypes, Vector<TextCheckingResult>& results) = 0;
#endif
virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail& detail) = 0;
virtual void updateSpellingUIWithMisspelledWord(const String&) = 0;
......
......@@ -83,6 +83,18 @@
- (NSString *)contextMenuItemTagDefaultDirection;
- (NSString *)contextMenuItemTagLeftToRight;
- (NSString *)contextMenuItemTagRightToLeft;
- (NSString *)contextMenuItemTagCorrectSpellingAutomatically;
- (NSString *)contextMenuItemTagSubstitutionsMenu;
- (NSString *)contextMenuItemTagShowSubstitutions:(bool)show;
- (NSString *)contextMenuItemTagSmartCopyPaste;
- (NSString *)contextMenuItemTagSmartQuotes;
- (NSString *)contextMenuItemTagSmartDashes;
- (NSString *)contextMenuItemTagSmartLinks;
- (NSString *)contextMenuItemTagTextReplacement;
- (NSString *)contextMenuItemTagTransformationsMenu;
- (NSString *)contextMenuItemTagMakeUpperCase;
- (NSString *)contextMenuItemTagMakeLowerCase;
- (NSString *)contextMenuItemTagCapitalize;
- (NSString *)contextMenuItemTagInspectElement;
- (NSString *)searchMenuNoRecentSearchesText;
......
......@@ -112,11 +112,21 @@ static void createAndAppendSpellingAndGrammarSubMenu(const HitTestResult& result
contextMenuItemTagCheckSpellingWhileTyping());
ContextMenuItem grammarWithSpelling(CheckableActionType, ContextMenuItemTagCheckGrammarWithSpelling,
contextMenuItemTagCheckGrammarWithSpelling());
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
ContextMenuItem correctSpelling(CheckableActionType, ContextMenuItemTagCorrectSpellingAutomatically,
contextMenuItemTagCorrectSpellingAutomatically());
#endif
spellingAndGrammarMenu.appendItem(showSpellingPanel);
spellingAndGrammarMenu.appendItem(checkSpelling);
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
spellingAndGrammarMenu.appendItem(*separatorItem());
#endif
spellingAndGrammarMenu.appendItem(checkAsYouType);
spellingAndGrammarMenu.appendItem(grammarWithSpelling);
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
spellingAndGrammarMenu.appendItem(correctSpelling);
#endif
spellingAndGrammarMenuItem.setSubMenu(&spellingAndGrammarMenu);
}
......@@ -189,6 +199,45 @@ static void createAndAppendTextDirectionSubMenu(const HitTestResult& result, Con
}
#endif
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
static void createAndAppendSubstitutionsSubMenu(const HitTestResult& result, ContextMenuItem& substitutionsMenuItem)
{
ContextMenu substitutionsMenu(result);
ContextMenuItem showSubstitutions(ActionType, ContextMenuItemTagShowSubstitutions, contextMenuItemTagShowSubstitutions(true));
ContextMenuItem smartCopyPaste(CheckableActionType, ContextMenuItemTagSmartCopyPaste, contextMenuItemTagSmartCopyPaste());
ContextMenuItem smartQuotes(CheckableActionType, ContextMenuItemTagSmartQuotes, contextMenuItemTagSmartQuotes());
ContextMenuItem smartDashes(CheckableActionType, ContextMenuItemTagSmartDashes, contextMenuItemTagSmartDashes());
ContextMenuItem smartLinks(CheckableActionType, ContextMenuItemTagSmartLinks, contextMenuItemTagSmartLinks());
ContextMenuItem textReplacement(CheckableActionType, ContextMenuItemTagTextReplacement, contextMenuItemTagTextReplacement());
substitutionsMenu.appendItem(showSubstitutions);
substitutionsMenu.appendItem(*separatorItem());
substitutionsMenu.appendItem(smartCopyPaste);
substitutionsMenu.appendItem(smartQuotes);
substitutionsMenu.appendItem(smartDashes);
substitutionsMenu.appendItem(smartLinks);
substitutionsMenu.appendItem(textReplacement);
substitutionsMenuItem.setSubMenu(&substitutionsMenu);
}
static void createAndAppendTransformationsSubMenu(const HitTestResult& result, ContextMenuItem& transformationsMenuItem)
{
ContextMenu transformationsMenu(result);
ContextMenuItem makeUpperCase(ActionType, ContextMenuItemTagMakeUpperCase, contextMenuItemTagMakeUpperCase());
ContextMenuItem makeLowerCase(ActionType, ContextMenuItemTagMakeLowerCase, contextMenuItemTagMakeLowerCase());
ContextMenuItem capitalize(ActionType, ContextMenuItemTagCapitalize, contextMenuItemTagCapitalize());
transformationsMenu.appendItem(makeUpperCase);
transformationsMenu.appendItem(makeLowerCase);
transformationsMenu.appendItem(capitalize);
transformationsMenuItem.setSubMenu(&transformationsMenu);
}
#endif
static bool selectionContainsPossibleWord(Frame* frame)
{
// Current algorithm: look for a character that's not just a separator.
......@@ -406,6 +455,16 @@ void ContextMenu::populate()
contextMenuItemTagSpellingMenu());
createAndAppendSpellingSubMenu(m_hitTestResult, SpellingMenuItem);
appendItem(SpellingMenuItem);
#endif
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
ContextMenuItem substitutionsMenuItem(SubmenuType, ContextMenuItemTagSubstitutionsMenu,
contextMenuItemTagSubstitutionsMenu());
createAndAppendSubstitutionsSubMenu(m_hitTestResult, substitutionsMenuItem);
appendItem(substitutionsMenuItem);
ContextMenuItem transformationsMenuItem(SubmenuType, ContextMenuItemTagTransformationsMenu,
contextMenuItemTagTransformationsMenu());
createAndAppendTransformationsSubMenu(m_hitTestResult, transformationsMenuItem);
appendItem(transformationsMenuItem);
#endif
ContextMenuItem FontMenuItem(SubmenuType, ContextMenuItemTagFontMenu,
contextMenuItemTagFontMenu());
......@@ -584,6 +643,55 @@ void ContextMenu::checkOrEnableIfNeeded(ContextMenuItem& item) const
case ContextMenuItemTagCheckSpellingWhileTyping:
shouldCheck = frame->editor()->isContinuousSpellCheckingEnabled();
break;
#if PLATFORM(MAC)
case ContextMenuItemTagSubstitutionsMenu:
case ContextMenuItemTagTransformationsMenu:
break;
case ContextMenuItemTagShowSubstitutions:
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
if (frame->editor()->substitutionsPanelIsShowing())
item.setTitle(contextMenuItemTagShowSubstitutions(false));
else
item.setTitle(contextMenuItemTagShowSubstitutions(true));
shouldEnable = frame->editor()->canEdit();
#endif
break;
case ContextMenuItemTagMakeUpperCase:
case ContextMenuItemTagMakeLowerCase:
case ContextMenuItemTagCapitalize:
shouldEnable = frame->editor()->canEdit();
break;
case ContextMenuItemTagCorrectSpellingAutomatically:
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
shouldCheck = frame->editor()->isAutomaticSpellingCorrectionEnabled();
#endif
break;
case ContextMenuItemTagSmartCopyPaste:
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
shouldCheck = frame->editor()->smartInsertDeleteEnabled();
#endif
break;
case ContextMenuItemTagSmartQuotes:
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
shouldCheck = frame->editor()->isAutomaticQuoteSubstitutionEnabled();
#endif
break;
case ContextMenuItemTagSmartDashes:
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
shouldCheck = frame->editor()->isAutomaticDashSubstitutionEnabled();
#endif
break;
case ContextMenuItemTagSmartLinks:
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
shouldCheck = frame->editor()->isAutomaticLinkDetectionEnabled();
#endif
break;
case ContextMenuItemTagTextReplacement:
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
shouldCheck = frame->editor()->isAutomaticTextReplacementEnabled();
#endif
break;
#endif
#if PLATFORM(GTK)
case ContextMenuItemTagGoBack:
shouldEnable = frame->loader()->canGoBackOrForward(-1);
......
......@@ -124,6 +124,20 @@ namespace WebCore {
ContextMenuItemTagTextDirectionDefault,
ContextMenuItemTagTextDirectionLeftToRight,
ContextMenuItemTagTextDirectionRightToLeft,
#if PLATFORM(MAC)
ContextMenuItemTagCorrectSpellingAutomatically,
ContextMenuItemTagSubstitutionsMenu,
ContextMenuItemTagShowSubstitutions,
ContextMenuItemTagSmartCopyPaste,
ContextMenuItemTagSmartQuotes,
ContextMenuItemTagSmartDashes,
ContextMenuItemTagSmartLinks,
ContextMenuItemTagTextReplacement,
ContextMenuItemTagTransformationsMenu,
ContextMenuItemTagMakeUpperCase,
ContextMenuItemTagMakeLowerCase,
ContextMenuItemTagCapitalize,
#endif
ContextMenuItemBaseApplicationTag = 10000
};
......
......@@ -88,6 +88,18 @@ namespace WebCore {
String contextMenuItemTagSpeechMenu();
String contextMenuItemTagStartSpeaking();
String contextMenuItemTagStopSpeaking();
String contextMenuItemTagCorrectSpellingAutomatically();
String contextMenuItemTagSubstitutionsMenu();
String contextMenuItemTagShowSubstitutions(bool show);
String contextMenuItemTagSmartCopyPaste();
String contextMenuItemTagSmartQuotes();
String contextMenuItemTagSmartDashes();
String contextMenuItemTagSmartLinks();
String contextMenuItemTagTextReplacement();
String contextMenuItemTagTransformationsMenu();
String contextMenuItemTagMakeUpperCase();
String contextMenuItemTagMakeLowerCase();
String contextMenuItemTagCapitalize();
#endif
String contextMenuItemTagInspectElement();
......
......@@ -433,6 +433,102 @@ String contextMenuItemTagRightToLeft()
return String();
}
String contextMenuItemTagCorrectSpellingAutomatically()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return [[WebCoreViewFactory sharedFactory] contextMenuItemTagCorrectSpellingAutomatically];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
String contextMenuItemTagSubstitutionsMenu()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return [[WebCoreViewFactory sharedFactory] contextMenuItemTagSubstitutionsMenu];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
String contextMenuItemTagShowSubstitutions(bool show)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return [[WebCoreViewFactory sharedFactory] contextMenuItemTagShowSubstitutions:show];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
String contextMenuItemTagSmartCopyPaste()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return [[WebCoreViewFactory sharedFactory] contextMenuItemTagSmartCopyPaste];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
String contextMenuItemTagSmartQuotes()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return [[WebCoreViewFactory sharedFactory] contextMenuItemTagSmartQuotes];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
String contextMenuItemTagSmartDashes()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return [[WebCoreViewFactory sharedFactory] contextMenuItemTagSmartDashes];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
String contextMenuItemTagSmartLinks()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return [[WebCoreViewFactory sharedFactory] contextMenuItemTagSmartLinks];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
String contextMenuItemTagTextReplacement()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return [[WebCoreViewFactory sharedFactory] contextMenuItemTagTextReplacement];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
String contextMenuItemTagTransformationsMenu()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return [[WebCoreViewFactory sharedFactory] contextMenuItemTagTransformationsMenu];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
String contextMenuItemTagMakeUpperCase()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return [[WebCoreViewFactory sharedFactory] contextMenuItemTagMakeUpperCase];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
String contextMenuItemTagMakeLowerCase()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return [[WebCoreViewFactory sharedFactory] contextMenuItemTagMakeLowerCase];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
String contextMenuItemTagCapitalize()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return [[WebCoreViewFactory sharedFactory] contextMenuItemTagCapitalize];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
String contextMenuItemTagInspectElement()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
......
2009-04-27 Douglas R. Davidson <ddavidso@apple.com>
Add localizable strings for
<rdar://problem/6724106> WebViews need to implement text checking
Reviewed by Justin Garcia.
* English.lproj/Localizable.strings:
2009-04-27 Kevin Decker <kdecker@apple.com>
Reviewed by Anders Carlsson.
......
B/* window title for a standalone image (uses multiplication symbol, not x) */
......
2009-04-27 Douglas R. Davidson <ddavidso@apple.com>
Add the various switches and context menu items needed for
<rdar://problem/6724106> WebViews need to implement text checking
and adopt updatePanels in place of old SPI _updateGrammar.
Reviewed by Justin Garcia.
* WebCoreSupport/WebContextMenuClient.mm:
(fixMenusReceivedFromOldClients):
* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::uppercaseWord):
(WebEditorClient::lowercaseWord):
(WebEditorClient::capitalizeWord):
(WebEditorClient::showSubstitutionsPanel):
(WebEditorClient::substitutionsPanelIsShowing):
(WebEditorClient::toggleSmartInsertDelete):
(WebEditorClient::isAutomaticQuoteSubstitutionEnabled):
(WebEditorClient::toggleAutomaticQuoteSubstitution):
(WebEditorClient::isAutomaticLinkDetectionEnabled):
(WebEditorClient::toggleAutomaticLinkDetection):
(WebEditorClient::isAutomaticDashSubstitutionEnabled):
(WebEditorClient::toggleAutomaticDashSubstitution):
(WebEditorClient::isAutomaticTextReplacementEnabled):
(WebEditorClient::toggleAutomaticTextReplacement):
(WebEditorClient::isAutomaticSpellingCorrectionEnabled):
(WebEditorClient::toggleAutomaticSpellingCorrection):
(WebEditorClient::checkTextOfParagraph):
* WebCoreSupport/WebViewFactory.mm:
(-[WebViewFactory contextMenuItemTagShowColors]):
(-[WebViewFactory contextMenuItemTagCorrectSpellingAutomatically]):
(-[WebViewFactory contextMenuItemTagSubstitutionsMenu]):
(-[WebViewFactory contextMenuItemTagShowSubstitutions:]):
(-[WebViewFactory contextMenuItemTagSmartCopyPaste]):
(-[WebViewFactory contextMenuItemTagSmartQuotes]):
(-[WebViewFactory contextMenuItemTagSmartDashes]):
(-[WebViewFactory contextMenuItemTagSmartLinks]):
(-[WebViewFactory contextMenuItemTagTextReplacement]):
(-[WebViewFactory contextMenuItemTagTransformationsMenu]):
(-[WebViewFactory contextMenuItemTagMakeUpperCase]):
(-[WebViewFactory contextMenuItemTagMakeLowerCase]):
(-[WebViewFactory contextMenuItemTagCapitalize]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView validateUserInterfaceItemWithoutDelegate:]):
(-[WebHTMLView isAutomaticQuoteSubstitutionEnabled]):
(-[WebHTMLView setAutomaticQuoteSubstitutionEnabled:]):
(-[WebHTMLView toggleAutomaticQuoteSubstitution:]):
(-[WebHTMLView isAutomaticLinkDetectionEnabled]):
(-[WebHTMLView setAutomaticLinkDetectionEnabled:]):
(-[WebHTMLView toggleAutomaticLinkDetection:]):
(-[WebHTMLView isAutomaticDashSubstitutionEnabled]):
(-[WebHTMLView setAutomaticDashSubstitutionEnabled:]):
(-[WebHTMLView toggleAutomaticDashSubstitution:]):
(-[WebHTMLView isAutomaticTextReplacementEnabled]):
(-[WebHTMLView setAutomaticTextReplacementEnabled:]):
(-[WebHTMLView toggleAutomaticTextReplacement:]):
(-[WebHTMLView isAutomaticSpellingCorrectionEnabled]):
(-[WebHTMLView setAutomaticSpellingCorrectionEnabled:]):
(-[WebHTMLView toggleAutomaticSpellingCorrection:]):
* WebView/WebHTMLViewInternal.h:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebUIDelegatePrivate.h:
* WebView/WebView.mm:
(-[WebViewPrivate init]):
(-[WebView validateUserInterfaceItemWithoutDelegate:]):
(-[WebView setGrammarCheckingEnabled:]):
(-[WebView isAutomaticQuoteSubstitutionEnabled]):
(-[WebView isAutomaticLinkDetectionEnabled]):
(-[WebView isAutomaticDashSubstitutionEnabled]):
(-[WebView isAutomaticTextReplacementEnabled]):
(-[WebView isAutomaticSpellingCorrectionEnabled]):
(-[WebView setAutomaticQuoteSubstitutionEnabled:]):
(-[WebView toggleAutomaticQuoteSubstitution:]):
(-[WebView setAutomaticLinkDetectionEnabled:]):
(-[WebView toggleAutomaticLinkDetection:]):
(-[WebView setAutomaticDashSubstitutionEnabled:]):
(-[WebView toggleAutomaticDashSubstitution:]):
(-[WebView setAutomaticTextReplacementEnabled:]):
(-[WebView toggleAutomaticTextReplacement:]):
(-[WebView setAutomaticSpellingCorrectionEnabled:]):
(-[WebView toggleAutomaticSpellingCorrection:]):
* WebView/WebViewPrivate.h:
2009-04-27 David Kilzer <ddkilzer@apple.com>
Consolidate runtime application checks for Apple Mail and Safari
......
......@@ -212,6 +212,31 @@ static void fixMenusReceivedFromOldClients(NSMutableArray *newMenuItems, NSMutab
modernTag = WebMenuItemTagLeftToRight;
else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagRightToLeft]])
modernTag = WebMenuItemTagRightToLeft;
else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagCorrectSpellingAutomatically]])
modernTag = WebMenuItemTagCorrectSpellingAutomatically;
else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSubstitutionsMenu]])
modernTag = WebMenuItemTagSubstitutionsMenu;
else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagShowSubstitutions:true]]
|| [title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagShowSubstitutions:false]])
modernTag = WebMenuItemTagShowSubstitutions;
else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSmartCopyPaste]])
modernTag = WebMenuItemTagSmartCopyPaste;
else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSmartQuotes]])
modernTag = WebMenuItemTagSmartQuotes;
else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSmartDashes]])
modernTag = WebMenuItemTagSmartDashes;
else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSmartLinks]])
modernTag = WebMenuItemTagSmartLinks;
else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagTextReplacement]])
modernTag = WebMenuItemTagTextReplacement;