Chromium Code Reviews| Index: Source/core/inspector/InspectorCSSAgent.cpp |
| diff --git a/Source/core/inspector/InspectorCSSAgent.cpp b/Source/core/inspector/InspectorCSSAgent.cpp |
| index 0b7fc1525271f495a6f646baa8c8854511c2eb01..7efc12f37a9990f84811c9dbb02de1bb75a158a0 100644 |
| --- a/Source/core/inspector/InspectorCSSAgent.cpp |
| +++ b/Source/core/inspector/InspectorCSSAgent.cpp |
| @@ -619,17 +619,30 @@ static bool hasVendorSpecificPrefix(const CharType* string, size_t stringLength) |
| return false; |
| } |
| -static bool hasNonWebkitVendorSpecificPrefix(const CSSParserString& string) |
| +static bool hasNonWebkitVendorSpecificPrefix(const CSSParserString& string, unsigned offset = 0) |
|
pfeldman
2013/06/21 12:20:45
Do not use default values.
|
| { |
| - const size_t stringLength = string.length(); |
| - if (stringLength < 4 || string[0] != '-') |
| + const size_t stringLength = string.length() - offset; |
| + if (stringLength < 4 || string[offset] != '-') |
| return false; |
| static const char webkitPrefix[] = "-webkit-"; |
| - if (stringLength > 8 && string.startsWithIgnoringCase(webkitPrefix)) |
| + if (stringLength > 8 && string.containsIgnoringCaseAt(webkitPrefix, offset)) |
| return false; |
| - return string.is8Bit() ? hasVendorSpecificPrefix(string.characters8(), stringLength) : hasVendorSpecificPrefix(string.characters16(), stringLength); |
| + return string.is8Bit() ? hasVendorSpecificPrefix(string.characters8() + offset, stringLength) : hasVendorSpecificPrefix(string.characters16() + offset, stringLength); |
| +} |
| + |
| +static bool isIgnoredPropertyName(const CSSParserString& content) |
|
pfeldman
2013/06/21 12:20:45
isValidPropertyName
|
| +{ |
| + if (content.equalIgnoringCase("animation") |
| + || content.equalIgnoringCase("font-size-adjust") |
| + || content.equalIgnoringCase("transform") |
| + || content.equalIgnoringCase("user-select") |
| + || content.equalIgnoringCase("-webkit-flex-pack") |
| + || content.equalIgnoringCase("-webkit-text-size-adjust")) |
| + return true; |
| + |
| + return false; |
| } |
| // static |
| @@ -646,6 +659,7 @@ bool InspectorCSSAgent::cssErrorFilter(const CSSParserString& content, int prope |
| // The "filter" property is commonly used instead of "opacity" for IE9. |
| if (propertyId == CSSPropertyFilter) |
| return false; |
| + |
| break; |
| case CSSParser::InvalidPropertyValueError: |
| @@ -661,9 +675,20 @@ bool InspectorCSSAgent::cssErrorFilter(const CSSParserString& content, int prope |
| if (propertyId == CSSPropertyCursor && content.equalIgnoringCase("hand")) |
| return false; |
| - // Ignore properties like "property: value \9". This trick used in bootsrtap for IE-only properies. |
| - if (contentLength > 2 && content[contentLength - 2] == '\\' && content[contentLength - 1] == '9') |
| + // Ignore properties like "property: value \9" (common IE hack) or "property: value \0" (IE 8 hack). |
| + if (contentLength > 2 && content[contentLength - 2] == '\\' && (content[contentLength - 1] == '9' || content[contentLength - 1] == '0')) |
| + return false; |
| + |
| + // Another hack like "property: value\0/". |
| + if (contentLength > 3 && content[contentLength - 3] == '\\' && content[contentLength - 2] == '0' && content[contentLength - 1] == '/') |
| return false; |
| + |
| + // Popular value prefixes valid in other browsers. |
| + if (content.startsWithIgnoringCase("linear-gradient")) |
| + return false; |
| + if (content.startsWithIgnoringCase("-webkit-flexbox")) |
| + return false; |
| + |
| break; |
| case CSSParser::InvalidPropertyError: |
| @@ -678,9 +703,18 @@ bool InspectorCSSAgent::cssErrorFilter(const CSSParserString& content, int prope |
| if (content.startsWithIgnoringCase("scrollbar-")) |
| return false; |
| - // Unsupported standard property. |
| - if (content.equalIgnoringCase("font-size-adjust")) |
| + if (isIgnoredPropertyName(content)) |
| return false; |
| + |
| + break; |
| + |
| + case CSSParser::InvalidRuleError: |
| + if (contentLength > 4 && content[0] == '@') { |
| + if (hasNonWebkitVendorSpecificPrefix(content, 1)) |
| + return false; |
| + if (content.containsIgnoringCaseAt("keyframes", 1)) |
| + return false; |
| + } |
| break; |
| } |
| return true; |