Changeset 130411 in webkit


Ignore:
Timestamp:
Oct 4, 2012 11:36:44 AM (11 years ago)
Author:
rniwa@webkit.org
Message:

ReplaceSelectionCommand should merge text nodes
https://bugs.webkit.org/show_bug.cgi?id=98188

Reviewed by Levi Weintraub.

Source/WebCore:

Added mergeTextNodesAroundPosition to ReplaceSelectionCommand to merge text nodes after the replace in
completeHTMLReplacement. Also fixed a bunch of bugs in other classes and functions to make this work.

This behavior change is tested by existing tests.

  • editing/InsertParagraphSeparatorCommand.cpp:

(WebCore::InsertParagraphSeparatorCommand::doApply): When splitting a text node, place the insertionPosition
at the end of the first half. Leaving it at the beginning of the second half confuses the rest of the code in
the function. However, the logic to handle the "insignificant" white spaces needs the position at the start of
the second half. So keep this position.

  • editing/ReplaceSelectionCommand.cpp:

(WebCore::ReplaceSelectionCommand::doApply): Update visibleStart after inserting a paragraph separator so that
the logic to cleanup the nested div checks the right condition (right beneath it starting with a long comment).
(WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace): Insert a space for smart paste at the appropriate
offset instead of at the end of endNode. Also update the layout before obtaining startDownstream as we may have
modified the DOM by inserting a space for endNode. Finally, a non-breaking space should be treated like a space
isCharacterSmartReplaceExempt for the purpose of smart replace. e.g. if we're inserting "world" after
"hello ", we shouldn't be inserting another space between "hello" and "world".
(WebCore::ReplaceSelectionCommand::completeHTMLReplacement):
(WebCore::ReplaceSelectionCommand::mergeTextNodesAroundPosition): Added. Merge text nodes around position, and
adjust position and positionOnlyToBeUpdated accordingly. We need to call updatePositionForNodeRemoval when
positions were before or after the text node.

  • editing/ReplaceSelectionCommand.h:

(ReplaceSelectionCommand):

LayoutTests:

Rebaselined tests.

  • editing/deleting/merge-paragraphs-with-transparent-background-expected.txt:
  • editing/deleting/paste-with-transparent-background-color-expected.txt:
  • editing/execCommand/outdent-selection-expected.txt:
  • editing/execCommand/remove-list-items-expected.txt:
  • editing/inserting/insert-3907422-fix-expected.txt:
  • editing/pasteboard/avoid-copying-body-with-background-expected.txt:
  • editing/pasteboard/block-wrappers-necessary-expected.txt:
  • editing/pasteboard/drag-drop-list-expected.txt:
  • editing/pasteboard/merge-end-5-expected.txt:
  • editing/pasteboard/paste-before-tab-span-expected.txt:
  • editing/pasteboard/paste-into-table-cell-expected.txt:
  • editing/pasteboard/paste-text-001-expected.txt:
  • editing/pasteboard/paste-text-002-expected.txt:
  • editing/pasteboard/paste-text-003-expected.txt:
  • editing/pasteboard/paste-text-010-expected.txt:
  • editing/pasteboard/paste-text-at-tabspan-001-expected.txt:
  • editing/pasteboard/paste-unrendered-select-expected.txt:
  • editing/pasteboard/smart-paste-001-expected.txt:
  • editing/pasteboard/smart-paste-002-expected.txt:
  • editing/pasteboard/smart-paste-003-expected.txt:
  • editing/pasteboard/smart-paste-004-expected.txt:
  • editing/pasteboard/smart-paste-005-expected.txt:
  • editing/pasteboard/smart-paste-006-expected.txt:
  • fast/events/ondragenter-expected.txt:
  • fast/lists/drag-into-marker.html:
  • platform/mac/editing/deleting/delete-block-merge-contents-018-expected.txt:
  • platform/mac/editing/deleting/delete-block-merge-contents-019-expected.txt:
  • platform/mac/editing/deleting/delete-block-merge-contents-020-expected.txt:
  • platform/mac/editing/deleting/delete-block-merge-contents-021-expected.txt:
  • platform/mac/editing/deleting/delete-block-merge-contents-022-expected.txt:
  • platform/mac/editing/deleting/merge-no-br-expected.txt:
  • platform/mac/editing/execCommand/find-after-replace-expected.txt:
  • platform/mac/editing/execCommand/paste-1-expected.txt:
  • platform/mac/editing/execCommand/paste-2-expected.txt:
  • platform/mac/editing/pasteboard/4944770-2-expected.txt:
  • platform/mac/editing/pasteboard/5006779-expected.txt:
  • platform/mac/editing/pasteboard/5028447-expected.txt:
  • platform/mac/editing/pasteboard/8145-3-expected.txt:
  • platform/mac/editing/pasteboard/drag-drop-modifies-page-expected.txt:
  • platform/mac/editing/pasteboard/emacs-ctrl-k-y-001-expected.txt:
  • platform/mac/editing/pasteboard/merge-end-borders-expected.txt:
  • platform/mac/editing/pasteboard/paste-line-endings-007-expected.txt:
  • platform/mac/editing/pasteboard/paste-line-endings-008-expected.txt:
  • platform/mac/editing/pasteboard/paste-line-endings-009-expected.txt:
  • platform/mac/editing/pasteboard/paste-line-endings-010-expected.txt:
  • platform/mac/editing/pasteboard/paste-match-style-001-expected.txt:
  • platform/mac/editing/pasteboard/paste-text-004-expected.txt:
  • platform/mac/editing/pasteboard/paste-text-005-expected.txt:
  • platform/mac/editing/pasteboard/paste-text-008-expected.txt:
  • platform/mac/editing/pasteboard/paste-text-009-expected.txt:
  • platform/mac/editing/pasteboard/smart-drag-drop-expected.txt:
  • platform/mac/editing/pasteboard/smart-paste-007-expected.txt:
  • platform/mac/editing/pasteboard/smart-paste-008-expected.txt:
  • platform/mac/editing/pasteboard/subframe-dragndrop-1-expected.txt:
  • platform/mac/editing/pasteboard/unrendered-br-expected.txt:
