From b0693d58f10cd1017cb4d6a4de2bdb4af09730a7 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Tue, 1 Apr 2014 11:53:32 -0700 Subject: [PATCH] Bug 989560 patch 3 - Add one more ExpectEndProperty() call that is needed for variables. r=heycam This adds a check that is currently present in most but not all codepaths leading to this point, but which patch 4 will remove from many of those codepaths. --- layout/style/nsCSSParser.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index cc5c675f095..2b3c0287906 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -8866,6 +8866,24 @@ CSSParserImpl::ParseProperty(nsCSSProperty aPropID) } } + if (result) { + // We need to call ExpectEndProperty() to decide whether to reparse + // with variables. This is needed because the property parsing may + // have stopped upon finding a variable (e.g., 'margin: 1px var(a)') + // in a way that future variable substitutions will be valid, or + // because it parsed everything that's possible but we still want to + // act as though the property contains variables even though we know + // the substitution will never work (e.g., for 'margin: 1px 2px 3px + // 4px 5px var(a)'). + // + // It would be nice to find a better solution here + // (and for the SkipUntilOneOf below), though, that doesn't depend + // on using what we don't accept for doing parsing correctly. + if (!ExpectEndProperty()) { + result = false; + } + } + bool seenVariable = mScanner->SeenVariableReference() || (stateBeforeProperty.mHavePushBack && stateBeforeProperty.mToken.mType == eCSSToken_Function &&