diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/css/CSSMutableStyleDeclaration.cpp')
-rw-r--r-- | src/3rdparty/webkit/WebCore/css/CSSMutableStyleDeclaration.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/3rdparty/webkit/WebCore/css/CSSMutableStyleDeclaration.cpp b/src/3rdparty/webkit/WebCore/css/CSSMutableStyleDeclaration.cpp index 2dd2f5d..31c7507 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSMutableStyleDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSMutableStyleDeclaration.cpp @@ -23,7 +23,6 @@ #include "CSSImageValue.h" #include "CSSParser.h" -#include "CSSProperty.h" #include "CSSPropertyLonghand.h" #include "CSSPropertyNames.h" #include "CSSRule.h" @@ -259,20 +258,28 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const String CSSMutableStyleDeclaration::get4Values(const int* properties) const { - String res; - for (int i = 0; i < 4; ++i) { - if (!isPropertyImplicit(properties[i])) { - RefPtr<CSSValue> value = getPropertyCSSValue(properties[i]); + // Assume the properties are in the usual order top, right, bottom, left. + RefPtr<CSSValue> topValue = getPropertyCSSValue(properties[0]); + RefPtr<CSSValue> rightValue = getPropertyCSSValue(properties[1]); + RefPtr<CSSValue> bottomValue = getPropertyCSSValue(properties[2]); + RefPtr<CSSValue> leftValue = getPropertyCSSValue(properties[3]); - // apparently all 4 properties must be specified. - if (!value) - return String(); + // All 4 properties must be specified. + if (!topValue || !rightValue || !bottomValue || !leftValue) + return String(); + + bool showLeft = rightValue->cssText() != leftValue->cssText(); + bool showBottom = (topValue->cssText() != bottomValue->cssText()) || showLeft; + bool showRight = (topValue->cssText() != rightValue->cssText()) || showBottom; + + String res = topValue->cssText(); + if (showRight) + res += " " + rightValue->cssText(); + if (showBottom) + res += " " + bottomValue->cssText(); + if (showLeft) + res += " " + leftValue->cssText(); - if (!res.isNull()) - res += " "; - res += value->cssText(); - } - } return res; } @@ -306,7 +313,7 @@ String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* propertie RefPtr<CSSValue> value; if (values[j]) { if (values[j]->isValueList()) - value = static_cast<CSSValueList*>(values[j].get())->itemWithoutBoundsCheck(i); + value = static_cast<CSSValueList*>(values[j].get())->item(i); else { value = values[j]; @@ -628,7 +635,7 @@ unsigned CSSMutableStyleDeclaration::length() const String CSSMutableStyleDeclaration::item(unsigned i) const { if (i >= m_properties.size()) - return String(); + return ""; return getPropertyName(static_cast<CSSPropertyID>(m_properties[i].id())); } |