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

Side by Side Diff: Source/core/dom/Text.cpp

Issue 1343443002: Revert "Allow whitespace inside anonymous table cells" from M45 (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2454
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
« 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
254 static inline bool canHaveWhitespaceChildren(const LayoutObject& parent) 240 static inline bool canHaveWhitespaceChildren(const LayoutObject& parent)
255 { 241 {
256 // <button> should allow whitespace even though LayoutFlexibleBox doesn't. 242 // <button> should allow whitespace even though LayoutFlexibleBox doesn't.
257 if (parent.isLayoutButton()) 243 if (parent.isLayoutButton())
258 return true; 244 return true;
259 245
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
265 if (parent.isTable() || parent.isTableRow() || parent.isTableSection() 246 if (parent.isTable() || parent.isTableRow() || parent.isTableSection()
266 || parent.isLayoutTableCol() || parent.isFrameSet() 247 || parent.isLayoutTableCol() || parent.isFrameSet()
267 || parent.isFlexibleBox() || parent.isLayoutGrid() 248 || parent.isFlexibleBox() || parent.isLayoutGrid()
268 || parent.isSVGRoot() 249 || parent.isSVGRoot()
269 || parent.isSVGContainer() 250 || parent.isSVGContainer()
270 || parent.isSVGImage() 251 || parent.isSVGImage()
271 || parent.isSVGShape()) 252 || parent.isSVGShape())
272 return false; 253 return false;
273 return true; 254 return true;
274 } 255 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 result.appendLiteral("; "); 433 result.appendLiteral("; ");
453 result.appendLiteral("value="); 434 result.appendLiteral("value=");
454 result.append(s); 435 result.append(s);
455 } 436 }
456 437
457 strncpy(buffer, result.toString().utf8().data(), length - 1); 438 strncpy(buffer, result.toString().utf8().data(), length - 1);
458 } 439 }
459 #endif 440 #endif
460 441
461 } // namespace blink 442 } // 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