+2006-11-14 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by harrison
+
+ <rdar://problem/4806874>
+ Missing background image after paste
+
+ Checking in new expected results for fixes:
+ * editing/inserting/insert-3851164-fix-expected.checksum:
+ * editing/inserting/insert-3851164-fix-expected.png:
+ * editing/selection/drag-in-iframe-expected.checksum:
+ * editing/selection/drag-in-iframe-expected.png:
+
+ Same, but also removing an outdated comment about a bug:
+ * editing/pasteboard/paste-text-019-expected.checksum:
+ * editing/pasteboard/paste-text-019-expected.png:
+ * editing/pasteboard/paste-text-019-expected.txt:
+ * editing/pasteboard/paste-text-019.html:
+
+ Added:
+ * editing/pasteboard/4806874-expected.checksum: Added.
+ * editing/pasteboard/4806874-expected.png: Added.
+ * editing/pasteboard/4806874-expected.txt: Added.
+ * editing/pasteboard/4806874.html: Added.
+
+ Equivalent render trees:
+ * editing/inserting/insert-3907422-fix-expected.txt:
+ * editing/pasteboard/paste-text-011-expected.txt:
+ * editing/pasteboard/paste-text-015-expected.txt:
+
2006-11-14 Mitz Pettel <mitz@webkit.org>
http://bugs.webkit.org/show_bug.cgi?id=11575
-74336ed9a35562fc6c2e65f42d581187
\ No newline at end of file
+2d4b3e3e330ec1cc541a5cca7f16e24f
\ No newline at end of file
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 > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+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: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 3 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > BODY > HTML > #document to 3 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+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: 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 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 {BLOCKQUOTE} at (40,102) size 704x18
- RenderText {#text} at (0,0) size 20x18
- text run at (0,0) width 20: "bar"
- RenderBlock (anonymous) at (0,136) size 784x18
- RenderText {#text} at (0,0) size 22x18
- text run at (0,0) width 22: "baz"
- RenderText {#text} at (0,0) size 0x0
- RenderText {#text} at (0,0) size 0x0
- RenderText {#text} at (0,0) size 0x0
-caret: position 3 of child 3 {#text} 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 (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 1 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
--- /dev/null
+6a83e8fbf6d3687a4a69084591fd2b6a
\ No newline at end of file
--- /dev/null
+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 784x18
+ RenderText {#text} at (0,0) size 545x18
+ text run at (0,0) width 245: "This tests for an infinite loop on Paste. "
+ text run at (245,0) width 300: "You should see 'Hello: ' and then an input field."
+ RenderBlock {DIV} at (0,34) size 784x23
+ RenderText {#text} at (0,2) size 35x18
+ text run at (0,2) width 35: "Hello"
+ RenderTextField {INPUT} at (37,2) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+ RenderText {#text} at (187,2) size 4x18
+ text run at (187,2) width 4: ":"
+layer at (48,47) size 142x13
+ RenderBlock {DIV} at (3,3) size 142x13
+caret: position 1 of child 1 {INPUT} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
--- /dev/null
+<p>This tests for an infinite loop on Paste. You should see 'Hello: ' and then an input field.</p>
+<div id="div" contenteditable="true">Hello: </div>
+
+<script>
+var div = document.getElementById("div");
+var sel = window.getSelection();
+
+sel.setPosition(div, 0);
+sel.modify("move", "forward", "word");
+
+document.execCommand("InsertHTML", false, "<div><input type='text'></div>");
+</script>
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 > 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: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 5 of #text > B > FONT > P > DIV > SPAN > B > FONT > P > BODY > HTML > #document to 5 of #text > B > FONT > P > DIV > 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
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 784x21
- 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 (anonymous) at (0,37) size 784x0
- RenderInline {FONT} at (0,0) size 0x0
- RenderInline {B} at (0,0) size 0x0
- RenderInline {SPAN} at (0,0) size 0x0
- RenderInline {SPAN} at (0,0) size 0x0
- RenderBlock (anonymous) at (0,37) size 784x21
- 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: "there"
+ 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
RenderInline {FONT} at (0,0) size 0x0
RenderInline {B} at (0,0) size 0x0
RenderInline {B} at (0,0) size 0x0
RenderInline {FONT} at (0,0) size 0x0
RenderInline {B} at (0,0) size 0x0
- 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 0 {P} of child 1 {SPAN} of child 0 {B} of child 0 {FONT} of child 4 {P} of child 1 {BODY} of child 0 {HTML} of document
+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 {SPAN} of child 0 {B} of child 0 {FONT} of child 4 {P} of child 1 {BODY} of child 0 {HTML} of document
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 > P > DIV > DIV > BODY > HTML > #document to 3 of #text > P > SPAN > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > P > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document to 3 of #text > P > 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 > P > DIV > DIV > BODY > HTML > #document to 3 of #text > P > SPAN > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of P > SPAN > P > DIV > DIV > BODY > HTML > #document to 0 of P > SPAN > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > P > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document to 3 of #text > P > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of P > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document to 0 of P > 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 > P > DIV > DIV > BODY > HTML > #document to 0 of P > SPAN > P > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
+EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of P > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document to 0 of P > 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 > P > SPAN > P > DIV > DIV > BODY > HTML > #document to 3 of #text > P > SPAN > P > SPAN > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 3 of #text > P > DIV > SPAN > P > DIV > SPAN > P > DIV > DIV > BODY > HTML > #document to 3 of #text > P > DIV > SPAN > P > 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
RenderBlock {P} at (14,14) size 756x112
RenderBlock (anonymous) at (0,0) size 756x0
RenderInline {SPAN} at (0,0) size 0x0
- RenderBlock (anonymous) at (0,0) size 756x28
- RenderBlock {P} at (0,0) size 756x28
- RenderText {#text} at (0,0) size 32x28
- text run at (0,0) width 32: "foo"
- RenderBlock (anonymous) at (0,28) size 756x0
- RenderInline {SPAN} at (0,0) size 0x0
- RenderInline {SPAN} at (0,0) size 0x0
- RenderBlock (anonymous) at (0,28) size 756x84
- RenderBlock {P} at (0,0) size 756x28
- RenderText {#text} at (0,0) size 31x28
- text run at (0,0) width 31: "bar"
- RenderBlock {P} at (0,28) size 756x56
- RenderBlock (anonymous) at (0,0) size 756x0
- RenderInline {SPAN} at (0,0) size 0x0
- RenderBlock (anonymous) at (0,0) size 756x28
- RenderBlock {P} at (0,0) size 756x28
- RenderText {#text} at (0,0) size 32x28
- text run at (0,0) width 32: "foo"
- RenderBlock (anonymous) at (0,28) size 756x0
- RenderInline {SPAN} at (0,0) size 0x0
- RenderInline {SPAN} at (0,0) size 0x0
- RenderBlock (anonymous) at (0,28) size 756x28
- RenderBlock {P} at (0,0) size 756x28
- RenderText {#text} at (0,0) size 31x28
- text run at (0,0) width 31: "bar"
- RenderBlock (anonymous) at (0,56) size 756x0
- RenderInline {SPAN} at (0,0) size 0x0
+ RenderBlock (anonymous) at (0,0) size 756x112
+ RenderBlock {DIV} 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 (anonymous) at (0,0) size 756x0
+ RenderInline {SPAN} at (0,0) size 0x0
+ RenderBlock (anonymous) at (0,0) size 756x56
+ RenderBlock {DIV} 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
+ RenderInline {SPAN} at (0,0) size 0x0
RenderBlock (anonymous) at (0,112) size 756x0
RenderInline {SPAN} at (0,0) size 0x0
-caret: position 3 of child 0 {#text} of child 0 {P} of child 1 {SPAN} of child 1 {P} of child 1 {SPAN} of child 0 {P} of child 1 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+caret: position 3 of child 0 {#text} of child 1 {P} of child 0 {DIV} of child 0 {SPAN} of child 2 {P} 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
-329f766c06e6f043242bfd9e28720822
\ No newline at end of file
+a3445382dec1905883993f121d2c4882
\ No newline at end of file
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
- RenderInline {B} at (0,0) size 171x18
- RenderText {#text} at (0,0) size 171x18
- text run at (0,0) width 171: "This demonstrates a bug:"
- RenderText {#text} at (171,0) size 757x36
- text run at (171,0) width 586: " two adjacent text nodes render with a line break between them and cause focus ring drawing"
- text run at (0,18) width 116: "problems (10428)."
- RenderBlock {DIV} at (0,52) size 784x288 [border: (2px solid #0000FF)]
+ RenderBlock {DIV} at (0,0) size 784x288 [border: (2px solid #0000FF)]
RenderBlock {DIV} at (14,14) size 756x84
RenderText {#text} at (0,0) size 67x28
text run at (0,0) width 67: "Tests: "
RenderBlock (anonymous) at (0,132) size 756x28
RenderText {#text} at (0,0) size 155x28
text run at (0,0) width 155: "(case sensitive)."
- RenderBlock {DIV} at (0,364) size 784x32 [border: (2px solid #FF0000)]
+ RenderBlock {DIV} at (0,312) size 784x32 [border: (2px solid #FF0000)]
RenderInline {SPAN} at (0,0) size 153x28
RenderInline {SPAN} at (0,0) size 78x28
RenderText {#text} at (2,2) size 78x28
text run at (80,2) width 40: " baz"
RenderText {#text} at (120,2) size 35x28
text run at (120,2) width 35: "Bar"
-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
+caret: position 3 of child 2 {#text} of child 1 {SPAN} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
<title>Editing Test</title>
</head>
<body>
-<p><b>This demonstrates a bug:</b> two adjacent text nodes render with a line break between them and cause focus ring drawing problems (10428).</p>
<div class="explanation">
<div class="scenario">
Tests:
-8ca0e17c98959ca8a7e4b907dfccbb41
\ No newline at end of file
+e43c6beca0c9cd12d61babac9f4a6d04
\ No newline at end of file
+2006-11-13 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by harrison
+
+ <rdar://problem/4806874>
+ Missing background image after paste
+
+ * editing/markup.cpp:
+ (WebCore::createMarkup): If the body is fully selected, add a
+ div with its CSS properties to the markup. Migrated a use of
+ enclosingBlockFlowElement to enclosingBlock to fix an infinite
+ loop when pasting <div><input></div>.
+
2006-11-14 Anders Carlsson <acarlsson@apple.com>
Reviewed by Adam.
#include "markup.h"
#include "CSSComputedStyleDeclaration.h"
+#include "CSSPropertyNames.h"
#include "CSSRule.h"
#include "CSSRuleList.h"
#include "CSSStyleRule.h"
#include "Logging.h"
#include "ProcessingInstruction.h"
#include "Range.h"
+#include "Selection.h"
#include "htmlediting.h"
#include "visible_units.h"
#include "TextIterator.h"
doc->updateLayoutIgnorePendingStylesheets();
Node *commonAncestorBlock = 0;
- if (commonAncestor)
- commonAncestorBlock = commonAncestor->enclosingBlockFlowElement();
+ if (commonAncestor) {
+ commonAncestorBlock = enclosingBlock(commonAncestor);
+ if (commonAncestorBlock->hasTagName(tbodyTag)) {
+ Node* table = commonAncestorBlock->parentNode();
+ while (table && !table->hasTagName(tableTag))
+ table = table->parentNode();
+ if (table)
+ commonAncestorBlock = table;
+ }
+ }
if (!commonAncestorBlock)
return "";
}
}
+ // FIXME: Do this for all fully selected blocks, not just a body.
+ Node* root = range->startPosition().node();
+ while (root && !root->hasTagName(bodyTag))
+ root = root->parentNode();
+ if (root && *Selection::selectionFromContentsOfNode(root).toRange() == *range) {
+ CSSMutableStyleDeclaration* inlineStyleDecl = static_cast<HTMLElement*>(root)->inlineStyleDecl();
+ RefPtr<CSSMutableStyleDeclaration> style = inlineStyleDecl ? inlineStyleDecl->copy() : new CSSMutableStyleDeclaration();
+ RefPtr<CSSRuleList> matchedRules = root->document()->styleSelector()->styleRulesForElement(static_cast<Element*>(root), true);
+ if (matchedRules) {
+ for (unsigned i = 0; i < matchedRules->length(); i++) {
+ if (matchedRules->item(i)->type() == CSSRule::STYLE_RULE) {
+ RefPtr<CSSMutableStyleDeclaration> s = static_cast<CSSStyleRule*>(matchedRules->item(i))->style();
+ style->merge(s.get(), true);
+ }
+ }
+ }
+ defaultStyle->diff(style.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>");
+ }
+
// add in the "default style" for this markup
// FIXME: Handle case where value has illegal characters in it, like "
DeprecatedString openTag = DeprecatedString("<span class=\"") + AppleStyleSpanClass + "\" style=\"" + defaultStyle->cssText().deprecatedString() + "\">";