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() ...@@ -1819,7 +1819,7 @@ CSSValueImpl* CSSParser::parseBackgroundSize()
return new CSSPrimitiveValueImpl(value->id); return new CSSPrimitiveValueImpl(value->id);
if (value->id == CSS_VAL_AUTO) if (value->id == CSS_VAL_AUTO)
parsedValue1 = new CSSPrimitiveValueImpl(0, CSSPrimitiveValue::CSS_UNKNOWN); parsedValue1 = new CSSPrimitiveValueImpl(CSS_VAL_AUTO);
else { else {
if (!validUnit(value, FLength|FPercent|FNonNeg, strict)) if (!validUnit(value, FLength|FPercent|FNonNeg, strict))
return 0; return 0;
...@@ -1829,7 +1829,7 @@ CSSValueImpl* CSSParser::parseBackgroundSize() ...@@ -1829,7 +1829,7 @@ CSSValueImpl* CSSParser::parseBackgroundSize()
CSSPrimitiveValueImpl* parsedValue2; CSSPrimitiveValueImpl* parsedValue2;
if ((value = valueList->next())) { if ((value = valueList->next())) {
if (value->id == CSS_VAL_AUTO) if (value->id == CSS_VAL_AUTO)
parsedValue2 = new CSSPrimitiveValueImpl(0, CSSPrimitiveValue::CSS_UNKNOWN); parsedValue2 = new CSSPrimitiveValueImpl(CSS_VAL_AUTO);
else { else {
if (!validUnit(value, FLength|FPercent|FNonNeg, strict)) { if (!validUnit(value, FLength|FPercent|FNonNeg, strict)) {
delete parsedValue1; delete parsedValue1;
...@@ -1838,7 +1838,7 @@ CSSValueImpl* CSSParser::parseBackgroundSize() ...@@ -1838,7 +1838,7 @@ CSSValueImpl* CSSParser::parseBackgroundSize()
parsedValue2 = new CSSPrimitiveValueImpl(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit); parsedValue2 = new CSSPrimitiveValueImpl(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
} }
} else { } else {
parsedValue2 = new CSSPrimitiveValueImpl(0, CSSPrimitiveValue::CSS_UNKNOWN); parsedValue2 = new CSSPrimitiveValueImpl(CSS_VAL_AUTO);
} }
PairImpl* pair = new PairImpl(parsedValue1, parsedValue2); PairImpl* pair = new PairImpl(parsedValue1, parsedValue2);
......
...@@ -4443,26 +4443,32 @@ void CSSStyleSelector::mapBackgroundSize(BackgroundLayer* layer, CSSValueImpl* v ...@@ -4443,26 +4443,32 @@ void CSSStyleSelector::mapBackgroundSize(BackgroundLayer* layer, CSSValueImpl* v
return; return;
Length firstLength, secondLength; 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); firstLength = Length(Auto);
else if (firstType > CSSPrimitiveValue::CSS_PERCENTAGE && firstType < CSSPrimitiveValue::CSS_DEG) } else {
firstLength = Length(first->computeLength(style, logicalDpiY), Fixed); const unsigned short firstType = first->primitiveType();
else if (firstType == CSSPrimitiveValue::CSS_PERCENTAGE) if (firstType > CSSPrimitiveValue::CSS_PERCENTAGE && firstType < CSSPrimitiveValue::CSS_DEG) {
firstLength = Length(first->floatValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); firstLength = Length(first->computeLength(style, logicalDpiY), Fixed);
else } else if (firstType == CSSPrimitiveValue::CSS_PERCENTAGE) {
return; firstLength = Length(first->floatValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
} else {
return;
}
}
if (secondType == CSSPrimitiveValue::CSS_UNKNOWN) if (second->getIdent() == CSS_VAL_AUTO) {
secondLength = Length(Auto); secondLength = Length(Auto);
else if (secondType > CSSPrimitiveValue::CSS_PERCENTAGE && secondType < CSSPrimitiveValue::CSS_DEG) } else {
secondLength = Length(second->computeLength(style, logicalDpiY), Fixed); const unsigned short secondType = second->primitiveType();
else if (secondType == CSSPrimitiveValue::CSS_PERCENTAGE) if (secondType > CSSPrimitiveValue::CSS_PERCENTAGE && secondType < CSSPrimitiveValue::CSS_DEG) {
secondLength = Length(second->floatValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); secondLength = Length(second->computeLength(style, logicalDpiY), Fixed);
else } else if (secondType == CSSPrimitiveValue::CSS_PERCENTAGE) {
return; secondLength = Length(second->floatValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
} else {
return;
}
}
b.width = firstLength; b.width = firstLength;
b.height = secondLength; 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