| 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()
|
|
|