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 478c8b7fccde663f9bbb365f8b1a32b4f2aac3e0..959b3431393e8253a8955e84843d77394fe4b243 100644 |
| --- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp |
| +++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp |
| @@ -1805,8 +1805,23 @@ static bool executeYank(LocalFrame& frame, |
| Event*, |
| EditorCommandSource, |
| const String&) { |
| + const String& yankString = frame.editor().killRing().yank(); |
| + if (dispatchBeforeInputInsertText( |
| + eventTargetNodeForDocument(frame.document()), yankString, |
| + InputEvent::InputType::InsertFromYank) != |
| + DispatchEventResult::NotCanceled) |
| + return true; |
| + |
| + // 'beforeinput' event handler may destroy document. |
| + if (frame.document()->frame() != &frame) |
| + return false; |
| + |
| + // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
|
yosin_UTC9
2017/03/09 03:49:11
nit: s/xiaochengh/editing-dev/
chongz
2017/03/09 21:31:36
Done.
|
| + // needs to be audited. see http://crbug.com/590369 for more details. |
| + frame.document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| + |
| frame.editor().insertTextWithoutSendingTextEvent( |
| - frame.editor().killRing().yank(), false, 0); |
| + yankString, false, 0, InputEvent::InputType::InsertFromYank); |
| frame.editor().killRing().setToYankedState(); |
| return true; |
| } |
| @@ -1815,8 +1830,24 @@ static bool executeYankAndSelect(LocalFrame& frame, |
| Event*, |
| EditorCommandSource, |
| const String&) { |
| + const String& yankString = frame.editor().killRing().yank(); |
| + if (dispatchBeforeInputInsertText( |
| + eventTargetNodeForDocument(frame.document()), yankString, |
| + InputEvent::InputType::InsertFromYank) != |
| + DispatchEventResult::NotCanceled) |
| + return true; |
| + |
| + // 'beforeinput' event handler may destroy document. |
| + if (frame.document()->frame() != &frame) |
| + return false; |
| + |
| + // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
|
yosin_UTC9
2017/03/09 03:49:11
nit: s/xiaochengh/editing-dev/
chongz
2017/03/09 21:31:36
Done.
|
| + // needs to be audited. see http://crbug.com/590369 for more details. |
| + frame.document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| + |
| frame.editor().insertTextWithoutSendingTextEvent( |
| - frame.editor().killRing().yank(), true, 0); |
| + frame.editor().killRing().yank(), true, 0, |
| + InputEvent::InputType::InsertFromYank); |
| frame.editor().killRing().setToYankedState(); |
| return true; |
| } |