diff ./nsCSSDeclaration.h /Users/glazou/trees/xr-1905/mozilla/layout/style/nsCSSDeclaration.h 247a248,251 > > // Block everyone, except us or a derivative, from deleting us. > ~nsCSSDeclaration(void); > 249,251d252 < // Block everyone, except us or a derivative, from deleting us. < ~nsCSSDeclaration(void); < diff ./nsCSSParser.cpp /Users/glazou/trees/xr-1905/mozilla/layout/style/nsCSSParser.cpp 204a205 > void SkipUntilAtKeyword(nsresult& aErrorCode); 234a236,239 > PRBool ParseIfImplementedRule(nsresult& aErrorCode); > PRBool ParseElseImplementedRule(nsresult& aErrorCode); > PRBool ParseEndifImplementedRule(nsresult& aErrorCode); > 478a484,486 > PRPackedBool mHandlingCondition; > PRPackedBool mConditionValue; > 558c566,568 < mParsingCompoundProperty(PR_FALSE) --- > mParsingCompoundProperty(PR_FALSE), > mHandlingCondition(PR_FALSE), > mConditionValue(PR_FALSE) 1278a1289,1303 > if (mToken.mIdent.LowerCaseEqualsLiteral("if-implemented")) { > if (ParseIfImplementedRule(aErrorCode)) > return PR_TRUE; > } > > if (mToken.mIdent.LowerCaseEqualsLiteral("else-implemented")) { > if (ParseElseImplementedRule(aErrorCode)) > return PR_TRUE; > } > > if (mToken.mIdent.LowerCaseEqualsLiteral("endif-implemented")) { > if (ParseEndifImplementedRule(aErrorCode)) > return PR_TRUE; > } > 1663a1689,1786 > PRBool CSSParserImpl::ParseIfImplementedRule(nsresult& aErrorCode) > { > if (mHandlingCondition) { > // do not accept to nest @if-implemented rules > OUTPUT_ERROR(); > return PR_FALSE; > } > > nsresult errorCode = NS_OK; > mHandlingCondition = PR_FALSE; > mConditionValue = PR_FALSE; > > if (!ExpectSymbol(aErrorCode, '{', PR_TRUE)) { > REPORT_UNEXPECTED_TOKEN(PEBadDeclBlockStart); > OUTPUT_ERROR(); > return PR_FALSE; > } > UngetToken(); > > nsCSSDeclaration* declaration = ParseDeclarationBlock(errorCode, PR_TRUE); > > mHandlingCondition = PR_TRUE; > if (declaration && declaration->Count()) { > delete declaration; > mConditionValue = PR_TRUE; > } else > mConditionValue = PR_FALSE; > > if (!mConditionValue) { > // condition is not met, skip until @else-implemented or @endif-implemented > for (;;) { > SkipUntilAtKeyword(aErrorCode); > if (!GetToken(aErrorCode, PR_FALSE)) { > return PR_FALSE; > } > if (eCSSToken_AtKeyword == mToken.mType) { > if (mToken.mIdent.LowerCaseEqualsLiteral("else-implemented") || > mToken.mIdent.LowerCaseEqualsLiteral("endif-implemented")) { > UngetToken(); > UngetToken(); > return PR_TRUE; > } > } > } > } > > return PR_TRUE; > } > > PRBool CSSParserImpl::ParseElseImplementedRule(nsresult& aErrorCode) > { > if (!mHandlingCondition) { > // we must have had a @if-implemented before... > OUTPUT_ERROR(); > return PR_FALSE; > } > > if (!ExpectSymbol(aErrorCode, ';', PR_TRUE)) { > return PR_FALSE; > } > > if (mConditionValue) { > // condition is met, skip until @else-implemented or @endif-implemented > for (;;) { > SkipUntilAtKeyword(aErrorCode); > if (!GetToken(aErrorCode, PR_FALSE)) { > return PR_FALSE; > } > if (eCSSToken_AtKeyword == mToken.mType) { > if (mToken.mIdent.LowerCaseEqualsLiteral("endif-implemented")) { > UngetToken(); > UngetToken(); > return PR_TRUE; > } > } > } > } > > return PR_TRUE; > } > > PRBool CSSParserImpl::ParseEndifImplementedRule(nsresult& aErrorCode) > { > if (!mHandlingCondition) { > // we must have had a @if-implemented before... > OUTPUT_ERROR(); > return PR_FALSE; > } > > if (!ExpectSymbol(aErrorCode, ';', PR_TRUE)) { > return PR_FALSE; > } > > mHandlingCondition = PR_FALSE; > > return PR_TRUE; > } > 1685a1809,1832 > void CSSParserImpl::SkipUntilAtKeyword(nsresult& aErrorCode) > { > nsCSSToken* tk = &mToken; > for (;;) { > if (!GetToken(aErrorCode, PR_TRUE)) > return; > > if (eCSSToken_AtKeyword == tk->mType) > { > UngetToken(); > return; > } else if (eCSSToken_Symbol == tk->mType) { > PRUnichar symbol = tk->mSymbol; > if ('{' == symbol) { > SkipUntil(aErrorCode, '}'); > } else if ('[' == symbol) { > SkipUntil(aErrorCode, ']'); > } else if ('(' == symbol) { > SkipUntil(aErrorCode, ')'); > } > } > } > } >