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

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: Again, updating to ToT. Created 7 years, 7 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
Index: Source/core/dom/Text.cpp
diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp
index f0c0158df1b2d5b0b3c013523a22aa2b242301ce..3347c73af6c260ee732026bb83958b6451b724a4 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;

Powered by Google App Engine
This is Rietveld 408576698