Reviewed by justin.
REGRESSION: two editing layout tests show incorrect spell checking in pixel test mode
http://bugzilla.opendarwin.org/show_bug.cgi?id=8350
* editing/pasteboard/innerText-inline-table-expected.checksum: Added.
* editing/pasteboard/innerText-inline-table-expected.png: Added.
* editing/pasteboard/innerText-inline-table-expected.txt: Added.
* editing/pasteboard/innerText-inline-table.html: Added.
WebCore:
Reviewed by justin.
* editing/TextIterator.cpp:
(WebCore::shouldEmitSpaceBeforeAndAfterNode):
Returns true when the node should have a leading and trailing space. Currently only
used for inline tables. The function shouldEmitNewlinesBeforeAndAfterNode has a
fallback for nodes with no RenderObject, but the inline property doesn't really
have a meaning without one.
(WebCore::TextIterator::handleNonTextNode):
Checks shouldEmitSpaceBeforeAndAfterNode and inserts a space if necessary.
(WebCore::TextIterator::exitNode):
Checks shouldEmitSpaceBeforeAndAfterNode and inserts a space if necessary.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14248
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-05-08 Levi Weintraub <lweintraub@apple.com>
+
+ Reviewed by justin.
+
+ REGRESSION: two editing layout tests show incorrect spell checking in pixel test mode
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=8350
+
+ * editing/pasteboard/innerText-inline-table-expected.checksum: Added.
+ * editing/pasteboard/innerText-inline-table-expected.png: Added.
+ * editing/pasteboard/innerText-inline-table-expected.txt: Added.
+ * editing/pasteboard/innerText-inline-table.html: Added.
+
2006-05-04 Anders Carlsson <acarlsson@apple.com>
Reviewed by Darin.
--- /dev/null
+0c0a270023ed8851420486ea5ad82a3b
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas 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 {DIV} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 490x18
+ text run at (0,0) width 490: "Checks that the text iterator is emitting a space before and after an inline table."
+ RenderBlock {DIV} at (0,18) size 784x28
+ RenderText {#text} at (0,10) size 31x18
+ text run at (0,10) width 31: "hello"
+ RenderTable {TABLE} at (31,0) size 14x24
+ RenderTableSection {TBODY} at (0,0) size 14x24
+ RenderTableRow {TR} at (0,2) size 14x20
+ RenderTableCell {TD} at (2,2) size 10x20 [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 8x18
+ text run at (1,1) width 8: "1"
+ RenderText {#text} at (45,10) size 37x18
+ text run at (45,10) width 37: "world"
+ RenderBlock {DIV} at (0,46) size 784x28
+ RenderText {#text} at (0,10) size 25x18
+ text run at (0,10) width 25: "foo "
+ RenderTable {TABLE} at (25,0) size 14x24
+ RenderTableSection {TBODY} at (0,0) size 14x24
+ RenderTableRow {TR} at (0,2) size 14x20
+ RenderTableCell {TD} at (2,2) size 10x20 [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 8x18
+ text run at (1,1) width 8: "2"
+ RenderText {#text} at (39,10) size 24x18
+ text run at (39,10) width 24: " bar"
+ RenderBlock {UL} at (0,90) size 784x18
+ RenderListItem {LI} at (40,0) size 744x18
+ RenderBlock {PRE} at (0,0) size 744x18
+ RenderListMarker at (-17,0) size 7x18
+ RenderText {#text} at (0,2) size 64x15
+ text run at (0,2) width 64: "Success!"
--- /dev/null
+<div id="explanation">Checks that the text iterator is emitting a space before and after an inline table.</div>
+
+<div id="test">hello<table style="display:inline"><tr><td>1</td></tr></table>world</div>
+<div id="test2">foo <table style="display:inline"><tr><td>2</td></tr></table> bar</div>
+<ul id="console"></ul>
+<script>
+
+function log(message) {
+ var console = document.getElementById("console");
+ var li = document.createElement("li");
+ var pre = document.createElement("pre");
+ pre.appendChild(document.createTextNode(message));
+ li.appendChild(pre);
+ console.appendChild(li);
+}
+
+var e = document.getElementById("test");
+var e2 = document.getElementById("test2");
+var expected = "hello 1 world\nfoo 2 bar";
+var actual = e.innerText + "\n" + e2.innerText;
+if (expected == actual)
+ log("Success!");
+else {
+ log("Failure!");
+ log("Expected \n\"" + expected + "\"");
+ log("Received \n\"" + actual + "\"");
+}
+</script>
\ No newline at end of file
+2006-05-08 Levi Weintraub <lweintraub@apple.com>
+
+ Reviewed by justin.
+
+ * editing/TextIterator.cpp:
+ (WebCore::shouldEmitSpaceBeforeAndAfterNode):
+ Returns true when the node should have a leading and trailing space. Currently only
+ used for inline tables. The function shouldEmitNewlinesBeforeAndAfterNode has a
+ fallback for nodes with no RenderObject, but the inline property doesn't really
+ have a meaning without one.
+ (WebCore::TextIterator::handleNonTextNode):
+ Checks shouldEmitSpaceBeforeAndAfterNode and inserts a space if necessary.
+ (WebCore::TextIterator::exitNode):
+ Checks shouldEmitSpaceBeforeAndAfterNode and inserts a space if necessary.
+
2006-05-08 Anders Carlsson <acarlsson@apple.com>
Try fixing the Win32 build
return t && (t->cellBefore(rc) || t->cellAbove(rc));
}
+static bool shouldEmitSpaceBeforeAndAfterNode(Node* node)
+{
+ RenderObject* r = node->renderer();
+
+ return r && r->isTable() && r->isInline();
+}
+
static bool shouldEmitNewlineForNode(Node* node)
{
// br elements are represented by a single newline.
emitCharacter('\t', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
else if (shouldEmitNewlinesBeforeAndAfterNode(m_node))
emitCharacter('\n', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
+ else if (shouldEmitSpaceBeforeAndAfterNode(m_node))
+ emitCharacter(' ', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
}
return true;
// insert a newline with a position following this block
emitCharacter('\n', m_node->parentNode(), m_node, 1, 1);
}
- }
+ } else if (shouldEmitSpaceBeforeAndAfterNode(m_node))
+ emitCharacter(' ', m_node->parentNode(), m_node, 1, 1);
}
void TextIterator::emitCharacter(QChar c, Node *textNode, Node *offsetBaseNode, int textStartOffset, int textEndOffset)