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

Unified Diff: Source/core/dom/Text.cpp

Issue 15871005: Avoid N^2 walk placing renderers when building the render tree (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adding a mitigation for the perf regression to Element::recalcStyle. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/ScriptElement.cpp ('k') | Source/core/dom/shadow/ShadowRoot.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Text.cpp
diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp
index 119d1dc6eb4288b9c2d73b189472cdfceba08c5e..5db0fb06f7b89ebed56df8ffe86254d4d5ac4130 100644
--- a/Source/core/dom/Text.cpp
+++ b/Source/core/dom/Text.cpp
@@ -216,7 +216,9 @@ bool Text::textRendererIsNeeded(const NodeRenderingContext& context)
if (context.style()->preserveNewline()) // pre/pre-wrap/pre-line always make renderers.
return true;
-
+
+ // FIXME: We should resolve this function's dependencies on next and previous renderers
+ // lazily to avoid potentially N^2 walks through the DOM.
RenderObject* prev = context.previousRenderer();
if (prev && prev->isBR()) // <span><br/> <br/></span>
return false;
« no previous file with comments | « Source/core/dom/ScriptElement.cpp ('k') | Source/core/dom/shadow/ShadowRoot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698