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

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

Issue 2524303002: Emit console warning when element.animate() keyframe value fails to parse (Closed)
Patch Set: Review changes Created 4 years 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 return propertyAt(foundPropertyIndex).shorthandID(); 289 return propertyAt(foundPropertyIndex).shorthandID();
290 } 290 }
291 291
292 bool StylePropertySet::isPropertyImplicit(CSSPropertyID propertyID) const { 292 bool StylePropertySet::isPropertyImplicit(CSSPropertyID propertyID) const {
293 int foundPropertyIndex = findPropertyIndex(propertyID); 293 int foundPropertyIndex = findPropertyIndex(propertyID);
294 if (foundPropertyIndex == -1) 294 if (foundPropertyIndex == -1)
295 return false; 295 return false;
296 return propertyAt(foundPropertyIndex).isImplicit(); 296 return propertyAt(foundPropertyIndex).isImplicit();
297 } 297 }
298 298
299 bool MutableStylePropertySet::setProperty( 299 MutableStylePropertySet::SetResult MutableStylePropertySet::setProperty(
300 CSSPropertyID unresolvedProperty, 300 CSSPropertyID unresolvedProperty,
301 const String& value, 301 const String& value,
302 bool important, 302 bool important,
303 StyleSheetContents* contextStyleSheet) { 303 StyleSheetContents* contextStyleSheet) {
304 DCHECK_GE(unresolvedProperty, firstCSSProperty); 304 DCHECK_GE(unresolvedProperty, firstCSSProperty);
305 305
306 // Setting the value to an empty string just removes the property in both IE 306 // Setting the value to an empty string just removes the property in both IE
307 // and Gecko. Setting it to null seems to produce less consistent results, but 307 // and Gecko. Setting it to null seems to produce less consistent results, but
308 // we treat it just the same. 308 // we treat it just the same.
309 if (value.isEmpty()) 309 if (value.isEmpty()) {
310 return removeProperty(resolveCSSPropertyID(unresolvedProperty)); 310 bool didParse = true;
311 bool didChange = removeProperty(resolveCSSPropertyID(unresolvedProperty));
312 return SetResult{didParse, didChange};
313 }
311 314
312 // When replacing an existing property value, this moves the property to the 315 // When replacing an existing property value, this moves the property to the
313 // end of the list. Firefox preserves the position, and MSIE moves the 316 // end of the list. Firefox preserves the position, and MSIE moves the
314 // property to the beginning. 317 // property to the beginning.
315 return CSSParser::parseValue(this, unresolvedProperty, value, important, 318 return CSSParser::parseValue(this, unresolvedProperty, value, important,
316 contextStyleSheet); 319 contextStyleSheet);
317 } 320 }
318 321
319 bool MutableStylePropertySet::setProperty( 322 MutableStylePropertySet::SetResult MutableStylePropertySet::setProperty(
320 const AtomicString& customPropertyName, 323 const AtomicString& customPropertyName,
321 const String& value, 324 const String& value,
322 bool important, 325 bool important,
323 StyleSheetContents* contextStyleSheet, 326 StyleSheetContents* contextStyleSheet,
324 bool isAnimationTainted) { 327 bool isAnimationTainted) {
325 if (value.isEmpty()) 328 if (value.isEmpty()) {
326 return removeProperty(customPropertyName); 329 bool didParse = true;
330 bool didChange = removeProperty(customPropertyName);
331 return MutableStylePropertySet::SetResult{didParse, didChange};
332 }
327 return CSSParser::parseValueForCustomProperty(this, customPropertyName, value, 333 return CSSParser::parseValueForCustomProperty(this, customPropertyName, value,
328 important, contextStyleSheet, 334 important, contextStyleSheet,
329 isAnimationTainted); 335 isAnimationTainted);
330 } 336 }
331 337
332 void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, 338 void MutableStylePropertySet::setProperty(CSSPropertyID propertyID,
333 const CSSValue& value, 339 const CSSValue& value,
334 bool important) { 340 bool important) {
335 StylePropertyShorthand shorthand = shorthandForProperty(propertyID); 341 StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
336 if (!shorthand.length()) { 342 if (!shorthand.length()) {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 608
603 MutableStylePropertySet* MutableStylePropertySet::create( 609 MutableStylePropertySet* MutableStylePropertySet::create(
604 const CSSProperty* properties, 610 const CSSProperty* properties,
605 unsigned count) { 611 unsigned count) {
606 return new MutableStylePropertySet(properties, count); 612 return new MutableStylePropertySet(properties, count);
607 } 613 }
608 614
609 DEFINE_TRACE(CSSLazyPropertyParser) {} 615 DEFINE_TRACE(CSSLazyPropertyParser) {}
610 616
611 } // namespace blink 617 } // 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