WebCore:
authorjustin.garcia@apple.com <justin.garcia@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Mar 2009 01:00:29 +0000 (01:00 +0000)
committerjustin.garcia@apple.com <justin.garcia@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Mar 2009 01:00:29 +0000 (01:00 +0000)
commitf451fcbd016542851f7a86a23393877c285acb2c
tree33ef951ee8eb2f7aad103f8e68d4c13044efd791
parentfd1c0520a9f5bac155b2937d70752251abe0d4f3
WebCore:

2009-03-05  Justin Garcia  <justin.garcia@apple.com>

        Reviewed by Darin Adler.

        WebViewDidChangeSelectionNotifications weren't being sent for commands that change the selection's position
        within the document without changing its position in the DOM.  For example, pressing return in (caret marked by ^):
        <div contentEditable="true"><div>^Hello</div></div>
        Undo was being enabled, shouldDeleteDOMRange called, etc. when doing no-op deletes (a delete in an empty document
        for example).

        Changes to layout tests demonstrate fix.

        * editing/EditCommand.cpp:
        (WebCore::EditCommand::apply): Don't call applyEditing for a TypingCommand.  The TypingCommand knows whether or
        not it did work that needs to be applied.
        * editing/Editor.cpp:
        (WebCore::Editor::appliedEditing): Moved code (but did not alter) to changeSelectionAfterCommand.
        (WebCore::Editor::unappliedEditing): Ditto.
        (WebCore::Editor::reappliedEditing): Ditto.
        (WebCore::Editor::changeSelectionAfterCommand): Moved code from *appliedEditing into here.  Also call out to
        EditorClient::respondToChangedSelection() for commands that changed the selection's position in the document
        even if they did not change it's position in the DOM.  Any TypingCommand that gets this far changed it's position
        in the document.
        * editing/Editor.h:
        * editing/TypingCommand.cpp:
        (WebCore::TypingCommand::TypingCommand): Removed unused m_appliedEditing.
        (WebCore::TypingCommand::typingAddedToOpenCommand): Always apply editing.  We won't get this far if we don't need to.
        (WebCore::TypingCommand::deleteKeyPressed): Don't do any of the things that only make sense for Range selections, like
        adding to the killring and responding to a change in selections if the delete was a no-op.
        (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto.
        * editing/TypingCommand.h:

LayoutTests:

2009-03-05  Justin Garcia  <justin.garcia@apple.com>

        Reviewed by Darin Adler.

        WebViewDidChangeSelectionNotification isn't always called.
        Undo was enabled, shouldDeleteDOMRange was called, etc. for no-op backward and forward deletes.

        * platform/mac/editing/deleting/delete-4038408-fix-expected.txt:
        * platform/mac/editing/deleting/delete-at-start-or-end-expected.txt:
        * platform/mac/editing/deleting/delete-br-002-expected.txt:
        * platform/mac/editing/deleting/delete-br-004-expected.txt:
        * platform/mac/editing/deleting/delete-br-005-expected.txt:
        * platform/mac/editing/deleting/delete-br-006-expected.txt:
        * platform/mac/editing/deleting/delete-br-009-expected.txt:
        * platform/mac/editing/deleting/delete-br-010-expected.txt:
        * platform/mac/editing/deleting/delete-hr-expected.txt:
        * platform/mac/editing/deleting/delete-tab-004-expected.txt:
        * platform/mac/editing/deleting/forward-delete-expected.txt:
        * platform/mac/editing/deleting/merge-into-empty-block-1-expected.txt:
        * platform/mac/editing/deleting/merge-into-empty-block-2-expected.txt:
        * platform/mac/editing/inserting/editing-empty-divs-expected.txt:
        * platform/mac/editing/inserting/insert-3800346-fix-expected.txt:
        * platform/mac/editing/inserting/insert-br-004-expected.txt:
        * platform/mac/editing/inserting/insert-br-005-expected.txt:
        * platform/mac/editing/inserting/insert-br-006-expected.txt:
        * platform/mac/editing/inserting/insert-br-008-expected.txt:
        * platform/mac/editing/inserting/insert-div-006-expected.txt:
        * platform/mac/editing/inserting/insert-div-008-expected.txt:
        * platform/mac/editing/inserting/insert-div-010-expected.txt:
        * platform/mac/editing/inserting/insert-div-011-expected.txt:
        * platform/mac/editing/inserting/insert-div-013-expected.txt:
        * platform/mac/editing/inserting/insert-div-015-expected.txt:
        * platform/mac/editing/inserting/insert-div-019-expected.txt:
        * platform/mac/editing/inserting/insert-div-021-expected.txt:
        * platform/mac/editing/inserting/insert-paragraph-01-expected.txt:
        * platform/mac/editing/inserting/insert-paragraph-03-expected.txt:
        * platform/mac/editing/inserting/insert-paragraph-05-expected.txt:
        * platform/mac/editing/inserting/insert-tab-004-expected.txt:
        * platform/mac/editing/inserting/insert-text-with-newlines-expected.txt:
        * platform/mac/editing/inserting/line-break-expected.txt:
        * platform/mac/editing/pasteboard/3976872-expected.txt:
        * platform/mac/editing/pasteboard/emacs-ctrl-a-k-y-expected.txt:
        * platform/mac/editing/pasteboard/emacs-ctrl-k-y-001-expected.txt:
        * platform/mac/editing/pasteboard/paste-text-010-expected.txt:
        * platform/mac/editing/style/block-style-006-expected.txt:
        * platform/mac/editing/undo/undo-combined-delete-boundary-expected.txt:
        * platform/mac/editing/undo/undo-combined-delete-expected.txt:
        * platform/mac/editing/undo/undo-forward-delete-boundary-expected.txt:
        * platform/mac/editing/undo/undo-forward-delete-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41465 268f45cc-cd09-0410-ab3c-d52691b4dbfc
49 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/editing/deleting/delete-4038408-fix-expected.txt
LayoutTests/platform/mac/editing/deleting/delete-at-start-or-end-expected.txt
LayoutTests/platform/mac/editing/deleting/delete-br-002-expected.txt
LayoutTests/platform/mac/editing/deleting/delete-br-004-expected.txt
LayoutTests/platform/mac/editing/deleting/delete-br-005-expected.txt
LayoutTests/platform/mac/editing/deleting/delete-br-006-expected.txt
LayoutTests/platform/mac/editing/deleting/delete-br-009-expected.txt
LayoutTests/platform/mac/editing/deleting/delete-br-010-expected.txt
LayoutTests/platform/mac/editing/deleting/delete-hr-expected.txt
LayoutTests/platform/mac/editing/deleting/delete-tab-004-expected.txt
LayoutTests/platform/mac/editing/deleting/forward-delete-expected.txt
LayoutTests/platform/mac/editing/deleting/merge-into-empty-block-1-expected.txt
LayoutTests/platform/mac/editing/deleting/merge-into-empty-block-2-expected.txt
LayoutTests/platform/mac/editing/inserting/editing-empty-divs-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-3800346-fix-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-br-004-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-br-005-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-br-006-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-br-008-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-div-006-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-div-008-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-div-010-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-div-011-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-div-013-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-div-015-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-div-019-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-div-021-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-paragraph-01-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-paragraph-03-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-paragraph-05-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-tab-004-expected.txt
LayoutTests/platform/mac/editing/inserting/insert-text-with-newlines-expected.txt
LayoutTests/platform/mac/editing/inserting/line-break-expected.txt
LayoutTests/platform/mac/editing/pasteboard/3976872-expected.txt
LayoutTests/platform/mac/editing/pasteboard/emacs-ctrl-a-k-y-expected.txt
LayoutTests/platform/mac/editing/pasteboard/emacs-ctrl-k-y-001-expected.txt
LayoutTests/platform/mac/editing/pasteboard/paste-text-010-expected.txt
LayoutTests/platform/mac/editing/style/block-style-006-expected.txt
LayoutTests/platform/mac/editing/undo/undo-combined-delete-boundary-expected.txt
LayoutTests/platform/mac/editing/undo/undo-combined-delete-expected.txt
LayoutTests/platform/mac/editing/undo/undo-forward-delete-boundary-expected.txt
LayoutTests/platform/mac/editing/undo/undo-forward-delete-expected.txt
WebCore/ChangeLog
WebCore/editing/EditCommand.cpp
WebCore/editing/Editor.cpp
WebCore/editing/Editor.h
WebCore/editing/TypingCommand.cpp
WebCore/editing/TypingCommand.h