Push more member functions from EditCommand to CompositeEditCommand
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Dec 2011 23:16:06 +0000 (23:16 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Dec 2011 23:16:06 +0000 (23:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=74249

Reviewed by Enrica Casucci.

Moved startingRootEditableElement and endingRootEditableElement from EditCommand to EditCommandComposition,
and isTypingCommand, preservesTypingStyle, shouldRetainAutocorrectionIndicator,
setShouldRetainAutocorrectionIndicator, and shouldStopCaretBlinking from EditCommand to CompositeEditCommand.
Also removed EditCommand::updateLayout().

* editing/ApplyBlockElementCommand.cpp:
(WebCore::ApplyBlockElementCommand::doApply):
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyBlockStyle):
(WebCore::ApplyStyleCommand::applyInlineStyle):
* editing/CompositeEditCommand.cpp:
(WebCore::EditCommandComposition::EditCommandComposition):
(WebCore::EditCommandComposition::setStartingSelection):
(WebCore::EditCommandComposition::setEndingSelection):
(WebCore::CompositeEditCommand::preservesTypingStyle):
(WebCore::CompositeEditCommand::isTypingCommand):
(WebCore::CompositeEditCommand::shouldRetainAutocorrectionIndicator):
(WebCore::CompositeEditCommand::setShouldRetainAutocorrectionIndicator):
(WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded):
(WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
(WebCore::CompositeEditCommand::moveParagraphs):
* editing/CompositeEditCommand.h:
(WebCore::EditCommandComposition::startingRootEditableElement):
(WebCore::EditCommandComposition::endingRootEditableElement):
(WebCore::CompositeEditCommand::shouldStopCaretBlinking):
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::removeNode):
(WebCore::DeleteSelectionCommand::fixupWhitespace):
* editing/EditCommand.cpp:
(WebCore::EditCommand::apply):
(WebCore::EditCommand::unapply):
(WebCore::EditCommand::reapply):
(WebCore::EditCommand::setStartingSelection):
(WebCore::EditCommand::setEndingSelection):
(WebCore::EditCommand::setParent):
* editing/EditCommand.h:
(WebCore::EditCommand::isEditCommandComposition):
* editing/Editor.cpp:
(WebCore::dispatchEditableContentChangedEvents):
(WebCore::Editor::appliedEditing):
(WebCore::Editor::unappliedEditing):
(WebCore::Editor::reappliedEditing):
* editing/Editor.h:
(WebCore::Editor::lastEditCommand):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::updateAppearance):
* editing/IndentOutdentCommand.cpp:
(WebCore::IndentOutdentCommand::outdentParagraph):
* editing/InsertLineBreakCommand.cpp:
(WebCore::InsertLineBreakCommand::doApply):
* editing/InsertParagraphSeparatorCommand.cpp:
(WebCore::InsertParagraphSeparatorCommand::doApply):
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::lastTypingCommandIfStillOpenForTyping):
* editing/TypingCommand.h:
(WebCore::TypingCommand::shouldRetainAutocorrectionIndicator):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@102833 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/editing/ApplyBlockElementCommand.cpp
Source/WebCore/editing/ApplyStyleCommand.cpp
Source/WebCore/editing/CompositeEditCommand.cpp
Source/WebCore/editing/CompositeEditCommand.h
Source/WebCore/editing/DeleteSelectionCommand.cpp
Source/WebCore/editing/EditCommand.cpp
Source/WebCore/editing/EditCommand.h
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/editing/IndentOutdentCommand.cpp
Source/WebCore/editing/InsertLineBreakCommand.cpp
Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp
Source/WebCore/editing/SpellingCorrectionController.cpp
Source/WebCore/editing/SpellingCorrectionController.h
Source/WebCore/editing/TypingCommand.cpp
Source/WebCore/editing/TypingCommand.h

