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

Side by Side Diff: third_party/WebKit/Source/core/css/DOMWindowCSS.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) 2012 Motorola Mobility Inc. All rights reserved. 2 * Copyright (C) 2012 Motorola Mobility 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above 10 * 2. Redistributions in binary form must reproduce the above
(...skipping 28 matching lines...) Expand all
39 namespace blink { 39 namespace blink {
40 40
41 bool DOMWindowCSS::supports(const String& property, const String& value) { 41 bool DOMWindowCSS::supports(const String& property, const String& value) {
42 CSSPropertyID unresolvedProperty = unresolvedCSSPropertyID(property); 42 CSSPropertyID unresolvedProperty = unresolvedCSSPropertyID(property);
43 if (unresolvedProperty == CSSPropertyInvalid) 43 if (unresolvedProperty == CSSPropertyInvalid)
44 return false; 44 return false;
45 if (unresolvedProperty == CSSPropertyVariable) { 45 if (unresolvedProperty == CSSPropertyVariable) {
46 MutableStylePropertySet* dummyStyle = 46 MutableStylePropertySet* dummyStyle =
47 MutableStylePropertySet::create(HTMLStandardMode); 47 MutableStylePropertySet::create(HTMLStandardMode);
48 bool isAnimationTainted = false; 48 bool isAnimationTainted = false;
49 return CSSParser::parseValueForCustomProperty( 49 return CSSParser::parseValueForCustomProperty(dummyStyle, "--valid",
50 dummyStyle, "--valid", value, false, nullptr, isAnimationTainted) 50 nullptr, value, false,
51 nullptr, isAnimationTainted)
51 .didParse; 52 .didParse;
52 } 53 }
53 54
54 ASSERT(CSSPropertyMetadata::isEnabledProperty(unresolvedProperty)); 55 ASSERT(CSSPropertyMetadata::isEnabledProperty(unresolvedProperty));
55 56
56 // This will return false when !important is present 57 // This will return false when !important is present
57 MutableStylePropertySet* dummyStyle = 58 MutableStylePropertySet* dummyStyle =
58 MutableStylePropertySet::create(HTMLStandardMode); 59 MutableStylePropertySet::create(HTMLStandardMode);
59 return CSSParser::parseValue(dummyStyle, unresolvedProperty, value, false, 0) 60 return CSSParser::parseValue(dummyStyle, unresolvedProperty, value, false, 0)
60 .didParse; 61 .didParse;
61 } 62 }
62 63
63 bool DOMWindowCSS::supports(const String& conditionText) { 64 bool DOMWindowCSS::supports(const String& conditionText) {
64 return CSSParser::parseSupportsCondition(conditionText); 65 return CSSParser::parseSupportsCondition(conditionText);
65 } 66 }
66 67
67 String DOMWindowCSS::escape(const String& ident) { 68 String DOMWindowCSS::escape(const String& ident) {
68 StringBuilder builder; 69 StringBuilder builder;
69 serializeIdentifier(ident, builder); 70 serializeIdentifier(ident, builder);
70 return builder.toString(); 71 return builder.toString();
71 } 72 }
72 73
73 } // namespace blink 74 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698