Commit 4645fa8f authored by ddkilzer's avatar ddkilzer

WebCore:

        Reviewed by Justin.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9505
          moveParagraphContentsToNewBlockIfNecessary creates a new block outside the current position

        * editing/CompositeEditCommand.cpp:
        Added sanity checking to prevent modifying nodes outside of 
        where we should be
        (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):

LayoutTests:

        Reviewed by Justin.

        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9505
         moveParagraphContentsToNewBlockIfNecessary creates a new block outside the current position

        * editing/pasteboard/paste-table-002.html: Added.
        * editing/pasteboard/paste-table-002-expected.checksum: Added.
        * editing/pasteboard/paste-table-002-expected.png: Added.
        * editing/pasteboard/paste-table-002-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15103 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 980e0e7b
2006-06-29 Graham Dennis <Graham.Dennis@gmail.com>
Reviewed by Justin.
- test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9505
moveParagraphContentsToNewBlockIfNecessary creates a new block outside the current position
* editing/pasteboard/paste-table-002.html: Added.
* editing/pasteboard/paste-table-002-expected.checksum: Added.
* editing/pasteboard/paste-table-002-expected.png: Added.
* editing/pasteboard/paste-table-002-expected.txt: Added.
2006-06-29 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by Darin.
92b222216c0ad7cb02568b948edd8d0b
\ No newline at end of file
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > DIV > BODY > HTML > #document to 6 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > DIV > DIV > BODY > HTML > #document to 0 of 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 0 of DIV > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 5 of #text > DIV > DIV > DIV > DIV > BODY > HTML > #document to 5 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
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 784x576
RenderBlock (anonymous) at (0,0) size 784x36
RenderText {#text} at (0,0) size 770x36
text run at (0,0) width 770: "Problem: copy/pasting some HTML including tables can give rise to a <div> element as the first child of the table element."
text run at (0,18) width 93: "This is invalid."
RenderBlock {DIV} at (0,36) size 784x84
RenderBlock {DIV} at (0,0) size 784x84 [border: (2px solid #FF0000)]
RenderBlock {DIV} at (2,2) size 780x80
RenderBlock (anonymous) at (0,0) size 780x28
RenderText {#text} at (0,0) size 65x28
text run at (0,0) width 65: "abcdef"
RenderBlock {DIV} at (0,28) size 780x52
RenderTable {TABLE} at (0,0) size 51x24
RenderTableSection {TBODY} at (0,0) size 51x24
RenderTableRow {TR} at (0,2) size 51x20
RenderTableCell {TD} at (2,2) size 23x20 [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (1,1) size 21x18
text run at (1,1) width 21: "foo"
RenderTableCell {TD} at (27,2) size 22x20 [r=0 c=1 rs=1 cs=1]
RenderText {#text} at (1,1) size 20x18
text run at (1,1) width 20: "bar"
RenderBlock (anonymous) at (0,24) size 780x28
RenderText {#text} at (365,0) size 50x28
text run at (365,0) width 50: "ghijk"
RenderBlock (anonymous) at (0,80) size 780x0
RenderBlock {OL} at (0,136) size 784x54
RenderListItem {LI} at (40,0) size 744x54
RenderListMarker at (-20,0) size 16x18
RenderText {#text} at (0,0) size 731x54
text run at (0,0) width 731: "<div id=\"test\" class=\"editing\"> <div>abcdef<div style=\"text-align: center;\"><table style=\"border-spacing: 2px 2px;"
text run at (0,18) width 729: "\"><tbody style=\"border-spacing: 2px 2px; \"><tr style=\"border-spacing: 2px 2px; \"><td style=\"border-spacing: 2px"
text run at (0,36) width 712: "2px; \">foo</td><td style=\"border-spacing: 2px 2px; \">bar</td></tr></tbody></table>ghijk</div> </div> </div>"
caret: position 5 of child 1 {#text} of child 1 {DIV} of child 1 {DIV} of child 1 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
<html>
<head>
<style>
.editing {
border: 2px solid red;
font-size: 24px;
}
.explanation {
border: 2px solid blue;
padding: 12px;
font-size: 24px;
margin-bottom: 24px;
}
.scenario { margin-bottom: 16px;}
.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
.expected-results:first-line { font-weight: bold }
</style>
<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
<script>
function log(message) {
var console = document.getElementById("console");
var li = document.createElement("li");
var text = document.createTextNode(message);
li.appendChild(text);
console.appendChild(li);
}
function editingTest() {
execSelectAllCommand();
copyCommand();
execDeleteCommand();
pasteCommand();
}
</script>
<title>Editing Test</title>
</head>
<body>
Problem: copy/pasting some HTML including tables can give rise to a &lt;div&gt; element as the first child of the table element. This is invalid.
<div contenteditable id="root">
<div id="test" class="editing">
<div>
abcdef
<div style="text-align: center" >
<table><tr><td>foo</td><td>bar</td></tr></table>
ghijk
</div>
</div>
</div>
</div>
<ol id="console" />
<script>
runEditingTest();
log(root.innerHTML);
</script>
</body>
</html>
2006-06-29 Graham Dennis <Graham.Dennis@gmail.com>
Reviewed by Justin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9505
moveParagraphContentsToNewBlockIfNecessary creates a new block outside the current position
* editing/CompositeEditCommand.cpp:
Added sanity checking to prevent modifying nodes outside of
where we should be
(WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
2006-06-29 Brady Eidson <beidson@apple.com>
Reviewed by Levi.
......@@ -27,7 +39,6 @@
* icon/SiteIcon.cpp:
(SiteIcon::getImage):
2006-06-29 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by Darin.
......@@ -537,7 +548,6 @@
(WebCore::SQLStatement::getColumnBlobAsVector):
(WebCore::SQLStatement::getColumnBlob):
>>>>>>> .r15079
2006-06-27 Ada Chan <adachan@apple.com>
Reviewed by sfalken.
......@@ -1378,7 +1388,6 @@
(WebCore::xmlDocPtrFromNode):
Pass DocLoader to xmlDocPtrForString
>>>>>>> .r15049
2006-06-21 David Hyatt <hyatt@apple.com>
Back out -webkit-overlay and just rename it back to overlay.
......
......@@ -552,7 +552,12 @@ void CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary(const Posi
Position paragraphStart = visibleParagraphStart.deepEquivalent().upstream();
Position end = visibleEnd.deepEquivalent().upstream();
// Perform some sanity checks. If there are no VisiblePositions in
// the same block as pos then paragraphStart will be outside the paragraph
if (Range::compareBoundaryPoints(pos, paragraphStart) < 0)
return;
// Perform some checks to see if we need to perform work in this function.
if (paragraphStart.node()->isBlockFlow()) {
if (end.node()->isBlockFlow()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment