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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/svg/animations/classAttributeSettingCrash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 } 1093 }
1094 1094
1095 void Element::classAttributeChanged(const AtomicString& newClassString) 1095 void Element::classAttributeChanged(const AtomicString& newClassString)
1096 { 1096 {
1097 StyleResolver* styleResolver = document().styleResolver(); 1097 StyleResolver* styleResolver = document().styleResolver();
1098 bool testShouldInvalidateStyle = inActiveDocument() && styleResolver && styl eChangeType() < SubtreeStyleChange; 1098 bool testShouldInvalidateStyle = inActiveDocument() && styleResolver && styl eChangeType() < SubtreeStyleChange;
1099 bool shouldInvalidateStyle = false; 1099 bool shouldInvalidateStyle = false;
1100 1100
1101 if (classStringHasClassName(newClassString)) { 1101 if (classStringHasClassName(newClassString)) {
1102 const bool shouldFoldCase = document().inQuirksMode(); 1102 const bool shouldFoldCase = document().inQuirksMode();
1103 const SpaceSplitString oldClasses = elementData()->classNames(); 1103 const SpaceSplitString oldClasses = ensureUniqueElementData()->className s();
1104 elementData()->setClass(newClassString, shouldFoldCase); 1104 elementData()->setClass(newClassString, shouldFoldCase);
1105 const SpaceSplitString& newClasses = elementData()->classNames(); 1105 const SpaceSplitString& newClasses = elementData()->classNames();
1106 shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForCla ssChange(oldClasses, newClasses, styleResolver->ensureRuleFeatureSet()); 1106 shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForCla ssChange(oldClasses, newClasses, styleResolver->ensureRuleFeatureSet());
1107 } else { 1107 } else if (elementData()) {
1108 const SpaceSplitString& oldClasses = elementData()->classNames(); 1108 const SpaceSplitString& oldClasses = elementData()->classNames();
1109 shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForCla ssChange(oldClasses, styleResolver->ensureRuleFeatureSet()); 1109 shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForCla ssChange(oldClasses, styleResolver->ensureRuleFeatureSet());
1110 elementData()->clearClass(); 1110 elementData()->clearClass();
1111 } 1111 }
1112 1112
1113 if (hasRareData()) 1113 if (hasRareData())
1114 elementRareData()->clearClassListValueForQuirksMode(); 1114 elementRareData()->clearClassListValueForQuirksMode();
1115 1115
1116 if (shouldInvalidateStyle) 1116 if (shouldInvalidateStyle)
1117 setNeedsStyleRecalc(); 1117 setNeedsStyleRecalc();
(...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after
3620 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems 3620 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems
3621 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 3621 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405
3622 if (hasTagName(optionTag) || hasTagName(optgroupTag)) 3622 if (hasTagName(optionTag) || hasTagName(optgroupTag))
3623 return false; 3623 return false;
3624 if (FullscreenElementStack::isActiveFullScreenElement(this)) 3624 if (FullscreenElementStack::isActiveFullScreenElement(this))
3625 return false; 3625 return false;
3626 return true; 3626 return true;
3627 } 3627 }
3628 3628
3629 } // namespace WebCore 3629 } // namespace WebCore
OLDNEW
« 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