Chromium Code Reviews| 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() |