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

Side by Side Diff: third_party/WebKit/Source/core/animation/EffectInput.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 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 const String& value, 88 const String& value,
89 ExecutionContext* executionContext) { 89 ExecutionContext* executionContext) {
90 StyleSheetContents* styleSheetContents = 90 StyleSheetContents* styleSheetContents =
91 element.document().elementSheet().contents(); 91 element.document().elementSheet().contents();
92 CSSPropertyID cssProperty = 92 CSSPropertyID cssProperty =
93 AnimationInputHelpers::keyframeAttributeToCSSProperty(property, 93 AnimationInputHelpers::keyframeAttributeToCSSProperty(property,
94 element.document()); 94 element.document());
95 if (cssProperty != CSSPropertyInvalid) { 95 if (cssProperty != CSSPropertyInvalid) {
96 MutableStylePropertySet::SetResult setResult = 96 MutableStylePropertySet::SetResult setResult =
97 cssProperty == CSSPropertyVariable 97 cssProperty == CSSPropertyVariable
98 ? keyframe.setCSSPropertyValue(AtomicString(property), value, 98 ? keyframe.setCSSPropertyValue(
99 styleSheetContents) 99 AtomicString(property), element.document().propertyRegistry(),
100 value, styleSheetContents)
100 : keyframe.setCSSPropertyValue(cssProperty, value, 101 : keyframe.setCSSPropertyValue(cssProperty, value,
101 styleSheetContents); 102 styleSheetContents);
102 if (!setResult.didParse && executionContext) { 103 if (!setResult.didParse && executionContext) {
103 Document& document = toDocument(*executionContext); 104 Document& document = toDocument(*executionContext);
104 if (document.frame()) { 105 if (document.frame()) {
105 document.frame()->console().addMessage(ConsoleMessage::create( 106 document.frame()->console().addMessage(ConsoleMessage::create(
106 JSMessageSource, WarningMessageLevel, 107 JSMessageSource, WarningMessageLevel,
107 "Invalid keyframe value for property " + property + ": " + value)); 108 "Invalid keyframe value for property " + property + ": " + value));
108 } 109 }
109 } 110 }
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 385 }
385 386
386 std::sort(keyframes.begin(), keyframes.end(), compareKeyframes); 387 std::sort(keyframes.begin(), keyframes.end(), compareKeyframes);
387 388
388 DCHECK(!exceptionState.hadException()); 389 DCHECK(!exceptionState.hadException());
389 390
390 return createEffectModelFromKeyframes(element, keyframes, exceptionState); 391 return createEffectModelFromKeyframes(element, keyframes, exceptionState);
391 } 392 }
392 393
393 } // namespace blink 394 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698