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

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

Issue 138173002: Ensure ElementData exists before modifying when animating class attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 | « LayoutTests/svg/animations/classAttributeSettingCrash-expected.txt ('k') | no next file » | 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 00fa98a94b1c7bcffd26d2de4feeffdce37223cd..879a7316ff662daae797414d5237f3ca795ffa63 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -1100,11 +1100,11 @@ void Element::classAttributeChanged(const AtomicString& newClassString)
if (classStringHasClassName(newClassString)) {
const bool shouldFoldCase = document().inQuirksMode();
- const SpaceSplitString oldClasses = elementData()->classNames();
+ const SpaceSplitString oldClasses = ensureUniqueElementData()->classNames();
elementData()->setClass(newClassString, shouldFoldCase);
const SpaceSplitString& newClasses = elementData()->classNames();
shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForClassChange(oldClasses, newClasses, styleResolver->ensureRuleFeatureSet());
- } else {
+ } else if (elementData()) {
const SpaceSplitString& oldClasses = elementData()->classNames();
shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForClassChange(oldClasses, styleResolver->ensureRuleFeatureSet());
elementData()->clearClass();
« no previous file with comments | « LayoutTests/svg/animations/classAttributeSettingCrash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698