Reviewed by Darin Adler.
- fix http://bugs.webkit.org/show_bug.cgi?id=14134
<rdar://problem/
5655160> REGRESSION (r25353): Whitespace nodes ignored between inline list items
Test: fast/dynamic/create-renderer-for-whitespace-only-text.html
* dom/Node.cpp:
(WebCore::Node::attach): Added code to check if this node's renderer
has become the "previous renderer" of any sibling text node, and if so,
ensure that that node gets a renderer if it now needs one.
(WebCore::Node::createRendererIfNeeded): Removed the assertion that the
node is not attached.
LayoutTests:
Reviewed by Darin Adler.
- test and updated results for http://bugs.webkit.org/show_bug.cgi?id=14134
<rdar://problem/
5655160> REGRESSION (r25353): Whitespace nodes ignored between inline list items
* fast/dynamic/create-renderer-for-whitespace-only-text.html: Added.
* fast/dynamic/style-access-late-stylesheet-load-expected.txt:
* platform/mac-leopard/fast/dynamic: Added.
* platform/mac-leopard/fast/dynamic/create-renderer-for-whitespace-only-text-expected.checksum: Added.
* platform/mac-leopard/fast/dynamic/create-renderer-for-whitespace-only-text-expected.png: Added.
* platform/mac/editing/deleting/delete-block-merge-contents-001-expected.txt:
* platform/mac/editing/deleting/delete-block-merge-contents-019-expected.txt:
* platform/mac/editing/deleting/delete-block-merge-contents-020-expected.txt:
* platform/mac/editing/inserting/editable-html-element-expected.txt:
* platform/mac/editing/inserting/editing-empty-divs-expected.txt:
* platform/mac/editing/pasteboard/paste-TIFF-expected.txt:
* platform/mac/editing/selection/
4983858-expected.txt:
* platform/mac/editing/selection/
5136696-expected.txt:
* platform/mac/editing/selection/drag-to-contenteditable-iframe-expected.txt:
* platform/mac/editing/style/remove-underline-across-paragraph-expected.txt:
* platform/mac/editing/style/remove-underline-across-paragraph-in-bold-expected.txt:
* platform/mac/editing/style/remove-underline-after-paragraph-expected.txt:
* platform/mac/editing/style/remove-underline-after-paragraph-in-bold-expected.txt:
* platform/mac/editing/style/remove-underline-from-stylesheet-expected.txt:
* platform/mac/fast/dynamic/create-renderer-for-whitespace-only-text-expected.txt: Added.
* platform/mac/fast/dynamic/move-node-with-selection-expected.txt:
* platform/mac/fast/forms/input-align-expected.txt:
* platform/mac/fast/inline/positionedLifetime-expected.txt:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29054
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-12-31 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ - test and updated results for http://bugs.webkit.org/show_bug.cgi?id=14134
+ <rdar://problem/5655160> REGRESSION (r25353): Whitespace nodes ignored between inline list items
+
+ * fast/dynamic/create-renderer-for-whitespace-only-text.html: Added.
+ * fast/dynamic/style-access-late-stylesheet-load-expected.txt:
+ * platform/mac-leopard/fast/dynamic: Added.
+ * platform/mac-leopard/fast/dynamic/create-renderer-for-whitespace-only-text-expected.checksum: Added.
+ * platform/mac-leopard/fast/dynamic/create-renderer-for-whitespace-only-text-expected.png: Added.
+ * platform/mac/editing/deleting/delete-block-merge-contents-001-expected.txt:
+ * platform/mac/editing/deleting/delete-block-merge-contents-019-expected.txt:
+ * platform/mac/editing/deleting/delete-block-merge-contents-020-expected.txt:
+ * platform/mac/editing/inserting/editable-html-element-expected.txt:
+ * platform/mac/editing/inserting/editing-empty-divs-expected.txt:
+ * platform/mac/editing/pasteboard/paste-TIFF-expected.txt:
+ * platform/mac/editing/selection/4983858-expected.txt:
+ * platform/mac/editing/selection/5136696-expected.txt:
+ * platform/mac/editing/selection/drag-to-contenteditable-iframe-expected.txt:
+ * platform/mac/editing/style/remove-underline-across-paragraph-expected.txt:
+ * platform/mac/editing/style/remove-underline-across-paragraph-in-bold-expected.txt:
+ * platform/mac/editing/style/remove-underline-after-paragraph-expected.txt:
+ * platform/mac/editing/style/remove-underline-after-paragraph-in-bold-expected.txt:
+ * platform/mac/editing/style/remove-underline-from-stylesheet-expected.txt:
+ * platform/mac/fast/dynamic/create-renderer-for-whitespace-only-text-expected.txt: Added.
+ * platform/mac/fast/dynamic/move-node-with-selection-expected.txt:
+ * platform/mac/fast/forms/input-align-expected.txt:
+ * platform/mac/fast/inline/positionedLifetime-expected.txt:
+
2007-12-31 Darin Adler <darin@apple.com>
Reviewed by Mitz.
--- /dev/null
+<style>
+ table { border-collapse: collapse; }
+ td { border: 1px solid black; padding: 4px; }
+
+ ul.inlineItems li { display: inline; }
+
+ div.inlineDivs div { display: inline; }
+</style>
+<p>
+ Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=14134">http://bugs.webkit.org/show_bug.cgi?id=14134</a>
+ REGRESSION (r25353): Whitespace nodes ignored between inline list items</i>.
+</p>
+<p>
+ This tests that whitespace-only text nodes get renderers when they should
+ even if initially they did not need a renderer.
+</p>
+<p>
+ The left column should be identical to the right column.
+</p>
+<table>
+ <tr>
+ <td>
+ <div id="target">suit</div>
+ </td>
+ <td>
+ <div>wet suit</div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <ul id="list">
+ <li>wet</li>
+ <li>suit</li>
+ </ul>
+ </td>
+ <td>
+ <ul class="inlineItems">
+ <li>wet</li>
+ <li>suit</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="div">
+ <div>wet</div>
+ <div>suit</div>
+ </div>
+ </td>
+ <td>
+ <div class="inlineDivs">
+ <div>wet</div>
+ <div>suit</div>
+ </div>
+ </td>
+ </tr>
+</table>
+<script>
+ function test()
+ {
+ var target = document.getElementById("target");
+ target.insertBefore(document.createTextNode(" "), target.firstChild);
+ target.insertBefore(document.createTextNode("wet"), target.firstChild);
+
+ document.getElementById("list").className = "inlineItems";
+
+ document.getElementById("div").className = "inlineDivs";
+ }
+
+ test();
+</script>
Test that offsetWidth and similar get up to date style information even if a new stylesheet load is started at late stage of document rendering
PASS
+
--- /dev/null
+0425b8c30495b420d075df1cd6f3b6b3
\ No newline at end of file
text run at (0,0) width 40: "One"
RenderText {#text} at (40,0) size 44x28
text run at (40,0) width 44: "Two"
+ RenderText {#text} at (0,0) size 0x0
caret: position 4 of child 0 {#text} of child 1 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
text run at (14,14) width 17: "X"
RenderText {#text} at (31,14) size 17x28
text run at (31,14) width 17: "X"
+ RenderText {#text} at (0,0) size 0x0
caret: position 2 of child 0 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
text run at (14,14) width 17: "X"
RenderText {#text} at (31,14) size 17x28
text run at (31,14) width 17: "X"
+ RenderText {#text} at (0,0) size 0x0
caret: position 2 of child 0 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
text run at (783,0) width 1: " "
text run at (0,18) width 755: "paragraph separator doesn't split the body (inserting a paragraph separator usually splits/clones the enclosing block flow "
text run at (0,36) width 58: "element)."
+ RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,54) size 784x18
RenderBR {BR} at (0,0) size 0x18
caret: position 0 of child 0 {BR} of child 2 {DIV} of child 2 {BODY} of child 0 {HTML} of document
RenderBlock {DIV} at (0,230) size 707x22 [border: (1px dotted #0000FF)]
RenderText {#text} at (1,1) size 7x18
text run at (1,1) width 7: "c"
+ RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,268) size 784x18
RenderText {#text} at (0,0) size 234x18
text run at (0,0) width 234: "This div contains a self-closing p tag."
RenderBlock (anonymous) at (1,1) size 705x18
RenderText {#text} at (0,0) size 7x18
text run at (0,0) width 7: "c"
+ RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (1,35) size 705x0
caret: position 1 of child 0 {#text} of child 21 {DIV} of child 2 {BODY} of child 0 {HTML} of document
RenderBlock {DIV} at (0,0) size 784x125 [border: (2px solid #FF0000)]
RenderBlock (anonymous) at (14,14) size 756x97
RenderImage {IMG} at (0,0) size 593x97
+ RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (14,111) size 756x0
RenderBlock {DIV} at (0,125) size 784x0
caret: position 1 of child 0 {IMG} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
RenderText {#text} at (0,0) size 780x36
text run at (0,0) width 780: "This tests for a bug where selecting a word would select the line break and word before it. Only the word in the paragraph "
text run at (0,18) width 162: "below should be selected:"
+ RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,36) size 784x18
RenderText {#text} at (0,0) size 21x18
text run at (0,0) width 21: "foo"
RenderText {#text} at (0,0) size 270x36
text run at (0,0) width 270: "This test should be selected, but this frame "
text run at (0,18) width 133: "shouldn't be focused."
+ RenderText {#text} at (0,0) size 0x0
RenderBR {BR} at (304,154) size 0x0
RenderTextControl {INPUT} at (2,156) size 217x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
RenderText {#text} at (0,0) size 0x0
RenderBlock {HTML} at (0,0) size 200x200
RenderBody {BODY} at (8,8) size 184x184 [bgcolor=#FFFFE0]
RenderImage {IMG} at (0,0) size 76x103
+ RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (208,194) size 4x18
text run at (208,194) width 4: " "
RenderImage {IMG} at (212,105) size 76x103
RenderText {#text} at (78,0) size 78x28
text run at (78,0) width 78: " xxxxxx"
selection start: position 0 of child 1 {#text} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
-selection end: position 7 of child 0 {#text} of child 4 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection end: position 7 of child 0 {#text} of child 3 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
RenderText {#text} at (78,0) size 78x28
text run at (78,0) width 78: " xxxxxx"
selection start: position 0 of child 0 {#text} of child 1 {B} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
-selection end: position 7 of child 0 {#text} of child 0 {B} of child 4 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection end: position 7 of child 0 {#text} of child 0 {B} of child 3 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
RenderBlock {DIV} at (14,42) size 756x28
RenderText {#text} at (0,0) size 156x28
text run at (0,0) width 156: " xxxxxx xxxxxx"
-caret: position 14 of child 0 {#text} of child 3 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+caret: position 14 of child 0 {#text} of child 2 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
RenderInline {B} at (0,0) size 156x28
RenderText {#text} at (0,0) size 156x28
text run at (0,0) width 156: " xxxxxx xxxxxx"
-caret: position 14 of child 0 {#text} of child 0 {B} of child 3 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+caret: position 14 of child 0 {#text} of child 0 {B} of child 2 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
RenderInline {SPAN} at (0,0) size 78x28
RenderText {#text} at (164,14) size 78x28
text run at (164,14) width 78: " xxxxxx"
- RenderText {#text} at (0,0) size 0x0
- RenderInline {SPAN} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 0x28
selection start: position 0 of child 1 {#text} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
selection end: position 6 of child 1 {#text} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
--- /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 784x36
+ RenderText {#text} at (0,0) size 53x18
+ text run at (0,0) width 53: "Test for "
+ RenderInline {I} at (0,0) size 784x36
+ RenderInline {A} at (0,0) size 301x18 [color=#0000EE]
+ RenderText {#text} at (53,0) size 301x18
+ text run at (53,0) width 301: "http://bugs.webkit.org/show_bug.cgi?id=14134"
+ RenderText {#text} at (354,0) size 784x36
+ text run at (354,0) width 4: " "
+ text run at (358,0) width 426: "REGRESSION (r25353): Whitespace nodes ignored between inline"
+ text run at (0,18) width 55: "list items"
+ RenderText {#text} at (55,18) size 4x18
+ text run at (55,18) width 4: "."
+ RenderBlock {P} at (0,52) size 784x18
+ RenderText {#text} at (0,0) size 744x18
+ text run at (0,0) width 466: "This tests that whitespace-only text nodes get renderers when they should "
+ text run at (466,0) width 278: "even if initially they did not need a renderer."
+ RenderBlock {P} at (0,86) size 784x18
+ RenderText {#text} at (0,0) size 349x18
+ text run at (0,0) width 349: "The left column should be identical to the right column."
+ RenderTable {TABLE} at (0,120) size 197x98 [border: none]
+ RenderTableSection {TBODY} at (0,0) size 196x97
+ RenderTableRow {TR} at (0,0) size 196x27
+ RenderTableCell {TD} at (0,0) size 98x27 [border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1]
+ RenderBlock {DIV} at (5,5) size 89x18
+ RenderText {#text} at (0,0) size 23x18
+ text run at (0,0) width 23: "wet"
+ RenderText {#text} at (23,0) size 4x18
+ text run at (23,0) width 4: " "
+ RenderText {#text} at (27,0) size 22x18
+ text run at (27,0) width 22: "suit"
+ RenderTableCell {TD} at (98,0) size 98x27 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1]
+ RenderBlock {DIV} at (5,5) size 89x18
+ RenderText {#text} at (0,0) size 49x18
+ text run at (0,0) width 49: "wet suit"
+ RenderTableRow {TR} at (0,27) size 196x43
+ RenderTableCell {TD} at (0,27) size 98x43 [border: (1px solid #000000)] [r=1 c=0 rs=1 cs=1]
+ RenderBlock {UL} at (5,5) size 89x18
+ RenderInline {LI} at (0,0) size 23x18
+ RenderText {#text} at (40,0) size 23x18
+ text run at (40,0) width 23: "wet"
+ RenderText {#text} at (63,0) size 4x18
+ text run at (63,0) width 4: " "
+ RenderInline {LI} at (0,0) size 22x18
+ RenderText {#text} at (67,0) size 22x18
+ text run at (67,0) width 22: "suit"
+ RenderText {#text} at (0,0) size 0x0
+ RenderTableCell {TD} at (98,27) size 98x43 [border: (1px solid #000000)] [r=1 c=1 rs=1 cs=1]
+ RenderBlock {UL} at (5,5) size 89x18
+ RenderInline {LI} at (0,0) size 23x18
+ RenderText {#text} at (40,0) size 23x18
+ text run at (40,0) width 23: "wet"
+ RenderText {#text} at (63,0) size 4x18
+ text run at (63,0) width 4: " "
+ RenderInline {LI} at (0,0) size 22x18
+ RenderText {#text} at (67,0) size 22x18
+ text run at (67,0) width 22: "suit"
+ RenderText {#text} at (0,0) size 0x0
+ RenderTableRow {TR} at (0,70) size 196x27
+ RenderTableCell {TD} at (0,70) size 98x27 [border: (1px solid #000000)] [r=2 c=0 rs=1 cs=1]
+ RenderBlock {DIV} at (5,5) size 89x18
+ RenderInline {DIV} at (0,0) size 23x18
+ RenderText {#text} at (0,0) size 23x18
+ text run at (0,0) width 23: "wet"
+ RenderText {#text} at (23,0) size 4x18
+ text run at (23,0) width 4: " "
+ RenderInline {DIV} at (0,0) size 22x18
+ RenderText {#text} at (27,0) size 22x18
+ text run at (27,0) width 22: "suit"
+ RenderText {#text} at (0,0) size 0x0
+ RenderTableCell {TD} at (98,70) size 98x27 [border: (1px solid #000000)] [r=2 c=1 rs=1 cs=1]
+ RenderBlock {DIV} at (5,5) size 89x18
+ RenderInline {DIV} at (0,0) size 23x18
+ RenderText {#text} at (0,0) size 23x18
+ text run at (0,0) width 23: "wet"
+ RenderText {#text} at (23,0) size 4x18
+ text run at (23,0) width 4: " "
+ RenderInline {DIV} at (0,0) size 22x18
+ RenderText {#text} at (27,0) size 22x18
+ text run at (27,0) width 22: "suit"
+ RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 84x18
text run at (0,0) width 84: "Lorem ipsum"
RenderBlock (anonymous) at (0,18) size 784x0
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
text run at (152,48) width 4: " "
RenderBR {BR} at (0,0) size 0x0
RenderTextControl {INPUT} at (2,71) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
- RenderBR {BR} at (152,85) size 0x0
+ RenderText {#text} at (152,71) size 4x18
+ text run at (152,71) width 4: " "
+ RenderBR {BR} at (0,0) size 0x0
RenderBlock {DIV} at (0,126) size 784x23
RenderTextControl {INPUT} at (2,2) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
layer at (13,47) size 142x13
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
+2007-12-31 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=14134
+ <rdar://problem/5655160> REGRESSION (r25353): Whitespace nodes ignored between inline list items
+
+ Test: fast/dynamic/create-renderer-for-whitespace-only-text.html
+
+ * dom/Node.cpp:
+ (WebCore::Node::attach): Added code to check if this node's renderer
+ has become the "previous renderer" of any sibling text node, and if so,
+ ensure that that node gets a renderer if it now needs one.
+ (WebCore::Node::createRendererIfNeeded): Removed the assertion that the
+ node is not attached.
+
2007-12-31 Darin Adler <darin@apple.com>
Reviewed by Mitz.
{
ASSERT(!attached());
ASSERT(!renderer() || (renderer()->style() && renderer()->parent()));
+
+ // If this node got a renderer it may be the previousRenderer() of sibling text nodes and thus affect the
+ // result of Text::rendererIsNeeded() for those nodes.
+ if (renderer()) {
+ for (Node* next = nextSibling(); next; next = next->nextSibling()) {
+ if (next->renderer())
+ break;
+ if (!next->attached())
+ break; // Assume this means none of the following siblings are attached.
+ if (next->isTextNode())
+ next->createRendererIfNeeded();
+ }
+ }
+
m_attached = true;
}
{
if (!document()->shouldCreateRenderers())
return;
-
- ASSERT(!attached());
+
ASSERT(!renderer());
Node *parent = parentNode();