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

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

Issue 684633006: Reattach whitespace siblings only when needed (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 1 month 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/Node.h ('k') | Source/core/dom/Text.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index 354388db49f6cc0a808156e54208c4706d0732d3..328a9922fdc215473c69b0c382db384c534529dd 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -954,16 +954,15 @@ void Node::detach(const AttachContext& context)
#endif
}
-void Node::reattachWhitespaceSiblings(Text* start)
+void Node::reattachWhitespaceSiblingsIfNeeded(Text* start)
{
for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) {
if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace()) {
bool hadRenderer = !!sibling->renderer();
- sibling->reattach();
- // If the reattach didn't toggle the visibility of the whitespace we don't
- // need to continue reattaching siblings since they won't toggle visibility
- // either.
- if (hadRenderer == !!sibling->renderer())
+ toText(sibling)->reattachIfNeeded();
+ // If sibling's renderer status didn't change we don't need to continue checking
+ // other siblings since their renderer status won't change either.
+ if (!!sibling->renderer() == hadRenderer)
return;
} else if (sibling->renderer()) {
return;
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/Text.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698