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

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

Issue 16629006: Revert 151996 "Avoid N^2 walk placing renderers when building th..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Update to head Created 7 years, 6 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/Element.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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 bool onlyWS = containsOnlyWhitespace(); 209 bool onlyWS = containsOnlyWhitespace();
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 return false; 215 return false;
216 216
217 if (context.style()->preserveNewline()) // pre/pre-wrap/pre-line always make renderers. 217 if (context.style()->preserveNewline()) // pre/pre-wrap/pre-line always make renderers.
218 return true; 218 return true;
219 219
220 // FIXME: We should resolve this function's dependencies on next and previou s renderers
221 // lazily to avoid potentially N^2 walks through the DOM.
222 RenderObject* prev = context.previousRenderer(); 220 RenderObject* prev = context.previousRenderer();
223 if (prev && prev->isBR()) // <span><br/> <br/></span> 221 if (prev && prev->isBR()) // <span><br/> <br/></span>
224 return false; 222 return false;
225 223
226 if (parent->isRenderInline()) { 224 if (parent->isRenderInline()) {
227 // <span><div/> <div/></span> 225 // <span><div/> <div/></span>
228 if (prev && !prev->isInline()) 226 if (prev && !prev->isInline())
229 return false; 227 return false;
230 } else { 228 } else {
231 if (parent->isRenderBlock() && !parent->childrenInline() && (!prev || !p rev->isInline())) 229 if (parent->isRenderBlock() && !parent->childrenInline() && (!prev || !p rev->isInline()))
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 result.appendLiteral("; "); 341 result.appendLiteral("; ");
344 result.appendLiteral("value="); 342 result.appendLiteral("value=");
345 result.append(s); 343 result.append(s);
346 } 344 }
347 345
348 strncpy(buffer, result.toString().utf8().data(), length - 1); 346 strncpy(buffer, result.toString().utf8().data(), length - 1);
349 } 347 }
350 #endif 348 #endif
351 349
352 } // namespace WebCore 350 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/dom/shadow/ShadowRoot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698