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

Side by Side Diff: Source/WebCore/dom/StyledElement.cpp

Issue 10824091: Merge 123377 - Crash when setting empty class name on a new element (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 4 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/custom/empty-className-baseVal-crash-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 * Copyright (C) 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 for (i = 0; i < length; ++i) { 165 for (i = 0; i < length; ++i) {
166 if (isNotHTMLSpace(characters[i])) 166 if (isNotHTMLSpace(characters[i]))
167 break; 167 break;
168 } 168 }
169 bool hasClass = i < length; 169 bool hasClass = i < length;
170 if (hasClass) { 170 if (hasClass) {
171 const bool shouldFoldCase = document()->inQuirksMode(); 171 const bool shouldFoldCase = document()->inQuirksMode();
172 ensureAttributeData()->setClass(newClassString, shouldFoldCase); 172 ensureAttributeData()->setClass(newClassString, shouldFoldCase);
173 if (DOMTokenList* classList = optionalClassList()) 173 if (DOMTokenList* classList = optionalClassList())
174 static_cast<ClassList*>(classList)->reset(newClassString); 174 static_cast<ClassList*>(classList)->reset(newClassString);
175 } else 175 } else if (attributeData())
176 attributeData()->clearClass(); 176 attributeData()->clearClass();
177 setNeedsStyleRecalc(); 177 setNeedsStyleRecalc();
178 } 178 }
179 179
180 void StyledElement::styleAttributeChanged(const AtomicString& newStyleString, Sh ouldReparseStyleAttribute shouldReparse) 180 void StyledElement::styleAttributeChanged(const AtomicString& newStyleString, Sh ouldReparseStyleAttribute shouldReparse)
181 { 181 {
182 if (shouldReparse) { 182 if (shouldReparse) {
183 WTF::OrdinalNumber startLineNumber = WTF::OrdinalNumber::beforeFirst(); 183 WTF::OrdinalNumber startLineNumber = WTF::OrdinalNumber::beforeFirst();
184 if (document() && document()->scriptableDocumentParser() && !document()- >isInDocumentWrite()) 184 if (document() && document()->scriptableDocumentParser() && !document()- >isInDocumentWrite())
185 startLineNumber = document()->scriptableDocumentParser()->lineNumber (); 185 startLineNumber = document()->scriptableDocumentParser()->lineNumber ();
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 { 346 {
347 style->setProperty(propertyID, cssValuePool().createValue(value, unit)); 347 style->setProperty(propertyID, cssValuePool().createValue(value, unit));
348 } 348 }
349 349
350 void StyledElement::addPropertyToAttributeStyle(StylePropertySet* style, CSSProp ertyID propertyID, const String& value) 350 void StyledElement::addPropertyToAttributeStyle(StylePropertySet* style, CSSProp ertyID propertyID, const String& value)
351 { 351 {
352 style->setProperty(propertyID, value, false, document()->elementSheet()->con tents()); 352 style->setProperty(propertyID, value, false, document()->elementSheet()->con tents());
353 } 353 }
354 354
355 } 355 }
OLDNEW
« no previous file with comments | « LayoutTests/svg/custom/empty-className-baseVal-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698