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

Minor optimization

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