index 0c8124e..6dfb412 100644 (file)
@@ -1,3 +1,67 @@
+2011-12-14  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Push more member functions from EditCommand to CompositeEditCommand
+        https://bugs.webkit.org/show_bug.cgi?id=74249
+
+        Reviewed by Enrica Casucci.
+
+        Moved startingRootEditableElement and endingRootEditableElement from EditCommand to EditCommandComposition,
+        and isTypingCommand, preservesTypingStyle, shouldRetainAutocorrectionIndicator,
+        setShouldRetainAutocorrectionIndicator, and shouldStopCaretBlinking from EditCommand to CompositeEditCommand.
+        Also removed EditCommand::updateLayout().
+
+        * editing/ApplyBlockElementCommand.cpp:
+        (WebCore::ApplyBlockElementCommand::doApply):
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::applyBlockStyle):
+        (WebCore::ApplyStyleCommand::applyInlineStyle):
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::EditCommandComposition::EditCommandComposition):
+        (WebCore::EditCommandComposition::setStartingSelection):
+        (WebCore::EditCommandComposition::setEndingSelection):
+        (WebCore::CompositeEditCommand::preservesTypingStyle):
+        (WebCore::CompositeEditCommand::isTypingCommand):
+        (WebCore::CompositeEditCommand::shouldRetainAutocorrectionIndicator):
+        (WebCore::CompositeEditCommand::setShouldRetainAutocorrectionIndicator):
+        (WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded):
+        (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
+        (WebCore::CompositeEditCommand::moveParagraphs):
+        * editing/CompositeEditCommand.h:
+        (WebCore::EditCommandComposition::startingRootEditableElement):
+        (WebCore::EditCommandComposition::endingRootEditableElement):
+        (WebCore::CompositeEditCommand::shouldStopCaretBlinking):
+        * editing/DeleteSelectionCommand.cpp:
+        (WebCore::DeleteSelectionCommand::removeNode):
+        (WebCore::DeleteSelectionCommand::fixupWhitespace):
+        * editing/EditCommand.cpp:
+        (WebCore::EditCommand::apply):
+        (WebCore::EditCommand::unapply):
+        (WebCore::EditCommand::reapply):
+        (WebCore::EditCommand::setStartingSelection):
+        (WebCore::EditCommand::setEndingSelection):
+        (WebCore::EditCommand::setParent):
+        * editing/EditCommand.h:
+        (WebCore::EditCommand::isEditCommandComposition):
+        * editing/Editor.cpp:
+        (WebCore::dispatchEditableContentChangedEvents):
+        (WebCore::Editor::appliedEditing):
+        (WebCore::Editor::unappliedEditing):
+        (WebCore::Editor::reappliedEditing):
+        * editing/Editor.h:
+        (WebCore::Editor::lastEditCommand):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::updateAppearance):
+        * editing/IndentOutdentCommand.cpp:
+        (WebCore::IndentOutdentCommand::outdentParagraph):
+        * editing/InsertLineBreakCommand.cpp:
+        (WebCore::InsertLineBreakCommand::doApply):
+        * editing/InsertParagraphSeparatorCommand.cpp:
+        (WebCore::InsertParagraphSeparatorCommand::doApply):
+        * editing/TypingCommand.cpp:
+        (WebCore::TypingCommand::lastTypingCommandIfStillOpenForTyping):
+        * editing/TypingCommand.h:
+        (WebCore::TypingCommand::shouldRetainAutocorrectionIndicator):
+
 2011-12-14  Tony Chang  <tony@chromium.org>
 
         Fix compile on gcc on Mac.
index d919c29..45fcf27 100644 (file)
@@ -87,8 +87,8 @@ void ApplyBlockElementCommand::doApply()
 
     formatSelection(startOfSelection, endOfSelection);
 
-    updateLayout();
-    
+    document()->updateLayoutIgnorePendingStylesheets();
+
     ASSERT(startScope == endScope);
     ASSERT(startIndex >= 0);
     ASSERT(startIndex <= endIndex);
index 5f55b10..bfffa3a 100644 (file)
@@ -243,7 +243,7 @@ void ApplyStyleCommand::applyBlockStyle(EditingStyle *style)
     // update document layout once before removing styles
     // so that we avoid the expense of updating before each and every call
     // to check a computed style
-    updateLayout();
+    document()->updateLayoutIgnorePendingStylesheets();
 
     // get positions we want to use for applying style
     Position start = startPosition();
@@ -540,7 +540,7 @@ void ApplyStyleCommand::applyInlineStyle(EditingStyle* style)
     // update document layout once before removing styles
     // so that we avoid the expense of updating before each and every call
     // to check a computed style
-    updateLayout();
+    document()->updateLayoutIgnorePendingStylesheets();
 
     // adjust to the positions we want to use for applying style
     Position start = startPosition();
@@ -630,7 +630,7 @@ void ApplyStyleCommand::applyInlineStyle(EditingStyle* style)
     // update document layout once before running the rest of the function
     // so that we avoid the expense of updating before each and every call
     // to check a computed style
