Bug 1060090 part 1: Rename ParseBackgroundPositionValues to ParsePositionValue. r=heycam

This commit is contained in:
Daniel Holbert 2014-09-09 11:40:10 -07:00
parent b662348a22
commit edab2d2a41

View File

@ -652,11 +652,14 @@ protected:
bool ParseBackgroundPosition();
// ParseBoxPositionValues parses the CSS 2.1 background-position syntax,
// which is still used by some properties. See ParseBackgroundPositionValues
// which is still used by some properties. See ParsePositionValue
// for the css3-background syntax.
bool ParseBoxPositionValues(nsCSSValuePair& aOut, bool aAcceptsInherit,
bool aAllowExplicitCenter = true); // deprecated
bool ParseBackgroundPositionValues(nsCSSValue& aOut, bool aAcceptsInherit);
// ParsePositionValue parses a CSS <position> value, which is used by
// the 'background-position' property.
bool ParsePositionValue(nsCSSValue& aOut);
bool ParseBackgroundSize();
bool ParseBackgroundSizeValues(nsCSSValuePair& aOut);
@ -10197,7 +10200,7 @@ CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundParseState& aState)
if (havePositionAndSize)
return false;
havePositionAndSize = true;
if (!ParseBackgroundPositionValues(aState.mPosition->mValue, false)) {
if (!ParsePositionValue(aState.mPosition->mValue)) {
return false;
}
if (ExpectSymbol('/', true)) {
@ -10281,7 +10284,7 @@ CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundParseState& aState)
if (havePositionAndSize)
return false;
havePositionAndSize = true;
if (!ParseBackgroundPositionValues(aState.mPosition->mValue, false)) {
if (!ParsePositionValue(aState.mPosition->mValue)) {
return false;
}
if (ExpectSymbol('/', true)) {
@ -10393,7 +10396,7 @@ CSSParserImpl::ParseBackgroundPosition()
// 'initial', 'inherit' and 'unset' stand alone, no list permitted.
if (!ParseVariant(value, VARIANT_INHERIT, nullptr)) {
nsCSSValue itemValue;
if (!ParseBackgroundPositionValues(itemValue, false)) {
if (!ParsePositionValue(itemValue)) {
return false;
}
nsCSSValueList* item = value.SetListValue();
@ -10402,7 +10405,7 @@ CSSParserImpl::ParseBackgroundPosition()
if (!ExpectSymbol(',', true)) {
break;
}
if (!ParseBackgroundPositionValues(itemValue, false)) {
if (!ParsePositionValue(itemValue)) {
return false;
}
item->mNext = new nsCSSValueList;
@ -10515,19 +10518,11 @@ bool CSSParserImpl::ParseBoxPositionValues(nsCSSValuePair &aOut,
return true;
}
bool CSSParserImpl::ParseBackgroundPositionValues(nsCSSValue& aOut,
bool aAcceptsInherit)
// Parses a CSS <position> value, for e.g. the 'background-position' property.
// Spec reference: http://www.w3.org/TR/css3-background/#ltpositiongt
bool
CSSParserImpl::ParsePositionValue(nsCSSValue& aOut)
{
// css3-background allows positions to be defined as offsets
// from an edge. There can be 2 keywords and 2 offsets given. These
// four 'values' are stored in an array in the following order:
// [keyword offset keyword offset]. If a keyword or offset isn't
// parsed the value of the corresponding array element is set
// to eCSSUnit_Null by a call to nsCSSValue::Reset().
if (aAcceptsInherit && ParseVariant(aOut, VARIANT_INHERIT, nullptr)) {
return true;
}
nsRefPtr<nsCSSValue::Array> value = nsCSSValue::Array::Create(4);
aOut.SetArrayValue(value, eCSSUnit_Array);