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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 Node::NodeType Text::nodeType() const 230 Node::NodeType Text::nodeType() const
231 { 231 {
232 return TEXT_NODE; 232 return TEXT_NODE;
233 } 233 }
234 234
235 PassRefPtrWillBeRawPtr<Node> Text::cloneNode(bool /*deep*/) 235 PassRefPtrWillBeRawPtr<Node> Text::cloneNode(bool /*deep*/)
236 { 236 {
237 return cloneWithData(data()); 237 return cloneWithData(data());
238 } 238 }
239 239
240 static inline bool hasGeneratedAnonymousTableCells(const LayoutObject& parent)
241 {
242 // We're checking whether the table part has generated anonymous table
243 // part wrappers to hold its contents, so inspecting its first child will su ffice.
244 LayoutObject* child = parent.slowFirstChild();
245 if (!child || !child->isAnonymous())
246 return false;
247 if (child->isTableCell())
248 return true;
249 if (child->isTableSection() || child->isTableRow())
250 return hasGeneratedAnonymousTableCells(*child);
251 return false;
252 }
253
240 static inline bool canHaveWhitespaceChildren(const LayoutObject& parent) 254 static inline bool canHaveWhitespaceChildren(const LayoutObject& parent)
241 { 255 {
242 // <button> should allow whitespace even though LayoutFlexibleBox doesn't. 256 // <button> should allow whitespace even though LayoutFlexibleBox doesn't.
243 if (parent.isLayoutButton()) 257 if (parent.isLayoutButton())
244 return true; 258 return true;
245 259
260 // Allow whitespace when the text is inside a table, section or row element that
261 // has generated anonymous table cells to hold its contents.
262 if (hasGeneratedAnonymousTableCells(parent))
263 return true;
264
246 if (parent.isTable() || parent.isTableRow() || parent.isTableSection() 265 if (parent.isTable() || parent.isTableRow() || parent.isTableSection()
247 || parent.isLayoutTableCol() || parent.isFrameSet() 266 || parent.isLayoutTableCol() || parent.isFrameSet()
248 || parent.isFlexibleBox() || parent.isLayoutGrid() 267 || parent.isFlexibleBox() || parent.isLayoutGrid()
249 || parent.isSVGRoot() 268 || parent.isSVGRoot()
250 || parent.isSVGContainer() 269 || parent.isSVGContainer()
251 || parent.isSVGImage() 270 || parent.isSVGImage()
252 || parent.isSVGShape()) 271 || parent.isSVGShape())
253 return false; 272 return false;
254 return true; 273 return true;
255 } 274 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 result.appendLiteral("; "); 452 result.appendLiteral("; ");
434 result.appendLiteral("value="); 453 result.appendLiteral("value=");
435 result.append(s); 454 result.append(s);
436 } 455 }
437 456
438 strncpy(buffer, result.toString().utf8().data(), length - 1); 457 strncpy(buffer, result.toString().utf8().data(), length - 1);
439 } 458 }
440 #endif 459 #endif
441 460
442 } // namespace blink 461 } // namespace blink
OLDNEW
« 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