• enrica@apple.com's avatar
    Source/WebCore: Repeated copy and paste-in-place operation results in increasingly verbose HTML. · f8d20922
    enrica@apple.com authored
    <rdar://problem/8690506>
    https://bugs.webkit.org/show_bug.cgi?id=56874
            
    Reviewed by Darin Adler.
    
    When we calculate the style to apply at the insertion point we compare the initial
    style at the insertion point against the style calculated at the span we wrap the
    copied markup fragment with. We could end up with a series of unnecessary spans
    to remove the initial style that simply grow our markup.
    The consists in moving the insertion point outside any inline element that could
    affect the fragment being inserted when we are not pasting and matching the style.
    
    Test: editing/pasteboard/paste-text-with-style.html
    
    * editing/ReplaceSelectionCommand.cpp:
    (WebCore::isInlineNodeWithStyle): Added.
    (WebCore::ReplaceSelectionCommand::doApply): Added logic to change the insertion
    point according to the new rules.
    
    LayoutTests: Repeated copy and paste-in-place operation results in increasingly verbose HTML.
    <rdar://problem/8690506>
    https://bugs.webkit.org/show_bug.cgi?id=56874
    
    Reviewed by Darin Adler.
    
    * editing/pasteboard/paste-text-with-style-expected.txt: Added.
    * editing/pasteboard/paste-text-with-style.html: Added.
    The following are new results for existing tests that now produce
    a different markup.
    * platform/mac/editing/pasteboard/5065605-expected.txt:
    * platform/mac/editing/pasteboard/display-block-on-spans-expected.txt:
    * platform/mac/editing/pasteboard/paste-text-011-expected.txt:
    * platform/mac/editing/pasteboard/paste-text-at-tabspan-001-expected.txt:
    * platform/mac/editing/pasteboard/paste-text-at-tabspan-002-expected.txt:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@81887 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    f8d20922
ChangeLog 1.16 MB