diff --git a/khtml/css/cssparser.cpp b/khtml/css/cssparser.cpp
index 2f7676fd8fd2c8e00a8a6aea50407afcf07610df..67e371559c0153db47b29688744d8f00ad5eb585 100644
--- a/khtml/css/cssparser.cpp
+++ b/khtml/css/cssparser.cpp
@@ -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);
diff --git a/khtml/css/cssstyleselector.cpp b/khtml/css/cssstyleselector.cpp
index 450a5557edacb7242a0ca6832f67db7c32c939ab..01835739752b1320caaacb5a7b2554970dde8105 100644
--- a/khtml/css/cssstyleselector.cpp
+++ b/khtml/css/cssstyleselector.cpp
@@ -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;