Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Unified Diff: Source/core/dom/Text.cpp

Issue 1065563005: Allow whitespace inside anonymous table cells (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/platform/linux/tables/mozilla/bugs/bug72359-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Text.cpp
diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp
index 4f46e8abb87b7a02e36d8616e7d9793b75794c77..71ce46fafe31b261b867f458704327e75b04cf5b 100644
--- a/Source/core/dom/Text.cpp
+++ b/Source/core/dom/Text.cpp
@@ -237,12 +237,31 @@ PassRefPtrWillBeRawPtr<Node> Text::cloneNode(bool /*deep*/)
return cloneWithData(data());
}
+static inline bool hasGeneratedAnonymousTableCells(const LayoutObject& parent)
+{
+ // We're checking whether the table part has generated anonymous table
+ // part wrappers to hold its contents, so inspecting its first child will suffice.
+ LayoutObject* child = parent.slowFirstChild();
+ if (!child || !child->isAnonymous())
+ return false;
+ if (child->isTableCell())
+ return true;
+ if (child->isTableSection() || child->isTableRow())
+ return hasGeneratedAnonymousTableCells(*child);
+ return false;
+}
+
static inline bool canHaveWhitespaceChildren(const LayoutObject& parent)
{
// <button> should allow whitespace even though LayoutFlexibleBox doesn't.
if (parent.isLayoutButton())
return true;
+ // Allow whitespace when the text is inside a table, section or row element that
+ // has generated anonymous table cells to hold its contents.
+ if (hasGeneratedAnonymousTableCells(parent))
+ return true;
+
if (parent.isTable() || parent.isTableRow() || parent.isTableSection()
|| parent.isLayoutTableCol() || parent.isFrameSet()
|| parent.isFlexibleBox() || parent.isLayoutGrid()
« no previous file with comments | « LayoutTests/platform/linux/tables/mozilla/bugs/bug72359-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698