-    updateLayout();
+    document()->updateLayoutIgnorePendingStylesheets();
 
     RefPtr<EditingStyle> styleToApply = style;
     if (hasTextDirection) {
index 1269c75..1599364 100644 (file)
@@ -78,6 +78,8 @@ PassRefPtr<EditCommandComposition> EditCommandComposition::create(Document* docu
 
 EditCommandComposition::EditCommandComposition(Document* document, const VisibleSelection& startingSelection, const VisibleSelection& endingSelection, bool wasCreateLinkCommand)
     : EditCommand(document, startingSelection, endingSelection)
+    , m_startingRootEditableElement(startingSelection.rootEditableElement())
+    , m_endingRootEditableElement(endingSelection.rootEditableElement())
     , m_wasCreateLinkCommand(wasCreateLinkCommand)
 {
 }
@@ -106,6 +108,18 @@ void EditCommandComposition::append(SimpleEditCommand* command)
     m_commands.append(command);
 }
 
+void EditCommandComposition::setStartingSelection(const VisibleSelection& selection)
+{
+    EditCommand::setStartingSelection(selection);
+    m_startingRootEditableElement = selection.rootEditableElement();
+}
+
+void EditCommandComposition::setEndingSelection(const VisibleSelection& selection)
+{
+    EditCommand::setEndingSelection(selection);
+    m_endingRootEditableElement = selection.rootEditableElement();
+}
+
 #ifndef NDEBUG
 void EditCommandComposition::getNodesInCommand(HashSet<Node*>& nodes)
 {
@@ -150,6 +164,25 @@ bool CompositeEditCommand::isCreateLinkCommand() const
     return false;
 }
 
+bool CompositeEditCommand::preservesTypingStyle() const
+{
+    return false;
+}
+
+bool CompositeEditCommand::isTypingCommand() const
+{
+    return false;
+}
+
+bool CompositeEditCommand::shouldRetainAutocorrectionIndicator() const
+{
+    return false;
+}
+
+void CompositeEditCommand::setShouldRetainAutocorrectionIndicator(bool)
+{
+}
+
 //
 // sugary-sweet convenience functions to help create and apply edit commands in composite commands
 //
@@ -728,7 +761,7 @@ PassRefPtr<Node> CompositeEditCommand::addBlockPlaceholderIfNeeded(Element* cont
     if (!container)
         return 0;
 
-    updateLayout();
+    document()->updateLayoutIgnorePendingStylesheets();
 
     RenderObject* renderer = container->renderer();
     if (!renderer || !renderer->isBlockFlow())
@@ -773,7 +806,7 @@ PassRefPtr<Node> CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessar
     if (pos.isNull())
         return 0;
     
-    updateLayout();
+    document()->updateLayoutIgnorePendingStylesheets();
     
     // It's strange that this function is responsible for verifying that pos has not been invalidated
     // by an earlier call to this function.  The caller, applyBlockStyle, should do this.
@@ -1083,7 +1116,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
         // FIXME: Trim text between beforeParagraph and afterParagraph if they aren't equal.
         insertNodeAt(createBreakElement(document()), beforeParagraph.deepEquivalent());
         // Need an updateLayout here in case inserting the br has split a text node.
-        updateLayout();
+        document()->updateLayoutIgnorePendingStylesheets();
     }
 
     RefPtr<Range> startToDestinationRange(Range::create(document(), firstPositionInNode(document()->documentElement()), destination.deepEquivalent().parentAnchoredEquivalent()));
index 56735e2..6ec3127 100644 (file)
@@ -47,6 +47,9 @@ public:
     void append(SimpleEditCommand*);
     bool wasCreateLinkCommand() const { return m_wasCreateLinkCommand; }
 
+    Element* startingRootEditableElement() const { return m_startingRootEditableElement.get(); }
+    Element* endingRootEditableElement() const { return m_endingRootEditableElement.get(); }
+
 #ifndef NDEBUG
     virtual void getNodesInCommand(HashSet<Node*>&);
 #endif
@@ -54,8 +57,12 @@ public:
 private:
     EditCommandComposition(Document*, const VisibleSelection& startingSelection, const VisibleSelection& endingSelection, bool wasCreateLinkCommand);
     virtual bool isEditCommandComposition() const OVERRIDE { return true; }
+    virtual void setStartingSelection(const VisibleSelection&) OVERRIDE;
+    virtual void setEndingSelection(const VisibleSelection&) OVERRIDE;
 
     Vector<RefPtr<SimpleEditCommand> > m_commands;
+    RefPtr<Element> m_startingRootEditableElement;
+    RefPtr<Element> m_endingRootEditableElement;
     bool m_wasCreateLinkCommand;
 };
 
