Commit d692526f authored by chrishtr@chromium.org's avatar chrishtr@chromium.org

Don't use RenderStyle::clone unless there is actually a RenderObject to attach the cloned style to.

Non-renderer-based elements such as optGroup do not have renderers.
BUG=348330
R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/185293011

git-svn-id: svn://svn.chromium.org/blink/trunk@168394 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 973e88d8
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment