Changeset 112399 in webkit


Ignore:
Timestamp:
Mar 28, 2012 8:00:42 AM (12 years ago)
Author:
yi.4.shen@nokia.com
Message:

An extra line break is inserted when pasting into a font element.
https://bugs.webkit.org/show_bug.cgi?id=71207

Reviewed by Ryosuke Niwa.

Fix an editing bug where inserting text into a font element would
create an extra div element in the dom tree. The
WebCore::positionAvoidingPrecedingNodes() tries to set the correct
destination position by checking the next visible position, however,
it causes the position moves into the child element in somecase.
Instead, we should only check the position in parent after node.

Source/WebCore:

Test: editing/inserting/insert-text-into-font.html

  • editing/ReplaceSelectionCommand.cpp:

(WebCore::positionAvoidingPrecedingNodes):

LayoutTests:

  • editing/inserting/insert-text-into-font-expected.txt: Added.
  • editing/inserting/insert-text-into-font.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r112398 r112399  
     12012-03-28  Yi Shen  <yi.4.shen@nokia.com>
     2
     3        An extra line break is inserted when pasting into a font element.
     4        https://bugs.webkit.org/show_bug.cgi?id=71207
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Fix an editing bug where inserting text into a font element would
     9        create an extra div element in the dom tree. The
     10        WebCore::positionAvoidingPrecedingNodes() tries to set the correct
     11        destination position by checking the next visible position, however,
     12        it causes the position moves into the child element in somecase.
     13        Instead, we should only check the position in parent after node.
     14
     15        * editing/inserting/insert-text-into-font-expected.txt: Added.
     16        * editing/inserting/insert-text-into-font.html: Added.
     17
    1182012-03-28  Mihai Balan  <mibalan@adobe.com>
    219
  • trunk/Source/WebCore/ChangeLog

    r112396 r112399  
     12012-03-28  Yi Shen  <yi.4.shen@nokia.com>
     2
     3        An extra line break is inserted when pasting into a font element.
     4        https://bugs.webkit.org/show_bug.cgi?id=71207
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Fix an editing bug where inserting text into a font element would
     9        create an extra div element in the dom tree. The
     10        WebCore::positionAvoidingPrecedingNodes() tries to set the correct
     11        destination position by checking the next visible position, however,
     12        it causes the position moves into the child element in somecase.
     13        Instead, we should only check the position in parent after node.
     14
     15        Test: editing/inserting/insert-text-into-font.html
     16
     17        * editing/ReplaceSelectionCommand.cpp:
     18        (WebCore::positionAvoidingPrecedingNodes):
     19
    1202012-03-28  Sergio Villar Senin  <svillar@igalia.com>
    221
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp

    r111895 r112399  
    122122    //   <div>foo^</div>^
    123123    // The two positions above are the same visual position, but we want to stay in the same block.
    124     Node* stopNode = pos.deprecatedNode()->enclosingBlockFlowElement();
    125     while (stopNode != pos.deprecatedNode() && VisiblePosition(pos) == VisiblePosition(pos.next()))
    126         pos = pos.next();
     124    Node* enclosingBlockNode = enclosingBlock(pos.containerNode());
     125    for (Position nextPosition = pos; nextPosition.containerNode() != enclosingBlockNode; pos = nextPosition) {
     126        if (pos.containerNode()->nonShadowBoundaryParentNode())
     127            nextPosition = positionInParentAfterNode(pos.containerNode());
     128       
     129        if (nextPosition == pos
     130            || enclosingBlock(nextPosition.containerNode()) != enclosingBlockNode
     131            || VisiblePosition(pos) != VisiblePosition(nextPosition))
     132            break;
     133    }
    127134    return pos;
    128135}
Note: See TracChangeset for help on using the changeset viewer.