Changeset 102643 in webkit


Ignore:
Timestamp:
Dec 12, 2011 4:59:36 PM (12 years ago)
Author:
rniwa@webkit.org
Message:

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:
Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r102641 r102643  
     12011-12-12  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        REGRESSION(r102357): respondToUnappliedEditing exits early for CreateLinkCommand
     4        https://bugs.webkit.org/show_bug.cgi?id=74356
     5
     6        Reviewed by Enrica Casucci.
     7
     8        The problem was that isCreateLinkCommand was called on EditCommandComposition by respondToUnappliedEditing.
     9        Fixed the bug by propagating the value of isCreteLinkCommand from CompositeEditCommand to
     10        EditCommandComposition via wasCreateLinkCommand.
     11
     12        Also move isCreateLinkCommand from EditCommand to CompositeEditCommand to prevent this mistake in the future.
     13
     14        * editing/CompositeEditCommand.cpp:
     15        (WebCore::EditCommandComposition::create):
     16        (WebCore::EditCommandComposition::EditCommandComposition):
     17        (WebCore::CompositeEditCommand::ensureComposition):
     18        (WebCore::CompositeEditCommand::isCreateLinkCommand):
     19        * editing/CompositeEditCommand.h:
     20        (WebCore::EditCommandComposition::wasCreateLinkCommand):
     21        * editing/SpellingCorrectionController.cpp:
     22        (WebCore::SpellingCorrectionController::respondToUnappliedEditing):
     23        * editing/SpellingCorrectionController.h:
     24
    1252011-12-12  Mihnea Ovidenie  <mihnea@adobe.com>
    226
  • trunk/Source/WebCore/editing/CompositeEditCommand.cpp

    r102527 r102643  
    7272
    7373PassRefPtr<EditCommandComposition> EditCommandComposition::create(Document* document,
    74     const VisibleSelection& startingSelection, const VisibleSelection endingSelection)
    75 {
    76     return adoptRef(new EditCommandComposition(document, startingSelection, endingSelection));
     74    const VisibleSelection& startingSelection, const VisibleSelection& endingSelection, bool wasCreateLinkCommand)
     75{
     76    return adoptRef(new EditCommandComposition(document, startingSelection, endingSelection, wasCreateLinkCommand));
     77}
     78
     79EditCommandComposition::EditCommandComposition(Document* document, const VisibleSelection& startingSelection, const VisibleSelection& endingSelection, bool wasCreateLinkCommand)
     80    : EditCommand(document, startingSelection, endingSelection)
     81    , m_wasCreateLinkCommand(wasCreateLinkCommand)
     82{
    7783}
    7884
     
    136142        command = command->parent();
    137143    if (!command->m_composition)
    138         command->m_composition = EditCommandComposition::create(document(), startingSelection(), endingSelection());
     144        command->m_composition = EditCommandComposition::create(document(), startingSelection(), endingSelection(), isCreateLinkCommand());
    139145    return command->m_composition.get();
     146}
     147
     148bool CompositeEditCommand::isCreateLinkCommand() const
     149{
     150    return false;
    140151}
    141152
  • trunk/Source/WebCore/editing/CompositeEditCommand.h

    r102529 r102643  
    4040class EditCommandComposition : public EditCommand {
    4141public:
    42     static PassRefPtr<EditCommandComposition> create(Document*, const VisibleSelection&, const VisibleSelection);
     42    static PassRefPtr<EditCommandComposition> create(Document*, const VisibleSelection&, const VisibleSelection&, bool wasCreateLinkCommand);
    4343
    4444    virtual void doApply() OVERRIDE;
     
    4646    virtual void doReapply() OVERRIDE;
    4747    void append(SimpleEditCommand*);
     48    bool wasCreateLinkCommand() const { return m_wasCreateLinkCommand; }
    4849
    4950#ifndef NDEBUG
     
    5253
    5354private:
    54     EditCommandComposition(Document* document, const VisibleSelection& startingSelection, const VisibleSelection& endingSelection)
    55         : EditCommand(document, startingSelection, endingSelection)
    56     { }
     55    EditCommandComposition(Document*, const VisibleSelection& startingSelection, const VisibleSelection& endingSelection, bool wasCreateLinkCommand);
    5756    virtual bool isEditCommandComposition() const OVERRIDE { return true; }
    5857
    5958    Vector<RefPtr<SimpleEditCommand> > m_commands;
     59    bool m_wasCreateLinkCommand;
    6060};
    6161
     
    6767    EditCommandComposition* composition() { return m_composition.get(); }
    6868    EditCommandComposition* ensureComposition();
     69
     70    virtual bool isCreateLinkCommand() const;
    6971
    7072protected:
  • trunk/Source/WebCore/editing/EditCommand.cpp

    r102627 r102643  
    220220}
    221221
    222 bool EditCommand::isCreateLinkCommand() const
    223 {
    224     return false;
    225 }
    226 
    227222bool EditCommand::shouldRetainAutocorrectionIndicator() const
    228223{
  • trunk/Source/WebCore/editing/EditCommand.h

    r102627 r102643  
    6262    virtual bool isEditCommandComposition() const { return false; }
    6363    virtual bool isTypingCommand() const;
    64     virtual bool isCreateLinkCommand() const;
    6564
    6665    virtual bool preservesTypingStyle() const;
  • trunk/Source/WebCore/editing/SpellingCorrectionController.cpp

    r101413 r102643  
    437437}
    438438
    439 void SpellingCorrectionController::respondToUnappliedEditing(EditCommand* command)
    440 {
    441     if (!command->isCreateLinkCommand())
     439void SpellingCorrectionController::respondToUnappliedEditing(EditCommandComposition* command)
     440{
     441    if (!command->wasCreateLinkCommand())
    442442        return;
    443443    RefPtr<Range> range = Range::create(m_frame->document(), command->startingSelection().start(), command->startingSelection().end());
  • trunk/Source/WebCore/editing/SpellingCorrectionController.h

    r101413 r102643  
    3939class EditorClient;
    4040class EditCommand;
     41class EditCommandComposition;
    4142class Frame;
    4243class TextCheckerClient;
     
    8990    void respondToUnappliedSpellCorrection(const VisibleSelection&, const String& corrected, const String& correction) UNLESS_ENABLED({ UNUSED_PARAM(corrected); UNUSED_PARAM(correction); })
    9091    void respondToAppliedEditing(EditCommand*) UNLESS_ENABLED({})
    91     void respondToUnappliedEditing(EditCommand*) UNLESS_ENABLED({})
     92    void respondToUnappliedEditing(EditCommandComposition*) UNLESS_ENABLED({ })
    9293    void respondToChangedSelection(const VisibleSelection& oldSelection) UNLESS_ENABLED({ UNUSED_PARAM(oldSelection); })
    9394
Note: See TracChangeset for help on using the changeset viewer.