Bug 1148711 - Remove nsresult return values from nsCSSParser::Parse{Property,Variable}. r=dholbert

This commit is contained in:
Cameron McCormack 2015-03-29 22:57:04 +11:00
Родитель 2b3486247c
Коммит 44a6617223
5 изменённых файлов: 65 добавлений и 74 удалений

Просмотреть файл

@ -2056,19 +2056,13 @@ CreateStyleRule(nsINode* aNode,
}
if (aProp1 != eCSSProperty_UNKNOWN) {
error = parser.ParseProperty(aProp1, aValue1, docURL, baseURL, principal,
parser.ParseProperty(aProp1, aValue1, docURL, baseURL, principal,
rule->GetDeclaration(), aChanged1, false);
if (error.Failed()) {
return nullptr;
}
}
if (aProp2 != eCSSProperty_UNKNOWN) {
error = parser.ParseProperty(aProp2, aValue2, docURL, baseURL, principal,
parser.ParseProperty(aProp2, aValue2, docURL, baseURL, principal,
rule->GetDeclaration(), aChanged2, false);
if (error.Failed()) {
return nullptr;
}
}
rule->RuleMatched();

Просмотреть файл

@ -2495,14 +2495,13 @@ BuildStyleRule(nsCSSProperty aProperty,
nsCSSProps::SubpropertyEntryFor(aProperty)[0] : aProperty;
// Get a parser, parse the property, and check for CSS parsing errors.
// If any of these steps fails, we bail out and delete the declaration.
if (NS_FAILED(parser.ParseProperty(aProperty, aSpecifiedValue,
doc->GetDocumentURI(), baseURI,
aTargetElement->NodePrincipal(),
declaration, &changed, false,
aUseSVGMode)) ||
// If this fails, we bail out and delete the declaration.
parser.ParseProperty(aProperty, aSpecifiedValue, doc->GetDocumentURI(),
baseURI, aTargetElement->NodePrincipal(), declaration,
&changed, false, aUseSVGMode);
// check whether property parsed without CSS parsing errors
!declaration->HasNonImportantValueFor(propertyToCheck)) {
if (!declaration->HasNonImportantValueFor(propertyToCheck)) {
NS_WARNING("failure in BuildStyleRule");
return nullptr;
}

Просмотреть файл

@ -144,7 +144,7 @@ public:
nsIPrincipal* aSheetPrincipal,
css::Rule** aResult);
nsresult ParseProperty(const nsCSSProperty aPropID,
void ParseProperty(const nsCSSProperty aPropID,
const nsAString& aPropValue,
nsIURI* aSheetURL,
nsIURI* aBaseURL,
@ -167,7 +167,7 @@ public:
InfallibleTArray<nsCSSValue>& aValues,
bool aHTMLMode);
nsresult ParseVariable(const nsAString& aVariableName,
void ParseVariable(const nsAString& aVariableName,
const nsAString& aPropValue,
nsIURI* aSheetURL,
nsIURI* aBaseURL,
@ -1615,7 +1615,7 @@ CSSParserImpl::ParseRule(const nsAString& aRule,
#pragma warning( disable : 4748 )
#endif
nsresult
void
CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
const nsAString& aPropValue,
nsIURI* aSheetURI,
@ -1654,7 +1654,7 @@ CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
REPORT_UNEXPECTED(PEDeclDropped);
OUTPUT_ERROR();
ReleaseScanner();
return NS_OK;
return;
}
bool parsedOK = ParseProperty(aPropID);
@ -1693,10 +1693,9 @@ CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
mTempData.AssertInitialState();
ReleaseScanner();
return NS_OK;
}
nsresult
void
CSSParserImpl::ParseVariable(const nsAString& aVariableName,
const nsAString& aPropValue,
nsIURI* aSheetURI,
@ -1749,7 +1748,6 @@ CSSParserImpl::ParseVariable(const nsAString& aVariableName,
mTempData.AssertInitialState();
ReleaseScanner();
return NS_OK;
}
#ifdef _MSC_VER
@ -15568,7 +15566,7 @@ nsCSSParser::ParseRule(const nsAString& aRule,
ParseRule(aRule, aSheetURI, aBaseURI, aSheetPrincipal, aResult);
}
nsresult
void
nsCSSParser::ParseProperty(const nsCSSProperty aPropID,
const nsAString& aPropValue,
nsIURI* aSheetURI,
@ -15579,13 +15577,13 @@ nsCSSParser::ParseProperty(const nsCSSProperty aPropID,
bool aIsImportant,
bool aIsSVGMode)
{
return static_cast<CSSParserImpl*>(mImpl)->
static_cast<CSSParserImpl*>(mImpl)->
ParseProperty(aPropID, aPropValue, aSheetURI, aBaseURI,
aSheetPrincipal, aDeclaration, aChanged,
aIsImportant, aIsSVGMode);
}
nsresult
void
nsCSSParser::ParseVariable(const nsAString& aVariableName,
const nsAString& aPropValue,
nsIURI* aSheetURI,
@ -15595,7 +15593,7 @@ nsCSSParser::ParseVariable(const nsAString& aVariableName,
bool* aChanged,
bool aIsImportant)
{
return static_cast<CSSParserImpl*>(mImpl)->
static_cast<CSSParserImpl*>(mImpl)->
ParseVariable(aVariableName, aPropValue, aSheetURI, aBaseURI,
aSheetPrincipal, aDeclaration, aChanged, aIsImportant);
}

Просмотреть файл

@ -122,7 +122,7 @@ public:
// particular, units may be omitted from <length>. The 'aIsSVGMode'
// argument controls this quirk. Note that this *only* applies to
// mapped attributes, not inline styles or full style sheets in SVG.
nsresult ParseProperty(const nsCSSProperty aPropID,
void ParseProperty(const nsCSSProperty aPropID,
const nsAString& aPropValue,
nsIURI* aSheetURL,
nsIURI* aBaseURL,
@ -133,7 +133,7 @@ public:
bool aIsSVGMode = false);
// The same as ParseProperty but for a variable.
nsresult ParseVariable(const nsAString& aVariableName,
void ParseVariable(const nsAString& aVariableName,
const nsAString& aPropValue,
nsIURI* aSheetURL,
nsIURI* aBaseURL,

Просмотреть файл

@ -331,14 +331,14 @@ nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSProperty aPropID,
nsCSSParser cssParser(env.mCSSLoader);
bool changed;
nsresult result = cssParser.ParseProperty(aPropID, aPropValue, env.mSheetURI,
env.mBaseURI, env.mPrincipal, decl,
&changed, aIsImportant);
if (NS_FAILED(result) || !changed) {
cssParser.ParseProperty(aPropID, aPropValue, env.mSheetURI, env.mBaseURI,
env.mPrincipal, decl, &changed, aIsImportant);
if (!changed) {
if (decl != olddecl) {
delete decl;
}
return result;
// Parsing failed -- but we don't throw an exception for that.
return NS_OK;
}
return SetCSSDeclaration(decl);
@ -372,17 +372,17 @@ nsDOMCSSDeclaration::ParseCustomPropertyValue(const nsAString& aPropertyName,
nsCSSParser cssParser(env.mCSSLoader);
bool changed;
nsresult result =
cssParser.ParseVariable(Substring(aPropertyName,
CSS_CUSTOM_NAME_PREFIX_LENGTH),
aPropValue, env.mSheetURI,
env.mBaseURI, env.mPrincipal, decl,
&changed, aIsImportant);
if (NS_FAILED(result) || !changed) {
if (!changed) {
if (decl != olddecl) {
delete decl;
}
return result;
// Parsing failed -- but we don't throw an exception for that.
return NS_OK;
}
return SetCSSDeclaration(decl);