Changeset 55762 in webkit
- Timestamp:
- Mar 9, 2010 9:32:21 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r55756 r55762 1 2010-03-09 Tony Chang <tony@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 https://bugs.webkit.org/show_bug.cgi?id=21840 6 https://bugs.webkit.org/show_bug.cgi?id=23993 7 8 Fix an editing bug where replacing a selection would result in the 9 new text ending up inside nodes that were not visibly included in the 10 selection. Instead, move our destination position out of nodes that 11 were not visibly included. 12 13 Two new tests to verify the new behavior. Because we're now inserting 14 outside of some formatting nodes, some span tags are no longer necessary 15 for undoing formatting caused by these formatting nodes. 16 17 * editing/deleting/backspace-avoid-preceding-style-expected.txt: Added. 18 * editing/deleting/backspace-avoid-preceding-style.html: Added. 19 * editing/inserting/replace-at-visible-boundary-expected.txt: Added. 20 * editing/inserting/replace-at-visible-boundary.html: Added. 21 * platform/mac/editing/deleting/delete-3857753-fix-expected.txt: 22 * platform/mac/editing/inserting/insert-div-026-expected.txt: 23 * platform/mac/editing/pasteboard/paste-text-at-tabspan-001-expected.txt: 24 * platform/mac/editing/pasteboard/paste-text-at-tabspan-002-expected.txt: 25 * platform/mac/editing/style/font-family-with-space-expected.txt: 26 * platform/mac/editing/style/smoosh-styles-001-expected.txt: 27 * platform/mac/editing/style/style-boundary-005-expected.txt: 28 1 29 2010-03-09 Csaba Osztrogonác <ossy@webkit.org> 2 30 -
trunk/LayoutTests/platform/mac/editing/deleting/delete-3857753-fix-expected.txt
r46446 r55762 19 19 RenderBody {BODY} at (8,8) size 784x584 [border: (2px solid #FF0000)] 20 20 RenderBlock {DIV} at (14,14) size 756x28 21 RenderInline {B} at (0,0) size 37x2821 RenderInline {B} at (0,0) size 25x28 22 22 RenderText {#text} at (0,0) size 25x28 23 23 text run at (0,0) width 25: "on" 24 RenderInline {SPAN} at (0,0) size 12x28 25 RenderInline {I} at (0,0) size 12x28 26 RenderText {#text} at (25,0) size 12x28 27 text run at (25,0) width 12: "o" 24 RenderInline {I} at (0,0) size 12x28 25 RenderText {#text} at (25,0) size 12x28 26 text run at (25,0) width 12: "o" 28 27 RenderBlock {DIV} at (14,42) size 756x28 29 28 RenderInline {B} at (0,0) size 54x28 -
trunk/LayoutTests/platform/mac/editing/inserting/insert-div-026-expected.txt
r25970 r55762 53 53 RenderBlock {DIV} at (0,236) size 784x32 54 54 RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)] 55 RenderInline {B} at (0,0) size 32x2855 RenderInline {B} at (0,0) size 20x28 56 56 RenderText {#text} at (2,2) size 20x28 57 57 text run at (2,2) width 20: "fo" 58 RenderInline {SPAN} at (0,0) size 12x28 59 RenderText {#text} at (22,2) size 12x28 60 text run at (22,2) width 12: "x" 58 RenderText {#text} at (22,2) size 12x28 59 text run at (22,2) width 12: "x" 61 60 caret: position 3 of child 0 {#text} of child 0 {B} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/platform/mac/editing/pasteboard/paste-text-at-tabspan-001-expected.txt
r25970 r55762 5 5 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 6 6 EDITING 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 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 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text> SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE7 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 > SPAN > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > SPAN > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 8 8 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 9 9 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification 10 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:FALSE10 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > SPAN > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > SPAN > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > SPAN > SPAN > SPAN > DIV > BODY > HTML > #document to 2 of #text > SPAN > SPAN > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 11 11 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 12 12 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 20 20 RenderText {#text} at (14,14) size 11x28 21 21 text run at (14,14) width 11: "a" 22 RenderText {#text} at (25,14) size 23x28 23 text run at (25,14) width 23: "ax" 24 RenderInline {SPAN} at (0,0) size 110x28 22 RenderInline {SPAN} at (0,0) size 133x28 23 RenderInline {SPAN} at (0,0) size 23x28 24 RenderText {#text} at (25,14) size 23x28 25 text run at (25,14) width 23: "ax" 25 26 RenderText {#text} at (48,14) size 110x28 26 27 text run at (48,14) width 110: "\x{9}\x{9}\x{9}" … … 28 29 text run at (158,14) width 11: "z" 29 30 RenderText {#text} at (0,0) size 0x0 30 caret: position 2 of child 1 {#text} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document31 caret: position 2 of child 0 {#text} of child 0 {SPAN} of child 1 {SPAN} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/platform/mac/editing/pasteboard/paste-text-at-tabspan-002-expected.txt
r25970 r55762 6 6 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 7 7 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 1 of #text > SPAN > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > SPAN > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted 8 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > 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:FALSE8 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > SPAN > SPAN > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > SPAN > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 9 9 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 10 10 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification 11 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:FALSE11 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > SPAN > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > SPAN > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > SPAN > SPAN > SPAN > DIV > BODY > HTML > #document to 2 of #text > SPAN > SPAN > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 12 12 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 13 13 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 24 24 RenderText {#text} at (25,14) size 37x28 25 25 text run at (25,14) width 37: "\x{9}" 26 RenderText {#text} at (62,14) size 23x28 27 text run at (62,14) width 23: "ax" 28 RenderInline {SPAN} at (0,0) size 73x28 26 RenderInline {SPAN} at (0,0) size 96x28 27 RenderInline {SPAN} at (0,0) size 23x28 28 RenderText {#text} at (62,14) size 23x28 29 text run at (62,14) width 23: "ax" 29 30 RenderText {#text} at (85,14) size 73x28 30 31 text run at (85,14) width 73: "\x{9}\x{9}" … … 32 33 text run at (158,14) width 11: "z" 33 34 RenderText {#text} at (0,0) size 0x0 34 caret: position 2 of child 2 {#text} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document35 caret: position 2 of child 0 {#text} of child 0 {SPAN} of child 2 {SPAN} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/platform/mac/editing/style/font-family-with-space-expected.txt
r47640 r55762 4 4 RenderBlock {HTML} at (0,0) size 800x600 5 5 RenderBody {BODY} at (8,8) size 784x584 6 RenderInline {U} at (0,0) size 490x156 RenderInline {U} at (0,0) size 245x15 7 7 RenderText {#text} at (0,0) size 245x15 8 8 text run at (0,0) width 245: "This text should be Times New Roman bold." 9 RenderInline {SPAN} at (0,0) size 245x15 10 RenderInline {U} at (0,0) size 245x15 11 RenderText {#text} at (245,0) size 245x15 12 text run at (245,0) width 245: "This text should be Times New Roman bold." 9 RenderInline {U} at (0,0) size 245x15 10 RenderText {#text} at (245,0) size 245x15 11 text run at (245,0) width 245: "This text should be Times New Roman bold." 13 12 RenderText {#text} at (0,0) size 0x0 14 13 RenderText {#text} at (0,0) size 0x0 15 caret: position 41 of child 0 {#text} of child 0 {U} of child 1 {SPAN} of child 0{U} of child 1 {BODY} of child 0 {HTML} of document14 caret: position 41 of child 0 {#text} of child 1 {U} of child 1 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/platform/mac/editing/style/smoosh-styles-001-expected.txt
r25970 r55762 19 19 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 2 of #text > SPAN > DIV > DIV > BODY > HTML > #document to 2 of #text > SPAN > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted 20 20 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 21 EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > SPAN > SPAN > DIV > DIV > BODY > HTML > #document to 3 of #text > SPAN > SPAN> DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE21 EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 22 22 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 23 23 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 52 52 RenderBlock {DIV} at (0,208) size 784x32 53 53 RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)] 54 RenderInline {SPAN} at (0,0) size 77x28 [color=#FF0000]54 RenderInline {SPAN} at (0,0) size 23x28 [color=#FF0000] 55 55 RenderText {#text} at (2,2) size 23x28 56 56 text run at (2,2) width 23: "ab" 57 RenderInline {SPAN} at (0,0) size 54x28 [color=#000000] 58 RenderText {#text} at (25,2) size 34x28 59 text run at (25,2) width 34: "cde" 60 RenderInline {SPAN} at (0,0) size 20x28 [color=#FF0000] 61 RenderText {#text} at (59,2) size 20x28 62 text run at (59,2) width 20: "fg" 57 RenderText {#text} at (25,2) size 34x28 58 text run at (25,2) width 34: "cde" 59 RenderInline {SPAN} at (0,0) size 20x28 [color=#FF0000] 60 RenderText {#text} at (59,2) size 20x28 61 text run at (59,2) width 20: "fg" 63 62 RenderBlock (anonymous) at (0,32) size 784x0 64 caret: position 3 of child 0 {#text} of child 1 {SPAN} of child 1 {SPAN} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document63 caret: position 3 of child 2 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/platform/mac/editing/style/style-boundary-005-expected.txt
r34799 r55762 25 25 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 26 26 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 5 of #text > B > DIV > DIV > BODY > HTML > #document to 5 of #text > B > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted 27 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > B > DIV > DIV > BODY > HTML > #document to 5 of #text > B > DIV > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > SPAN > B > DIV > DIV > BODY > HTML > #document to 4 of #text > SPAN > B> DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE27 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > B > DIV > DIV > BODY > HTML > #document to 5 of #text > B > 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 28 28 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 29 29 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 60 60 RenderText {#text} at (2,2) size 86x18 61 61 text run at (2,2) width 86: "one two three" 62 RenderInline {B} at (0,0) size 60x1862 RenderInline {B} at (0,0) size 33x18 63 63 RenderText {#text} at (88,2) size 33x18 64 64 text run at (88,2) width 33: " four" 65 RenderInline {SPAN} at (0,0) size 27x18 66 RenderText {#text} at (121,2) size 27x18 67 text run at (121,2) width 27: " one" 65 RenderText {#text} at (121,2) size 27x18 66 text run at (121,2) width 27: " one" 68 67 RenderBlock (anonymous) at (0,22) size 784x0 69 68 RenderText {#text} at (0,0) size 0x0 70 caret: position 4 of child 0 {#text} of child 1 {SPAN} of child 1 {B} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document69 caret: position 4 of child 2 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document -
trunk/WebCore/ChangeLog
r55761 r55762 1 2010-03-09 Tony Chang <tony@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 https://bugs.webkit.org/show_bug.cgi?id=21840 6 https://bugs.webkit.org/show_bug.cgi?id=23993 7 8 Fix an editing bug where replacing a selection would result in the 9 new text ending up inside nodes that were not visibly included in the 10 selection. Instead, move our destination position out of nodes that 11 were not visibly included. 12 13 Tests: editing/deleting/backspace-avoid-preceding-style.html 14 editing/inserting/replace-at-visible-boundary.html 15 16 * editing/ReplaceSelectionCommand.cpp: 17 (WebCore::positionAvoidingPrecedingNodes): 18 (WebCore::ReplaceSelectionCommand::doApply): 19 1 20 2010-03-09 Brady Eidson <beidson@apple.com> 2 21 -
trunk/WebCore/editing/ReplaceSelectionCommand.cpp
r55178 r55762 105 105 } 106 106 107 static Position positionAvoidingPrecedingNodes(Position pos) 108 { 109 // If we're already on a break, it's probably a placeholder and we shouldn't change our position. 110 if (pos.node()->hasTagName(brTag)) 111 return pos; 112 113 // We also stop when changing block flow elements because even though the visual position is the 114 // same. E.g., 115 // <div>foo^</div>^ 116 // The two positions above are the same visual position, but we want to stay in the same block. 117 Node* stopNode = pos.node()->enclosingBlockFlowElement(); 118 while (stopNode != pos.node() && VisiblePosition(pos) == VisiblePosition(pos.next())) 119 pos = pos.next(); 120 return pos; 121 } 122 107 123 ReplacementFragment::ReplacementFragment(Document* document, DocumentFragment* fragment, bool matchStyle, const VisibleSelection& selection) 108 124 : m_document(document), … … 886 902 887 903 bool handledStyleSpans = handleStyleSpansBeforeInsertion(fragment, insertionPos); 888 904 905 // We don't want the destination to end up inside nodes that weren't selected. To avoid that, we move the 906 // position forward without changing the visible position so we're still at the same visible location, but 907 // outside of preceding tags. 908 insertionPos = positionAvoidingPrecedingNodes(insertionPos); 909 889 910 // FIXME: When pasting rich content we're often prevented from heading down the fast path by style spans. Try 890 911 // again here if they've been removed.
Note: See TracChangeset
for help on using the changeset viewer.