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

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, 6 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 461d5f14f5d2fdd1439006746cc260a008878547..ba7c1db25c7146d31fbfc489b6bc64f93c99b037 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;
esprehn 2015/07/06 23:11:04 It's not clear to me that this actually works, in
rhogan 2015/07/07 18:35:40 There is though, the following test has whitespace
+
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