Index: third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp |
diff --git a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp |
index 8e9f33a1e1d1e1348aee20a445f9137a3502cd4a..ee81dce271d7319aab59e5652f6a218db8f031a0 100644 |
--- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp |
+++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp |
@@ -105,11 +105,14 @@ bool EditCommandComposition::belongsTo(const LocalFrame& frame) const { |
return m_document->frame() == &frame; |
} |
-void EditCommandComposition::unapply() { |
+void EditCommandComposition::unapply(EditCommandSource source) { |
DCHECK(m_document); |
LocalFrame* frame = m_document->frame(); |
DCHECK(frame); |
+ if (!willUnapply(source)) |
+ return; |
+ |
// Changes to the document may have been made since the last editing operation |
// that require a layout, as in <rdar://problem/5658603>. Low level |
// operations, like RemoveNodeCommand, don't require a layout because the high |
@@ -126,11 +129,14 @@ void EditCommandComposition::unapply() { |
frame->editor().unappliedEditing(this); |
} |
-void EditCommandComposition::reapply() { |
+void EditCommandComposition::reapply(EditCommandSource source) { |
DCHECK(m_document); |
LocalFrame* frame = m_document->frame(); |
DCHECK(frame); |
+ if (!willReapply(source)) |
+ return; |
+ |
// Changes to the document may have been made since the last editing operation |
// that require a layout, as in <rdar://problem/5658603>. Low level |
// operations, like RemoveNodeCommand, don't require a layout because the high |
@@ -146,6 +152,16 @@ void EditCommandComposition::reapply() { |
frame->editor().reappliedEditing(this); |
} |
+bool EditCommandComposition::willUnapply(EditCommandSource) { |
+ // TODO(chongz): Fire 'beforeinput' for 'historyUndo'. |
+ return true; |
+} |
+ |
+bool EditCommandComposition::willReapply(EditCommandSource) { |
+ // TODO(chongz): Fire 'beforeinput' for 'historyRedo'. |
+ return true; |
+} |
+ |
InputEvent::InputType EditCommandComposition::inputType() const { |
return m_inputType; |
} |