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

Unified Diff: third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp

Issue 2141133003: [InputEvent] Fire 'beforeinput'/'input' for 6 text styling actions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
Index: third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
index 5c5f415d3187d909368a021d2ec52ab3580b5816..ef35efb93145c8c368544a6b792249d709673e16 100644
--- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
@@ -127,6 +127,21 @@ InputEvent::InputType InputTypeFromCommandType(WebEditingCommandType commandType
case WebEditingCommandType::InsertBacktab:
case WebEditingCommandType::InsertText:
return InputEvent::InputType::InsertText;
+ case WebEditingCommandType::Bold:
+ case WebEditingCommandType::ToggleBold:
+ return InputEvent::InputType::Bold;
+ case WebEditingCommandType::Italic:
+ case WebEditingCommandType::ToggleItalic:
+ return InputEvent::InputType::Italic;
+ case WebEditingCommandType::Underline:
+ case WebEditingCommandType::ToggleUnderline:
+ return InputEvent::InputType::Underline;
+ case WebEditingCommandType::Strikethrough:
+ return InputEvent::InputType::StrikeThrough;
+ case WebEditingCommandType::Superscript:
+ return InputEvent::InputType::Superscript;
+ case WebEditingCommandType::Subscript:
+ return InputEvent::InputType::Subscript;
default:
return InputEvent::InputType::None;
}
@@ -188,7 +203,7 @@ static bool applyCommandToFrame(LocalFrame& frame, EditorCommandSource source, E
frame.editor().applyStyleToSelection(style, action);
return true;
case CommandFromDOM:
- frame.editor().applyStyle(style);
+ frame.editor().applyStyle(style, action);
chongz 2016/07/13 07:24:39 Not sure why we don't pass |action| before?
return true;
}
NOTREACHED();
@@ -1179,7 +1194,7 @@ static bool executeSetMark(LocalFrame& frame, Event*, EditorCommandSource, const
static bool executeStrikethrough(LocalFrame& frame, Event*, EditorCommandSource source, const String&)
{
CSSPrimitiveValue* lineThrough = CSSPrimitiveValue::createIdentifier(CSSValueLineThrough);
- return executeToggleStyleInList(frame, source, EditActionUnderline, CSSPropertyWebkitTextDecorationsInEffect, lineThrough);
+ return executeToggleStyleInList(frame, source, EditActionStrikeThrough, CSSPropertyWebkitTextDecorationsInEffect, lineThrough);
chongz 2016/07/13 07:24:39 I'm not sure is this a bug or intentionally?
yosin_UTC9 2016/07/13 08:10:42 Should be a bug. But, nobody uses |EditActionUnder
}
static bool executeStyleWithCSS(LocalFrame& frame, Event*, EditorCommandSource, const String& value)
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/EditAction.h ('k') | third_party/WebKit/Source/core/events/InputEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698