Changeset 121357 in webkit


Ignore:
Timestamp:
Jun 27, 2012 12:42:22 PM (12 years ago)
Author:
rniwa@webkit.org
Message:

REGRESSION (Safari 5?): Pasting a line into textarea inserts two newlines
https://bugs.webkit.org/show_bug.cgi?id=49288

Reviewed by Tony Chang.

Source/WebCore:

The bug was caused by positionAvoidingPrecedingNodes getting out of a block when the insertion point is at a line break.
It caused the subsequent code to be misinformed of the insertion position and ended up not pruning the extra line break.

Fixed the bug by checking this special case and bailing out so that we don't crawl out of the enclosing block.
It's similar to checks several lines below it.

Test: editing/pasteboard/copy-paste-pre-line-content.html

  • editing/ReplaceSelectionCommand.cpp:

(WebCore::positionAvoidingPrecedingNodes):

LayoutTests:

Add a test regerssion test for copying & pasting a line in pre into textarea twice.

  • editing/pasteboard/copy-paste-pre-line-content-expected.txt: Added.
  • editing/pasteboard/copy-paste-pre-line-content.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r121356 r121357  
     12012-06-27  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        REGRESSION (Safari 5?): Pasting a line into textarea inserts two newlines
     4        https://bugs.webkit.org/show_bug.cgi?id=49288
     5
     6        Reviewed by Tony Chang.
     7
     8        Add a test regerssion test for copying & pasting a line in pre into textarea twice.
     9
     10        * editing/pasteboard/copy-paste-pre-line-content-expected.txt: Added.
     11        * editing/pasteboard/copy-paste-pre-line-content.html: Added.
     12
    1132012-06-27  Alpha Lam  <hclam@chromium.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r121352 r121357  
     12012-06-27  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        REGRESSION (Safari 5?): Pasting a line into textarea inserts two newlines
     4        https://bugs.webkit.org/show_bug.cgi?id=49288
     5
     6        Reviewed by Tony Chang.
     7
     8        The bug was caused by positionAvoidingPrecedingNodes getting out of a block when the insertion point is at a line break.
     9        It caused the subsequent code to be misinformed of the insertion position and ended up not pruning the extra line break.
     10
     11        Fixed the bug by checking this special case and bailing out so that we don't crawl out of the enclosing block.
     12        It's similar to checks several lines below it.
     13
     14        Test: editing/pasteboard/copy-paste-pre-line-content.html
     15
     16        * editing/ReplaceSelectionCommand.cpp:
     17        (WebCore::positionAvoidingPrecedingNodes):
     18
    1192012-06-27  Andrei Onea  <onea@adobe.com>
    220
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp

    r120044 r121357  
    124124    Node* enclosingBlockNode = enclosingBlock(pos.containerNode());
    125125    for (Position nextPosition = pos; nextPosition.containerNode() != enclosingBlockNode; pos = nextPosition) {
     126        if (lineBreakExistsAtPosition(pos))
     127            break;
     128
    126129        if (pos.containerNode()->nonShadowBoundaryParentNode())
    127130            nextPosition = positionInParentAfterNode(pos.containerNode());
Note: See TracChangeset for help on using the changeset viewer.