Commit 5e79bbae authored by Andrea Iacovitti's avatar Andrea Iacovitti

css background-size property: do not use CSS_UNKNOWN type to map internally

'auto' value as its serialization return a null string.
parent 0d9d4ddd
......@@ -1819,7 +1819,7 @@ CSSValueImpl* CSSParser::parseBackgroundSize()
return new CSSPrimitiveValueImpl(value->id);
if (value->id == CSS_VAL_AUTO)
parsedValue1 = new CSSPrimitiveValueImpl(0, CSSPrimitiveValue::CSS_UNKNOWN);
parsedValue1 = new CSSPrimitiveValueImpl(CSS_VAL_AUTO);
else {
if (!validUnit(value, FLength|FPercent|FNonNeg, strict))
return 0;
......@@ -1829,7 +1829,7 @@ CSSValueImpl* CSSParser::parseBackgroundSize()
CSSPrimitiveValueImpl* parsedValue2;
if ((value = valueList->next())) {
if (value->id == CSS_VAL_AUTO)
parsedValue2 = new CSSPrimitiveValueImpl(0, CSSPrimitiveValue::CSS_UNKNOWN);
parsedValue2 = new CSSPrimitiveValueImpl(CSS_VAL_AUTO);
else {
if (!validUnit(value, FLength|FPercent|FNonNeg, strict)) {
delete parsedValue1;
......@@ -1838,7 +1838,7 @@ CSSValueImpl* CSSParser::parseBackgroundSize()
parsedValue2 = new CSSPrimitiveValueImpl(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
}
} else {
parsedValue2 = new CSSPrimitiveValueImpl(0, CSSPrimitiveValue::CSS_UNKNOWN);
parsedValue2 = new CSSPrimitiveValueImpl(CSS_VAL_AUTO);
}
PairImpl* pair = new PairImpl(parsedValue1, parsedValue2);
......
......@@ -4443,26 +4443,32 @@ void CSSStyleSelector::mapBackgroundSize(BackgroundLayer* layer, CSSValueImpl* v
return;
Length firstLength, secondLength;
int firstType = first->primitiveType();
int secondType = second->primitiveType();
if (firstType == CSSPrimitiveValue::CSS_UNKNOWN)
if (first->getIdent() == CSS_VAL_AUTO) {
firstLength = Length(Auto);
else if (firstType > CSSPrimitiveValue::CSS_PERCENTAGE && firstType < CSSPrimitiveValue::CSS_DEG)
firstLength = Length(first->computeLength(style, logicalDpiY), Fixed);
else if (firstType == CSSPrimitiveValue::CSS_PERCENTAGE)
firstLength = Length(first->floatValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
else
return;
} else {
const unsigned short firstType = first->primitiveType();
if (firstType > CSSPrimitiveValue::CSS_PERCENTAGE && firstType < CSSPrimitiveValue::CSS_DEG) {
firstLength = Length(first->computeLength(style, logicalDpiY), Fixed);
} else if (firstType == CSSPrimitiveValue::CSS_PERCENTAGE) {
firstLength = Length(first->floatValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
} else {
return;
}
}
if (secondType == CSSPrimitiveValue::CSS_UNKNOWN)
if (second->getIdent() == CSS_VAL_AUTO) {
secondLength = Length(Auto);
else if (secondType > CSSPrimitiveValue::CSS_PERCENTAGE && secondType < CSSPrimitiveValue::CSS_DEG)
secondLength = Length(second->computeLength(style, logicalDpiY), Fixed);
else if (secondType == CSSPrimitiveValue::CSS_PERCENTAGE)
secondLength = Length(second->floatValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
else
return;
} else {
const unsigned short secondType = second->primitiveType();
if (secondType > CSSPrimitiveValue::CSS_PERCENTAGE && secondType < CSSPrimitiveValue::CSS_DEG) {
secondLength = Length(second->computeLength(style, logicalDpiY), Fixed);
} else if (secondType == CSSPrimitiveValue::CSS_PERCENTAGE) {
secondLength = Length(second->floatValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
} else {
return;
}
}
b.width = firstLength;
b.height = secondLength;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment