OLD | NEW |
---|---|
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 Node::NodeType Text::nodeType() const | 265 Node::NodeType Text::nodeType() const |
266 { | 266 { |
267 return TEXT_NODE; | 267 return TEXT_NODE; |
268 } | 268 } |
269 | 269 |
270 PassRefPtrWillBeRawPtr<Node> Text::cloneNode(bool /*deep*/) | 270 PassRefPtrWillBeRawPtr<Node> Text::cloneNode(bool /*deep*/) |
271 { | 271 { |
272 return cloneWithData(data()); | 272 return cloneWithData(data()); |
273 } | 273 } |
274 | 274 |
275 static inline bool isTableCellAncestor(const LayoutObject& renderer) | |
esprehn
2015/05/04 22:12:16
not inline. also don't use the word renderer. Mayb
| |
276 { | |
277 return renderer.isTable() || renderer.isTableRow() || renderer.isTableSectio n() || renderer.isLayoutTableCol(); | |
esprehn
2015/05/04 22:12:16
LayoutTableCol layouters only ever have more Layou
rhogan
2015/05/05 21:18:49
Right, this makes such cases slightly more expensi
esprehn
2015/05/28 05:43:55
The code doesn't make sense though, you can't find
| |
278 } | |
279 | |
280 static inline bool isAncestorOfAnonymousTableCell(const LayoutObject& parent) | |
esprehn
2015/05/04 22:12:16
not inline.
| |
281 { | |
282 LayoutObject* firstChild = parent.slowFirstChild(); | |
283 if (!firstChild || !firstChild->isAnonymous()) | |
284 return false; | |
285 if (firstChild->isTableCell()) | |
286 return true; | |
287 if (isTableCellAncestor(*firstChild)) | |
288 return isAncestorOfAnonymousTableCell(*firstChild); | |
esprehn
2015/05/04 22:12:16
This check doesn't make sense, why are you drillin
rhogan
2015/05/05 21:18:49
If the table part is the ancestor of an anonymous
| |
289 return false; | |
290 } | |
291 | |
275 static inline bool canHaveWhitespaceChildren(const LayoutObject& parent) | 292 static inline bool canHaveWhitespaceChildren(const LayoutObject& parent) |
276 { | 293 { |
277 // <button> should allow whitespace even though LayoutFlexibleBox doesn't. | 294 // <button> should allow whitespace even though LayoutFlexibleBox doesn't. |
278 if (parent.isLayoutButton()) | 295 if (parent.isLayoutButton()) |
279 return true; | 296 return true; |
280 | 297 |
281 if (parent.isTable() || parent.isTableRow() || parent.isTableSection() | 298 // Allow whitespace when the text will be inside an anonymous table cell. |
282 || parent.isLayoutTableCol() || parent.isFrameSet() | 299 if (isAncestorOfAnonymousTableCell(parent)) |
leviw_travelin_and_unemployed
2015/04/21 18:42:37
This is more expensive in the common case, and thi
rhogan
2015/04/21 19:00:48
It's not that much more expensive to my reading. I
| |
300 return true; | |
301 | |
302 if (isTableCellAncestor(parent) || parent.isFrameSet() | |
283 || parent.isFlexibleBox() || parent.isLayoutGrid() | 303 || parent.isFlexibleBox() || parent.isLayoutGrid() |
284 || parent.isSVGRoot() | 304 || parent.isSVGRoot() |
285 || parent.isSVGContainer() | 305 || parent.isSVGContainer() |
286 || parent.isSVGImage() | 306 || parent.isSVGImage() |
287 || parent.isSVGShape()) | 307 || parent.isSVGShape()) |
288 return false; | 308 return false; |
289 return true; | 309 return true; |
290 } | 310 } |
291 | 311 |
292 bool Text::textRendererIsNeeded(const ComputedStyle& style, const LayoutObject& parent) | 312 bool Text::textRendererIsNeeded(const ComputedStyle& style, const LayoutObject& parent) |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
465 result.appendLiteral("; "); | 485 result.appendLiteral("; "); |
466 result.appendLiteral("value="); | 486 result.appendLiteral("value="); |
467 result.append(s); | 487 result.append(s); |
468 } | 488 } |
469 | 489 |
470 strncpy(buffer, result.toString().utf8().data(), length - 1); | 490 strncpy(buffer, result.toString().utf8().data(), length - 1); |
471 } | 491 } |
472 #endif | 492 #endif |
473 | 493 |
474 } // namespace blink | 494 } // namespace blink |
OLD | NEW |