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

Side by Side Diff: Source/core/css/PropertySetCSSStyleDeclaration.cpp

Issue 141243006: Make element.style.setProperty override earlier property values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Set correct parser mode 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
« no previous file with comments | « Source/core/css/CSSStyleDeclaration.idl ('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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 return propertySet()->isPropertyImplicit(propertyID); 208 return propertySet()->isPropertyImplicit(propertyID);
209 } 209 }
210 210
211 void AbstractPropertySetCSSStyleDeclaration::setProperty(const String& propertyN ame, const String& value, const String& priority, ExceptionState& exceptionState ) 211 void AbstractPropertySetCSSStyleDeclaration::setProperty(const String& propertyN ame, const String& value, const String& priority, ExceptionState& exceptionState )
212 { 212 {
213 StyleAttributeMutationScope mutationScope(this); 213 StyleAttributeMutationScope mutationScope(this);
214 CSSPropertyID propertyID = cssPropertyID(propertyName); 214 CSSPropertyID propertyID = cssPropertyID(propertyName);
215 if (!propertyID) 215 if (!propertyID)
216 return; 216 return;
217 217
218 bool important = priority.find("important", 0, false) != kNotFound; 218 bool important = equalIgnoringCase(priority, "important");
219 if (!important && !priority.isEmpty())
220 return;
esprehn 2014/02/25 19:20:39 Can you make this change separately?
219 221
220 willMutate(); 222 willMutate();
221 223
222 bool changed = propertySet()->setProperty(propertyID, value, important, cont extStyleSheet()); 224 bool changed;
225
226 if (priority.isNull()) {
227 RefPtr<MutableStylePropertySet> tempPropertySet = MutableStylePropertySe t::create(propertySet()->cssParserMode());
228 changed = tempPropertySet->setProperty(propertyID, value, important, con textStyleSheet());
229 propertySet()->mergeAndOverrideOnConflict(tempPropertySet.get());
esprehn 2014/02/25 19:20:39 This doesn't seem like the right way to fix this.
230 } else {
231 changed = propertySet()->setProperty(propertyID, value, important, conte xtStyleSheet());
232 }
223 233
224 didMutate(changed ? PropertyChanged : NoChanges); 234 didMutate(changed ? PropertyChanged : NoChanges);
225 235
226 if (changed) { 236 if (changed) {
227 // CSS DOM requires raising SyntaxError of parsing failed, but this is t oo dangerous for compatibility, 237 // CSS DOM requires raising SyntaxError of parsing failed, but this is t oo dangerous for compatibility,
228 // see <http://bugs.webkit.org/show_bug.cgi?id=7296>. 238 // see <http://bugs.webkit.org/show_bug.cgi?id=7296>.
229 mutationScope.enqueueMutationRecord(); 239 mutationScope.enqueueMutationRecord();
230 } 240 }
231 } 241 }
232 242
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 { 398 {
389 m_parentElement->ref(); 399 m_parentElement->ref();
390 } 400 }
391 401
392 void InlineCSSStyleDeclaration::deref() 402 void InlineCSSStyleDeclaration::deref()
393 { 403 {
394 m_parentElement->deref(); 404 m_parentElement->deref();
395 } 405 }
396 406
397 } // namespace WebCore 407 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSStyleDeclaration.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698