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

Side by Side Diff: third_party/WebKit/Source/core/css/StylePropertySet.cpp

Issue 2233333002: Made StylePropertySet::setProperty take a const CSSValue& instead of ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
5 * Copyright (C) 2013 Intel Corporation. All rights reserved. 5 * Copyright (C) 2013 Intel Corporation. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 return CSSParser::parseValue(this, unresolvedProperty, value, important, con textStyleSheet); 302 return CSSParser::parseValue(this, unresolvedProperty, value, important, con textStyleSheet);
303 } 303 }
304 304
305 bool MutableStylePropertySet::setProperty(const AtomicString& customPropertyName , const String& value, bool important, StyleSheetContents* contextStyleSheet) 305 bool MutableStylePropertySet::setProperty(const AtomicString& customPropertyName , const String& value, bool important, StyleSheetContents* contextStyleSheet)
306 { 306 {
307 if (value.isEmpty()) 307 if (value.isEmpty())
308 return removeProperty(customPropertyName); 308 return removeProperty(customPropertyName);
309 return CSSParser::parseValueForCustomProperty(this, customPropertyName, valu e, important, contextStyleSheet); 309 return CSSParser::parseValueForCustomProperty(this, customPropertyName, valu e, important, contextStyleSheet);
310 } 310 }
311 311
312 void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, const CSSVal ue* value, bool important) 312 void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, const CSSVal ue& value, bool important)
313 { 313 {
314 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); 314 StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
315 if (!shorthand.length()) { 315 if (!shorthand.length()) {
316 setProperty(CSSProperty(propertyID, *value, important)); 316 setProperty(CSSProperty(propertyID, value, important));
317 return; 317 return;
318 } 318 }
319 319
320 removePropertiesInSet(shorthand.properties(), shorthand.length()); 320 removePropertiesInSet(shorthand.properties(), shorthand.length());
321 321
322 for (unsigned i = 0; i < shorthand.length(); ++i) 322 for (unsigned i = 0; i < shorthand.length(); ++i)
323 m_propertyVector.append(CSSProperty(shorthand.properties()[i], *value, i mportant)); 323 m_propertyVector.append(CSSProperty(shorthand.properties()[i], value, im portant));
324 } 324 }
325 325
326 bool MutableStylePropertySet::setProperty(const CSSProperty& property, CSSProper ty* slot) 326 bool MutableStylePropertySet::setProperty(const CSSProperty& property, CSSProper ty* slot)
327 { 327 {
328 if (!removeShorthandProperty(property.id())) { 328 if (!removeShorthandProperty(property.id())) {
329 const AtomicString& name = (property.id() == CSSPropertyVariable) ? 329 const AtomicString& name = (property.id() == CSSPropertyVariable) ?
330 toCSSCustomPropertyDeclaration(property.value())->name() : nullAtom; 330 toCSSCustomPropertyDeclaration(property.value())->name() : nullAtom;
331 CSSProperty* toReplace = slot ? slot : findCSSPropertyWithID(property.id (), name); 331 CSSProperty* toReplace = slot ? slot : findCSSPropertyWithID(property.id (), name);
332 if (toReplace && *toReplace == property) 332 if (toReplace && *toReplace == property)
333 return false; 333 return false;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 { 570 {
571 return new MutableStylePropertySet(cssParserMode); 571 return new MutableStylePropertySet(cssParserMode);
572 } 572 }
573 573
574 MutableStylePropertySet* MutableStylePropertySet::create(const CSSProperty* prop erties, unsigned count) 574 MutableStylePropertySet* MutableStylePropertySet::create(const CSSProperty* prop erties, unsigned count)
575 { 575 {
576 return new MutableStylePropertySet(properties, count); 576 return new MutableStylePropertySet(properties, count);
577 } 577 }
578 578
579 } // namespace blink 579 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StylePropertySet.h ('k') | third_party/WebKit/Source/core/dom/Element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698