Location:
trunk
Files:
60 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r130410 r130411  
     12012-10-03  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        ReplaceSelectionCommand should merge text nodes
     4        https://bugs.webkit.org/show_bug.cgi?id=98188
     5
     6        Reviewed by Levi Weintraub.
     7
     8        Rebaselined tests.
     9
     10        * editing/deleting/merge-paragraphs-with-transparent-background-expected.txt:
     11        * editing/deleting/paste-with-transparent-background-color-expected.txt:
     12        * editing/execCommand/outdent-selection-expected.txt:
     13        * editing/execCommand/remove-list-items-expected.txt:
     14        * editing/inserting/insert-3907422-fix-expected.txt:
     15        * editing/pasteboard/avoid-copying-body-with-background-expected.txt:
     16        * editing/pasteboard/block-wrappers-necessary-expected.txt:
     17        * editing/pasteboard/drag-drop-list-expected.txt:
     18        * editing/pasteboard/merge-end-5-expected.txt:
     19        * editing/pasteboard/paste-before-tab-span-expected.txt:
     20        * editing/pasteboard/paste-into-table-cell-expected.txt:
     21        * editing/pasteboard/paste-text-001-expected.txt:
     22        * editing/pasteboard/paste-text-002-expected.txt:
     23        * editing/pasteboard/paste-text-003-expected.txt:
     24        * editing/pasteboard/paste-text-010-expected.txt:
     25        * editing/pasteboard/paste-text-at-tabspan-001-expected.txt:
     26        * editing/pasteboard/paste-unrendered-select-expected.txt:
     27        * editing/pasteboard/smart-paste-001-expected.txt:
     28        * editing/pasteboard/smart-paste-002-expected.txt:
     29        * editing/pasteboard/smart-paste-003-expected.txt:
     30        * editing/pasteboard/smart-paste-004-expected.txt:
     31        * editing/pasteboard/smart-paste-005-expected.txt:
     32        * editing/pasteboard/smart-paste-006-expected.txt:
     33        * fast/events/ondragenter-expected.txt:
     34        * fast/lists/drag-into-marker.html:
     35        * platform/mac/editing/deleting/delete-block-merge-contents-018-expected.txt:
     36        * platform/mac/editing/deleting/delete-block-merge-contents-019-expected.txt:
     37        * platform/mac/editing/deleting/delete-block-merge-contents-020-expected.txt:
     38        * platform/mac/editing/deleting/delete-block-merge-contents-021-expected.txt:
     39        * platform/mac/editing/deleting/delete-block-merge-contents-022-expected.txt:
     40        * platform/mac/editing/deleting/merge-no-br-expected.txt:
     41        * platform/mac/editing/execCommand/find-after-replace-expected.txt:
     42        * platform/mac/editing/execCommand/paste-1-expected.txt:
     43        * platform/mac/editing/execCommand/paste-2-expected.txt:
     44        * platform/mac/editing/pasteboard/4944770-2-expected.txt:
     45        * platform/mac/editing/pasteboard/5006779-expected.txt:
     46        * platform/mac/editing/pasteboard/5028447-expected.txt:
     47        * platform/mac/editing/pasteboard/8145-3-expected.txt:
     48        * platform/mac/editing/pasteboard/drag-drop-modifies-page-expected.txt:
     49        * platform/mac/editing/pasteboard/emacs-ctrl-k-y-001-expected.txt:
     50        * platform/mac/editing/pasteboard/merge-end-borders-expected.txt:
     51        * platform/mac/editing/pasteboard/paste-line-endings-007-expected.txt:
     52        * platform/mac/editing/pasteboard/paste-line-endings-008-expected.txt:
     53        * platform/mac/editing/pasteboard/paste-line-endings-009-expected.txt:
     54        * platform/mac/editing/pasteboard/paste-line-endings-010-expected.txt:
     55        * platform/mac/editing/pasteboard/paste-match-style-001-expected.txt:
     56        * platform/mac/editing/pasteboard/paste-text-004-expected.txt:
     57        * platform/mac/editing/pasteboard/paste-text-005-expected.txt:
     58        * platform/mac/editing/pasteboard/paste-text-008-expected.txt:
     59        * platform/mac/editing/pasteboard/paste-text-009-expected.txt:
     60        * platform/mac/editing/pasteboard/smart-drag-drop-expected.txt:
     61        * platform/mac/editing/pasteboard/smart-paste-007-expected.txt:
     62        * platform/mac/editing/pasteboard/smart-paste-008-expected.txt:
     63        * platform/mac/editing/pasteboard/subframe-dragndrop-1-expected.txt:
     64        * platform/mac/editing/pasteboard/unrendered-br-expected.txt:
     65
    1662012-10-04  Tony Chang  <tony@chromium.org>
    267
  • trunk/LayoutTests/editing/deleting/merge-paragraphs-with-transparent-background-expected.txt

    r99067 r130411  
    55| <p>
    66|   id="destination"
    7 |   "hello<#selection-caret>"
    8 |   "world"
     7|   "hello<#selection-caret>world"
    98| "
    109"
  • trunk/LayoutTests/editing/deleting/paste-with-transparent-background-color-expected.txt

    r126656 r130411  
    1111
    1212After cut and paste:
    13 | "hello"
    14 | " "
     13| "hello "
    1514| <span>
    1615|   class="test"
  • trunk/LayoutTests/editing/execCommand/outdent-selection-expected.txt

    r88699 r130411  
    2020|   "
    2121
    22 "
    23 |   "Foo"
     22Foo"
    2423|   <br>
    2524|   "Bar"
     
    3332| <br>
    3433| "
    35 "
    36 | "Dinner time?"
     34Dinner time?"
    3735| <br>
    3836| <ul>
  • trunk/LayoutTests/editing/execCommand/remove-list-items-expected.txt

    r96257 r130411  
    1414EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    1515EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    16 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 29 of #text > DIV > BODY > HTML > #document to 29 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 0 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     16EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 14 of DIV > BODY > HTML > #document to 14 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 0 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1717EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1818EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    1919EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    20 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 15 of DIV > BODY > HTML > #document to 15 of DIV > BODY > HTML > #document toDOMRange:range from 15 of DIV > BODY > HTML > #document to 15 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     20EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 14 of DIV > BODY > HTML > #document to 14 of DIV > BODY > HTML > #document toDOMRange:range from 14 of DIV > BODY > HTML > #document to 14 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    2121EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2222EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/editing/inserting/insert-3907422-fix-expected.txt

    r87604 r130411  
    3232|       <blockquote>
    3333|         "bar"
    34 |       "baz"
    35 |       "foo"
     34|       "bazfoo"
    3635|     <blockquote>
    3736|       "bar"
  • trunk/LayoutTests/editing/pasteboard/avoid-copying-body-with-background-expected.txt

    r98794 r130411  
    1515|     "Copied content"
    1616|   <li>
    17 |     "hello, world"
    18 |     " "
     17|     "hello, world "
    1918|     <a>
    2019|       href="http://www.webkit.org/"
  • trunk/LayoutTests/editing/pasteboard/block-wrappers-necessary-expected.txt

    r96257 r130411  
    110110|     <p>
    111111|       <p>
    112 |         "This is an"
    113 |         " "
     112|         "This is an "
    114113|         <b>
    115114|           "interactive"
  • trunk/LayoutTests/editing/pasteboard/drag-drop-list-expected.txt

    r87778 r130411  
    99|       id="contents"
    1010|       style="border: 1px solid red;"
    11 |       "DropAboveMe"
    12 |       "<#selection-anchor> DragMe<#selection-focus>"
     11|       "DropAboveMe<#selection-anchor> DragMe<#selection-focus>"
    1312| "
    1413"
  • trunk/LayoutTests/editing/pasteboard/merge-end-5-expected.txt

    r96870 r130411  
    1515| <div>
    1616|   style="border: 1px solid red;"
    17 |   "This text should have a red border around<#selection-caret>"
    18 |   " it."
     17|   "This text should have a red border around<#selection-caret> it."
  • trunk/LayoutTests/editing/pasteboard/paste-before-tab-span-expected.txt

    r84885 r130411  
    44| <span>
    55|   id="test"
    6 |   "hello"
    7 |   "helloa<#selection-caret>"
     6|   "hellohelloa<#selection-caret>"
    87|   <span>
    98|     class="Apple-tab-span"
  • trunk/LayoutTests/editing/pasteboard/paste-into-table-cell-expected.txt

    r115869 r130411  
    99|     <tr>
    1010|       <td>
    11 |         " "
    12 |         "Drag me<#selection-caret>"
     11|         " Drag me<#selection-caret>"
    1312|       <td>
    1413|         " "
  • trunk/LayoutTests/editing/pasteboard/paste-text-001-expected.txt

    r96257 r130411  
    99EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 7 of #text > SPAN > DIV > BODY > HTML > #document to 7 of #text > SPAN > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    1010EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    11 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > SPAN > DIV > BODY > HTML > #document to 3 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > SPAN > DIV > BODY > HTML > #document to 3 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     11EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 10 of #text > SPAN > DIV > BODY > HTML > #document to 10 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 10 of #text > SPAN > DIV > BODY > HTML > #document to 10 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1313EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    1919| <span>
    2020|   id="test"
    21 |   "foo bar"
    22 |   "bar<#selection-caret>"
     21|   "foo barbar<#selection-caret>"
    2322|   " baz"
    2423| "
  • trunk/LayoutTests/editing/pasteboard/paste-text-002-expected.txt

    r96257 r130411  
    5555EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    5656EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    57 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 11 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 11 of #text > DIV > DIV > BODY > HTML > #document to 11 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     57EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 45 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 11 of #text > DIV > DIV > BODY > HTML > #document to 11 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    5858EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    5959EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    6060EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 11 of #text > DIV > DIV > BODY > HTML > #document to 11 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    61 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV > DIV > BODY > HTML > #document to 11 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 11 of #text > DIV > DIV > BODY > HTML > #document to 11 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     61EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     62EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 43 of #text > DIV > DIV > BODY > HTML > #document to 43 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 11 of #text > DIV > DIV > BODY > HTML > #document to 11 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    6263EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    6364EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    6465This tests copy and pastes "is a tide in the affairs of men,\nWhich taken" twice.
    6566
    66 There is a tide in the affairs of men,
     67There is a tide in the affairs of men,
    6768Which takenis a tide in the affairs of men,
    68 Which taken at the flood leads on to fortune.
     69Which taken at the flood leads on to fortune.
    6970Omitted, all the voyage of their life,
    7071Is bound in shallows and in miseries.
    7172execCopyCommand: <div id="test" class="editing">There is a tide in the affairs of men,</div> <div class="editing">Which taken at the flood leads on to fortune.</div> <div class="editing">Omitted, all the voyage of their life,</div> <div class="editing">Is bound in shallows and in miseries.</div>
    72 execPasteCommand: <div id="test" class="editing">There&nbsp;is a tide in the affairs of men,</div><div class="editing">Which taken&nbsp;at the flood leads on to fortune.</div> <div class="editing">Omitted, all the voyage of their life,</div> <div class="editing">Is bound in shallows and in miseries.</div>
    73 execPasteCommand: <div id="test" class="editing">There&nbsp;is a tide in the affairs of men,</div><div class="editing">Which takenis a tide in the affairs of men,</div><div class="editing">Which taken&nbsp;at the flood leads on to fortune.</div> <div class="editing">Omitted, all the voyage of their life,</div> <div class="editing">Is bound in shallows and in miseries.</div>
     73execPasteCommand: <div id="test" class="editing">There is a tide in the affairs of men,</div><div class="editing">Which taken at the flood leads on to fortune.</div> <div class="editing">Omitted, all the voyage of their life,</div> <div class="editing">Is bound in shallows and in miseries.</div>
     74execPasteCommand: <div id="test" class="editing">There is a tide in the affairs of men,</div><div class="editing">Which takenis a tide in the affairs of men,</div><div class="editing">Which taken at the flood leads on to fortune.</div> <div class="editing">Omitted, all the voyage of their life,</div> <div class="editing">Is bound in shallows and in miseries.</div>
  • trunk/LayoutTests/editing/pasteboard/paste-text-003-expected.txt

    r96257 r130411  
    9797EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    9898EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    99 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 7 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 7 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 7 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     99EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 38 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 7 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 7 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    100100EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    101101EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    102102EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 7 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 7 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    103 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 7 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 7 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 7 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     103EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     104EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 39 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 39 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 7 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 7 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    104105EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    105106EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/editing/pasteboard/paste-text-010-expected.txt

    r93302 r130411  
    99|   <br>
    1010|   <br>
    11 |   "of men."
    12 |   "of men.<#selection-caret>"
     11|   "of men.of men.<#selection-caret>"
    1312| "
    1413"
  • trunk/LayoutTests/editing/pasteboard/paste-text-at-tabspan-001-expected.txt

    r96257 r130411  
    22EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    33EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    4 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     4EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > SPAN > DIV > BODY > HTML > #document to 2 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    66EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    7 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > SPAN > DIV > BODY > HTML > #document to 2 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     7EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > SPAN > DIV > BODY > HTML > #document to 2 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > SPAN > DIV > BODY > HTML > #document to 3 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    88EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    99EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    1515| <span>
    1616|   id="test"
    17 |   "a"
    18 |   "ax<#selection-caret>"
     17|   "aax<#selection-caret>"
    1918|   <span>
    2019|     class="Apple-tab-span"
  • trunk/LayoutTests/editing/pasteboard/paste-unrendered-select-expected.txt

    r87493 r130411  
    11This tests copy/paste of an unrendered select.  The options inside of it should not be pasted.
    2 | "Hello"
    3 | " "
     2| "Hello "
    43| "World<#selection-caret>"
  • trunk/LayoutTests/editing/pasteboard/smart-paste-001-expected.txt

    r87495 r130411  
    66EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    77EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    8 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     8EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 10 of #text > DIV > DIV > BODY > HTML > #document to 10 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    99EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1010EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    1414A space should be added between the preexisting word and the word that's pasted. It should like this:
    1515test test
    16 test test
     16test test
    1717execCopyCommand: <div id="test" class="editing"> test </div>
    18 execPasteCommand: <div id="test" class="editing"> test&nbsp;test</div>
     18execPasteCommand: <div id="test" class="editing"> test test</div>
  • trunk/LayoutTests/editing/pasteboard/smart-paste-002-expected.txt

    r87495 r130411  
    99EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    1010EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    11 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     11EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 9 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1313EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    1717A space should be added after the pasted word before the preexising word. It should like this:
    1818test test
    19 test test
     19test test
    2020execCopyCommand: <div id="test" class="editing"> test </div>
    21 execPasteCommand: <div id="test" class="editing">test&nbsp;test </div>
     21execPasteCommand: <div id="test" class="editing">test test </div>
  • trunk/LayoutTests/editing/pasteboard/smart-paste-003-expected.txt

    r96257 r130411  
    77EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    88EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    9 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     9EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 15 of #text > DIV > DIV > BODY > HTML > #document to 15 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 10 of #text > DIV > DIV > BODY > HTML > #document to 10 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1010EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1111EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    1515A space should be added between the preexisting word and the word that's pasted. No space should be added after the pasted word. It should like this:
    1616test test test
    17 test test test
     17test test test
    1818execCopyCommand: <div id="test" class="editing"> test test </div>
    19 execPasteCommand: <div id="test" class="editing"> test&nbsp;test&nbsp;test</div>
     19execPasteCommand: <div id="test" class="editing"> test test test</div>
  • trunk/LayoutTests/editing/pasteboard/smart-paste-004-expected.txt

    r96257 r130411  
    99EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1010EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    11 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 6 of #text > DIV > DIV > BODY > HTML > #document to 6 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     11EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 15 of #text > DIV > DIV > BODY > HTML > #document to 15 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 11 of #text > DIV > DIV > BODY > HTML > #document to 11 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1313EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    1717A space should be added after the pasted word before the other preexisting word. It should like this:
    1818test test test
    19 test test test
     19test test test
    2020execCopyCommand: <div id="test" class="editing"> test test </div>
    21 execPasteCommand: <div id="test" class="editing"> test&nbsp;test&nbsp;test</div>
     21execPasteCommand: <div id="test" class="editing"> test test test</div>
  • trunk/LayoutTests/editing/pasteboard/smart-paste-005-expected.txt

    r96257 r130411  
    1111EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 3 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    13 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 6 of #text > DIV > DIV > BODY > HTML > #document to 6 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     13EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV > DIV > BODY > HTML > #document to 11 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 9 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1414EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1515EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    1919Spaces should be added before and after the pasted word. It should look like this:
    2020te test st
    21 te test st
     21te test st
    2222execCopyCommand: <div id="test" class="editing"> test </div>
    23 execPasteCommand: <div id="test" class="editing"> te&nbsp;test&nbsp;st</div>
     23execPasteCommand: <div id="test" class="editing"> te test st</div>
  • trunk/LayoutTests/editing/pasteboard/smart-paste-006-expected.txt

    r96257 r130411  
    1717EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    1818EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    19 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > DIV > BODY > HTML > #document to 4 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     19EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 6 of #text > DIV > DIV > BODY > HTML > #document to 6 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    2020EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2121EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/fast/events/ondragenter-expected.txt

    r21687 r130411  
    11
    2 Success: Text
     2Success: Text
    33This automated layout test checks to see that ondragenter events are being sent.
  • trunk/LayoutTests/platform/mac/editing/deleting/delete-block-merge-contents-018-expected.txt

    r96264 r130411  
    88EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    99EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    10 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     10EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1111EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1212EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    2424        RenderBlock {DIV} at (0,0) size 784x112 [border: (2px solid #FF0000)]
    2525          RenderBlock (anonymous) at (14,14) size 756x28
    26             RenderText {#text} at (0,0) size 15x28
    27               text run at (0,0) width 15: "T"
    28             RenderText {#text} at (15,0) size 67x28
    29               text run at (15,0) width 67: "est OK"
     26            RenderText {#text} at (0,0) size 82x28
     27              text run at (0,0) width 82: "Test OK"
    3028          RenderBlock {DIV} at (14,42) size 756x56 [border: (2px solid #FF0000)]
    3129            RenderText {#text} at (14,14) size 111x28
  • trunk/LayoutTests/platform/mac/editing/deleting/delete-block-merge-contents-019-expected.txt

    r96264 r130411  
    77EDITING DELEGATE: shouldDeleteDOMRange:range from 3 of #text > DIV > DIV > BODY > HTML > #document to 2 of DIV > DIV > DIV > BODY > HTML > #document
    88EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    9 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 0 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     9EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1010EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1111EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    2020      RenderBlock {DIV} at (0,80) size 784x56
    2121        RenderBlock {DIV} at (0,0) size 784x56 [border: (2px solid #FF0000)]
    22           RenderText {#text} at (14,14) size 17x28
    23             text run at (14,14) width 17: "X"
    24           RenderText {#text} at (31,14) size 17x28
    25             text run at (31,14) width 17: "X"
     22          RenderText {#text} at (14,14) size 34x28
     23            text run at (14,14) width 34: "XX"
    2624          RenderText {#text} at (0,0) size 0x0
    2725caret: position 2 of child 0 {#text} of child 1 {DIV} of child 3 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/deleting/delete-block-merge-contents-020-expected.txt

    r96264 r130411  
    99EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1010EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    11 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 0 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     11EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1313EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    2222      RenderBlock {DIV} at (0,80) size 784x56
    2323        RenderBlock {DIV} at (0,0) size 784x56 [border: (2px solid #FF0000)]
    24           RenderText {#text} at (14,14) size 17x28
    25             text run at (14,14) width 17: "X"
    26           RenderText {#text} at (31,14) size 17x28
    27             text run at (31,14) width 17: "X"
     24          RenderText {#text} at (14,14) size 34x28
     25            text run at (14,14) width 34: "XX"
    2826          RenderText {#text} at (0,0) size 0x0
    2927caret: position 2 of child 0 {#text} of child 1 {DIV} of child 3 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/deleting/delete-block-merge-contents-021-expected.txt

    r96264 r130411  
    99EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1010EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    11 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     11EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1313EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    2525        RenderBlock {DIV} at (0,0) size 784x112 [border: (2px solid #FF0000)]
    2626          RenderBlock (anonymous) at (14,14) size 756x28
    27             RenderText {#text} at (0,0) size 17x28
    28               text run at (0,0) width 17: "X"
    29             RenderText {#text} at (17,0) size 17x28
    30               text run at (17,0) width 17: "X"
     27            RenderText {#text} at (0,0) size 34x28
     28              text run at (0,0) width 34: "XX"
    3129          RenderBlock {DIV} at (14,42) size 756x56 [border: (2px solid #FF0000)]
    3230            RenderText {#text} at (14,14) size 34x28
  • trunk/LayoutTests/platform/mac/editing/deleting/delete-block-merge-contents-022-expected.txt

    r96264 r130411  
    99EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1010EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    11 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     11EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > DIV > BODY > HTML > #document to 2 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1313EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    2525        RenderBlock {DIV} at (0,0) size 784x140 [border: (2px solid #FF0000)]
    2626          RenderBlock (anonymous) at (14,14) size 756x28
    27             RenderText {#text} at (0,0) size 17x28
    28               text run at (0,0) width 17: "X"
    29             RenderText {#text} at (17,0) size 17x28
    30               text run at (17,0) width 17: "X"
     27            RenderText {#text} at (0,0) size 34x28
     28              text run at (0,0) width 34: "XX"
    3129          RenderBlock {DIV} at (14,42) size 756x84 [border: (2px solid #008000)]
    3230            RenderBlock {DIV} at (14,14) size 728x56 [border: (2px solid #FFA500)]
  • trunk/LayoutTests/platform/mac/editing/deleting/merge-no-br-expected.txt

    r96264 r130411  
    1717      RenderBlock {DIV} at (8,52) size 768x176
    1818        RenderBlock {DIV} at (16,16) size 736x40 [border: (3px solid #FF0000)]
    19           RenderText {#text} at (11,11) size 27x18
    20             text run at (11,11) width 27: "One"
    21           RenderText {#text} at (38,11) size 30x18
    22             text run at (38,11) width 30: "Two"
     19          RenderText {#text} at (11,11) size 57x18
     20            text run at (11,11) width 57: "OneTwo"
    2321        RenderBlock {DIV} at (16,64) size 736x96 [border: (3px solid #008000)]
    2422          RenderBlock (anonymous) at (11,11) size 714x0
  • trunk/LayoutTests/platform/mac/editing/execCommand/find-after-replace-expected.txt

    r96264 r130411  
    99EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1010EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    11 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > BODY > HTML > #document to 3 of #text > BODY > HTML > #document toDOMRange:range from 3 of #text > BODY > HTML > #document to 3 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     11EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > BODY > HTML > #document to 3 of #text > BODY > HTML > #document toDOMRange:range from 7 of #text > BODY > HTML > #document to 7 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1313EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    2929            RenderBlock {HTML} at (0,0) size 300x150
    3030              RenderBody {BODY} at (8,8) size 284x134 [bgcolor=#FFFFE0]
    31                 RenderText {#text} at (0,0) size 31x18
    32                   text run at (0,0) width 31: "A B "
    33                 RenderText {#text} at (31,0) size 27x18
    34                   text run at (31,0) width 27: "A B"
     31                RenderText {#text} at (0,0) size 58x18
     32                  text run at (0,0) width 58: "A B A B"
    3533        RenderText {#text} at (0,0) size 0x0
    3634        RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/mac/editing/execCommand/paste-1-expected.txt

    r96264 r130411  
    1111EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    1212EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    13 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document toDOMRange:range from 3 of #text > BODY > HTML > #document to 3 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     13EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document toDOMRange:range from 11 of #text > BODY > HTML > #document to 11 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1414EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1515EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    3030            RenderBlock {HTML} at (0,0) size 300x150
    3131              RenderBody {BODY} at (8,8) size 284x134 [bgcolor=#FFFFE0]
    32                 RenderText {#text} at (0,0) size 49x18
    33                   text run at (0,0) width 49: "foo bar "
    34                 RenderText {#text} at (49,0) size 22x18
    35                   text run at (49,0) width 22: "baz"
     32                RenderText {#text} at (0,0) size 71x18
     33                  text run at (0,0) width 71: "foo bar baz"
    3634        RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/mac/editing/execCommand/paste-2-expected.txt

    r96264 r130411  
    1111EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    1212EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    13 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document toDOMRange:range from 3 of #text > BODY > HTML > #document to 3 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     13EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document toDOMRange:range from 11 of #text > BODY > HTML > #document to 11 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1414EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1515EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    3030            RenderBlock {HTML} at (0,0) size 300x150
    3131              RenderBody {BODY} at (8,8) size 284x134 [bgcolor=#FFFFE0]
    32                 RenderText {#text} at (0,0) size 49x18
    33                   text run at (0,0) width 49: "foo bar "
    34                 RenderText {#text} at (49,0) size 22x18
    35                   text run at (49,0) width 22: "baz"
     32                RenderText {#text} at (0,0) size 71x18
     33                  text run at (0,0) width 71: "foo bar baz"
    3634        RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/mac/editing/pasteboard/4944770-2-expected.txt

    r63291 r130411  
    1515              text run at (8,2) width 7: "1"
    1616      RenderBlock {DIV} at (0,74) size 784x22
    17         RenderText {#text} at (0,1) size 8x18
    18           text run at (0,1) width 8: "x"
    19         RenderText {#text} at (8,1) size 4x18
    20           text run at (8,1) width 4: " "
     17        RenderText {#text} at (0,1) size 12x18
     18          text run at (0,1) width 12: "x "
    2119        RenderMenuList {SELECT} at (14,2) size 38x18 [bgcolor=#FFFFFF]
    2220          RenderBlock (anonymous) at (0,0) size 38x18
     
    2725        RenderText {#text} at (58,1) size 8x18
    2826          text run at (58,1) width 8: "x"
    29 caret: position 1 of child 3 {#text} of child 4 {DIV} of body
     27caret: position 1 of child 2 {#text} of child 4 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/5006779-expected.txt

    r126704 r130411  
    2222          RenderText {#text} at (12,0) size 83x18
    2323            text run at (12,0) width 83: "Hello World."
    24 caret: position 2 of child 1 {#text} of child 2 {DIV} of body
     24caret: position 2 of child 0 {#text} of child 2 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/5028447-expected.txt

    r63403 r130411  
    44  RenderBlock {HTML} at (0,0) size 800x600
    55    RenderBody {BODY} at (8,8) size 784x584
    6       RenderText {#text} at (0,0) size 418x29
    7         text run at (0,0) width 418: "All the text here should be the same size. "
    8       RenderText {#text} at (418,0) size 784x58
    9         text run at (418,0) width 361: "All the text here should be the same"
     6      RenderText {#text} at (0,0) size 784x58
     7        text run at (0,0) width 779: "All the text here should be the same size. All the text here should be the same"
    108        text run at (779,0) width 5: " "
    119        text run at (0,29) width 45: "size."
    1210        text run at (45,29) width 6: " "
    1311      RenderText {#text} at (0,0) size 0x0
    14 caret: position 43 of child 1 {#text} of body
     12caret: position 87 of child 0 {#text} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/8145-3-expected.txt

    r96264 r130411  
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    6 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     6EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > DIV > BODY > HTML > #document to 4 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    77EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    88EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    2020      RenderBlock {DIV} at (0,70) size 784x56 [border: (1px solid #000000)]
    2121        RenderBlock {DIV} at (1,1) size 782x18
    22           RenderText {#text} at (0,0) size 5x18
    23             text run at (0,0) width 5: "f"
    24           RenderText {#text} at (5,0) size 20x18
    25             text run at (5,0) width 20: "bar"
     22          RenderText {#text} at (0,0) size 25x18
     23            text run at (0,0) width 25: "fbar"
    2624        RenderBlock (anonymous) at (1,19) size 782x18
    2725          RenderText {#text} at (0,0) size 22x18
  • trunk/LayoutTests/platform/mac/editing/pasteboard/drag-drop-modifies-page-expected.txt

    r96264 r130411  
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    55EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionDropped
    6 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 5 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     6EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > BODY > HTML > #document to 10 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    77EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    88EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    1717          text run at (0,18) width 86: "\"worldhello\"."
    1818      RenderBlock {DIV} at (0,52) size 784x18
    19         RenderText {#text} at (0,0) size 37x18
    20           text run at (0,0) width 37: "world"
    21         RenderText {#text} at (37,0) size 31x18
    22           text run at (37,0) width 31: "hello"
    23 selection start: position 0 of child 1 {#text} of child 3 {DIV} of body
    24 selection end:   position 5 of child 1 {#text} of child 3 {DIV} of body
     19        RenderText {#text} at (0,0) size 68x18
     20          text run at (0,0) width 68: "worldhello"
     21selection start: position 5 of child 0 {#text} of child 3 {DIV} of body
     22selection end:   position 10 of child 0 {#text} of child 3 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/emacs-ctrl-k-y-001-expected.txt

    r96264 r130411  
    1010EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1111EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    12 EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 13 of #text > DIV > DIV > BODY > HTML > #document
     12EDITING DELEGATE: shouldDeleteDOMRange:range from 8 of #text > DIV > DIV > BODY > HTML > #document to 21 of #text > DIV > DIV > BODY > HTML > #document
    1313EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1414EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    1616EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1717EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    18 EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 16 of #text > DIV > DIV > BODY > HTML > #document
     18EDITING DELEGATE: shouldDeleteDOMRange:range from 8 of #text > DIV > DIV > BODY > HTML > #document to 24 of #text > DIV > DIV > BODY > HTML > #document
    1919EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2020EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
  • trunk/LayoutTests/platform/mac/editing/pasteboard/merge-end-borders-expected.txt

    r96264 r130411  
    88EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    99EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    10 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > DIV > BODY > HTML > #document to 4 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     10EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > BODY > HTML > #document to 47 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > DIV > BODY > HTML > #document to 4 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1111EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1212EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    2929      RenderBlock {DIV} at (0,104) size 784x38
    3030        RenderBlock (anonymous) at (0,0) size 784x18
    31           RenderText {#text} at (0,0) size 32x18
    32             text run at (0,0) width 32: "First "
    33           RenderText {#text} at (32,0) size 63x18
    34             text run at (32,0) width 63: "paragraph"
     31          RenderText {#text} at (0,0) size 95x18
     32            text run at (0,0) width 95: "First paragraph"
    3533        RenderBlock {DIV} at (0,18) size 784x20 [border: (1px solid #FF0000)]
    36           RenderText {#text} at (1,1) size 28x18
    37             text run at (1,1) width 28: "This"
    38           RenderText {#text} at (29,1) size 271x18
    39             text run at (29,1) width 271: " text should be surrounded by a red border."
    40 caret: position 4 of child 0 {#text} of child 2 {DIV} of child 3 {DIV} of body
     34          RenderText {#text} at (1,1) size 299x18
     35            text run at (1,1) width 299: "This text should be surrounded by a red border."
     36caret: position 4 of child 0 {#text} of child 1 {DIV} of child 3 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/paste-line-endings-007-expected.txt

    r80121 r130411  
    1414EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 9 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    1515EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    16 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     16EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > BODY > HTML > #document to 8 of #text > DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1717EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1818EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    5050            RenderBR {BR} at (78,22) size 0x0
    5151          RenderBlock {DIV} at (2,30) size 780x28
    52             RenderText {#text} at (0,0) size 7x28
    53               text run at (0,0) width 7: "l"
    54             RenderText {#text} at (7,0) size 72x28
    55               text run at (7,0) width 72: "ine two"
     52            RenderText {#text} at (0,0) size 79x28
     53              text run at (0,0) width 79: "line two"
    5654caret: position 1 of child 0 {#text} of child 2 {DIV} of child 1 {DIV} of child 3 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/paste-line-endings-008-expected.txt

    r80121 r130411  
    1414EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 8 of #text > DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    1515EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    16 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     16EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > DIV > DIV > DIV > BODY > HTML > #document to 8 of #text > DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1717EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1818EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    5050          RenderBlock (anonymous) at (2,30) size 780x0
    5151          RenderBlock {DIV} at (2,30) size 780x28
    52             RenderText {#text} at (0,0) size 7x28
    53               text run at (0,0) width 7: "l"
    54             RenderText {#text} at (7,0) size 72x28
    55               text run at (7,0) width 72: "ine two"
     52            RenderText {#text} at (0,0) size 79x28
     53              text run at (0,0) width 79: "line two"
    5654caret: position 1 of child 0 {#text} of child 2 {DIV} of child 1 {DIV} of child 3 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/paste-line-endings-009-expected.txt

    r80121 r130411  
    1414EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 8 of #text > DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    1515EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    16 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     16EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > DIV > BODY > HTML > #document to 8 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1717EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1818EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    5151              RenderBR {BR} at (78,22) size 0x0
    5252            RenderBlock {DIV} at (0,28) size 780x28
    53               RenderText {#text} at (0,0) size 7x28
    54                 text run at (0,0) width 7: "l"
    55               RenderText {#text} at (7,0) size 72x28
    56                 text run at (7,0) width 72: "ine two"
     53              RenderText {#text} at (0,0) size 79x28
     54                text run at (0,0) width 79: "line two"
    5755caret: position 1 of child 0 {#text} of child 2 {DIV} of child 1 {DIV} of child 1 {DIV} of child 3 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/paste-line-endings-010-expected.txt

    r80121 r130411  
    1414EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 8 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    1515EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    16 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     16EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 8 of #text > DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1717EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1818EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    5050                text run at (0,0) width 78: "line one"
    5151            RenderBlock (anonymous) at (0,28) size 780x28
    52               RenderText {#text} at (0,0) size 7x28
    53                 text run at (0,0) width 7: "l"
    54               RenderText {#text} at (7,0) size 72x28
    55                 text run at (7,0) width 72: "ine two"
     52              RenderText {#text} at (0,0) size 79x28
     53                text run at (0,0) width 79: "line two"
    5654caret: position 1 of child 1 {#text} of child 1 {DIV} of child 1 {DIV} of child 3 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/paste-match-style-001-expected.txt

    r96870 r130411  
    1212EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    1313EDITING DELEGATE: shouldInsertText:b replacingDOMRange:range from 1 of #text > B > DIV > DIV > BODY > HTML > #document to 1 of #text > B > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    14 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > B > DIV > DIV > BODY > HTML > #document to 1 of #text > B > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     14EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > B > DIV > DIV > BODY > HTML > #document to 2 of #text > B > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1515EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1616EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    4242        RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
    4343          RenderInline {B} at (0,0) size 25x28
    44             RenderText {#text} at (2,2) size 12x28
    45               text run at (2,2) width 12: "a"
    46             RenderText {#text} at (14,2) size 13x28
    47               text run at (14,2) width 13: "b"
     44            RenderText {#text} at (2,2) size 25x28
     45              text run at (2,2) width 25: "ab"
    4846        RenderBlock (anonymous) at (0,32) size 784x0
    4947          RenderText {#text} at (0,0) size 0x0
    50 caret: position 1 of child 1 {#text} of child 0 {B} of child 1 {DIV} of child 3 {DIV} of body
     48caret: position 2 of child 0 {#text} of child 0 {B} of child 1 {DIV} of child 3 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/paste-text-004-expected.txt

    r96264 r130411  
    5252    RenderBody {BODY} at (8,8) size 784x584
    5353      RenderBlock {DIV} at (0,0) size 784x56 [border: (2px solid #FF0000)]
    54         RenderText {#text} at (14,14) size 63x28
    55           text run at (14,14) width 63: "There "
    56         RenderText {#text} at (77,14) size 285x28
    57           text run at (77,14) width 285: "is a tide in the affairs of men,"
     54        RenderText {#text} at (14,14) size 348x28
     55          text run at (14,14) width 348: "There is a tide in the affairs of men,"
    5856      RenderBlock {DIV} at (0,56) size 784x56 [border: (2px solid #FF0000)]
    5957        RenderText {#text} at (14,14) size 434x28
  • trunk/LayoutTests/platform/mac/editing/pasteboard/paste-text-005-expected.txt

    r96264 r130411  
    5555    RenderBody {BODY} at (8,8) size 784x584
    5656      RenderBlock {DIV} at (0,0) size 784x56 [border: (2px solid #FF0000)]
    57         RenderText {#text} at (14,14) size 63x28
    58           text run at (14,14) width 63: "There "
    59         RenderText {#text} at (77,14) size 285x28
    60           text run at (77,14) width 285: "is a tide in the affairs of men,"
     57        RenderText {#text} at (14,14) size 348x28
     58          text run at (14,14) width 348: "There is a tide in the affairs of men,"
    6159      RenderBlock {DIV} at (0,56) size 784x56 [border: (2px solid #FF0000)]
    6260        RenderText {#text} at (14,14) size 285x28
  • trunk/LayoutTests/platform/mac/editing/pasteboard/paste-text-008-expected.txt

    r96264 r130411  
    119119            text run at (0,0) width 351: "Omitted, all the voyage of their life,"
    120120        RenderBlock {DIV} at (14,42) size 756x56 [border: (2px solid #FF0000)]
    121           RenderText {#text} at (14,14) size 114x28
    122             text run at (14,14) width 114: "Is bound in "
    123           RenderText {#text} at (128,14) size 243x28
    124             text run at (128,14) width 243: "shallows and in miseries."
     121          RenderText {#text} at (14,14) size 357x28
     122            text run at (14,14) width 357: "Is bound in shallows and in miseries."
    125123        RenderBlock (anonymous) at (14,98) size 756x28
    126           RenderText {#text} at (0,0) size 197x28
    127             text run at (0,0) width 197: "Upon such a full sea"
    128           RenderText {#text} at (197,0) size 243x28
    129             text run at (197,0) width 243: "shallows and in miseries."
     124          RenderText {#text} at (0,0) size 440x28
     125            text run at (0,0) width 440: "Upon such a full seashallows and in miseries."
    130126      RenderBlock (anonymous) at (0,140) size 784x0
    131127      RenderBlock {DIV} at (0,140) size 784x56 [border: (2px solid #FF0000)]
    132         RenderText {#text} at (14,14) size 197x28
    133           text run at (14,14) width 197: "Upon such a full sea"
    134         RenderText {#text} at (211,14) size 185x28
    135           text run at (211,14) width 185: " are we now afloat,"
     128        RenderText {#text} at (14,14) size 382x28
     129          text run at (14,14) width 382: "Upon such a full sea are we now afloat,"
    136130caret: position 20 of child 0 {#text} of child 2 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/paste-text-009-expected.txt

    r80121 r130411  
    8282EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 37 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    8383EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    84 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 37 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     84EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 37 of #text > DIV > DIV > BODY > HTML > #document to 39 of #text > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    8585EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    8686EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    8787EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
     88EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    8889EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    8990EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     
    106107      RenderBlock (anonymous) at (0,140) size 784x0
    107108      RenderBlock {DIV} at (0,140) size 784x56 [border: (2px solid #FF0000)]
    108         RenderText {#text} at (14,14) size 17x28
    109           text run at (14,14) width 17: "U"
    110         RenderText {#text} at (31,14) size 365x28
    111           text run at (31,14) width 365: "pon such a full sea are we now afloat,"
     109        RenderText {#text} at (14,14) size 382x28
     110          text run at (14,14) width 382: "Upon such a full sea are we now afloat,"
    112111caret: position 1 of child 0 {#text} of child 2 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/smart-drag-drop-expected.txt

    r96264 r130411  
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    66EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionDropped
    7 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     7EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    88EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    99EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    1818          text run at (0,18) width 434: "test manually double click on the \"hello\" and drag it to after \"world\"."
    1919      RenderBlock {DIV} at (0,52) size 784x18
    20         RenderText {#text} at (0,0) size 37x18
    21           text run at (0,0) width 37: "world"
    22         RenderText {#text} at (37,0) size 35x18
    23           text run at (37,0) width 35: " hello"
    24 selection start: position 0 of child 1 {#text} of child 3 {DIV} of body
    25 selection end:   position 6 of child 1 {#text} of child 3 {DIV} of body
     20        RenderText {#text} at (0,0) size 72x18
     21          text run at (0,0) width 72: "world hello"
     22selection start: position 5 of child 0 {#text} of child 3 {DIV} of body
     23selection end:   position 11 of child 0 {#text} of child 3 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/smart-paste-007-expected.txt

    r96264 r130411  
    1818EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    1919EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    20 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     20EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > DIV > DIV > BODY > HTML > #document to 7 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 6 of #text > DIV > DIV > BODY > HTML > #document to 6 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    2121EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2222EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    4545      RenderBlock {DIV} at (0,236) size 784x32
    4646        RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
    47           RenderText {#text} at (2,2) size 6x28
    48             text run at (2,2) width 6: "."
    49           RenderText {#text} at (8,2) size 40x28
    50             text run at (8,2) width 40: " test"
    51           RenderText {#text} at (48,2) size 6x28
    52             text run at (48,2) width 6: "."
     47          RenderText {#text} at (2,2) size 52x28
     48            text run at (2,2) width 52: ". test."
    5349        RenderBlock (anonymous) at (0,32) size 784x0
    54 caret: position 5 of child 1 {#text} of child 1 {DIV} of child 3 {DIV} of body
     50caret: position 6 of child 0 {#text} of child 1 {DIV} of child 3 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/smart-paste-008-expected.txt

    r96264 r130411  
    1111EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    13 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > DIV > BODY > HTML > #document to 4 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     13EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1414EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1515EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    3131      RenderBlock {DIV} at (0,104) size 784x18
    3232        RenderBlock {DIV} at (0,0) size 784x18
    33           RenderText {#text} at (0,0) size 5x18
    34             text run at (0,0) width 5: "f"
    35           RenderText {#text} at (5,0) size 25x18
    36             text run at (5,0) width 25: " foo"
    37           RenderText {#text} at (30,0) size 24x18
    38             text run at (30,0) width 24: " bar"
     33          RenderText {#text} at (0,0) size 54x18
     34            text run at (0,0) width 54: "f foo bar"
    3935        RenderBlock (anonymous) at (0,18) size 784x0
    40 caret: position 4 of child 1 {#text} of child 0 {DIV} of child 4 {DIV} of body
     36caret: position 5 of child 0 {#text} of child 0 {DIV} of child 4 {DIV} of body
  • trunk/LayoutTests/platform/mac/editing/pasteboard/subframe-dragndrop-1-expected.txt

    r96264 r130411  
    1111EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 11 of #text > BODY > HTML > #document to 11 of #text > BODY > HTML > #document givenAction:WebViewInsertActionDropped
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    13 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > BODY > HTML > #document to 3 of #text > BODY > HTML > #document toDOMRange:range from 0 of #text > BODY > HTML > #document to 4 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     13EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > BODY > HTML > #document to 3 of #text > BODY > HTML > #document toDOMRange:range from 7 of #text > BODY > HTML > #document to 11 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1414EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1515EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    2626            RenderBlock {HTML} at (0,0) size 300x300
    2727              RenderBody {BODY} at (8,8) size 284x284 [bgcolor=#FFFFE0]
    28                 RenderText {#text} at (0,0) size 47x18
    29                   text run at (0,0) width 47: "foo baz"
    30                 RenderText {#text} at (47,0) size 24x18
    31                   text run at (47,0) width 24: " bar"
     28                RenderText {#text} at (0,0) size 71x18
     29                  text run at (0,0) width 71: "foo baz bar"
    3230        RenderText {#text} at (0,0) size 0x0
    3331      RenderBlock {P} at (0,320) size 800x36
  • trunk/LayoutTests/platform/mac/editing/pasteboard/unrendered-br-expected.txt

    r63291 r130411  
    1717      RenderBlock {DIV} at (0,52) size 784x36
    1818        RenderBlock (anonymous) at (0,0) size 784x18
    19           RenderText {#text} at (0,0) size 32x18
    20             text run at (0,0) width 32: "First "
    21           RenderText {#text} at (32,0) size 67x18
    22             text run at (32,0) width 67: "paragraph."
     19          RenderText {#text} at (0,0) size 99x18
     20            text run at (0,0) width 99: "First paragraph."
    2321        RenderBlock {DIV} at (0,18) size 784x18
    2422          RenderText {#text} at (0,0) size 118x18
    2523            text run at (0,0) width 118: "Second paragraph."
    2624        RenderBlock (anonymous) at (0,36) size 784x0
    27 caret: position 17 of child 0 {#text} of child 2 {DIV} of child 2 {DIV} of body
     25caret: position 17 of child 0 {#text} of child 1 {DIV} of child 2 {DIV} of body
  • trunk/LayoutTests/platform/mac/fast/lists/drag-into-marker-expected.txt

    r63291 r130411  
    77        RenderListItem {LI} at (41,1) size 710x55
    88          RenderListMarker at (-36,0) size 16x55: black square
    9           RenderText {#text} at (0,0) size 124x55
    10             text run at (0,0) width 124: "world "
    11           RenderText {#text} at (124,0) size 95x55
    12             text run at (124,0) width 95: "hello"
     9          RenderText {#text} at (0,0) size 219x55
     10            text run at (0,0) width 219: "world hello"
    1311      RenderBlock {P} at (0,73) size 784x72
    1412        RenderText {#text} at (0,0) size 768x72
  • trunk/Source/WebCore/ChangeLog

    r130409 r130411  
     12012-10-03  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        ReplaceSelectionCommand should merge text nodes
     4        https://bugs.webkit.org/show_bug.cgi?id=98188
     5
     6        Reviewed by Levi Weintraub.
     7
     8        Added mergeTextNodesAroundPosition to ReplaceSelectionCommand to merge text nodes after the replace in
     9        completeHTMLReplacement. Also fixed a bunch of bugs in other classes and functions to make this work.
     10
     11        This behavior change is tested by existing tests.
     12
     13        * editing/InsertParagraphSeparatorCommand.cpp:
     14        (WebCore::InsertParagraphSeparatorCommand::doApply): When splitting a text node, place the insertionPosition
     15        at the end of the first half. Leaving it at the beginning of the second half confuses the rest of the code in
     16        the function. However, the logic to handle the "insignificant" white spaces needs the position at the start of
     17        the second half. So keep this position.
     18        * editing/ReplaceSelectionCommand.cpp:
     19        (WebCore::ReplaceSelectionCommand::doApply): Update visibleStart after inserting a paragraph separator so that
     20        the logic to cleanup the nested div checks the right condition (right beneath it starting with a long comment).
     21        (WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace): Insert a space for smart paste at the appropriate
     22        offset instead of at the end of endNode. Also update the layout before obtaining startDownstream as we may have
     23        modified the DOM by inserting a space for endNode. Finally, a non-breaking space should be treated like a space
     24        isCharacterSmartReplaceExempt for the purpose of smart replace. e.g. if we're inserting "world" after
     25        "hello&nbsp;", we shouldn't be inserting another space between "hello" and "world".
     26        (WebCore::ReplaceSelectionCommand::completeHTMLReplacement):
     27        (WebCore::ReplaceSelectionCommand::mergeTextNodesAroundPosition): Added. Merge text nodes around position, and
     28        adjust position and positionOnlyToBeUpdated accordingly. We need to call updatePositionForNodeRemoval when
     29        positions were before or after the text node.
     30        * editing/ReplaceSelectionCommand.h:
     31        (ReplaceSelectionCommand):
     32
    1332012-10-04  Tony Chang  <tony@chromium.org>
    234
  • trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp

    r119870 r130411  
    148148void InsertParagraphSeparatorCommand::doApply()
    149149{
    150     bool splitText = false;
    151150    if (!endingSelection().isNonOrphanedCaretOrRange())
    152151        return;
     
    330329   
    331330    // Split at pos if in the middle of a text node.
    332     if (insertionPosition.deprecatedNode()->isTextNode()) {
    333         Text* textNode = toText(insertionPosition.deprecatedNode());
    334         bool atEnd = (unsigned)insertionPosition.deprecatedEditingOffset() >= textNode->length();
     331    Position positionAfterSplit;
     332    if (insertionPosition.anchorType() == Position::PositionIsOffsetInAnchor && insertionPosition.containerNode()->isTextNode()) {
     333        RefPtr<Text> textNode = toText(insertionPosition.containerNode());
     334        bool atEnd = static_cast<unsigned>(insertionPosition.offsetInContainerNode()) >= textNode->length();
    335335        if (insertionPosition.deprecatedEditingOffset() > 0 && !atEnd) {
    336             splitTextNode(textNode, insertionPosition.deprecatedEditingOffset());
    337             insertionPosition.moveToOffset(0);
     336            splitTextNode(textNode, insertionPosition.offsetInContainerNode());
     337            positionAfterSplit = firstPositionInNode(textNode.get());
     338            insertionPosition.moveToPosition(textNode->previousSibling(), insertionPosition.offsetInContainerNode());
    338339            visiblePos = VisiblePosition(insertionPosition);
    339             splitText = true;
    340340        }
    341341    }
     
    381381
    382382    // Handle whitespace that occurs after the split
    383     if (splitText) {
     383    if (positionAfterSplit.isNotNull()) {
    384384        document()->updateLayoutIgnorePendingStylesheets();
    385         if (insertionPosition.anchorType() == Position::PositionIsOffsetInAnchor)
    386             insertionPosition.moveToOffset(0);
    387         if (!insertionPosition.isRenderedCharacter()) {
     385        if (!positionAfterSplit.isRenderedCharacter()) {
    388386            // Clear out all whitespace and insert one non-breaking space
    389             ASSERT(!insertionPosition.deprecatedNode()->renderer() || insertionPosition.deprecatedNode()->renderer()->style()->collapseWhiteSpace());
    390             deleteInsignificantTextDownstream(insertionPosition);
    391             if (insertionPosition.deprecatedNode()->isTextNode())
    392                 insertTextIntoNode(toText(insertionPosition.deprecatedNode()), 0, nonBreakingSpaceString());
     387            ASSERT(!positionAfterSplit.containerNode()->renderer() || positionAfterSplit.containerNode()->renderer()->style()->collapseWhiteSpace());
     388            deleteInsignificantTextDownstream(positionAfterSplit);
     389            if (positionAfterSplit.deprecatedNode()->isTextNode())
     390                insertTextIntoNode(toText(positionAfterSplit.containerNode()), 0, nonBreakingSpaceString());
    393391        }
    394392    }
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp

    r121357 r130411  
    838838            if (isEndOfParagraph(visibleStart) && !isStartOfParagraph(visibleStart) && next.isNotNull())
    839839                setEndingSelection(next);
    840             else
     840            else  {
    841841                insertParagraphSeparator();
     842                visibleStart = endingSelection().visibleStart();
     843            }
    842844        }
    843845        // We split the current paragraph in two to avoid nesting the blocks from the fragment inside the current block.
     
    11411143}
    11421144
     1145static bool isCharacterSmartReplaceExemptConsideringNonBreakingSpace(UChar32 character, bool previousCharacter)
     1146{
     1147    return isCharacterSmartReplaceExempt(character == noBreakSpace ? ' ' : character, previousCharacter);
     1148}
     1149
    11431150void ReplaceSelectionCommand::addSpacesForSmartReplace()
    11441151{
     
    11481155    Position endUpstream = endOfInsertedContent.deepEquivalent().upstream();
    11491156    Node* endNode = endUpstream.computeNodeBeforePosition();
    1150     if (endUpstream.anchorType() == Position::PositionIsOffsetInAnchor)
     1157    int endOffset = endNode && endNode->isTextNode() ? toText(endNode)->length() : 0;
     1158    if (endUpstream.anchorType() == Position::PositionIsOffsetInAnchor) {
    11511159        endNode = endUpstream.containerNode();
    1152 
    1153     bool needsTrailingSpace = !isEndOfParagraph(endOfInsertedContent) && !isCharacterSmartReplaceExempt(endOfInsertedContent.characterAfter(), false);
     1160        endOffset = endUpstream.offsetInContainerNode();
     1161    }
     1162
     1163    bool needsTrailingSpace = !isEndOfParagraph(endOfInsertedContent) && !isCharacterSmartReplaceExemptConsideringNonBreakingSpace(endOfInsertedContent.characterAfter(), false);
    11541164    if (needsTrailingSpace && endNode) {
    11551165        bool collapseWhiteSpace = !endNode->renderer() || endNode->renderer()->style()->collapseWhiteSpace();
    11561166        if (endNode->isTextNode()) {
    1157             Text* text = toText(endNode);
    1158             // FIXME: we shouldn't always be inserting the space at the end
    1159             insertTextIntoNode(text, text->length(), collapseWhiteSpace ? nonBreakingSpaceString() : " ");
    1160             if (m_endOfInsertedContent.containerNode() == text)
     1167            insertTextIntoNode(toText(endNode), endOffset, collapseWhiteSpace ? nonBreakingSpaceString() : " ");
     1168            if (m_endOfInsertedContent.containerNode() == endNode)
    11611169                m_endOfInsertedContent.moveToOffset(m_endOfInsertedContent.offsetInContainerNode() + 1);
    11621170        } else {
     
    11661174        }
    11671175    }
     1176
     1177    document()->updateLayout();
    11681178
    11691179    Position startDownstream = startOfInsertedContent.deepEquivalent().downstream();
     
    11751185    }
    11761186
    1177     bool needsLeadingSpace = !isStartOfParagraph(startOfInsertedContent) && !isCharacterSmartReplaceExempt(startOfInsertedContent.previous().characterAfter(), true);
     1187    bool needsLeadingSpace = !isStartOfParagraph(startOfInsertedContent) && !isCharacterSmartReplaceExemptConsideringNonBreakingSpace(startOfInsertedContent.previous().characterAfter(), true);
    11781188    if (needsLeadingSpace && startNode) {
    11791189        bool collapseWhiteSpace = !startNode->renderer() || startNode->renderer()->style()->collapseWhiteSpace();
     
    12061216            ASSERT(m_insertionStyle);
    12071217            applyStyle(m_insertionStyle.get(), start, end);
    1208         }   
     1218        }
    12091219
    12101220        if (lastPositionToSelect.isNotNull())
    12111221            end = lastPositionToSelect;
     1222
     1223        mergeTextNodesAroundPosition(start, end);
    12121224    } else if (lastPositionToSelect.isNotNull())
    12131225        start = end = lastPositionToSelect;
     
    12191231    else
    12201232        setEndingSelection(VisibleSelection(end, SEL_DEFAULT_AFFINITY, endingSelection().isDirectional()));
     1233}
     1234
     1235void ReplaceSelectionCommand::mergeTextNodesAroundPosition(Position& position, Position& positionOnlyToBeUpdated)
     1236{
     1237    bool positionIsOffsetInAnchor = position.anchorType() == Position::PositionIsOffsetInAnchor;
     1238    bool positionOnlyToBeUpdatedIsOffsetInAnchor = positionOnlyToBeUpdated.anchorType() == Position::PositionIsOffsetInAnchor;
     1239    RefPtr<Text> text = 0;
     1240    if (positionIsOffsetInAnchor && position.containerNode() && position.containerNode()->isTextNode())
     1241        text = toText(position.containerNode());
     1242    else {
     1243        Node* before = position.computeNodeBeforePosition();
     1244        if (before && before->isTextNode())
     1245            text = toText(before);
     1246        else {
     1247            Node* after = position.computeNodeAfterPosition();
     1248            if (after && after->isTextNode())
     1249                text = toText(after);
     1250        }
     1251    }
     1252    if (!text)
     1253        return;
     1254
     1255    if (text->previousSibling() && text->previousSibling()->isTextNode()) {
     1256        Text* previous = toText(text->previousSibling());
     1257        insertTextIntoNode(text, 0, previous->data());
     1258
     1259        if (positionIsOffsetInAnchor)
     1260            position.moveToOffset(previous->length() + position.offsetInContainerNode());
     1261        else
     1262            updatePositionForNodeRemoval(position, previous);
     1263
     1264        if (positionOnlyToBeUpdatedIsOffsetInAnchor) {
     1265            if (positionOnlyToBeUpdated.containerNode() == text)
     1266                positionOnlyToBeUpdated.moveToOffset(previous->length() + position.offsetInContainerNode());
     1267            else if (positionOnlyToBeUpdated.containerNode() == previous)
     1268                positionOnlyToBeUpdated.moveToPosition(text, position.offsetInContainerNode());
     1269        } else
     1270            updatePositionForNodeRemoval(positionOnlyToBeUpdated, previous);
     1271
     1272        removeNode(previous);
     1273    }
     1274    if (text->nextSibling() && text->nextSibling()->isTextNode()) {
     1275        Text* next = toText(text->nextSibling());
     1276        insertTextIntoNode(text, text->length(), next->data());
     1277
     1278        if (!positionIsOffsetInAnchor)
     1279            updatePositionForNodeRemoval(position, next);
     1280
     1281        if (positionOnlyToBeUpdatedIsOffsetInAnchor && positionOnlyToBeUpdated.containerNode() == next)
     1282            positionOnlyToBeUpdated.moveToPosition(text, text->length() + position.offsetInContainerNode());
     1283        else
     1284            updatePositionForNodeRemoval(positionOnlyToBeUpdated, next);
     1285
     1286        removeNode(next);
     1287    }
    12211288}
    12221289
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.h

    r118192 r130411  
    9696    void addSpacesForSmartReplace();
    9797    void completeHTMLReplacement(const Position& lastPositionToSelect);
     98    void mergeTextNodesAroundPosition(Position&, Position& positionOnlyToBeUpdated);
    9899
    99100    bool performTrivialReplace(const ReplacementFragment&);
Note: See TracChangeset for help on using the changeset viewer.