Commit 48f28703 authored by Andrea Iacovitti's avatar Andrea Iacovitti

Minor optimization

parent 6ac87911
......@@ -461,7 +461,7 @@ CSSValueImpl *RenderStyleDeclarationImpl::getPropertyCSSValue( int propertyID )
case CSS_PROP_BACKGROUND_POSITION:
{
RETURN_NULL_ON_NULL(renderer);
DOMString string;
QString string;
Length length(style->backgroundXPosition());
if (length.isPercent())
string = QString(QString::number(length.percent()) + "%");
......@@ -473,7 +473,7 @@ CSSValueImpl *RenderStyleDeclarationImpl::getPropertyCSSValue( int propertyID )
string += QString(QString::number(length.percent()) + "%");
else
string += QString(QString::number(length.minWidth(renderer->contentWidth())) + "px");
return new CSSPrimitiveValueImpl(string, CSSPrimitiveValue::CSS_STRING);
return new CSSPrimitiveValueImpl(DOMString(string), CSSPrimitiveValue::CSS_STRING);
}
case CSS_PROP_BACKGROUND_POSITION_X:
RETURN_NULL_ON_NULL(renderer);
......
......@@ -959,14 +959,17 @@ void CSSValueListImpl::append(CSSValueImpl *val)
DOM::DOMString CSSValueListImpl::cssText() const
{
DOMString result = "";
DOMString separatorString;
if (m_separator == Comma) {
separatorString = DOMString(", ");
} else { // Space
separatorString = DOMString(" ");
}
DOMString result = "";
for (QListIterator<CSSValueImpl*> iterator(m_values); iterator.hasNext();) {
if (!result.isEmpty()) {
if (m_separator == Comma)
result += ", ";
else if (m_separator == Space)
result += " ";
result += separatorString;
}
result += iterator.next()->cssText();
}
......
......@@ -4422,9 +4422,13 @@ void CSSStyleSelector::mapBackgroundSize(BackgroundLayer* layer, CSSValueImpl* v
return;
CSSPrimitiveValueImpl* primitiveValue = static_cast<CSSPrimitiveValueImpl*>(value);
int id = primitiveValue->getIdent();
if (id == CSS_VAL_CONTAIN || id == CSS_VAL_COVER) {
layer->setBackgroundSizeType( (id == CSS_VAL_CONTAIN) ? BGSCONTAIN : BGSCOVER );
const int id = primitiveValue->getIdent();
if (id == CSS_VAL_CONTAIN) {
layer->setBackgroundSizeType(BGSCONTAIN);
return;
}
if (id == CSS_VAL_COVER) {
layer->setBackgroundSizeType(BGSCOVER);
return;
}
......
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