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

Unified Diff: Source/core/css/RuleFeature.cpp

Issue 185293011: Don't use RenderStyle::clone unless there is actually a RenderObject to attach the cloned style to. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed comment. Created 6 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/RuleFeature.cpp
diff --git a/Source/core/css/RuleFeature.cpp b/Source/core/css/RuleFeature.cpp
index a8df5fbbf23489e113dc80a03e65bd146958f110..0a21f4ca358b3c6a45cbb5c8e3241ae880d76c0b 100644
--- a/Source/core/css/RuleFeature.cpp
+++ b/Source/core/css/RuleFeature.cpp
@@ -432,9 +432,13 @@ bool RuleFeatureSet::invalidateStyleForClassChange(Element* element, Vector<Atom
if (thisElementNeedsStyleRecalc) {
element->setNeedsStyleRecalc(LocalStyleChange);
} else if (foundInvalidationSet && someChildrenNeedStyleRecalc) {
- // Clone the RenderStyle in order to preserve correct style sharing.
- if (RenderStyle* renderStyle = element->renderStyle())
- element->renderer()->setStyle(RenderStyle::clone(renderStyle));
+ // Clone the RenderStyle in order to preserve correct style sharing, if possible. Otherwise recalc style.
+ if (RenderObject* renderer = element->renderer()) {
+ ASSERT(renderer->style());
+ renderer->setStyleInternal(RenderStyle::clone(renderer->style()));
+ } else {
+ element->setNeedsStyleRecalc(LocalStyleChange);
+ }
}
invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698