diff options
author | Ben Murdoch <benm@google.com> | 2010-06-15 19:36:43 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-06-16 14:52:28 +0100 |
commit | 545e470e52f0ac6a3a072bf559c796b42c6066b6 (patch) | |
tree | c0c14763654d84d37577dde512c3d3b4699a9e86 /WebCore/editing/htmlediting.cpp | |
parent | 719298a66237d38ea5c05f1547123ad8aacbc237 (diff) | |
download | external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.zip external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.gz external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.bz2 |
Merge webkit.org at r61121: Initial merge by git.
Change-Id: Icd6db395c62285be384d137164d95d7466c98760
Diffstat (limited to 'WebCore/editing/htmlediting.cpp')
-rw-r--r-- | WebCore/editing/htmlediting.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/WebCore/editing/htmlediting.cpp b/WebCore/editing/htmlediting.cpp index 3356ed9..9f73167 100644 --- a/WebCore/editing/htmlediting.cpp +++ b/WebCore/editing/htmlediting.cpp @@ -869,7 +869,35 @@ bool isTableCell(const Node* node) bool isEmptyTableCell(const Node* node) { - return node && node->renderer() && (node->renderer()->isTableCell() || (node->renderer()->isBR() && node->parentNode()->renderer() && node->parentNode()->renderer()->isTableCell())); + // Returns true IFF the passed in node is one of: + // .) a table cell with no children, + // .) a table cell with a single BR child, and which has no other child renderers, including :before and :after renderers + // .) the BR child of such a table cell + + // Find rendered node + while (node && !node->renderer()) + node = node->parent(); + if (!node) + return false; + + // Make sure the rendered node is a table cell or <br>. + // If it's a <br>, then the parent node has to be a table cell. + RenderObject* renderer = node->renderer(); + if (renderer->isBR()) { + renderer = renderer->parent(); + if (!renderer) + return false; + } + if (!renderer->isTableCell()) + return false; + + // Check that the table cell contains no child renderers except for perhaps a single <br>. + RenderObject* childRenderer = renderer->firstChild(); + if (!childRenderer) + return true; + if (!childRenderer->isBR()) + return false; + return !childRenderer->nextSibling(); } PassRefPtr<HTMLElement> createDefaultParagraphElement(Document* document) |