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

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: Reversing the snapshotting logic to fix a bug, and updating test expectations. 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
Index: Source/core/dom/Text.cpp
diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp
index ca6b808b967b35c706360f445e1d9dd1c0ab7888..574c6113753469a63578ce107b8ef0267ae2a9d3 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