Diff
Modified: trunk/Source/WebCore/ChangeLog (102642 => 102643)
--- trunk/Source/WebCore/ChangeLog 2011-12-13 00:58:17 UTC (rev 102642)
+++ trunk/Source/WebCore/ChangeLog 2011-12-13 00:59:36 UTC (rev 102643)
@@ -1,3 +1,27 @@
+2011-12-12 Ryosuke Niwa <[email protected]>
+
+ REGRESSION(r102357): respondToUnappliedEditing exits early for CreateLinkCommand
+ https://bugs.webkit.org/show_bug.cgi?id=74356
+
+ Reviewed by Enrica Casucci.
+
+ The problem was that isCreateLinkCommand was called on EditCommandComposition by respondToUnappliedEditing.
+ Fixed the bug by propagating the value of isCreteLinkCommand from CompositeEditCommand to
+ EditCommandComposition via wasCreateLinkCommand.
+
+ Also move isCreateLinkCommand from EditCommand to CompositeEditCommand to prevent this mistake in the future.
+
+ * editing/CompositeEditCommand.cpp:
+ (WebCore::EditCommandComposition::create):
+ (WebCore::EditCommandComposition::EditCommandComposition):
+ (WebCore::CompositeEditCommand::ensureComposition):
+ (WebCore::CompositeEditCommand::isCreateLinkCommand):
+ * editing/CompositeEditCommand.h:
+ (WebCore::EditCommandComposition::wasCreateLinkCommand):
+ * editing/SpellingCorrectionController.cpp:
+ (WebCore::SpellingCorrectionController::respondToUnappliedEditing):
+ * editing/SpellingCorrectionController.h:
+
2011-12-12 Mihnea Ovidenie <[email protected]>
[CSSRegions]Revert RenderObject::style() to its state before region styling
Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (102642 => 102643)
--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp 2011-12-13 00:58:17 UTC (rev 102642)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp 2011-12-13 00:59:36 UTC (rev 102643)
@@ -71,11 +71,17 @@
using namespace HTMLNames;
PassRefPtr<EditCommandComposition> EditCommandComposition::create(Document* document,
- const VisibleSelection& startingSelection, const VisibleSelection endingSelection)
+ const VisibleSelection& startingSelection, const VisibleSelection& endingSelection, bool wasCreateLinkCommand)
{
- return adoptRef(new EditCommandComposition(document, startingSelection, endingSelection));
+ return adoptRef(new EditCommandComposition(document, startingSelection, endingSelection, wasCreateLinkCommand));
}
+EditCommandComposition::EditCommandComposition(Document* document, const VisibleSelection& startingSelection, const VisibleSelection& endingSelection, bool wasCreateLinkCommand)
+ : EditCommand(document, startingSelection, endingSelection)
+ , m_wasCreateLinkCommand(wasCreateLinkCommand)
+{
+}
+
void EditCommandComposition::doApply()
{
ASSERT_NOT_REACHED();
@@ -135,10 +141,15 @@
while (command && command->parent())
command = command->parent();
if (!command->m_composition)
- command->m_composition = EditCommandComposition::create(document(), startingSelection(), endingSelection());
+ command->m_composition = EditCommandComposition::create(document(), startingSelection(), endingSelection(), isCreateLinkCommand());
return command->m_composition.get();
}
+bool CompositeEditCommand::isCreateLinkCommand() const
+{
+ return false;
+}
+
//
// sugary-sweet convenience functions to help create and apply edit commands in composite commands
//
Modified: trunk/Source/WebCore/editing/CompositeEditCommand.h (102642 => 102643)
--- trunk/Source/WebCore/editing/CompositeEditCommand.h 2011-12-13 00:58:17 UTC (rev 102642)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.h 2011-12-13 00:59:36 UTC (rev 102643)
@@ -39,24 +39,24 @@
class EditCommandComposition : public EditCommand {
public:
- static PassRefPtr<EditCommandComposition> create(Document*, const VisibleSelection&, const VisibleSelection);
+ static PassRefPtr<EditCommandComposition> create(Document*, const VisibleSelection&, const VisibleSelection&, bool wasCreateLinkCommand);
virtual void doApply() OVERRIDE;
virtual void doUnapply() OVERRIDE;
virtual void doReapply() OVERRIDE;
void append(SimpleEditCommand*);
+ bool wasCreateLinkCommand() const { return m_wasCreateLinkCommand; }
#ifndef NDEBUG
virtual void getNodesInCommand(HashSet<Node*>&);
#endif
private:
- EditCommandComposition(Document* document, const VisibleSelection& startingSelection, const VisibleSelection& endingSelection)
- : EditCommand(document, startingSelection, endingSelection)
- { }
+ EditCommandComposition(Document*, const VisibleSelection& startingSelection, const VisibleSelection& endingSelection, bool wasCreateLinkCommand);
virtual bool isEditCommandComposition() const OVERRIDE { return true; }
Vector<RefPtr<SimpleEditCommand> > m_commands;
+ bool m_wasCreateLinkCommand;
};
class CompositeEditCommand : public EditCommand {
@@ -67,6 +67,8 @@
EditCommandComposition* composition() { return m_composition.get(); }
EditCommandComposition* ensureComposition();
+ virtual bool isCreateLinkCommand() const;
+
protected:
explicit CompositeEditCommand(Document*);
Modified: trunk/Source/WebCore/editing/EditCommand.cpp (102642 => 102643)
--- trunk/Source/WebCore/editing/EditCommand.cpp 2011-12-13 00:58:17 UTC (rev 102642)
+++ trunk/Source/WebCore/editing/EditCommand.cpp 2011-12-13 00:59:36 UTC (rev 102643)
@@ -219,11 +219,6 @@
return false;
}
-bool EditCommand::isCreateLinkCommand() const
-{
- return false;
-}
-
bool EditCommand::shouldRetainAutocorrectionIndicator() const
{
return false;
Modified: trunk/Source/WebCore/editing/EditCommand.h (102642 => 102643)
--- trunk/Source/WebCore/editing/EditCommand.h 2011-12-13 00:58:17 UTC (rev 102642)
+++ trunk/Source/WebCore/editing/EditCommand.h 2011-12-13 00:59:36 UTC (rev 102643)
@@ -61,7 +61,6 @@
virtual bool isCompositeEditCommand() const { return false; }
virtual bool isEditCommandComposition() const { return false; }
virtual bool isTypingCommand() const;
- virtual bool isCreateLinkCommand() const;
virtual bool preservesTypingStyle() const;
Modified: trunk/Source/WebCore/editing/SpellingCorrectionController.cpp (102642 => 102643)
--- trunk/Source/WebCore/editing/SpellingCorrectionController.cpp 2011-12-13 00:58:17 UTC (rev 102642)
+++ trunk/Source/WebCore/editing/SpellingCorrectionController.cpp 2011-12-13 00:59:36 UTC (rev 102643)
@@ -436,9 +436,9 @@
m_originalStringForLastDeletedAutocorrection = String();
}
-void SpellingCorrectionController::respondToUnappliedEditing(EditCommand* command)
+void SpellingCorrectionController::respondToUnappliedEditing(EditCommandComposition* command)
{
- if (!command->isCreateLinkCommand())
+ if (!command->wasCreateLinkCommand())
return;
RefPtr<Range> range = Range::create(m_frame->document(), command->startingSelection().start(), command->startingSelection().end());
if (!range)
Modified: trunk/Source/WebCore/editing/SpellingCorrectionController.h (102642 => 102643)
--- trunk/Source/WebCore/editing/SpellingCorrectionController.h 2011-12-13 00:58:17 UTC (rev 102642)
+++ trunk/Source/WebCore/editing/SpellingCorrectionController.h 2011-12-13 00:59:36 UTC (rev 102643)
@@ -38,6 +38,7 @@
class EditorClient;
class EditCommand;
+class EditCommandComposition;
class Frame;
class TextCheckerClient;
@@ -88,7 +89,7 @@
void respondToUnappliedSpellCorrection(const VisibleSelection&, const String& corrected, const String& correction) UNLESS_ENABLED({ UNUSED_PARAM(corrected); UNUSED_PARAM(correction); })
void respondToAppliedEditing(EditCommand*) UNLESS_ENABLED({})
- void respondToUnappliedEditing(EditCommand*) UNLESS_ENABLED({})
+ void respondToUnappliedEditing(EditCommandComposition*) UNLESS_ENABLED({ })
void respondToChangedSelection(const VisibleSelection& oldSelection) UNLESS_ENABLED({ UNUSED_PARAM(oldSelection); })
void stopPendingCorrection(const VisibleSelection& oldSelection) UNLESS_ENABLED({ UNUSED_PARAM(oldSelection); })