fix regression in setting important property values in inline style via

DOM.  Bug 173767, r=caillon, sr=dbaron
This commit is contained in:
bzbarsky%mit.edu 2002-11-06 02:07:17 +00:00
parent 486933c1d4
commit fd71e8e971
4 changed files with 26 additions and 6 deletions

View File

@ -787,6 +787,10 @@ CSSParserImpl::ParseRule(const nsAString& aRule,
return NS_OK;
}
//XXXbz this function does not deal well with something like "foo
//!important" as the aPropValue. It will parse the "foo" and set it
//in the decl, then ignore the !important. It should either fail to
//parse this or do !important correctly....
NS_IMETHODIMP
CSSParserImpl::ParseProperty(const nsAString& aPropName,
const nsAString& aPropValue,

View File

@ -244,8 +244,13 @@ nsDOMCSSDeclaration::SetProperty(const nsAString& aPropertyName,
return ParsePropertyValue(aPropertyName, aValue);
}
return ParsePropertyValue(aPropertyName,
aValue + NS_LITERAL_STRING("!") + aPriority);
// ParsePropertyValue does not handle priorities correctly -- it's
// optimized for speed. And the priority is not part of the
// property value anyway.... So we have to use the full-blown
// ParseDeclaration()
return ParseDeclaration(aPropertyName + NS_LITERAL_STRING(":") +
aValue + NS_LITERAL_STRING("!") + aPriority,
PR_TRUE, PR_FALSE);
}
//////////////////////////////////////////////////////////////////////////////
@ -282,7 +287,8 @@ NS_INTERFACE_MAP_END_AGGREGATED(fOuter)
CSS2PropertiesTearoff::Set##method_(const nsAString& aValue) \
{ \
return NS_STATIC_CAST(nsIDOMCSSStyleDeclaration*, fOuter)-> \
SetProperty(NS_LITERAL_STRING(#name_), aValue, nsAutoString()); \
SetProperty(NS_LITERAL_STRING(#name_), aValue, \
NS_LITERAL_STRING("")); \
}
#define CSS_PROP_INTERNAL(name_, id_, method_, hint_) /* nothing */

View File

@ -787,6 +787,10 @@ CSSParserImpl::ParseRule(const nsAString& aRule,
return NS_OK;
}
//XXXbz this function does not deal well with something like "foo
//!important" as the aPropValue. It will parse the "foo" and set it
//in the decl, then ignore the !important. It should either fail to
//parse this or do !important correctly....
NS_IMETHODIMP
CSSParserImpl::ParseProperty(const nsAString& aPropName,
const nsAString& aPropValue,

View File

@ -244,8 +244,13 @@ nsDOMCSSDeclaration::SetProperty(const nsAString& aPropertyName,
return ParsePropertyValue(aPropertyName, aValue);
}
return ParsePropertyValue(aPropertyName,
aValue + NS_LITERAL_STRING("!") + aPriority);
// ParsePropertyValue does not handle priorities correctly -- it's
// optimized for speed. And the priority is not part of the
// property value anyway.... So we have to use the full-blown
// ParseDeclaration()
return ParseDeclaration(aPropertyName + NS_LITERAL_STRING(":") +
aValue + NS_LITERAL_STRING("!") + aPriority,
PR_TRUE, PR_FALSE);
}
//////////////////////////////////////////////////////////////////////////////
@ -282,7 +287,8 @@ NS_INTERFACE_MAP_END_AGGREGATED(fOuter)
CSS2PropertiesTearoff::Set##method_(const nsAString& aValue) \
{ \
return NS_STATIC_CAST(nsIDOMCSSStyleDeclaration*, fOuter)-> \
SetProperty(NS_LITERAL_STRING(#name_), aValue, nsAutoString()); \
SetProperty(NS_LITERAL_STRING(#name_), aValue, \
NS_LITERAL_STRING("")); \
}
#define CSS_PROP_INTERNAL(name_, id_, method_, hint_) /* nothing */