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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 return false; | 300 return false; |
301 | 301 |
302 // Avoiding creation of a layoutObject for the text node is a non-essent
ial memory optimization. | 302 // Avoiding creation of a layoutObject for the text node is a non-essent
ial memory optimization. |
303 // So to avoid blowing up on very wide DOMs, we limit the number of sibl
ings to visit. | 303 // So to avoid blowing up on very wide DOMs, we limit the number of sibl
ings to visit. |
304 unsigned maxSiblingsToVisit = 50; | 304 unsigned maxSiblingsToVisit = 50; |
305 | 305 |
306 LayoutObject* first = parent.slowFirstChild(); | 306 LayoutObject* first = parent.slowFirstChild(); |
307 while (first && first->isFloatingOrOutOfFlowPositioned() && maxSiblingsT
oVisit--) | 307 while (first && first->isFloatingOrOutOfFlowPositioned() && maxSiblingsT
oVisit--) |
308 first = first->nextSibling(); | 308 first = first->nextSibling(); |
309 if (!first || first == layoutObject() || LayoutTreeBuilderTraversal::nex
tSiblingLayoutObject(*this) == first) { | 309 if (!first || first == layoutObject() || LayoutTreeBuilderTraversal::nex
tSiblingLayoutObject(*this) == first) { |
| 310 // If we're adding children to this flow our previous siblings are n
ot in the layout tree yet so we |
| 311 // cannot know if we will be the first child in the line and collaps
e away. We have to assume we need a layout object. |
| 312 Node* firstChildNode = parent.node() ? LayoutTreeBuilderTraversal::f
irstChild(*parent.node()) : nullptr; |
| 313 if (first && first == layoutObject() && firstChildNode && !firstChil
dNode->layoutObject()) |
| 314 return true; |
| 315 |
310 // Whitespace at the start of a block just goes away. Don't even | 316 // Whitespace at the start of a block just goes away. Don't even |
311 // make a layout object for this text. | 317 // make a layout object for this text. |
312 return false; | 318 return !firstChildNode; |
313 } | 319 } |
314 } | 320 } |
315 return true; | 321 return true; |
316 } | 322 } |
317 | 323 |
318 static bool isSVGText(Text* text) | 324 static bool isSVGText(Text* text) |
319 { | 325 { |
320 Node* parentOrShadowHostNode = text->parentOrShadowHostNode(); | 326 Node* parentOrShadowHostNode = text->parentOrShadowHostNode(); |
321 ASSERT(parentOrShadowHostNode); | 327 ASSERT(parentOrShadowHostNode); |
322 return parentOrShadowHostNode->isSVGElement() && !isSVGForeignObjectElement(
*parentOrShadowHostNode); | 328 return parentOrShadowHostNode->isSVGElement() && !isSVGForeignObjectElement(
*parentOrShadowHostNode); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 result.appendLiteral("; "); | 440 result.appendLiteral("; "); |
435 result.appendLiteral("value="); | 441 result.appendLiteral("value="); |
436 result.append(s); | 442 result.append(s); |
437 } | 443 } |
438 | 444 |
439 strncpy(buffer, result.toString().utf8().data(), length - 1); | 445 strncpy(buffer, result.toString().utf8().data(), length - 1); |
440 } | 446 } |
441 #endif | 447 #endif |
442 | 448 |
443 } // namespace blink | 449 } // namespace blink |
OLD | NEW |