@@ -68,6 +75,11 @@ public:
     EditCommandComposition* ensureComposition();
 
     virtual bool isCreateLinkCommand() const;
+    virtual bool isTypingCommand() const;
+    virtual bool preservesTypingStyle() const;
+    virtual bool shouldRetainAutocorrectionIndicator() const;
+    virtual void setShouldRetainAutocorrectionIndicator(bool);
+    virtual bool shouldStopCaretBlinking() const { return false; }
 
 protected:
     explicit CompositeEditCommand(Document*);
index 51854e4..3381de2 100644 (file)
@@ -361,7 +361,7 @@ void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node)
         }
         
         // Make sure empty cell has some height, if a placeholder can be inserted.
-        updateLayout();
+        document()->updateLayoutIgnorePendingStylesheets();
         RenderObject *r = node->renderer();
         if (r && r->isTableCell() && toRenderTableCell(r)->contentHeight() <= 0) {
             Position firstEditablePosition = firstEditablePositionInNode(node.get());
@@ -528,7 +528,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
 
 void DeleteSelectionCommand::fixupWhitespace()
 {
-    updateLayout();
+    document()->updateLayoutIgnorePendingStylesheets();
     // FIXME: isRenderedCharacter should be removed, and we should use VisiblePosition::characterAfter and VisiblePosition::characterBefore
     if (m_leadingWhitespace.isNotNull() && !m_leadingWhitespace.isRenderedCharacter() && m_leadingWhitespace.deprecatedNode()->isTextNode()) {
         Text* textNode = static_cast<Text*>(m_leadingWhitespace.deprecatedNode());
index 15895cd..a5248de 100644 (file)
@@ -95,7 +95,7 @@ void EditCommand::apply()
     // RemoveNodeCommand, don't require a layout because the high level operations that 
     // use them perform one if one is necessary (like for the creation of VisiblePositions).
     if (isTopLevelCommand())
-        updateLayout();
+        document()->updateLayoutIgnorePendingStylesheets();
 
     {
         EventQueueScope scope;
@@ -107,13 +107,13 @@ void EditCommand::apply()
 
     if (isTopLevelCommand()) {
         ASSERT(isCompositeEditCommand());
+        CompositeEditCommand* command = toCompositeEditCommand(this);
         // Only need to call appliedEditing for top-level commands, and TypingCommands do it on their
         // own (see TypingCommand::typingAddedToOpenCommand).
-        if (!isTypingCommand())
-            frame->editor()->appliedEditing(toCompositeEditCommand(this));
+        if (!command->isTypingCommand())
+            frame->editor()->appliedEditing(command);
+        command->setShouldRetainAutocorrectionIndicator(false);
     }
-
-    setShouldRetainAutocorrectionIndicator(false);
 }
 
 void EditCommand::unapply()
@@ -128,7 +128,7 @@ void EditCommand::unapply()
     // RemoveNodeCommand, don't require a layout because the high level operations that 
     // use them perform one if one is necessary (like for the creation of VisiblePositions).
     if (isTopLevelCommand())
-        updateLayout();
+        document()->updateLayoutIgnorePendingStylesheets();
     
     DeleteButtonController* deleteButtonController = frame->editor()->deleteButtonController();
     deleteButtonController->disable();
@@ -151,7 +151,7 @@ void EditCommand::reapply()
     // RemoveNodeCommand, don't require a layout because the high level operations that 
     // use them perform one if one is necessary (like for the creation of VisiblePositions).
     if (isTopLevelCommand())
-        updateLayout();
+        document()->updateLayoutIgnorePendingStylesheets();
 
     DeleteButtonController* deleteButtonController = frame->editor()->deleteButtonController();
     deleteButtonController->disable();
@@ -181,15 +181,12 @@ static inline EditCommandComposition* compositionIfPossible(EditCommand* command
 
 void EditCommand::setStartingSelection(const VisibleSelection& s)
 {
-    Element* root = s.rootEditableElement();
     for (EditCommand* cmd = this; ; cmd = cmd->m_parent) {
         if (EditCommandComposition* composition = compositionIfPossible(cmd)) {
             ASSERT(cmd->isTopLevelCommand());
-            composition->m_startingSelection = s;
-            composition->m_startingRootEditableElement = root;
+            static_cast<EditCommand*>(composition)->setStartingSelection(s);
         }
         cmd->m_startingSelection = s;
-        cmd->m_startingRootEditableElement = root;
         if (!cmd->m_parent || cmd->m_parent->isFirstCommand(cmd))
             break;
     }
@@ -197,42 +194,15 @@ void EditCommand::setStartingSelection(const VisibleSelection& s)
 
 void EditCommand::setEndingSelection(const VisibleSelection &s)
 {
-    Element* root = s.rootEditableElement();
     for (EditCommand* cmd = this; cmd; cmd = cmd->m_parent) {
         if (EditCommandComposition* composition = compositionIfPossible(cmd)) {
             ASSERT(cmd->isTopLevelCommand());
-            composition->m_endingSelection = s;
-            composition->m_endingRootEditableElement = root;
+            static_cast<EditCommand*>(composition)->setEndingSelection(s);
         }
         cmd->m_endingSelection = s;
-        cmd->m_endingRootEditableElement = root;
     }
 }
 
-bool EditCommand::preservesTypingStyle() const
-{
-    return false;
-}
-
-bool EditCommand::isTypingCommand() const
-{
-    return false;
-}
-
-bool EditCommand::shouldRetainAutocorrectionIndicator() const
-{
-    return false;
-}
-
-void EditCommand::setShouldRetainAutocorrectionIndicator(bool)
-{
-}
-
-void EditCommand::updateLayout() const
-{
-    document()->updateLayoutIgnorePendingStylesheets();
-}
-
 void EditCommand::setParent(CompositeEditCommand* parent)
 {
     ASSERT((parent && !m_parent) || (!parent && m_parent));
@@ -241,8 +211,6 @@ void EditCommand::setParent(CompositeEditCommand* parent)
     if (parent) {
         m_startingSelection = parent->m_endingSelection;
         m_endingSelection = parent->m_endingSelection;
-        m_startingRootEditableElement = parent->m_endingRootEditableElement;
-        m_endingRootEditableElement = parent->m_endingRootEditableElement;
     }
 }
 
index 8e3eda7..ab8525b 100644 (file)
@@ -54,22 +54,11 @@ public:
     const VisibleSelection& startingSelection() const { return m_startingSelection; }
     const VisibleSelection& endingSelection() const { return m_endingSelection; }
 
-    Element* startingRootEditableElement() const { return m_startingRootEditableElement.get(); }
-    Element* endingRootEditableElement() const { return m_endingRootEditableElement.get(); }
-    
     virtual bool isSimpleEditCommand() const { return false; }
     virtual bool isCompositeEditCommand() const { return false; }
     virtual bool isEditCommandComposition() const { return false; }
-    virtual bool isTypingCommand() const;
-
-    virtual bool preservesTypingStyle() const;
-
     bool isTopLevelCommand() const { return !m_parent; }
 
-    virtual bool shouldRetainAutocorrectionIndicator() const;
-    virtual void setShouldRetainAutocorrectionIndicator(bool);
-    virtual bool shouldStopCaretBlinking() const { return false; }
-
 protected:
     EditCommand(Document*);
     EditCommand(Document*, const VisibleSelection&, const VisibleSelection&);
@@ -77,10 +66,8 @@ protected:
     Document* document() const { return m_document.get(); }
     CompositeEditCommand* parent() const { return m_parent; }
 
-    void setStartingSelection(const VisibleSelection&);
-    void setEndingSelection(const VisibleSelection&);
-
-    void updateLayout() const;
+    virtual void setStartingSelection(const VisibleSelection&);
+    virtual void setEndingSelection(const VisibleSelection&);
 
 private:
     virtual void doApply() = 0;
@@ -90,8 +77,6 @@ private:
     RefPtr<Document> m_document;
     VisibleSelection m_startingSelection;
     VisibleSelection m_endingSelection;
-    RefPtr<Element> m_startingRootEditableElement;
-    RefPtr<Element> m_endingRootEditableElement;
     CompositeEditCommand* m_parent;
 
     friend void applyCommand(PassRefPtr<CompositeEditCommand>);
index fb87882..261f562 100644 (file)
@@ -854,10 +854,8 @@ void Editor::outdent()
     applyCommand(IndentOutdentCommand::create(m_frame->document(), IndentOutdentCommand::Outdent));
 }
 
-static void dispatchEditableContentChangedEvents(const EditCommand& command)
+static void dispatchEditableContentChangedEvents(Element* startRoot, Element* endRoot)
 {
-    Element* startRoot = command.startingRootEditableElement();
-    Element* endRoot = command.endingRootEditableElement();
     ExceptionCode ec;
     if (startRoot)
         startRoot->dispatchEvent(Event::create(eventNames().webkitEditableContentChangedEvent, false, false), ec);
@@ -869,7 +867,9 @@ void Editor::appliedEditing(PassRefPtr<CompositeEditCommand> cmd)
 {
     m_frame->document()->updateLayout();
 
-    dispatchEditableContentChangedEvents(*cmd);
+    EditCommandComposition* composition = cmd->composition();
+    ASSERT(composition);
+    dispatchEditableContentChangedEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement());
     VisibleSelection newSelection(cmd->endingSelection());
 
     m_spellingCorrector->respondToAppliedEditing(cmd.get());
@@ -898,7 +898,7 @@ void Editor::unappliedEditing(PassRefPtr<EditCommandComposition> cmd)
 {
     m_frame->document()->updateLayout();
     
-    dispatchEditableContentChangedEvents(*cmd);
+    dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
     
     VisibleSelection newSelection(cmd->startingSelection());
     changeSelectionAfterCommand(newSelection, true, true);
@@ -914,7 +914,7 @@ void Editor::reappliedEditing(PassRefPtr<EditCommandComposition> cmd)
 {
     m_frame->document()->updateLayout();
     
-    dispatchEditableContentChangedEvents(*cmd);
+    dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
     
     VisibleSelection newSelection(cmd->endingSelection());
     changeSelectionAfterCommand(newSelection, true, true);
index b81e610..0209ed3 100644 (file)
@@ -91,7 +91,7 @@ public:
 
     Frame* frame() const { return m_frame; }
     DeleteButtonController* deleteButtonController() const { return m_deleteButtonController.get(); }
-    EditCommand* lastEditCommand() { return m_lastEditCommand.get(); }
+    CompositeEditCommand* lastEditCommand() { return m_lastEditCommand.get(); }
 
     void handleKeyboardEvent(KeyboardEvent*);
     void handleInputMethodKeydown(KeyboardEvent*);
@@ -385,7 +385,7 @@ public:
 private:
     Frame* m_frame;
     OwnPtr<DeleteButtonController> m_deleteButtonController;
-    RefPtr<EditCommand> m_lastEditCommand;
+    RefPtr<CompositeEditCommand> m_lastEditCommand;
     RefPtr<Node> m_removedAnchor;
     RefPtr<Text> m_compositionNode;
     unsigned m_compositionStart;
index cb1f957..af4cba9 100644 (file)
@@ -1657,7 +1657,7 @@ void FrameSelection::updateAppearance()
     bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
     bool shouldBlink = caretIsVisible() && isCaret() && (isContentEditable() || caretBrowsing);
     
-    EditCommand* lastEditCommand = m_frame ? m_frame->editor()->lastEditCommand() : 0;
+    CompositeEditCommand* lastEditCommand = m_frame ? m_frame->editor()->lastEditCommand() : 0;
     bool shouldStopBlinkingDueToTypingCommand = lastEditCommand && lastEditCommand->shouldStopCaretBlinking();
 
     // If the caret moved, stop the blink timer so we can restart with a
index 2d85806..e2cbec4 100644 (file)
@@ -161,8 +161,8 @@ void IndentOutdentCommand::outdentParagraph()
                     splitElement(static_cast<Element*>(splitPointParent), splitPoint);
             }
         }
-        
-        updateLayout();
+
+        document()->updateLayoutIgnorePendingStylesheets();
         visibleStartOfParagraph = VisiblePosition(visibleStartOfParagraph.deepEquivalent());
         visibleEndOfParagraph = VisiblePosition(visibleEndOfParagraph.deepEquivalent());
         if (visibleStartOfParagraph.isNotNull() && !isStartOfParagraph(visibleStartOfParagraph))
index ef0b34b..c8e8b83 100644 (file)
@@ -143,7 +143,7 @@ void InsertLineBreakCommand::doApply()
         Position endingPosition = firstPositionInNode(textNode);
         
         // Handle whitespace that occurs after the split
-        updateLayout();
+        document()->updateLayoutIgnorePendingStylesheets();
         if (!endingPosition.isRenderedCharacter()) {
             Position positionBeforeTextNode(positionInParentBeforeNode(textNode));
             // Clear out all whitespace and insert one non-breaking space
index ea8abdc..6484c58 100644 (file)
@@ -348,7 +348,7 @@ void InsertParagraphSeparatorCommand::doApply()
     else
         insertNodeAfter(blockToInsert.get(), startBlock);
 
-    updateLayout();
+    document()->updateLayoutIgnorePendingStylesheets();
 
     // If the paragraph separator was inserted at the end of a paragraph, an empty line must be
     // created.  All of the nodes, starting at visiblePos, are about to be added to the new paragraph 
@@ -384,7 +384,7 @@ void InsertParagraphSeparatorCommand::doApply()
 
     // Handle whitespace that occurs after the split
     if (splitText) {
-        updateLayout();
+        document()->updateLayoutIgnorePendingStylesheets();
         if (insertionPosition.anchorType() == Position::PositionIsOffsetInAnchor)
             insertionPosition.moveToOffset(0);
         if (!insertionPosition.isRenderedCharacter()) {
index bf6e35f..4ffdc7f 100644 (file)
@@ -427,7 +427,7 @@ void SpellingCorrectionController::respondToChangedSelection(const VisibleSelect
     }
 }
 
-void SpellingCorrectionController::respondToAppliedEditing(EditCommand* command)
+void SpellingCorrectionController::respondToAppliedEditing(CompositeEditCommand* command)
 {
     if (command->isTopLevelCommand() && !command->shouldRetainAutocorrectionIndicator())
         m_frame->document()->markers()->removeMarkers(DocumentMarker::CorrectionIndicator);
index 0e22034..dfd0608 100644 (file)
@@ -36,6 +36,7 @@
 
 namespace WebCore {
 
+class CompositeEditCommand;
 class EditorClient;
 class EditCommand;
 class EditCommandComposition;
@@ -88,7 +89,7 @@ public:
     bool applyAutocorrectionBeforeTypingIfAppropriate() UNLESS_ENABLED({ return false; })
 
     void respondToUnappliedSpellCorrection(const VisibleSelection&, const String& corrected, const String& correction) UNLESS_ENABLED({ UNUSED_PARAM(corrected); UNUSED_PARAM(correction); })
-    void respondToAppliedEditing(EditCommand*) UNLESS_ENABLED({})
+    void respondToAppliedEditing(CompositeEditCommand*) UNLESS_ENABLED({ })
     void respondToUnappliedEditing(EditCommandComposition*) UNLESS_ENABLED({ })
     void respondToChangedSelection(const VisibleSelection& oldSelection) UNLESS_ENABLED({ UNUSED_PARAM(oldSelection); })
 
index 1797b82..1ee0033 100644 (file)
@@ -240,7 +240,7 @@ TypingCommand* TypingCommand::lastTypingCommandIfStillOpenForTyping(Frame* frame
 {
     ASSERT(frame);
 
-    EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
+    CompositeEditCommand* lastEditCommand = frame->editor()->lastEditCommand();
     if (!lastEditCommand || !lastEditCommand->isTypingCommand() || !static_cast<TypingCommand*>(lastEditCommand)->isOpenForMoreTyping())
         return 0;
 
index 4053782..cce9cdb 100644 (file)
@@ -101,7 +101,11 @@ private:
     virtual EditAction editingAction() const;
     virtual bool isTypingCommand() const;
     virtual bool preservesTypingStyle() const { return m_preservesTypingStyle; }
-    virtual bool shouldRetainAutocorrectionIndicator() const { return m_shouldRetainAutocorrectionIndicator; }
+    virtual bool shouldRetainAutocorrectionIndicator() const
+    {
+        ASSERT(isTopLevelCommand());
+        return m_shouldRetainAutocorrectionIndicator;
+    }
     virtual void setShouldRetainAutocorrectionIndicator(bool retain) { m_shouldRetainAutocorrectionIndicator = retain; }
     virtual bool shouldStopCaretBlinking() const { return true; }
     void setShouldPreventSpellChecking(bool prevent) { m_shouldPreventSpellChecking = prevent; }