Changeset 16122 in webkit
- Timestamp:
- Aug 30, 2006 1:00:37 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r16117 r16122 1 2006-08-29 Justin Garcia <justin.garcia@apple.com> 2 3 Reviewed by harrison 4 5 <rdar://problem/4700297> 6 REGRESSION: After replacing a misspelled word in a sentence, the selection extends to end of current line 7 8 Fixed: 9 * editing/pasteboard/smart-paste-002-expected.checksum: 10 * editing/pasteboard/smart-paste-002-expected.png: 11 * editing/pasteboard/smart-paste-002-expected.txt: 12 Added to demonstrate fix: 13 * editing/pasteboard/4700297-expected.checksum: Added. 14 * editing/pasteboard/4700297-expected.png: Added. 15 * editing/pasteboard/4700297-expected.txt: Added. 16 * editing/pasteboard/4700297.html: Added. 17 Removed a superfluous style span: 18 * editing/deleting/pruning-after-merge-1-expected.txt: 19 * editing/pasteboard/interchange-newline-1-expected.txt: 20 * editing/pasteboard/paste-text-019-expected.checksum: 21 * editing/pasteboard/paste-text-019-expected.png: 22 * editing/pasteboard/paste-text-019-expected.txt: 23 * editing/selection/drag-to-contenteditable-iframe-expected.txt: 24 Accidently checked in bad results yesterday: 25 * editing/pasteboard/copy-paste-bidi-expected.txt: 26 Equivalent render tree: 27 * editing/pasteboard/smart-paste-001-expected.txt: 28 1 29 2006-08-29 waylonis <waylonis@google.com> 2 30 -
trunk/LayoutTests/editing/deleting/pruning-after-merge-1-expected.txt
r15975 r16122 32 32 RenderText {#text} at (0,0) size 5x18 33 33 text run at (0,0) width 5: "f" 34 RenderInline { SPAN} at (0,0) size 15x1834 RenderInline {B} at (0,0) size 15x18 35 35 RenderText {#text} at (5,0) size 15x18 36 36 text run at (5,0) width 15: "ar" 37 RenderInline {B} at (0,0) size 0x1838 37 RenderBlock (anonymous) at (0,18) size 784x18 39 38 RenderBlock {DIV} at (0,0) size 784x18 -
trunk/LayoutTests/editing/pasteboard/copy-paste-bidi-expected.txt
r16088 r16122 46 46 text run at (32,0) width 36 RTL: "\x{5E9}\x{5D3}\x{5D2}\x{5DB}" 47 47 text run at (68,0) width 4: ":" 48 RenderBlock (anonymous) at (0,18) size 784x0 48 49 RenderBlock {DIV} at (0,18) size 784x18 49 50 RenderText {#text} at (712,0) size 72x18 -
trunk/LayoutTests/editing/pasteboard/interchange-newline-1-expected.txt
r15918 r16122 21 21 RenderText {#text} at (0,0) size 8x18 22 22 text run at (0,0) width 8: "x" 23 Render Text {#text} at (8,0) size 21x1824 text run at (8,0) width 21: "foo"25 RenderInline {SPAN} at (0,0) size 0x1823 RenderInline {SPAN} at (0,0) size 21x18 24 RenderText {#text} at (8,0) size 21x18 25 text run at (8,0) width 21: "foo" 26 26 RenderBlock (anonymous) at (0,18) size 784x18 27 27 RenderBlock {DIV} at (0,0) size 784x18 … … 32 32 RenderText {#text} at (0,0) size 8x18 33 33 text run at (0,0) width 8: "x" 34 caret: position 0 of child 3{#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document34 caret: position 0 of child 2 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/editing/pasteboard/paste-text-019-expected.checksum
r15918 r16122 1 60a3a69108263e9487ae750e514fbcc3 1 329f766c06e6f043242bfd9e28720822 -
trunk/LayoutTests/editing/pasteboard/paste-text-019-expected.txt
r15918 r16122 15 15 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 16 16 EDITING DELEGATE: shouldInsertText:Bar replacingDOMRange:range from 4 of #text > SPAN > DIV > BODY > HTML > #document to 4 of #text > SPAN > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted 17 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > SPAN > DIV > BODY > HTML > #document to 4 of #text > SPAN > 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:FALSE17 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > SPAN > DIV > BODY > HTML > #document to 4 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 18 18 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 19 19 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 68 68 RenderText {#text} at (0,0) size 35x28 69 69 text run at (0,0) width 35: "Bar" 70 RenderText {#text} at (35,0) size 6x28 71 text run at (35,0) width 6: " " 72 caret: position 1 of child 2 {#text} of child 5 {DIV} of child 1 {BODY} of child 0 {HTML} of document 70 caret: position 3 of child 2 {#text} of child 1 {SPAN} of child 5 {DIV} of child 1 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/editing/pasteboard/smart-paste-001-expected.txt
r15918 r16122 5 5 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 6 6 EDITING 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 7 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 4 of #text > DIV > DIV > BODY > HTML > #document to 4of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE7 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 8 8 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 9 9 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 32 32 RenderBlock {DIV} at (0,236) size 784x32 33 33 RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)] 34 RenderText {#text} at (2,2) size 40x2835 text run at (2,2) width 40: "test"36 RenderText {#text} at ( 42,2) size 34x2837 text run at ( 42,2) width 34: "test"34 RenderText {#text} at (2,2) size 34x28 35 text run at (2,2) width 34: "test" 36 RenderText {#text} at (36,2) size 40x28 37 text run at (36,2) width 40: " test" 38 38 RenderBlock (anonymous) at (0,32) size 784x0 39 caret: position 4of child 1 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document39 caret: position 5 of child 1 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/editing/pasteboard/smart-paste-002-expected.checksum
r13644 r16122 1 11895ba8ba4493d17ac8a12adb18aff4 1 2b7e6aca0cf97c095c360a8a7abc2a4d -
trunk/LayoutTests/editing/pasteboard/smart-paste-002-expected.txt
r15918 r16122 5 5 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 6 6 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted 7 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 4of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE7 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 8 8 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 9 9 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 33 33 RenderBlock (anonymous) at (0,0) size 784x0 34 34 RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)] 35 RenderText {#text} at (2,2) size 34x2836 text run at (2,2) width 34: "test"37 RenderText {#text} at ( 36,2) size 40x2838 text run at ( 36,2) width 40: "test"39 caret: position 4of child 0 {#text} of child 0 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document35 RenderText {#text} at (2,2) size 40x28 36 text run at (2,2) width 40: "test " 37 RenderText {#text} at (42,2) size 34x28 38 text run at (42,2) width 34: "test" 39 caret: position 5 of child 0 {#text} of child 0 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/editing/selection/drag-to-contenteditable-iframe-expected.txt
r15531 r16122 2 2 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of BODY > HTML > #document to 2 of BODY > HTML > #document toDOMRange:range from 0 of #text > BODY > HTML > #document to 5 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 3 3 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification 4 EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 6of BODY > HTML > #document4 EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 4 of BODY > HTML > #document 5 5 EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification 6 6 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -
trunk/WebCore/ChangeLog
r16121 r16122 1 2006-08-29 Justin Garcia <justin.garcia@apple.com> 2 3 Reviewed by harrison 4 5 <rdar://problem/4700297> 6 REGRESSION: After replacing a misspelled word in a sentence, the selection extends to end of current line 7 8 * editing/ReplaceSelectionCommand.cpp: 9 (WebCore::ReplaceSelectionCommand::doApply): Rebalance whitespace 10 around insertionPos before insertion because the content might 11 cause a collapse, e.g. inserting <div>foo</div> at hello^ world. 12 * editing/htmlediting.cpp: 13 (WebCore::rebalanceWhitespaceInTextNode): Rebalance with all nbsps 14 for simplicity, we can produce sequences of regular spaces and 15 nbsps on serialization (10636). 16 1 17 2006-08-30 Nikolas Zimmermann <zimmermann@kde.org> 2 18 -
trunk/WebCore/editing/ReplaceSelectionCommand.cpp
r16088 r16122 483 483 } 484 484 485 // Inserting content could cause whitespace to collapse, e.g. inserting <div>foo</div> into hello^ world. 486 // We remove unrendered spaces and rebalance the rendered ones (turn them into nbsps) around insertionPos to prevent that. 487 Position upstreamInsertionPos = insertionPos.upstream(); 488 deleteInsignificantText(insertionPos.upstream(), insertionPos.downstream()); 489 insertionPos = upstreamInsertionPos.downstream(); 490 rebalanceWhitespaceAt(insertionPos); 491 485 492 // NOTE: This would be an incorrect usage of downstream() if downstream() were changed to mean the last position after 486 493 // p that maps to the same visible position as p (since in the case where a br is at the end of a block and collapsed … … 575 582 m_firstNodeInserted = endingSelection().visibleStart().deepEquivalent().downstream().node(); 576 583 if (!m_lastNodeInserted->inDocument()) 577 m_lastNodeInserted = endingSelection().visibleEnd().deepEquivalent(). downstream().node();584 m_lastNodeInserted = endingSelection().visibleEnd().deepEquivalent().upstream().node(); 578 585 } 579 586 -
trunk/WebCore/editing/htmlediting.cpp
r15563 r16122 348 348 void rebalanceWhitespaceInTextNode(Node *node, unsigned int start, unsigned int length) 349 349 { 350 static RegularExpression nonRegularWhitespace("[\xa0\n]"); 351 static DeprecatedString twoSpaces(" "); 350 static RegularExpression whitespace("[ \t\n]"); 352 351 static DeprecatedString nbsp("\xa0"); 353 static DeprecatedString space(" ");354 352 355 353 ASSERT(node->isTextNode()); … … 360 358 DeprecatedString substring = text.substring(start, length).deprecatedString(); 361 359 362 substring.replace(nonRegularWhitespace, space); 363 364 // The sequence should alternate between spaces and nbsps, always ending in a regular space. 365 // Note: This pattern doesn't mimic TextEdit editing behavior on other clients that don't 366 // support our -webkit-nbsp-mode: space, but it comes close. 367 static DeprecatedString pattern("\xa0 "); 368 int end = length - 1; 369 int i = substring.findRev(twoSpaces, end); 370 while (i >= 0) { 371 substring.replace(i , 2, pattern); 372 i = substring.findRev(twoSpaces, i); 373 } 374 375 // Rendering will collapse any regular whitespace at the start or end of a line. To prevent this, we use 376 // a nbsp at the start and end of a text node. This is sometimes unnecessary, E.G. <a>link</a> text 377 if (start == 0 && substring[0] == ' ') 378 substring.replace(0, 1, nbsp); 379 if (start + length == text.length() && substring[end] == ' ') 380 substring.replace(end, 1, nbsp); 360 // FIXME: We rebalance with all nbsps, for simplicity (we don't need crazy sequences while editing 361 // because all editable regions will have -webkit-nbsp-mode: space. We should produce sequences of 362 // regular spaces and nbsps that are better for interchange when we serialize (10636). 363 substring.replace(whitespace, nbsp); 381 364 382 365 ExceptionCode ec = 0;
Note: See TracChangeset
for help on using the changeset viewer.