Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Unified Diff: Source/core/editing/EditorCommand.cpp

Issue 337473010: Move implementation of WebFrameImpl::executeCommand to Editor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2014-06-30T10:05:35 Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/Editor.h ('k') | Source/web/WebLocalFrameImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/EditorCommand.cpp
diff --git a/Source/core/editing/EditorCommand.cpp b/Source/core/editing/EditorCommand.cpp
index ab081060a08264c820ff756714ded662585acd65..e1be936748344f829972b54f637ca8042e6c163b 100644
--- a/Source/core/editing/EditorCommand.cpp
+++ b/Source/core/editing/EditorCommand.cpp
@@ -1675,6 +1675,48 @@ Editor::Command Editor::command(const String& commandName, EditorCommandSource s
return Command(internalCommand(commandName), source, &m_frame);
}
+bool Editor::executeCommand(const String& commandName)
+{
+ // Specially handling commands that Editor::execCommand does not directly
+ // support.
+ if (commandName == "DeleteToEndOfParagraph") {
+ if (!deleteWithDirection(DirectionForward, ParagraphBoundary, true, false))
+ deleteWithDirection(DirectionForward, CharacterGranularity, true, false);
+ return true;
+ }
+ if (commandName == "DeleteBackward")
+ return command(AtomicString("BackwardDelete")).execute();
+ if (commandName == "DeleteForward")
+ return command(AtomicString("ForwardDelete")).execute();
+ if (commandName == "AdvanceToNextMisspelling") {
+ // Wee need to pass false here or else the currently selected word will never be skipped.
+ spellChecker().advanceToNextMisspelling(false);
+ return true;
+ }
+ if (commandName == "ToggleSpellPanel") {
+ spellChecker().showSpellingGuessPanel();
+ return true;
+ }
+ return command(commandName).execute();
+}
+
+bool Editor::executeCommand(const String& commandName, const String& value)
+{
+ // moveToBeginningOfDocument and moveToEndfDocument are only handled by WebKit for editable nodes.
+ if (!canEdit() && commandName == "moveToBeginningOfDocument")
+ return m_frame.eventHandler().bubblingScroll(ScrollUp, ScrollByDocument);
+
+ if (!canEdit() && commandName == "moveToEndOfDocument")
+ return m_frame.eventHandler().bubblingScroll(ScrollDown, ScrollByDocument);
+
+ if (commandName == "showGuessPanel") {
+ spellChecker().showSpellingGuessPanel();
+ return true;
+ }
+
+ return command(commandName).execute(value);
+}
+
Editor::Command::Command()
: m_command(0)
{
« no previous file with comments | « Source/core/editing/Editor.h ('k') | Source/web/WebLocalFrameImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698