Chromium Code Reviews| 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 240080bb55bfea13f1708e02bf9ba3cb23b7e199..aa82d5768d41eab1ee5ace76dcc5ba7d655e22b4 100644 |
| --- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp |
| +++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp |
| @@ -48,6 +48,7 @@ |
| #include "core/editing/serializers/Serialization.h" |
| #include "core/editing/spellcheck/SpellChecker.h" |
| #include "core/events/Event.h" |
| +#include "core/events/InputEvent.h" |
| #include "core/frame/FrameHost.h" |
| #include "core/frame/FrameView.h" |
| #include "core/frame/LocalFrame.h" |
| @@ -1779,6 +1780,16 @@ bool Editor::Command::execute(const String& parameter, Event* triggeringEvent) c |
| if (!isSupported() || !m_frame || !m_command->allowExecutionWhenDisabled) |
| return false; |
| } |
| + |
| + if (RuntimeEnabledFeatures::inputEventEnabled()) { |
| + if (EventTarget* target = eventTargetNodeForDocument(m_frame->document())) { |
| + RefPtrWillBeRawPtr<InputEvent> beforeInputEvent = InputEvent::createBeforeInput("executeCommand", ""); |
|
chongz
2016/03/01 20:41:10
Didn't find a way to get command name from Editor:
dtapuska
2016/03/01 21:49:51
Ya I think you'd want to load it from the EditorIn
|
| + DispatchEventResult dispatchResult = target->dispatchEvent(beforeInputEvent); |
| + if (dispatchResult != DispatchEventResult::NotCanceled) |
| + return true; |
| + } |
| + } |
| + |
| frame().document()->updateLayoutIgnorePendingStylesheets(); |
| DEFINE_STATIC_LOCAL(SparseHistogram, commandHistogram, ("WebCore.Editing.Commands")); |
| commandHistogram.sample(m_command->idForUserMetrics); |