Reviewed by adele
<rdar://problem/
5078739>
Crash in in ReplaceSelectionCommand if the fragment contains only a style span
* editing/pasteboard/
5078739-expected.txt: Added.
* editing/pasteboard/
5078739.html: Added.
WebCore:
Reviewed by adele
<rdar://problem/
5078739>
Crash in in ReplaceSelectionCommand if the fragment contains only a style span
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::doApply): Check
for an empty fragment after removing a redundant
style span instead of before.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@20456
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-03-23 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by adele
+
+ <rdar://problem/5078739>
+ Crash in in ReplaceSelectionCommand if the fragment contains only a style span
+
+ * editing/pasteboard/5078739-expected.txt: Added.
+ * editing/pasteboard/5078739.html: Added.
+
2007-03-23 Justin Garcia <justin.garcia@apple.com>
Reviewed by darin
--- /dev/null
+This tests for a crash when the fragment contains only an interchange newline.
+
+
+
--- /dev/null
+<p>This tests for a crash when the fragment contains only an interchange newline.</p>
+<div id="div" contenteditable="true"><br></div>
+
+<script>
+if (window.layoutTestController)
+ window.layoutTestController.dumpAsText();
+
+var div = document.getElementById("div");
+div.focus();
+document.execCommand("InsertHTML", false, "<span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: Times; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-fill-color: rgb(0, 0, 0); -webkit-text-size-adjust: auto; -webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: 0; '></span>");
+</script>
+2007-03-23 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by adele
+
+ <rdar://problem/5078739>
+ Crash in in ReplaceSelectionCommand if the fragment contains only a style span
+
+ * editing/ReplaceSelectionCommand.cpp:
+ (WebCore::ReplaceSelectionCommand::doApply): Check
+ for an empty fragment after removing a redundant
+ style span instead of before.
+
2007-03-23 David Hyatt <hyatt@apple.com>
<rdar://problem/5085063>
frame->clearTypingStyle();
setTypingStyle(0);
- // 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())) {
fragment.removeNodePreservingChildren(styleSpan);
}
+ // We're finished if there is nothing to add.
+ if (fragment.isEmpty() || !fragment.firstChild())
+ return;
+
// 1) Insert the content.
// 2) Remove redundant styles and style tags, this inner <b> for example: <b>foo <b>bar</b> baz</b>.
// 3) Merge the start of the added content with the content before the position being pasted into.