Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Cocoa] Merge WebEditCommandProxy::nameForEditAction and undoNameForE…
…ditAction into a single function https://bugs.webkit.org/show_bug.cgi?id=193129 Reviewed by Tim Horton. Source/WebCore: Adds a new helper function that returns the undo/redo name for a given EditAction. No change in behavior. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * editing/EditAction.cpp: Copied from Source/WebKit/UIProcess/WebEditCommandProxy.cpp. (WebCore::nameForUndoRedo): * editing/EditAction.h: * editing/Editor.cpp: Source/WebKit: Remove WebEditCommandProxy::nameForEditAction and use WebCore::nameForUndoRedo instead. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::registerEditCommand): * UIProcess/WebEditCommandProxy.cpp: (WebKit::WebEditCommandProxy::WebEditCommandProxy): (WebKit::WebEditCommandProxy::~WebEditCommandProxy): (WebKit::WebEditCommandProxy::nameForEditAction): Deleted. * UIProcess/WebEditCommandProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::addEditCommand): (WebKit::WebPageProxy::removeEditCommand): (WebKit::WebPageProxy::isValidEditCommand): Deleted. Bit of drive-by refactoring: remove an unused function, and make addEditCommand and removeEditCommand take references instead of pointers, since these are assumed to be nonnull. * UIProcess/WebPageProxy.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::registerEditCommand): Source/WebKitLegacy/mac: Remove undoNameForEditAction and use WebCore::nameForUndoRedo instead. * WebCoreSupport/WebEditorClient.mm: (WebEditorClient::registerUndoOrRedoStep): (undoNameForEditAction): Deleted. Canonical link: https://commits.webkit.org/207655@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
15 changed files
with
229 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
/* | ||
* Copyright (C) 2019 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include "config.h" | ||
#include "EditAction.h" | ||
|
||
#include "LocalizedStrings.h" | ||
|
||
namespace WebCore { | ||
|
||
String nameForUndoRedo(EditAction editAction) | ||
{ | ||
switch (editAction) { | ||
case EditAction::Unspecified: | ||
case EditAction::Insert: | ||
case EditAction::InsertReplacement: | ||
case EditAction::InsertFromDrop: | ||
return { }; | ||
case EditAction::SetColor: | ||
return WEB_UI_STRING_KEY("Set Color", "Set Color (Undo action name)", "Undo action name"); | ||
case EditAction::SetBackgroundColor: | ||
return WEB_UI_STRING_KEY("Set Background Color", "Set Background Color (Undo action name)", "Undo action name"); | ||
case EditAction::TurnOffKerning: | ||
return WEB_UI_STRING_KEY("Turn Off Kerning", "Turn Off Kerning (Undo action name)", "Undo action name"); | ||
case EditAction::TightenKerning: | ||
return WEB_UI_STRING_KEY("Tighten Kerning", "Tighten Kerning (Undo action name)", "Undo action name"); | ||
case EditAction::LoosenKerning: | ||
return WEB_UI_STRING_KEY("Loosen Kerning", "Loosen Kerning (Undo action name)", "Undo action name"); | ||
case EditAction::UseStandardKerning: | ||
return WEB_UI_STRING_KEY("Use Standard Kerning", "Use Standard Kerning (Undo action name)", "Undo action name"); | ||
case EditAction::TurnOffLigatures: | ||
return WEB_UI_STRING_KEY("Turn Off Ligatures", "Turn Off Ligatures (Undo action name)", "Undo action name"); | ||
case EditAction::UseStandardLigatures: | ||
return WEB_UI_STRING_KEY("Use Standard Ligatures", "Use Standard Ligatures (Undo action name)", "Undo action name"); | ||
case EditAction::UseAllLigatures: | ||
return WEB_UI_STRING_KEY("Use All Ligatures", "Use All Ligatures (Undo action name)", "Undo action name"); | ||
case EditAction::RaiseBaseline: | ||
return WEB_UI_STRING_KEY("Raise Baseline", "Raise Baseline (Undo action name)", "Undo action name"); | ||
case EditAction::LowerBaseline: | ||
return WEB_UI_STRING_KEY("Lower Baseline", "Lower Baseline (Undo action name)", "Undo action name"); | ||
case EditAction::SetTraditionalCharacterShape: | ||
return WEB_UI_STRING_KEY("Set Traditional Character Shape", "Set Traditional Character Shape (Undo action name)", "Undo action name"); | ||
case EditAction::SetFont: | ||
return WEB_UI_STRING_KEY("Set Font", "Set Font (Undo action name)", "Undo action name"); | ||
case EditAction::ChangeAttributes: | ||
return WEB_UI_STRING_KEY("Change Attributes", "Change Attributes (Undo action name)", "Undo action name"); | ||
case EditAction::AlignLeft: | ||
return WEB_UI_STRING_KEY("Align Left", "Align Left (Undo action name)", "Undo action name"); | ||
case EditAction::AlignRight: | ||
return WEB_UI_STRING_KEY("Align Right", "Align Right (Undo action name)", "Undo action name"); | ||
case EditAction::Center: | ||
return WEB_UI_STRING_KEY("Center", "Center (Undo action name)", "Undo action name"); | ||
case EditAction::Justify: | ||
return WEB_UI_STRING_KEY("Justify", "Justify (Undo action name)", "Undo action name"); | ||
case EditAction::SetWritingDirection: | ||
return WEB_UI_STRING_KEY("Set Writing Direction", "Set Writing Direction (Undo action name)", "Undo action name"); | ||
case EditAction::Subscript: | ||
return WEB_UI_STRING_KEY("Subscript", "Subscript (Undo action name)", "Undo action name"); | ||
case EditAction::Superscript: | ||
return WEB_UI_STRING_KEY("Superscript", "Superscript (Undo action name)", "Undo action name"); | ||
case EditAction::Underline: | ||
return WEB_UI_STRING_KEY("Underline", "Underline (Undo action name)", "Undo action name"); | ||
case EditAction::Outline: | ||
return WEB_UI_STRING_KEY("Outline", "Outline (Undo action name)", "Undo action name"); | ||
case EditAction::Unscript: | ||
return WEB_UI_STRING_KEY("Unscript", "Unscript (Undo action name)", "Undo action name"); | ||
case EditAction::DeleteByDrag: | ||
return WEB_UI_STRING_KEY("Drag", "Drag (Undo action name)", "Undo action name"); | ||
case EditAction::Cut: | ||
return WEB_UI_STRING_KEY("Cut", "Cut (Undo action name)", "Undo action name"); | ||
case EditAction::Bold: | ||
return WEB_UI_STRING_KEY("Bold", "Bold (Undo action name)", "Undo action name"); | ||
case EditAction::Italics: | ||
return WEB_UI_STRING_KEY("Italics", "Italics (Undo action name)", "Undo action name"); | ||
case EditAction::Delete: | ||
return WEB_UI_STRING_KEY("Delete", "Delete (Undo action name)", "Undo action name"); | ||
case EditAction::Dictation: | ||
return WEB_UI_STRING_KEY("Dictation", "Dictation (Undo action name)", "Undo action name"); | ||
case EditAction::Paste: | ||
return WEB_UI_STRING_KEY("Paste", "Paste (Undo action name)", "Undo action name"); | ||
case EditAction::PasteFont: | ||
return WEB_UI_STRING_KEY("Paste Font", "Paste Font (Undo action name)", "Undo action name"); | ||
case EditAction::PasteRuler: | ||
return WEB_UI_STRING_KEY("Paste Ruler", "Paste Ruler (Undo action name)", "Undo action name"); | ||
case EditAction::TypingDeleteSelection: | ||
case EditAction::TypingDeleteBackward: | ||
case EditAction::TypingDeleteForward: | ||
case EditAction::TypingDeleteWordBackward: | ||
case EditAction::TypingDeleteWordForward: | ||
case EditAction::TypingDeleteLineBackward: | ||
case EditAction::TypingDeleteLineForward: | ||
case EditAction::TypingDeletePendingComposition: | ||
case EditAction::TypingDeleteFinalComposition: | ||
case EditAction::TypingInsertText: | ||
case EditAction::TypingInsertLineBreak: | ||
case EditAction::TypingInsertParagraph: | ||
case EditAction::TypingInsertPendingComposition: | ||
case EditAction::TypingInsertFinalComposition: | ||
return WEB_UI_STRING_KEY("Typing", "Typing (Undo action name)", "Undo action name"); | ||
case EditAction::CreateLink: | ||
return WEB_UI_STRING_KEY("Create Link", "Create Link (Undo action name)", "Undo action name"); | ||
case EditAction::Unlink: | ||
return WEB_UI_STRING_KEY("Unlink", "Unlink (Undo action name)", "Undo action name"); | ||
case EditAction::InsertUnorderedList: | ||
case EditAction::InsertOrderedList: | ||
return WEB_UI_STRING_KEY("Insert List", "Insert List (Undo action name)", "Undo action name"); | ||
case EditAction::FormatBlock: | ||
return WEB_UI_STRING_KEY("Formatting", "Format Block (Undo action name)", "Undo action name"); | ||
case EditAction::Indent: | ||
return WEB_UI_STRING_KEY("Indent", "Indent (Undo action name)", "Undo action name"); | ||
case EditAction::Outdent: | ||
return WEB_UI_STRING_KEY("Outdent", "Outdent (Undo action name)", "Undo action name"); | ||
// FIXME: We should give internal clients a way to override these undo names. For instance, Mail refers to ordered and unordered lists as "numbered" and "bulleted" lists, respectively, | ||
// despite the fact that ordered and unordered lists are not necessarily displayed using bullets and numerals. | ||
case EditAction::ConvertToOrderedList: | ||
return WEB_UI_STRING_KEY("Convert to Ordered List", "Convert to Ordered List (Undo action name)", "Undo action name"); | ||
case EditAction::ConvertToUnorderedList: | ||
return WEB_UI_STRING_KEY("Convert to Unordered List", "Convert to Unordered List (Undo action name)", "Undo action name"); | ||
case EditAction::InsertEditableImage: | ||
return WEB_UI_STRING_KEY("Insert Drawing", "Insert Drawing (Undo action name)", "Undo action name"); | ||
} | ||
return { }; | ||
} | ||
|
||
} // namespace WebCore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.