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

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

Issue 18276003: Avoid N^2 walk placing renderers when building the render tree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removing extra parens (whoops) Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/dom/shadow/ShadowRoot.cpp » ('j') | 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 if (!onlyWS) 210 if (!onlyWS)
211 return true; 211 return true;
212 212
213 RenderObject* parent = context.parentRenderer(); 213 RenderObject* parent = context.parentRenderer();
214 if (parent->isTable() || parent->isTableRow() || parent->isTableSection() || parent->isRenderTableCol() || parent->isFrameSet() 214 if (parent->isTable() || parent->isTableRow() || parent->isTableSection() || parent->isRenderTableCol() || parent->isFrameSet()
215 || parent->isFlexibleBox() || parent->isRenderGrid()) 215 || parent->isFlexibleBox() || parent->isRenderGrid())
216 return false; 216 return false;
217 217
218 if (context.style()->preserveNewline()) // pre/pre-wrap/pre-line always make renderers. 218 if (context.style()->preserveNewline()) // pre/pre-wrap/pre-line always make renderers.
219 return true; 219 return true;
220 220
221 // FIXME: We should resolve this function's dependencies on next and previou s renderers
222 // lazily to avoid potentially N^2 walks through the DOM.
221 RenderObject* prev = context.previousRenderer(); 223 RenderObject* prev = context.previousRenderer();
222 if (prev && prev->isBR()) // <span><br/> <br/></span> 224 if (prev && prev->isBR()) // <span><br/> <br/></span>
223 return false; 225 return false;
224 226
225 if (parent->isRenderInline()) { 227 if (parent->isRenderInline()) {
226 // <span><div/> <div/></span> 228 // <span><div/> <div/></span>
227 if (prev && !prev->isInline()) 229 if (prev && !prev->isInline())
228 return false; 230 return false;
229 } else { 231 } else {
230 if (parent->isRenderBlock() && !parent->childrenInline() && (!prev || !p rev->isInline())) 232 if (parent->isRenderBlock() && !parent->childrenInline() && (!prev || !p rev->isInline()))
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 result.appendLiteral("; "); 346 result.appendLiteral("; ");
345 result.appendLiteral("value="); 347 result.appendLiteral("value=");
346 result.append(s); 348 result.append(s);
347 } 349 }
348 350
349 strncpy(buffer, result.toString().utf8().data(), length - 1); 351 strncpy(buffer, result.toString().utf8().data(), length - 1);
350 } 352 }
351 #endif 353 #endif
352 354
353 } // namespace WebCore 355 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/dom/shadow/ShadowRoot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698