Reviewed by John
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Feb 2005 21:23:02 +0000 (21:23 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Feb 2005 21:23:02 +0000 (21:23 +0000)
commit121f4ebe064befe4c14a9f5ca68604dbe7cff6ad
treec4efb77a272c8c2f87993c27d66c245d63b324f5
parent2b462079901c8664b94dd034f1f46a367c8425a3
    Reviewed by John

        Fix for this bug:

        <rdar://problem/3985160> Deficiencies in pasting architecture blocking progress on other bugs

        * khtml/editing/html_interchange.h: Move style span text used to mark element added to
        add style to this header.
        * khtml/editing/htmlediting.cpp:
        (khtml::styleSpanClassString): Change to use constant moved to html_interchange.h.
        (khtml::isStyleSpan): New helper function. Checks if this is a span we added to apply style.
        (khtml::CompositeEditCommand::insertNodeBefore): Added an assert to check that the node
        we are inserting before is not the body.
        (khtml::CompositeEditCommand::insertNodeAfter): Ditto, but check is for after.
        (khtml::ReplacementFragment::ReplacementFragment): Added code to process the "default style"
        that is added by the copy code.
        (khtml::ReplaceSelectionCommand::ReplaceSelectionCommand): first and last nodes inserted are
        now member variables instead of function locals. Initialize them here.
        (khtml::ReplaceSelectionCommand::~ReplaceSelectionCommand): Deref first and last nodes inserted
        if necessary.
        (khtml::ReplaceSelectionCommand::doApply): Change design to fix the bug. Major change is to
        separate out the code that inserts nodes into the tree so additional styling checks can
        be done in a centralized way. Also got rid of the notion of "merging into the end block." That
        concept was just wrong.
        (khtml::ReplaceSelectionCommand::completeHTMLReplacement): Tweak interface now that first and
        last nodes inserted are member variables.
        (khtml::ReplaceSelectionCommand::insertNodeAfterAndUpdateNodesInserted): New helper used
        by replace code to do the stated DOM operation and update state internal to the command.
        This will also be a catch point to handle the kinds of additional style checks needed to
        make paste work right.
        (khtml::ReplaceSelectionCommand::insertNodeAtAndUpdateNodesInserted): Ditto.
        (khtml::ReplaceSelectionCommand::insertNodeBeforeAndUpdateNodesInserted): Ditto.
        (khtml::ReplaceSelectionCommand::updateNodesInserted): Ditto.
        * khtml/editing/htmlediting.h: Update declarations as needed.
        * khtml/editing/markup.cpp:
        (khtml::createMarkup): Adds a "default style" span to the content written to the pasteboard.
        This will help us to fix some of the bugs blocked by the bug above.
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::lastDescendent): New helper.
        * khtml/xml/dom_nodeimpl.h: Ditto.
        * khtml/xml/dom_position.cpp:
        (DOM::Position::upstream): Fixed a bug which would allow the upstream position returned to be
        in unrendered content.
        (DOM::Position::downstream): Ditto.

        * layout-tests/editing/deleting/delete-3775172-fix-expected.txt: Ending positions tweaked due to
        changes in upstream() and downstream() functions.
        * layout-tests/editing/inserting/insert-3851164-fix-expected.txt: Ditto
        * layout-tests/editing/inserting/insert-3907422-fix-expected.txt: Ditto
        * layout-tests/editing/selection/extend-by-character-006-expected.txt: Ditto

        * layout-tests/editing/pasteboard/paste-text-003-expected.txt: Changed what we expect, given
        new behavior of paste code.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8492 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/editing/deleting/delete-3775172-fix-expected.txt
LayoutTests/editing/inserting/insert-3851164-fix-expected.txt
LayoutTests/editing/inserting/insert-3907422-fix-expected.txt
LayoutTests/editing/pasteboard/paste-text-003-expected.txt
LayoutTests/editing/selection/extend-by-character-006-expected.txt
WebCore/ChangeLog-2005-08-23
WebCore/khtml/editing/html_interchange.h
WebCore/khtml/editing/htmlediting.cpp
WebCore/khtml/editing/htmlediting.h
WebCore/khtml/editing/markup.cpp
WebCore/khtml/xml/dom_nodeimpl.cpp
WebCore/khtml/xml/dom_nodeimpl.h
WebCore/khtml/xml/dom_position.cpp