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

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

Issue 2607403002: Disallow setting invalid values for registered properties via CSSOM (Closed)
Patch Set: fix comments Created 3 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
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. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 5 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
6 * Copyright (C) 2013 Intel Corporation. All rights reserved. 6 * Copyright (C) 2013 Intel Corporation. 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 // When replacing an existing property value, this moves the property to the 316 // When replacing an existing property value, this moves the property to the
317 // end of the list. Firefox preserves the position, and MSIE moves the 317 // end of the list. Firefox preserves the position, and MSIE moves the
318 // property to the beginning. 318 // property to the beginning.
319 return CSSParser::parseValue(this, unresolvedProperty, value, important, 319 return CSSParser::parseValue(this, unresolvedProperty, value, important,
320 contextStyleSheet); 320 contextStyleSheet);
321 } 321 }
322 322
323 MutableStylePropertySet::SetResult MutableStylePropertySet::setProperty( 323 MutableStylePropertySet::SetResult MutableStylePropertySet::setProperty(
324 const AtomicString& customPropertyName, 324 const AtomicString& customPropertyName,
325 const PropertyRegistry* registry,
325 const String& value, 326 const String& value,
326 bool important, 327 bool important,
327 StyleSheetContents* contextStyleSheet, 328 StyleSheetContents* contextStyleSheet,
328 bool isAnimationTainted) { 329 bool isAnimationTainted) {
329 if (value.isEmpty()) { 330 if (value.isEmpty()) {
330 bool didParse = true; 331 bool didParse = true;
331 bool didChange = removeProperty(customPropertyName); 332 bool didChange = removeProperty(customPropertyName);
332 return MutableStylePropertySet::SetResult{didParse, didChange}; 333 return MutableStylePropertySet::SetResult{didParse, didChange};
333 } 334 }
334 return CSSParser::parseValueForCustomProperty(this, customPropertyName, value, 335 return CSSParser::parseValueForCustomProperty(
335 important, contextStyleSheet, 336 this, customPropertyName, registry, value, important, contextStyleSheet,
336 isAnimationTainted); 337 isAnimationTainted);
337 } 338 }
338 339
339 void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, 340 void MutableStylePropertySet::setProperty(CSSPropertyID propertyID,
340 const CSSValue& value, 341 const CSSValue& value,
341 bool important) { 342 bool important) {
342 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); 343 StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
343 if (!shorthand.length()) { 344 if (!shorthand.length()) {
344 setProperty(CSSProperty(propertyID, value, important)); 345 setProperty(CSSProperty(propertyID, value, important));
345 return; 346 return;
346 } 347 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 610
610 MutableStylePropertySet* MutableStylePropertySet::create( 611 MutableStylePropertySet* MutableStylePropertySet::create(
611 const CSSProperty* properties, 612 const CSSProperty* properties,
612 unsigned count) { 613 unsigned count) {
613 return new MutableStylePropertySet(properties, count); 614 return new MutableStylePropertySet(properties, count);
614 } 615 }
615 616
616 DEFINE_TRACE(CSSLazyPropertyParser) {} 617 DEFINE_TRACE(CSSLazyPropertyParser) {}
617 618
618 } // namespace blink 619 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StylePropertySet.h ('k') | third_party/WebKit/Source/core/css/parser/CSSParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698