Reviewed by levi
<rdar://problem/
4242293>
Poor paste fidelity of http://www.google.com/
* editing/pasteboard/styled-element-markup-expected.checksum: Added.
* editing/pasteboard/styled-element-markup-expected.png: Added.
* editing/pasteboard/styled-element-markup-expected.txt: Added.
* editing/pasteboard/styled-element-markup.html: Added.
WebCore:
Reviewed by levi
<rdar://problem/
4242293>
Poor paste fidelity of http://www.google.com/
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyInlineStyle): Fixed crasher with nil-check.
* editing/markup.cpp:
(WebCore::startMarkup): Style information wasn't added to an element if it had
attributes but no style attribute.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15656
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-07-27 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by levi
+
+ <rdar://problem/4242293>
+ Poor paste fidelity of http://www.google.com/
+
+ * editing/pasteboard/styled-element-markup-expected.checksum: Added.
+ * editing/pasteboard/styled-element-markup-expected.png: Added.
+ * editing/pasteboard/styled-element-markup-expected.txt: Added.
+ * editing/pasteboard/styled-element-markup.html: Added.
+
2006-07-27 Alexander Kellett <lypanov@kde.org>
Reviewed by Darin.
--- /dev/null
+4671eea1bf36a528bc452bb10459d536
\ No newline at end of file
--- /dev/null
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of CENTER > DIV > BODY > HTML > #document to 0 of CENTER > DIV > BODY > HTML > #document toDOMRange:range from 0 of CENTER > DIV > BODY > HTML > #document to 1 of CENTER > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 1 of DIV > BODY > HTML > #document to 1 of 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 784x584
+ RenderBlock {P} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 772x36
+ text run at (0,0) width 334: "This tests copy/paste of styled elements, like images. "
+ text run at (334,0) width 438: "The image in the region below should be centered after its copied and"
+ text run at (0,18) width 44: "pasted."
+ RenderBlock {DIV} at (0,52) size 784x103
+ RenderBlock {CENTER} at (0,0) size 784x103
+ RenderImage {IMG} at (354,0) size 76x103
+ RenderBlock {DIV} at (0,155) size 784x103
+ RenderImage {IMG} at (354,0) size 76x103
+caret: position 1 of child 0 {IMG} of child 4 {DIV} of child 0 {BODY} of child 0 {HTML} of document
--- /dev/null
+<p>This tests copy/paste of styled elements, like images. The image in the region below should be centered after its copied and pasted.</p>
+<div contenteditable="true" id="copy"><center><img src="../resources/abe.jpg"></center></div>
+<div contenteditable="true" id="paste"></div>
+
+<script>;
+window.getSelection().setPosition(document.getElementById("copy"));
+document.execCommand("SelectAll");
+document.execCommand("Copy");
+window.getSelection().setPosition(document.getElementById("paste"));
+document.execCommand("Paste");
+</script>
+2006-07-27 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by levi
+
+ <rdar://problem/4242293>
+ Poor paste fidelity of http://www.google.com/
+
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::applyInlineStyle): Fixed crasher with nil-check.
+ * editing/markup.cpp:
+ (WebCore::startMarkup): Style information wasn't added to an element if it had
+ attributes but no style attribute.
+
2006-07-27 Alexander Kellett <lypanov@kde.org>
Reviewed by Darin.
if (start.offset() >= start.node()->caretMaxOffset())
node = node->traverseNextNode();
- if (end.node()->renderer()->isTable() && end.offset() == maxDeepOffset(end.node()))
+ if (end.node()->renderer() && end.node()->renderer()->isTable() && end.offset() == maxDeepOffset(end.node()))
endNode = end.node()->lastDescendant();
if (start.node() == endNode) {
}
NamedAttrMap *attrs = el->attributes();
unsigned length = attrs->length();
- if (length == 0 && additionalStyle.length() > 0) {
- // FIXME: Handle case where additionalStyle has illegal characters in it, like "
- markup += " " + styleAttr.localName().deprecatedString() + "=\"" + additionalStyle.deprecatedString() + "\"";
- }
- else {
- for (unsigned int i=0; i<length; i++) {
- Attribute *attr = attrs->attributeItem(i);
- String value = attr->value();
- if (attr->name() == styleAttr && additionalStyle.length() > 0)
- value += "; " + additionalStyle;
- // FIXME: Handle case where value has illegal characters in it, like "
- if (documentIsHTML)
- markup += " " + attr->name().localName().deprecatedString();
- else
- markup += " " + attr->name().toString().deprecatedString();
- markup += "=\"" + escapeTextForMarkup(value.deprecatedString()) + "\"";
+
+ for (unsigned int i = 0; i < length; i++) {
+ Attribute *attr = attrs->attributeItem(i);
+ String value = attr->value();
+ if (attr->name() == styleAttr && additionalStyle.length() > 0) {
+ value += "; " + additionalStyle;
+ additionalStyle = "";
}
+ // FIXME: Handle case where value has illegal characters in it, like "
+ if (documentIsHTML)
+ markup += " " + attr->name().localName().deprecatedString();
+ else
+ markup += " " + attr->name().toString().deprecatedString();
+ markup += "=\"" + escapeTextForMarkup(value.deprecatedString()) + "\"";
}
+ if (additionalStyle.length() > 0)
+ // FIXME: Handle case where additionalStyle has illegal characters in it, like "
+ markup += " " + styleAttr.localName().deprecatedString() + "=\"" + additionalStyle.deprecatedString() + "\"";
+
if (shouldSelfClose(el)) {
if (el->isHTMLElement())
markup += " "; // XHTML 1.0 <-> HTML compatibility.