From 930a09233d5110b1c8c723293bfe29a98e76d304 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Thu, 12 Dec 2013 13:09:46 +1100 Subject: [PATCH] Bug 773296 - Part 25: Parse variable declarations in @supports conditions. r=dbaron Since we cannot parse and discard a white space token after the ':' in a custom property declaration, we instead explicitly skip over it when parsing a non-custom property's value. --- layout/style/nsCSSParser.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 6f492706c3d..72219e9b725 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -3691,18 +3691,35 @@ CSSParserImpl::ParseSupportsConditionInParensInsideParens(bool& aConditionMet) return false; } - if (ExpectSymbol(')', true)) { - UngetToken(); - return false; - } - nsCSSProperty propID = nsCSSProps::LookupProperty(propertyName, nsCSSProps::eEnabled); if (propID == eCSSProperty_UNKNOWN) { + if (ExpectSymbol(')', true)) { + UngetToken(); + return false; + } aConditionMet = false; SkipUntil(')'); UngetToken(); + } else if (propID == eCSSPropertyExtra_variable) { + if (ExpectSymbol(')', false)) { + UngetToken(); + return false; + } + CSSVariableDeclarations::Type variableType; + nsString variableValue; + aConditionMet = + ParseVariableDeclaration(&variableType, variableValue) && + ParsePriority() != ePriority_Error; + if (!aConditionMet) { + SkipUntil(')'); + UngetToken(); + } } else { + if (ExpectSymbol(')', true)) { + UngetToken(); + return false; + } aConditionMet = ParseProperty(propID) && ParsePriority() != ePriority_Error; if (!aConditionMet) {