void Editor::appliedEditing(PassRefPtr<CompositeEditCommand> cmd) { EventQueueScope scope; m_frame.document()->updateLayout(); EditCommandComposition* composition = cmd->composition(); ASSERT(composition); dispatchEditableContentChangedEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement()); VisibleSelection newSelection(cmd->endingSelection()); // Don't clear the typing style with this selection change. We do those things elsewhere if necessary. changeSelectionAfterCommand(newSelection, 0); if (!cmd->preservesTypingStyle()) m_frame.selection().clearTypingStyle(); // Command will be equal to last edit command only in the case of typing if (m_lastEditCommand.get() == cmd) { ASSERT(cmd->isTypingCommand()); } else { // Only register a new undo command if the command passed in is // different from the last command m_lastEditCommand = cmd; if (UndoStack* undoStack = this->undoStack()) undoStack->registerUndoStep(m_lastEditCommand->ensureComposition()); } respondToChangedContents(newSelection); }
void Editor::reappliedEditing(PassRefPtr<EditCommandComposition> cmd) { EventQueueScope scope; m_frame.document()->updateLayout(); dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement()); VisibleSelection newSelection(cmd->endingSelection()); changeSelectionAfterCommand(newSelection, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle); m_lastEditCommand = nullptr; if (UndoStack* undoStack = this->undoStack()) undoStack->registerUndoStep(cmd); respondToChangedContents(newSelection); }