Title: [102833] trunk/Source/WebCore
Revision
102833
Author
[email protected]
Date
2011-12-14 15:16:06 -0800 (Wed, 14 Dec 2011)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102832 => 102833)


--- trunk/Source/WebCore/ChangeLog	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/ChangeLog	2011-12-14 23:16:06 UTC (rev 102833)
@@ -1,3 +1,67 @@
+2011-12-14  Ryosuke Niwa  <[email protected]>
+
+        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  <[email protected]>
 
         Fix compile on gcc on Mac.

Modified: trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp (102832 => 102833)


--- trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp	2011-12-14 23:16:06 UTC (rev 102833)
@@ -87,8 +87,8 @@
 
     formatSelection(startOfSelection, endOfSelection);
 
-    updateLayout();
-    
+    document()->updateLayoutIgnorePendingStylesheets();
+
     ASSERT(startScope == endScope);
     ASSERT(startIndex >= 0);
     ASSERT(startIndex <= endIndex);

Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (102832 => 102833)


--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp	2011-12-14 23:16:06 UTC (rev 102833)
@@ -243,7 +243,7 @@
     // 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 @@
     // 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 @@
     // 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) {

Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (102832 => 102833)


--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2011-12-14 23:16:06 UTC (rev 102833)
@@ -78,6 +78,8 @@
 
 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 @@
     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 @@
     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 @@
     if (!container)
         return 0;
 
-    updateLayout();
+    document()->updateLayoutIgnorePendingStylesheets();
 
     RenderObject* renderer = container->renderer();
     if (!renderer || !renderer->isBlockFlow())
@@ -773,7 +806,7 @@
     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 @@
         // 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()));

Modified: trunk/Source/WebCore/editing/CompositeEditCommand.h (102832 => 102833)


--- trunk/Source/WebCore/editing/CompositeEditCommand.h	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.h	2011-12-14 23:16:06 UTC (rev 102833)
@@ -47,6 +47,9 @@
     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 @@
 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 @@
     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*);

Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (102832 => 102833)


--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp	2011-12-14 23:16:06 UTC (rev 102833)
@@ -361,7 +361,7 @@
         }
         
         // 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::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());

Modified: trunk/Source/WebCore/editing/EditCommand.cpp (102832 => 102833)


--- trunk/Source/WebCore/editing/EditCommand.cpp	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/EditCommand.cpp	2011-12-14 23:16:06 UTC (rev 102833)
@@ -95,7 +95,7 @@
     // 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 @@
 
     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 @@
     // 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 @@
     // 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 @@
 
 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::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 @@
     if (parent) {
         m_startingSelection = parent->m_endingSelection;
         m_endingSelection = parent->m_endingSelection;
-        m_startingRootEditableElement = parent->m_endingRootEditableElement;
-        m_endingRootEditableElement = parent->m_endingRootEditableElement;
     }
 }
 

Modified: trunk/Source/WebCore/editing/EditCommand.h (102832 => 102833)


--- trunk/Source/WebCore/editing/EditCommand.h	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/EditCommand.h	2011-12-14 23:16:06 UTC (rev 102833)
@@ -54,22 +54,11 @@
     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,11 +66,9 @@
     Document* document() const { return m_document.get(); }
     CompositeEditCommand* parent() const { return m_parent; }
 
-    void setStartingSelection(const VisibleSelection&);
-    void setEndingSelection(const VisibleSelection&);
+    virtual void setStartingSelection(const VisibleSelection&);
+    virtual void setEndingSelection(const VisibleSelection&);
 
-    void updateLayout() const;
-
 private:
     virtual void doApply() = 0;
     virtual void doUnapply() = 0;
@@ -90,8 +77,6 @@
     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>);

Modified: trunk/Source/WebCore/editing/Editor.cpp (102832 => 102833)


