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

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

Issue 58373002: Whitespace only text nodes need to be reattached when their siblings are reattached (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated js-test include Created 7 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/core.gypi ('k') | Source/core/dom/Node.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 40f6b46c18ea008352c7d939db4d4ea8053bfe82..12236dbd79610d654512a6fc44618af4bd186198 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -64,7 +64,6 @@
#include "core/dom/ScriptableDocumentParser.h"
#include "core/dom/SelectorQuery.h"
#include "core/dom/Text.h"
-#include "core/dom/WhitespaceChildList.h"
#include "core/dom/custom/CustomElement.h"
#include "core/dom/custom/CustomElementRegistrationContext.h"
#include "core/dom/shadow/InsertionPoint.h"
@@ -1624,29 +1623,23 @@ void Element::recalcChildStyle(StyleRecalcChange change)
// Reversing this loop can lead to non-deterministic results in our code to optimize out empty whitespace
// RenderTexts. We try to put off recalcing their style until the end to avoid this issue.
// See crbug.com/288225
- WhitespaceChildList whitespaceChildList(change);
for (Node* child = lastChild(); child; child = child->previousSibling()) {
+ bool didReattach = false;
if (child->isTextNode()) {
- Text* textChild = toText(child);
- // FIXME: This check is expensive and may negate the performance gained by the optimization of
- // avoiding whitespace renderers.
- if (textChild->containsOnlyWhitespace())
- whitespaceChildList.append(textChild);
- else
- textChild->recalcTextStyle(change);
+ didReattach = toText(child)->recalcTextStyle(change);
} else if (child->isElementNode()) {
Element* element = toElement(child);
if (shouldRecalcStyle(change, element)) {
parentPusher.push();
- element->recalcStyle(change);
+ didReattach = element->recalcStyle(change);
} else if (element->supportsStyleSharing()) {
document().styleResolver()->addToStyleSharingList(*element);
}
}
+ if (didReattach)
+ child->reattachWhitespaceSiblings();
}
- whitespaceChildList.recalcStyle();
-
if (shouldRecalcStyle(change, this)) {
updatePseudoElement(AFTER, change);
updatePseudoElement(BACKDROP, change);
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698