summaryrefslogtreecommitdiffstats
path: root/WebCore/css/CSSComputedStyleDeclaration.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-10-08 17:19:54 +0100
committerSteve Block <steveblock@google.com>2009-10-20 00:41:58 +0100
commit231d4e3152a9c27a73b6ac7badbe6be673aa3ddf (patch)
treea6c7e2d6cd7bfa7011cc39abbb436142d7a4a7c8 /WebCore/css/CSSComputedStyleDeclaration.cpp
parente196732677050bd463301566a68a643b6d14b907 (diff)
downloadexternal_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.zip
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.gz
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.bz2
Merge webkit.org at R49305 : Automatic merge by git.
Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7
Diffstat (limited to 'WebCore/css/CSSComputedStyleDeclaration.cpp')
-rw-r--r--WebCore/css/CSSComputedStyleDeclaration.cpp56
1 files changed, 46 insertions, 10 deletions
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp
index 8a91140..34b93c1 100644
--- a/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -62,6 +62,7 @@ static const int computedProperties[] = {
CSSPropertyBackgroundOrigin,
CSSPropertyBackgroundPosition, // more-specific background-position-x/y are non-standard
CSSPropertyBackgroundRepeat,
+ CSSPropertyBackgroundSize,
CSSPropertyBorderBottomColor,
CSSPropertyBorderBottomLeftRadius,
CSSPropertyBorderBottomRightRadius,
@@ -80,7 +81,6 @@ static const int computedProperties[] = {
CSSPropertyBorderTopStyle,
CSSPropertyBorderTopWidth,
CSSPropertyBottom,
- CSSPropertyBoxShadow,
CSSPropertyCaptionSide,
CSSPropertyClear,
CSSPropertyClip,
@@ -132,6 +132,7 @@ static const int computedProperties[] = {
CSSPropertyTextAlign,
CSSPropertyTextDecoration,
CSSPropertyTextIndent,
+ CSSPropertyTextRendering,
CSSPropertyTextShadow,
CSSPropertyTextOverflow,
CSSPropertyTextTransform,
@@ -160,7 +161,6 @@ static const int computedProperties[] = {
CSSPropertyWebkitBackgroundClip,
CSSPropertyWebkitBackgroundComposite,
CSSPropertyWebkitBackgroundOrigin,
- CSSPropertyWebkitBackgroundSize,
CSSPropertyWebkitBorderFit,
CSSPropertyWebkitBorderHorizontalSpacing,
CSSPropertyWebkitBorderImage,
@@ -174,6 +174,7 @@ static const int computedProperties[] = {
CSSPropertyWebkitBoxOrient,
CSSPropertyWebkitBoxPack,
CSSPropertyWebkitBoxReflect,
+ CSSPropertyWebkitBoxShadow,
CSSPropertyWebkitBoxSizing,
CSSPropertyWebkitColumnBreakAfter,
CSSPropertyWebkitColumnBreakBefore,
@@ -187,6 +188,7 @@ static const int computedProperties[] = {
#if ENABLE(DASHBOARD_SUPPORT)
CSSPropertyWebkitDashboardRegion,
#endif
+ CSSPropertyWebkitFontSmoothing,
CSSPropertyWebkitHighlight,
CSSPropertyWebkitLineBreak,
CSSPropertyWebkitLineClamp,
@@ -255,7 +257,6 @@ static const int computedProperties[] = {
CSSPropertyStrokeMiterlimit,
CSSPropertyStrokeOpacity,
CSSPropertyStrokeWidth,
- CSSPropertyTextRendering,
CSSPropertyAlignmentBaseline,
CSSPropertyBaselineShift,
CSSPropertyDominantBaseline,
@@ -627,6 +628,32 @@ static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecorati
return list;
}
+static PassRefPtr<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat)
+{
+ // For backwards compatibility, if both values are equal, just return one of them. And
+ // if the two values are equivalent to repeat-x or repeat-y, just return the shorthand.
+ if (xRepeat == yRepeat)
+ return CSSPrimitiveValue::create(xRepeat);
+ if (xRepeat == CSSValueRepeat && yRepeat == CSSValueNoRepeat)
+ return CSSPrimitiveValue::createIdentifier(CSSValueRepeatX);
+ if (xRepeat == CSSValueNoRepeat && yRepeat == CSSValueRepeat)
+ return CSSPrimitiveValue::createIdentifier(CSSValueRepeatY);
+
+ RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ list->append(CSSPrimitiveValue::create(xRepeat));
+ list->append(CSSPrimitiveValue::create(yRepeat));
+ return list.release();
+}
+
+static void logUnimplementedPropertyID(int propertyID)
+{
+ DEFINE_STATIC_LOCAL(HashSet<int>, propertyIDSet, ());
+ if (!propertyIDSet.add(propertyID).second)
+ return;
+
+ LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(static_cast<CSSPropertyID>(propertyID)));
+}
+
PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int propertyID, EUpdateLayout updateLayout) const
{
Node* node = m_node.get();
@@ -661,14 +688,19 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
if (style->backgroundImage())
return style->backgroundImage()->cssValue();
return CSSPrimitiveValue::createIdentifier(CSSValueNone);
- case CSSPropertyWebkitBackgroundSize: {
+ case CSSPropertyBackgroundSize: {
+ EFillSizeType size = style->backgroundSizeType();
+ if (size == Contain)
+ return CSSPrimitiveValue::createIdentifier(CSSValueContain);
+ if (size == Cover)
+ return CSSPrimitiveValue::createIdentifier(CSSValueCover);
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- list->append(CSSPrimitiveValue::create(style->backgroundSize().width()));
- list->append(CSSPrimitiveValue::create(style->backgroundSize().height()));
+ list->append(CSSPrimitiveValue::create(style->backgroundSizeLength().width()));
+ list->append(CSSPrimitiveValue::create(style->backgroundSizeLength().height()));
return list.release();
}
case CSSPropertyBackgroundRepeat:
- return CSSPrimitiveValue::create(style->backgroundRepeat());
+ return fillRepeatToCSSValue(style->backgroundRepeatX(), style->backgroundRepeatY());
case CSSPropertyWebkitBackgroundComposite:
return CSSPrimitiveValue::create(style->backgroundComposite());
case CSSPropertyBackgroundAttachment:
@@ -756,7 +788,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
}
case CSSPropertyWebkitBoxReflect:
return valueForReflection(style->boxReflect());
- case CSSPropertyBoxShadow:
+ case CSSPropertyWebkitBoxShadow:
return valueForShadow(style->boxShadow(), static_cast<CSSPropertyID>(propertyID));
case CSSPropertyCaptionSide:
return CSSPrimitiveValue::create(style->captionSide());
@@ -942,7 +974,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return list.release();
}
case CSSPropertyWebkitMaskRepeat:
- return CSSPrimitiveValue::create(style->maskRepeat());
+ return fillRepeatToCSSValue(style->maskRepeatX(), style->maskRepeatY());
case CSSPropertyWebkitMaskAttachment:
return CSSPrimitiveValue::create(style->maskAttachment());
case CSSPropertyWebkitMaskComposite:
@@ -1053,6 +1085,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::create(style->textIndent());
case CSSPropertyTextShadow:
return valueForShadow(style->textShadow(), static_cast<CSSPropertyID>(propertyID));
+ case CSSPropertyTextRendering:
+ return CSSPrimitiveValue::create(style->fontDescription().textRenderingMode());
case CSSPropertyTextOverflow:
if (style->textOverflow())
return CSSPrimitiveValue::createIdentifier(CSSValueEllipsis);
@@ -1141,6 +1175,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::create(style->matchNearestMailBlockquoteColor());
case CSSPropertyResize:
return CSSPrimitiveValue::create(style->resize());
+ case CSSPropertyWebkitFontSmoothing:
+ return CSSPrimitiveValue::create(style->fontDescription().fontSmoothing());
case CSSPropertyZIndex:
if (style->hasAutoZIndex())
return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
@@ -1435,7 +1471,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
#endif
}
- LOG_ERROR("unimplemented propertyID: %d", propertyID);
+ logUnimplementedPropertyID(propertyID);
return 0;
}