--- trunk/Source/WebCore/editing/Editor.cpp	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/Editor.cpp	2011-12-14 23:16:06 UTC (rev 102833)
@@ -854,10 +854,8 @@
     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 @@
 {
     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 @@
 {
     m_frame->document()->updateLayout();
     
-    dispatchEditableContentChangedEvents(*cmd);
+    dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
     
     VisibleSelection newSelection(cmd->startingSelection());
     changeSelectionAfterCommand(newSelection, true, true);
@@ -914,7 +914,7 @@
 {
     m_frame->document()->updateLayout();
     
-    dispatchEditableContentChangedEvents(*cmd);
+    dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
     
     VisibleSelection newSelection(cmd->endingSelection());
     changeSelectionAfterCommand(newSelection, true, true);

Modified: trunk/Source/WebCore/editing/Editor.h (102832 => 102833)


--- trunk/Source/WebCore/editing/Editor.h	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/Editor.h	2011-12-14 23:16:06 UTC (rev 102833)
@@ -91,7 +91,7 @@
 
     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 @@
 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;

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (102832 => 102833)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2011-12-14 23:16:06 UTC (rev 102833)
@@ -1657,7 +1657,7 @@
     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

Modified: trunk/Source/WebCore/editing/IndentOutdentCommand.cpp (102832 => 102833)


--- trunk/Source/WebCore/editing/IndentOutdentCommand.cpp	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/IndentOutdentCommand.cpp	2011-12-14 23:16:06 UTC (rev 102833)
@@ -161,8 +161,8 @@
                     splitElement(static_cast<Element*>(splitPointParent), splitPoint);
             }
         }
-        
-        updateLayout();
+
+        document()->updateLayoutIgnorePendingStylesheets();
         visibleStartOfParagraph = VisiblePosition(visibleStartOfParagraph.deepEquivalent());
         visibleEndOfParagraph = VisiblePosition(visibleEndOfParagraph.deepEquivalent());
         if (visibleStartOfParagraph.isNotNull() && !isStartOfParagraph(visibleStartOfParagraph))

Modified: trunk/Source/WebCore/editing/InsertLineBreakCommand.cpp (102832 => 102833)


--- trunk/Source/WebCore/editing/InsertLineBreakCommand.cpp	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/InsertLineBreakCommand.cpp	2011-12-14 23:16:06 UTC (rev 102833)
@@ -143,7 +143,7 @@
         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

Modified: trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp (102832 => 102833)


--- trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp	2011-12-14 23:16:06 UTC (rev 102833)
@@ -348,7 +348,7 @@
     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 @@
 
     // Handle whitespace that occurs after the split
     if (splitText) {
-        updateLayout();
+        document()->updateLayoutIgnorePendingStylesheets();
         if (insertionPosition.anchorType() == Position::PositionIsOffsetInAnchor)
             insertionPosition.moveToOffset(0);
         if (!insertionPosition.isRenderedCharacter()) {

Modified: trunk/Source/WebCore/editing/SpellingCorrectionController.cpp (102832 => 102833)


--- trunk/Source/WebCore/editing/SpellingCorrectionController.cpp	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/SpellingCorrectionController.cpp	2011-12-14 23:16:06 UTC (rev 102833)
@@ -427,7 +427,7 @@
     }
 }
 
-void SpellingCorrectionController::respondToAppliedEditing(EditCommand* command)
+void SpellingCorrectionController::respondToAppliedEditing(CompositeEditCommand* command)
 {
     if (command->isTopLevelCommand() && !command->shouldRetainAutocorrectionIndicator())
         m_frame->document()->markers()->removeMarkers(DocumentMarker::CorrectionIndicator);

Modified: trunk/Source/WebCore/editing/SpellingCorrectionController.h (102832 => 102833)


--- trunk/Source/WebCore/editing/SpellingCorrectionController.h	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/SpellingCorrectionController.h	2011-12-14 23:16:06 UTC (rev 102833)
@@ -36,6 +36,7 @@
 
 namespace WebCore {
 
+class CompositeEditCommand;
 class EditorClient;
 class EditCommand;
 class EditCommandComposition;
@@ -88,7 +89,7 @@
     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); })
 

Modified: trunk/Source/WebCore/editing/TypingCommand.cpp (102832 => 102833)


--- trunk/Source/WebCore/editing/TypingCommand.cpp	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/TypingCommand.cpp	2011-12-14 23:16:06 UTC (rev 102833)
@@ -240,7 +240,7 @@
 {
     ASSERT(frame);
 
-    EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
+    CompositeEditCommand* lastEditCommand = frame->editor()->lastEditCommand();
     if (!lastEditCommand || !lastEditCommand->isTypingCommand() || !static_cast<TypingCommand*>(lastEditCommand)->isOpenForMoreTyping())
         return 0;
 

Modified: trunk/Source/WebCore/editing/TypingCommand.h (102832 => 102833)


--- trunk/Source/WebCore/editing/TypingCommand.h	2011-12-14 23:08:08 UTC (rev 102832)
+++ trunk/Source/WebCore/editing/TypingCommand.h	2011-12-14 23:16:06 UTC (rev 102833)
@@ -101,7 +101,11 @@
     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; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to