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

Side by Side Diff: Source/core/dom/Element.cpp

Issue 174293005: Fix crash in which elementData() might be null. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 if (newClassString.is8Bit()) 1080 if (newClassString.is8Bit())
1081 return classStringHasClassName(newClassString.characters8(), length); 1081 return classStringHasClassName(newClassString.characters8(), length);
1082 return classStringHasClassName(newClassString.characters16(), length); 1082 return classStringHasClassName(newClassString.characters16(), length);
1083 } 1083 }
1084 1084
1085 void Element::classAttributeChanged(const AtomicString& newClassString) 1085 void Element::classAttributeChanged(const AtomicString& newClassString)
1086 { 1086 {
1087 StyleResolver* styleResolver = document().styleResolver(); 1087 StyleResolver* styleResolver = document().styleResolver();
1088 bool testShouldInvalidateStyle = inActiveDocument() && styleResolver && styl eChangeType() < SubtreeStyleChange; 1088 bool testShouldInvalidateStyle = inActiveDocument() && styleResolver && styl eChangeType() < SubtreeStyleChange;
1089 1089
1090 if (classStringHasClassName(newClassString)) { 1090 if (elementData()) {
adamk 2014/02/21 03:33:50 This is crazy. No element should have classAttribu
1091 const bool shouldFoldCase = document().inQuirksMode(); 1091 if (classStringHasClassName(newClassString)) {
1092 const SpaceSplitString oldClasses = elementData()->classNames(); 1092 const bool shouldFoldCase = document().inQuirksMode();
1093 elementData()->setClass(newClassString, shouldFoldCase); 1093 const SpaceSplitString oldClasses = elementData()->classNames();
1094 const SpaceSplitString& newClasses = elementData()->classNames(); 1094 elementData()->setClass(newClassString, shouldFoldCase);
1095 if (testShouldInvalidateStyle) 1095 const SpaceSplitString& newClasses = elementData()->classNames();
1096 styleResolver->ensureRuleFeatureSet().scheduleStyleInvalidationForCl assChange(oldClasses, newClasses, this); 1096 if (testShouldInvalidateStyle)
1097 } else { 1097 styleResolver->ensureRuleFeatureSet().scheduleStyleInvalidationF orClassChange(oldClasses, newClasses, this);
1098 const SpaceSplitString& oldClasses = elementData()->classNames(); 1098 } else {
1099 if (testShouldInvalidateStyle) 1099 const SpaceSplitString& oldClasses = elementData()->classNames();
1100 styleResolver->ensureRuleFeatureSet().scheduleStyleInvalidationForCl assChange(oldClasses, this); 1100 if (testShouldInvalidateStyle)
1101 elementData()->clearClass(); 1101 styleResolver->ensureRuleFeatureSet().scheduleStyleInvalidationF orClassChange(oldClasses, this);
1102 elementData()->clearClass();
1103 }
1102 } 1104 }
1103 1105
1104 if (hasRareData()) 1106 if (hasRareData())
1105 elementRareData()->clearClassListValueForQuirksMode(); 1107 elementRareData()->clearClassListValueForQuirksMode();
1106 } 1108 }
1107 1109
1108 bool Element::shouldInvalidateDistributionWhenAttributeChanged(ElementShadow* el ementShadow, const QualifiedName& name, const AtomicString& newValue) 1110 bool Element::shouldInvalidateDistributionWhenAttributeChanged(ElementShadow* el ementShadow, const QualifiedName& name, const AtomicString& newValue)
1109 { 1111 {
1110 ASSERT(elementShadow); 1112 ASSERT(elementShadow);
1111 const SelectRuleFeatureSet& featureSet = elementShadow->ensureSelectFeatureS et(); 1113 const SelectRuleFeatureSet& featureSet = elementShadow->ensureSelectFeatureS et();
(...skipping 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after
3504 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems 3506 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems
3505 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 3507 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405
3506 if (hasTagName(optionTag) || hasTagName(optgroupTag)) 3508 if (hasTagName(optionTag) || hasTagName(optgroupTag))
3507 return false; 3509 return false;
3508 if (FullscreenElementStack::isActiveFullScreenElement(this)) 3510 if (FullscreenElementStack::isActiveFullScreenElement(this))
3509 return false; 3511 return false;
3510 return true; 3512 return true;
3511 } 3513 }
3512 3514
3513 } // namespace WebCore 3515 } // namespace WebCore
OLDNEW
« 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