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

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

Issue 2680463003: Remove branch on childNeedsDistributionRecalc (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | 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 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 return false; 273 return false;
274 274
275 // pre-wrap in SVG never makes layoutObject. 275 // pre-wrap in SVG never makes layoutObject.
276 if (style.whiteSpace() == EWhiteSpace::kPreWrap && parent.isSVG()) 276 if (style.whiteSpace() == EWhiteSpace::kPreWrap && parent.isSVG())
277 return false; 277 return false;
278 278
279 // pre/pre-wrap/pre-line always make layoutObjects. 279 // pre/pre-wrap/pre-line always make layoutObjects.
280 if (style.preserveNewline()) 280 if (style.preserveNewline())
281 return true; 281 return true;
282 282
283 // childNeedsDistributionRecalc() here is rare, only happens JS calling
284 // surroundContents() etc. from DOMNodeInsertedIntoDocument etc.
285 if (document().childNeedsDistributionRecalc())
286 return true;
rune 2017/02/06 22:58:52 It looks like this could still happen, looking at
287
288 // Avoiding creation of a layoutObject for the text node is a non-essential 283 // Avoiding creation of a layoutObject for the text node is a non-essential
289 // memory optimization. So to avoid blowing up on very wide DOMs, we limit 284 // memory optimization. So to avoid blowing up on very wide DOMs, we limit
290 // the number of siblings to visit. 285 // the number of siblings to visit.
291 unsigned maxSiblingsToVisit = 50; 286 unsigned maxSiblingsToVisit = 50;
292 287
293 const LayoutObject* prev = 288 const LayoutObject* prev =
294 LayoutTreeBuilderTraversal::previousSiblingLayoutObject( 289 LayoutTreeBuilderTraversal::previousSiblingLayoutObject(
295 *this, maxSiblingsToVisit); 290 *this, maxSiblingsToVisit);
296 if (prev && prev->isBR()) // <span><br/> <br/></span> 291 if (prev && prev->isBR()) // <span><br/> <br/></span>
297 return false; 292 return false;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 444
450 Text* Text::cloneWithData(const String& data) { 445 Text* Text::cloneWithData(const String& data) {
451 return create(document(), data); 446 return create(document(), data);
452 } 447 }
453 448
454 DEFINE_TRACE(Text) { 449 DEFINE_TRACE(Text) {
455 CharacterData::trace(visitor); 450 CharacterData::trace(visitor);
456 } 451 }
457 452
458 } // namespace blink 453 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698