+2007-03-14 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by john
+
+ Removed an unnecessary block (one that was fully
+ selected but whose markup wasn't needed to preserve
+ appearance):
+ * editing/pasteboard/paste-text-011-expected.txt:
+ Removed unnecessary style spans:
+ * editing/pasteboard/merge-end-blockquote-expected.txt:
+ Removed unnecessary empty anonymous blocks:
+ * editing/execCommand/create-list-with-hr-expected.txt:
+ * editing/pasteboard/display-block-on-spans-expected.txt:
+ * editing/pasteboard/paste-text-006-expected.txt:
+ * editing/pasteboard/paste-table-001-expected.txt:
+ * editing/pasteboard/paste-text-013-expected.txt:
+ * editing/pasteboard/paste-text-002-expected.txt:
+ * editing/pasteboard/paste-list-001-expected.txt:
+ * editing/pasteboard/paste-text-005-expected.txt:
+ * editing/pasteboard/paste-text-003-expected.txt:
+ * editing/pasteboard/paste-text-014-expected.txt:
+ * editing/pasteboard/paste-pre-001-expected.txt:
+ Now (correctly) includes fully selected root:
+ * editing/pasteboard/paste-text-015-expected.checksum:
+ * editing/pasteboard/paste-text-015-expected.png:
+ * editing/pasteboard/paste-text-015-expected.txt:
+ * editing/inserting/insert-3907422-fix-expected.txt:
+ * editing/pasteboard/paste-text-004-expected.txt:
+ Demonstrates a bug that already existed (we don't inline
+ the font styles from the Preference Pane on copy):
+ * editing/pasteboard/5027857-expected.checksum:
+ * editing/pasteboard/5027857-expected.png:
+ * editing/pasteboard/5027857-expected.txt:
+ * editing/pasteboard/paste-pre-002-expected.checksum:
+ * editing/pasteboard/paste-pre-002-expected.png:
+ * editing/pasteboard/paste-pre-002-expected.txt:
+
2007-03-15 Beth Dakin <bdakin@apple.com>
Rubber-stamped by Adele.
RenderBlock (anonymous) at (0,0) size 744x18
RenderListMarker at (-17,0) size 7x18: bullet
RenderBlock {HR} at (0,26) size 744x2 [border: (1px inset #000000)]
- RenderBlock (anonymous) at (0,36) size 744x0
RenderBlock (anonymous) at (0,44) size 784x0
caret: position 0 of child 0 {HR} of child 0 {LI} of child 0 {UL} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-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
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > DIV > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING 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
-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 3 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 3 of #text > DIV > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > DIV > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {DIV} at (0,0) size 784x154
- RenderBlock {DIV} at (0,0) size 784x86
- RenderBlock (anonymous) at (0,0) size 784x18
- RenderText {#text} at (0,0) size 21x18
- text run at (0,0) width 21: "foo"
- RenderBlock {BLOCKQUOTE} at (40,34) size 704x18
- RenderText {#text} at (0,0) size 20x18
- text run at (0,0) width 20: "bar"
- RenderBlock (anonymous) at (0,68) size 784x18
- RenderText {#text} at (0,0) size 22x18
- text run at (0,0) width 22: "baz"
- RenderText {#text} at (22,0) size 21x18
- text run at (22,0) width 21: "foo"
- RenderBlock (anonymous) at (0,86) size 784x0
- RenderBlock {DIV} at (0,102) size 784x52
- RenderBlock (anonymous) at (0,0) size 784x0
- RenderBlock {BLOCKQUOTE} at (40,0) size 704x18
- RenderText {#text} at (0,0) size 20x18
- text run at (0,0) width 20: "bar"
- RenderBlock (anonymous) at (0,34) size 784x18
- RenderText {#text} at (0,0) size 22x18
- text run at (0,0) width 22: "baz"
-caret: position 3 of child 1 {#text} of child 1 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+ RenderBlock {DIV} at (0,0) size 784x154
+ RenderBlock {DIV} at (0,0) size 784x86
+ RenderBlock (anonymous) at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 21x18
+ text run at (0,0) width 21: "foo"
+ RenderBlock {BLOCKQUOTE} at (40,34) size 704x18
+ RenderText {#text} at (0,0) size 20x18
+ text run at (0,0) width 20: "bar"
+ RenderBlock (anonymous) at (0,68) size 784x18
+ RenderText {#text} at (0,0) size 22x18
+ text run at (0,0) width 22: "baz"
+ RenderText {#text} at (22,0) size 21x18
+ text run at (22,0) width 21: "foo"
+ RenderBlock {DIV} at (0,102) size 784x52
+ RenderBlock {DIV} at (0,0) size 784x52
+ RenderBlock (anonymous) at (0,0) size 784x0
+ RenderBlock {BLOCKQUOTE} at (40,0) size 704x18
+ RenderText {#text} at (0,0) size 20x18
+ text run at (0,0) width 20: "bar"
+ RenderBlock (anonymous) at (0,34) size 784x18
+ RenderText {#text} at (0,0) size 22x18
+ text run at (0,0) width 22: "baz"
+ RenderBlock (anonymous) at (0,154) size 784x0
+caret: position 3 of child 1 {#text} of child 0 {DIV} of child 1 {DIV} of child 0 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
-3c451b6cf5c9adde3cf099393c67fd01
\ No newline at end of file
+baad50e1cd049b1bf74a6a248a63d1d7
\ No newline at end of file
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
- RenderBody {BODY} at (8,8) size 784x579
+ RenderBody {BODY} at (8,8) size 784x576
RenderBlock {P} at (0,0) size 784x36
RenderText {#text} at (0,0) size 765x36
text run at (0,0) width 414: "This tests a bug when copying HTML markup inside <pre> tags. "
text run at (414,0) width 351: "When pasted, this content would appear as the rendered"
text run at (0,18) width 134: "form of that markup. "
text run at (134,18) width 333: "You should see markup in the editable region below."
- RenderBlock {PRE} at (0,52) size 784x15
- RenderBlock {PRE} at (0,0) size 784x15
- RenderText {#text} at (0,0) size 328x15
- text run at (0,0) width 328: "<input type='button'>foo<br>bar<b>baz</b>"
- RenderBlock (anonymous) at (0,28) size 784x0
-caret: position 41 of child 0 {#text} of child 0 {PRE} of child 2 {PRE} of child 0 {BODY} of child 0 {HTML} of document
+ RenderBlock {PRE} at (0,52) size 784x18
+ RenderBlock (anonymous) at (0,0) size 784x0
+ RenderInline {SPAN} at (0,0) size 0x0
+ RenderBlock (anonymous) at (0,0) size 784x18
+ RenderBlock {PRE} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 410x18
+ text run at (0,0) width 410: "<input type='button'>foo<br>bar<b>baz</b>"
+ RenderBlock (anonymous) at (0,34) size 784x0
+ RenderInline {SPAN} at (0,0) size 0x0
+caret: position 41 of child 0 {#text} of child 0 {PRE} of child 0 {SPAN} of child 2 {PRE} of child 0 {BODY} of child 0 {HTML} of document
RenderInline {B} at (0,0) size 137x18
RenderText {#text} at (0,0) size 137x18
text run at (0,0) width 137: "This is a paragraph."
- RenderBlock (anonymous) at (0,18) size 784x0
RenderBlock {SPAN} at (0,18) size 784x18
RenderInline {SPAN} at (0,0) size 182x18
RenderText {#text} at (0,0) size 30x18
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > SPAN > DIV > BLOCKQUOTE > DIV > BODY > HTML > #document to 3 of #text > SPAN > DIV > BLOCKQUOTE > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > DIV > BLOCKQUOTE > DIV > BODY > HTML > #document to 3 of #text > DIV > BLOCKQUOTE > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
RenderBlock {DIV} at (0,0) size 704x18
RenderText {#text} at (0,0) size 81x18
text run at (0,0) width 81: "Blockquoted"
- RenderInline {SPAN} at (0,0) size 21x18
- RenderText {#text} at (81,0) size 21x18
- text run at (81,0) width 21: "foo"
+ RenderText {#text} at (81,0) size 21x18
+ text run at (81,0) width 21: "foo"
RenderBlock {DIV} at (0,18) size 704x18
- RenderInline {SPAN} at (0,0) size 20x18
- RenderText {#text} at (0,0) size 20x18
- text run at (0,0) width 20: "bar"
+ RenderText {#text} at (0,0) size 20x18
+ text run at (0,0) width 20: "bar"
RenderText {#text} at (20,0) size 33x18
text run at (20,0) width 33: " Text"
-caret: position 3 of child 0 {#text} of child 0 {SPAN} of child 1 {DIV} of child 0 {BLOCKQUOTE} of child 10 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+caret: position 3 of child 0 {#text} of child 1 {DIV} of child 0 {BLOCKQUOTE} of child 10 {DIV} of child 1 {BODY} of child 0 {HTML} of document
RenderListMarker at (-31,0) size 24x28: "3"
RenderText {#text} at (0,0) size 211x28
text run at (0,0) width 211: "I should be number 3."
- RenderBlock (anonymous) at (40,84) size 676x0
caret: position 21 of child 0 {#text} of child 2 {LI} of child 1 {OL} of child 5 {LI} of child 4 {OL} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of PRE > DIV > DIV > BODY > HTML > #document to 0 of PRE > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 7 of #text > PRE > PRE > DIV > DIV > BODY > HTML > #document to 7 of #text > PRE > PRE > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 7 of #text > PRE > SPAN > PRE > DIV > DIV > BODY > HTML > #document to 7 of #text > PRE > SPAN > PRE > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
RenderBlock {DIV} at (0,340) size 784x108
RenderBlock {DIV} at (0,0) size 784x108 [border: (2px solid #FF0000)]
RenderBlock {PRE} at (2,26) size 780x56
- RenderBlock {PRE} at (0,0) size 780x56
- RenderText {#text} at (0,0) size 42x56
- text run at (0,0) width 42: "foo"
- text run at (42,0) width 0: " "
- text run at (0,28) width 42: "bar"
+ RenderBlock (anonymous) at (0,0) size 780x0
+ RenderInline {SPAN} at (0,0) size 0x0
+ RenderBlock (anonymous) at (0,0) size 780x56
+ RenderBlock {PRE} at (0,0) size 780x56
+ RenderText {#text} at (0,0) size 42x56
+ text run at (0,0) width 42: "foo"
+ text run at (42,0) width 0: " "
+ text run at (0,28) width 42: "bar"
RenderBlock (anonymous) at (0,80) size 780x0
-caret: position 7 of child 0 {#text} of child 0 {PRE} of child 1 {PRE} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+ RenderInline {SPAN} at (0,0) size 0x0
+caret: position 7 of child 0 {#text} of child 0 {PRE} of child 0 {SPAN} of child 1 {PRE} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
-6e04deb668c068cc9420b62a8b475c42
\ No newline at end of file
+e3c240413ddef4a32ea3b11cd1bcacc6
\ No newline at end of file
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of #text > PRE > DIV > DIV > BODY > HTML > #document to 7 of #text > PRE > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 7 of #text > PRE > PRE > DIV > DIV > BODY > HTML > #document to 7 of #text > PRE > PRE > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 7 of #text > PRE > SPAN > PRE > DIV > DIV > BODY > HTML > #document to 7 of #text > PRE > SPAN > PRE > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
- RenderBody {BODY} at (8,8) size 784x579
+ RenderBody {BODY} at (8,8) size 784x576
RenderBlock {DIV} at (0,0) size 784x36
RenderText {#text} at (0,0) size 147x18
text run at (0,0) width 147: "This is a layout test for "
text run at (689,0) width 95: "The text below"
text run at (0,18) width 263: "is selected, copied, and pasted over itself. "
text run at (263,18) width 205: "You'll see foo/nbar if successful."
- RenderBlock {DIV} at (0,49) size 784x30
- RenderBlock {DIV} at (0,0) size 784x30
- RenderBlock {PRE} at (0,0) size 784x30
- RenderBlock {PRE} at (0,0) size 784x30
- RenderText {#text} at (0,0) size 24x30
- text run at (0,0) width 24: "foo"
- text run at (24,0) width 0: " "
- text run at (0,15) width 24: "bar"
- RenderBlock (anonymous) at (0,43) size 784x0
-caret: position 7 of child 0 {#text} of child 0 {PRE} of child 1 {PRE} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+ RenderBlock {DIV} at (0,52) size 784x36
+ RenderBlock {DIV} at (0,0) size 784x36
+ RenderBlock {PRE} at (0,0) size 784x36
+ RenderBlock (anonymous) at (0,0) size 784x0
+ RenderInline {SPAN} at (0,0) size 0x0
+ RenderBlock (anonymous) at (0,0) size 784x36
+ RenderBlock {PRE} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 30x36
+ text run at (0,0) width 30: "foo"
+ text run at (30,0) width 0: " "
+ text run at (0,18) width 30: "bar"
+ RenderBlock (anonymous) at (0,52) size 784x0
+ RenderInline {SPAN} at (0,0) size 0x0
+caret: position 7 of child 0 {#text} of child 0 {PRE} of child 0 {SPAN} of child 1 {PRE} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
RenderTableCell {TD} at (85,26) size 201x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 197x18
text run at (2,2) width 197: "I should be in the right column."
- RenderBlock (anonymous) at (0,54) size 756x0
RenderTable {TABLE} at (0,54) size 292x54 [border: (2px outset #808080)]
RenderTableSection {TBODY} at (2,2) size 288x50
RenderTableRow {TR} at (0,2) size 288x22
text run at (14,14) width 63: "There "
RenderText {#text} at (77,14) size 285x28
text run at (77,14) width 285: "is a tide in the affairs of men,"
- RenderBlock (anonymous) at (0,56) size 784x0
RenderBlock {DIV} at (0,56) size 784x56 [border: (2px solid #FF0000)]
RenderText {#text} at (14,14) size 124x28
text run at (14,14) width 124: "Which taken"
RenderText {#text} at (138,14) size 285x28
text run at (138,14) width 285: "is a tide in the affairs of men,"
- RenderBlock (anonymous) at (0,112) size 784x0
RenderBlock {DIV} at (0,112) size 784x56 [border: (2px solid #FF0000)]
RenderText {#text} at (14,14) size 124x28
text run at (14,14) width 124: "Which taken"
RenderBlock {DIV} at (14,42) size 756x56 [border: (2px solid #FF0000)]
RenderText {#text} at (14,14) size 434x28
text run at (14,14) width 434: "Which taken at the flood leads on to fortune."
- RenderBlock (anonymous) at (14,98) size 756x0
RenderBlock {DIV} at (14,98) size 756x252 [border: (2px solid #FF0000)]
RenderBlock (anonymous) at (14,14) size 728x0
RenderBlock {DIV} at (14,14) size 728x56 [border: (2px solid #FF0000)]
RenderBlock {DIV} at (14,70) size 728x56 [border: (2px solid #FF0000)]
RenderText {#text} at (14,14) size 434x28
text run at (14,14) width 434: "Which taken at the flood leads on to fortune."
- RenderBlock (anonymous) at (14,126) size 728x0
RenderBlock {DIV} at (14,126) size 728x112 [border: (2px solid #FF0000)]
RenderBlock (anonymous) at (14,14) size 700x28
RenderText {#text} at (0,0) size 80x28
text run at (14,14) width 63: "There "
RenderText {#text} at (77,14) size 285x28
text run at (77,14) width 285: "is a tide in the affairs of men,"
- RenderBlock (anonymous) at (0,56) size 784x0
RenderBlock {DIV} at (0,56) size 784x56 [border: (2px solid #FF0000)]
RenderText {#text} at (14,14) size 434x28
text run at (14,14) width 434: "Which taken at the flood leads on to fortune."
RenderBlock {DIV} at (0,56) size 784x56 [border: (2px solid #FF0000)]
RenderText {#text} at (14,14) size 285x28
text run at (14,14) width 285: "is a tide in the affairs of men,"
- RenderBlock (anonymous) at (0,112) size 784x0
RenderBlock {DIV} at (0,112) size 784x56 [border: (2px solid #FF0000)]
RenderText {#text} at (14,14) size 434x28
text run at (14,14) width 434: "Which taken at the flood leads on to fortune."
RenderBlock {DIV} at (0,56) size 784x56 [border: (2px solid #FF0000)]
RenderText {#text} at (14,14) size 348x28
text run at (14,14) width 348: "There is a tide in the affairs of men,"
- RenderBlock (anonymous) at (0,112) size 784x0
RenderBlock {DIV} at (0,112) size 784x56 [border: (2px solid #FF0000)]
RenderText {#text} at (14,14) size 434x28
text run at (14,14) width 434: "Which taken at the flood leads on to fortune."
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of P > BODY > HTML > #document to 0 of P > BODY > HTML > #document givenAction:WebViewInsertActionPasted
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 5 of #text > B > FONT > P > DIV > B > FONT > P > BODY > HTML > #document to 5 of #text > B > FONT > P > DIV > B > FONT > P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 5 of #text > B > FONT > P > SPAN > B > FONT > P > BODY > HTML > #document to 5 of #text > B > FONT > P > SPAN > B > FONT > P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
RenderBlock (anonymous) at (0,0) size 784x0
RenderInline {FONT} at (0,0) size 0x0
RenderInline {B} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 0x0
RenderBlock (anonymous) at (0,0) size 784x58
- RenderBlock {DIV} at (0,0) size 784x58
- RenderBlock {P} at (0,0) size 784x21
- RenderInline {FONT} at (0,0) size 55x20
- RenderInline {B} at (0,0) size 55x20
- RenderText {#text} at (0,0) size 55x20
- text run at (0,0) width 55: "hello"
- RenderBlock {P} at (0,37) size 784x21
- RenderInline {FONT} at (0,0) size 55x20
- RenderInline {B} at (0,0) size 55x20
- RenderText {#text} at (0,0) size 55x20
- text run at (0,0) width 55: "there"
- RenderBlock (anonymous) at (0,74) size 784x0
+ RenderBlock {P} at (0,0) size 784x21
+ RenderInline {FONT} at (0,0) size 55x20
+ RenderInline {B} at (0,0) size 55x20
+ RenderText {#text} at (0,0) size 55x20
+ text run at (0,0) width 55: "hello"
+ RenderBlock {P} at (0,37) size 784x21
+ RenderInline {FONT} at (0,0) size 55x20
+ RenderInline {B} at (0,0) size 55x20
+ RenderText {#text} at (0,0) size 55x20
+ text run at (0,0) width 55: "there"
RenderBlock (anonymous) at (0,74) size 784x0
RenderInline {FONT} at (0,0) size 0x0
RenderInline {B} at (0,0) size 0x0
-caret: position 5 of child 0 {#text} of child 0 {B} of child 0 {FONT} of child 1 {P} of child 0 {DIV} of child 0 {B} of child 0 {FONT} of child 4 {P} of child 1 {BODY} of child 0 {HTML} of document
+ RenderInline {SPAN} at (0,0) size 0x0
+caret: position 5 of child 0 {#text} of child 0 {B} of child 0 {FONT} of child 1 {P} of child 0 {SPAN} of child 0 {B} of child 0 {FONT} of child 4 {P} of child 1 {BODY} of child 0 {HTML} of document
text run at (0,0) width 32: "foo"
RenderBlock {BLOCKQUOTE} at (40,52) size 676x28
RenderBR {BR} at (0,0) size 0x28
- RenderBlock (anonymous) at (0,394) size 784x0
caret: position 0 of child 0 {BR} of child 1 {BLOCKQUOTE} of child 0 {DIV} of child 8 {DIV} of child 1 {BODY} of child 0 {HTML} of document
RenderBlock {BLOCKQUOTE} at (40,0) size 676x28
RenderText {#text} at (0,0) size 32x28
text run at (0,0) width 32: "foo"
- RenderBlock (anonymous) at (0,268) size 784x0
RenderBlock {DIV} at (0,268) size 784x56 [border: (2px solid #FF0000)]
RenderText {#text} at (14,14) size 12x28
text run at (14,14) width 12: "x"
-d78fa5fec66907a0acffd77231ac33e8
\ No newline at end of file
+2c940c10141c012ac8c2e7a1e30a0c60
\ No newline at end of file
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of P > DIV > DIV > BODY > HTML > #document to 0 of P > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > P > SPAN > DIV > P > DIV > DIV > BODY > HTML > #document to 3 of #text > P > SPAN > DIV > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > P > DIV > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document to 3 of #text > P > DIV > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > P > SPAN > DIV > P > DIV > DIV > BODY > HTML > #document to 3 of #text > P > SPAN > DIV > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of P > SPAN > DIV > P > DIV > DIV > BODY > HTML > #document to 0 of P > SPAN > DIV > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > P > DIV > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document to 3 of #text > P > DIV > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of P > DIV > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document to 0 of P > DIV > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of P > SPAN > DIV > P > DIV > DIV > BODY > HTML > #document to 0 of P > SPAN > DIV > P > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
+EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of P > DIV > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document to 0 of P > DIV > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > P > SPAN > DIV > P > SPAN > DIV > P > DIV > DIV > BODY > HTML > #document to 3 of #text > P > SPAN > DIV > P > SPAN > DIV > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > P > DIV > DIV > SPAN > P > DIV > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document to 3 of #text > P > DIV > DIV > SPAN > P > DIV > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
- RenderBlock {DIV} at (0,0) size 784x140
- RenderBlock {DIV} at (0,0) size 784x140 [border: (2px solid #FF0000)]
- RenderBlock {P} at (14,14) size 756x112
- RenderBlock {DIV} at (0,0) size 756x112
- RenderBlock (anonymous) at (0,0) size 756x0
- RenderInline {SPAN} at (0,0) size 0x0
- RenderBlock (anonymous) at (0,0) size 756x112
- RenderBlock {P} at (0,0) size 756x28
- RenderText {#text} at (0,0) size 32x28
- text run at (0,0) width 32: "foo"
- RenderBlock {P} at (0,28) size 756x28
- RenderText {#text} at (0,0) size 31x28
- text run at (0,0) width 31: "bar"
- RenderBlock {P} at (0,56) size 756x56
- RenderBlock {DIV} at (0,0) size 756x56
- RenderBlock (anonymous) at (0,0) size 756x0
+ RenderBlock {DIV} at (0,0) size 784x196
+ RenderBlock {DIV} at (0,0) size 784x196 [border: (2px solid #FF0000)]
+ RenderBlock {P} at (14,14) size 756x168
+ RenderBlock (anonymous) at (0,0) size 756x0
+ RenderInline {SPAN} at (0,0) size 0x0
+ RenderBlock (anonymous) at (0,0) size 756x168
+ RenderBlock {DIV} at (0,0) size 756x168
+ RenderBlock {DIV} at (0,0) size 756x168 [border: (2px solid #FF0000)]
+ RenderBlock {P} at (14,14) size 728x28
+ RenderText {#text} at (0,0) size 32x28
+ text run at (0,0) width 32: "foo"
+ RenderBlock {P} at (14,42) size 728x28
+ RenderText {#text} at (0,0) size 31x28
+ text run at (0,0) width 31: "bar"
+ RenderBlock {P} at (14,70) size 728x84
+ RenderBlock (anonymous) at (0,0) size 728x0
RenderInline {SPAN} at (0,0) size 0x0
- RenderBlock (anonymous) at (0,0) size 756x56
- RenderBlock {P} at (0,0) size 756x28
- RenderText {#text} at (0,0) size 32x28
- text run at (0,0) width 32: "foo"
- RenderBlock {P} at (0,28) size 756x28
- RenderText {#text} at (0,0) size 31x28
- text run at (0,0) width 31: "bar"
- RenderBlock (anonymous) at (0,56) size 756x0
+ RenderBlock (anonymous) at (0,0) size 728x84
+ RenderBlock {DIV} at (0,0) size 728x84
+ RenderBlock {DIV} at (0,0) size 728x84 [border: (2px solid #FF0000)]
+ RenderBlock {P} at (14,14) size 700x28
+ RenderText {#text} at (0,0) size 32x28
+ text run at (0,0) width 32: "foo"
+ RenderBlock {P} at (14,42) size 700x28
+ RenderText {#text} at (0,0) size 31x28
+ text run at (0,0) width 31: "bar"
+ RenderBlock (anonymous) at (0,84) size 728x0
RenderInline {SPAN} at (0,0) size 0x0
- RenderBlock (anonymous) at (0,56) size 756x0
- RenderBlock (anonymous) at (0,112) size 756x0
- RenderInline {SPAN} at (0,0) size 0x0
- RenderBlock (anonymous) at (0,112) size 756x0
-caret: position 3 of child 0 {#text} of child 1 {P} of child 0 {SPAN} of child 0 {DIV} of child 2 {P} of child 0 {SPAN} of child 0 {DIV} of child 0 {P} of child 1 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+ RenderBlock (anonymous) at (0,168) size 756x0
+ RenderInline {SPAN} at (0,0) size 0x0
+caret: position 3 of child 0 {#text} of child 1 {P} of child 0 {DIV} of child 0 {DIV} of child 0 {SPAN} of child 2 {P} of child 0 {DIV} of child 0 {DIV} of child 0 {SPAN} of child 0 {P} of child 1 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+2007-03-14 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by john
+
+ ~2x speed up of 5k rich text paste:
+ http://shakespeare.mit.edu/hamlet/full.html
+
+ * editing/ReplaceSelectionCommand.cpp:
+ (WebCore::ReplaceSelectionCommand::doApply): Remove the top
+ level style span if its unnecessary before inserting
+ into the document, its faster than doing it after.
+ * editing/ReplaceSelectionCommand.h: Exposed
+ ReplacementFragment::removeNodePreservingChildren so that
+ the style span can be removed using non-undoable removes,
+ like the rest of the removes done on the ReplacementFragment.
+ * editing/markup.cpp:
+ (WebCore::createMarkup): Make the style span the top level
+ element, otherwise it's useless. This also facilitates the
+ optimization mentioned above.
+ When including markup for a fully selected root, include markup
+ for all the nodes beneath that fully selected root, to preserve
+ the structure and appearance of the copied markup. Did this
+ by merging with the code for adding markup for descendants of
+ special commonAncestorBlocks.
+
2007-03-15 Beth Dakin <bdakin@apple.com>
Rubber-stamped by Adele.
// We're finished if there is nothing to add.
if (fragment.isEmpty() || !fragment.firstChild())
return;
+
+ // Remove the top level style span if its unnecessary before inserting it into the document, its faster.
+ RefPtr<CSSMutableStyleDeclaration> styleAtInsertionPos = insertionPos.computedStyle()->copyInheritableProperties();
+ if (isStyleSpan(fragment.firstChild())) {
+ Node* styleSpan = fragment.firstChild();
+ String styleText = static_cast<Element*>(styleSpan)->getAttribute(styleAttr);
+ if (styleText == styleAtInsertionPos->cssText())
+ fragment.removeNodePreservingChildren(styleSpan);
+ }
// 1) Insert the content.
// 2) Remove redundant styles and style tags, this inner <b> for example: <b>foo <b>bar</b> baz</b>.
bool hasInterchangeNewlineAtEnd() const { return m_hasInterchangeNewlineAtEnd; }
void removeNode(PassRefPtr<Node>);
+ void removeNodePreservingChildren(Node*);
private:
PassRefPtr<Node> insertFragmentForTestRendering(Node* context);
void restoreTestRenderingNodesToFragment(Node*);
void removeInterchangeNodes(Node*);
- void removeNodePreservingChildren(Node*);
void insertNodeBefore(Node* node, Node* refNode);
RefPtr<Document> m_document;
ancestorsToClose.append(n);
}
- // Add a wrapper span with the styles that all of the nodes in the markup inherit.
- if (!commonAncestor->isElementNode())
- commonAncestor = commonAncestor->parentNode();
-
- if (commonAncestor) {
- RefPtr<CSSComputedStyleDeclaration> computedStyle = new CSSComputedStyleDeclaration(commonAncestor);
- RefPtr<CSSMutableStyleDeclaration> style = computedStyle->copyInheritableProperties();
- // Styles that Mail blockquotes contribute should only be placed on the Mail blockquote, to help
- // us differentiate those styles from ones that the user has applied. This helps us
- // get the color of content pasted into blockquotes right.
- removeEnclosingMailBlockquoteStyle(style.get(), commonAncestor);
-
- if (style->length() > 0) {
- // FIXME: Handle case where style->cssText() has illegal characters in it, like "
- DeprecatedString openTag = DeprecatedString("<span class=\"") + AppleStyleSpanClass + "\" style=\"" + style->cssText().deprecatedString() + "\">";
- markups.prepend(openTag);
- markups.append("</span>");
- }
- }
-
+ Node* body = enclosingNodeWithTag(commonAncestor, bodyTag);
+ // FIXME: Do this for all fully selected blocks, not just the body.
+ Node* fullySelectedRoot = body && *Selection::selectionFromContentsOfNode(body).toRange() == *range ? body : 0;
+ // FIXME: Only include markup for a fully selected root (and ancestors of lastClosed up to that root) if
+ // there are styles/attributes on those nodes that need to be included to preserve the appearance of the copied markup.
+ if (fullySelectedRoot)
+ commonAncestorBlock = fullySelectedRoot;
// Include ancestor blocks that are required to retain the appearance of the copied markup.
if (annotate &&
(commonAncestorBlock->hasTagName(listingTag)
|| commonAncestorBlock->hasTagName(preTag)
|| commonAncestorBlock->hasTagName(tableTag)
|| commonAncestorBlock->hasTagName(ulTag)
- || commonAncestorBlock->hasTagName(xmpTag))) {
+ || commonAncestorBlock->hasTagName(xmpTag)
+ || commonAncestorBlock == fullySelectedRoot)) {
+ // Also include all of the ancestors of lastClosed up to this ancestor block.
for (Node* ancestor = lastClosed->parentNode(); ancestor; ancestor = ancestor->parentNode()) {
- markups.prepend(startMarkup(ancestor, range, annotate));
- markups.append(endMarkup(ancestor));
+ if (ancestor == fullySelectedRoot) {
+ // From a fully selected root we want:
+ // The non-inheritble styles from its matched rules (author only).
+ RefPtr<CSSMutableStyleDeclaration> style = styleFromMatchedRulesForElement(static_cast<Element*>(fullySelectedRoot));
+
+ // The non-inheritble styles from its inline style declaration.
+ RefPtr<CSSMutableStyleDeclaration> inlineStyleDecl = static_cast<HTMLElement*>(fullySelectedRoot)->getInlineStyleDecl();
+ style->merge(inlineStyleDecl.get());
+
+ // Bring the background attribute over, but not as an attribute because a background attribute on a div
+ // appears to have no effect.
+ if (!style->getPropertyCSSValue(CSS_PROP_BACKGROUND_IMAGE) && static_cast<Element*>(fullySelectedRoot)->hasAttribute(backgroundAttr))
+ style->setProperty(CSS_PROP_BACKGROUND_IMAGE, "url('" + static_cast<Element*>(fullySelectedRoot)->getAttribute(backgroundAttr) + "')");
+
+ if (style->length()) {
+ markups.prepend("<div style='" + style->cssText().deprecatedString() + "'>");
+ markups.append("</div>");
+ }
+ } else {
+ markups.prepend(startMarkup(ancestor, range, annotate));
+ markups.append(endMarkup(ancestor));
+ }
if (nodes)
nodes->append(ancestor);
+
+ lastClosed = ancestor;
+
if (ancestor == commonAncestorBlock)
break;
}
}
+
+ // Add a wrapper span with the styles that all of the nodes in the markup inherit.
+ if (Node* parentOfLastClosed = lastClosed->parentNode()) {
+ RefPtr<CSSMutableStyleDeclaration> style = computedStyle(parentOfLastClosed)->copyInheritableProperties();
+ // Styles that Mail blockquotes contribute should only be placed on the Mail blockquote, to help
+ // us differentiate those styles from ones that the user has applied. This helps us
+ // get the color of content pasted into blockquotes right.
+ removeEnclosingMailBlockquoteStyle(style.get(), parentOfLastClosed);
+
+ if (style->length() > 0) {
+ // FIXME: Handle case where style->cssText() has illegal characters in it, like "
+ DeprecatedString openTag = DeprecatedString("<span class=\"") + AppleStyleSpanClass + "\" style=\"" + style->cssText().deprecatedString() + "\">";
+ markups.prepend(openTag);
+ markups.append("</span>");
+ }
+ }
if (annotate && needInterchangeNewlineAfter(visibleEnd.previous()))
markups.append(interchangeNewlineString);
}
}
}
-
- Node* root = range->startPosition().node();
- while (root && !root->hasTagName(bodyTag))
- root = root->parentNode();
- // Include markup for fully selected blocks (turn the body into a div so that we
- // don't end up with multiple bodies after a paste).
- // FIXME: Do this for all fully selected blocks, not just the body.
- if (root && *Selection::selectionFromContentsOfNode(root).toRange() == *range) {
- // From this fully selected root editable element we want:
- // The non-inheritble styles from its matched rules (author only).
- RefPtr<CSSMutableStyleDeclaration> style = styleFromMatchedRulesForElement(static_cast<Element*>(root));
-
- // The non-inheritble styles from its inline style declaration.
- RefPtr<CSSMutableStyleDeclaration> inlineStyleDecl = static_cast<HTMLElement*>(root)->getInlineStyleDecl();
- style->merge(inlineStyleDecl.get());
-
- // All the inheritble styles from its computed style.
- RefPtr<CSSComputedStyleDeclaration> computedStyle = new CSSComputedStyleDeclaration(static_cast<Element*>(root));
- RefPtr<CSSMutableStyleDeclaration> inheritedComputedProperties = computedStyle->copyInheritableProperties();
- style->merge(inheritedComputedProperties.get());
-
- // Bring the background attribute over, but not as an attribute because a background attribute on a div
- // appears to have no effect.
- if (!style->getPropertyCSSValue(CSS_PROP_BACKGROUND_IMAGE) && static_cast<Element*>(root)->hasAttribute(backgroundAttr))
- style->setProperty(CSS_PROP_BACKGROUND_IMAGE, "url('" + static_cast<Element*>(root)->getAttribute(backgroundAttr) + "')");
-
- markups.prepend("<div style='" + style->cssText().deprecatedString() + "'>");
- markups.append("</div>");
- }
doc->frame()->editor()->deleteButtonController()->enable();
return markups.join("");