summaryrefslogtreecommitdiffstats
path: root/WebCore/css/CSSComputedStyleDeclaration.cpp
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2010-11-10 15:31:59 -0800
committerTeng-Hui Zhu <ztenghui@google.com>2010-11-17 13:35:59 -0800
commit28040489d744e0c5d475a88663056c9040ed5320 (patch)
treec463676791e4a63e452a95f0a12b2a8519730693 /WebCore/css/CSSComputedStyleDeclaration.cpp
parenteff9be92c41913c92fb1d3b7983c071f3e718678 (diff)
downloadexternal_webkit-28040489d744e0c5d475a88663056c9040ed5320.zip
external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.gz
external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.bz2
Merge WebKit at r71558: Initial merge by git.
Change-Id: Ib345578fa29df7e4bc72b4f00e4a6fddcb754c4c
Diffstat (limited to 'WebCore/css/CSSComputedStyleDeclaration.cpp')
-rw-r--r--WebCore/css/CSSComputedStyleDeclaration.cpp208
1 files changed, 140 insertions, 68 deletions
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp
index 3f6aa4a..35a0b4a 100644
--- a/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -80,6 +80,7 @@ static const int computedProperties[] = {
CSSPropertyBorderTopStyle,
CSSPropertyBorderTopWidth,
CSSPropertyBottom,
+ CSSPropertyBoxSizing,
CSSPropertyCaptionSide,
CSSPropertyClear,
CSSPropertyClip,
@@ -177,7 +178,6 @@ static const int computedProperties[] = {
CSSPropertyWebkitBoxPack,
CSSPropertyWebkitBoxReflect,
CSSPropertyWebkitBoxShadow,
- CSSPropertyWebkitBoxSizing,
CSSPropertyWebkitColorCorrection,
CSSPropertyWebkitColumnBreakAfter,
CSSPropertyWebkitColumnBreakBefore,
@@ -215,6 +215,7 @@ static const int computedProperties[] = {
CSSPropertyWebkitPerspective,
CSSPropertyWebkitPerspectiveOrigin,
CSSPropertyWebkitRtlOrdering,
+ CSSPropertyWebkitTextCombine,
CSSPropertyWebkitTextDecorationsInEffect,
CSSPropertyWebkitTextFillColor,
CSSPropertyWebkitTextSecurity,
@@ -720,6 +721,20 @@ static PassRefPtr<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepea
return list.release();
}
+static PassRefPtr<CSSValue> fillSizeToCSSValue(const FillSize& fillSize)
+{
+ if (fillSize.type == Contain)
+ return CSSPrimitiveValue::createIdentifier(CSSValueContain);
+
+ if (fillSize.type == Cover)
+ return CSSPrimitiveValue::createIdentifier(CSSValueCover);
+
+ RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ list->append(CSSPrimitiveValue::create(fillSize.size.width()));
+ list->append(CSSPrimitiveValue::create(fillSize.size.height()));
+ return list.release();
+}
+
static void logUnimplementedPropertyID(int propertyID)
{
DEFINE_STATIC_LOCAL(HashSet<int>, propertyIDSet, ());
@@ -766,47 +781,141 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyBackgroundColor:
return CSSPrimitiveValue::createColor(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor().rgb());
case CSSPropertyBackgroundImage:
- // FIXME: Broken for multiple backgrounds. https://bugs.webkit.org/show_bug.cgi?id=44853
- if (style->backgroundImage())
- return style->backgroundImage()->cssValue();
- return CSSPrimitiveValue::createIdentifier(CSSValueNone);
+ case CSSPropertyWebkitMaskImage: {
+ const FillLayer* layers = propertyID == CSSPropertyWebkitMaskImage ? style->maskLayers() : style->backgroundLayers();
+ if (!layers)
+ return CSSPrimitiveValue::createIdentifier(CSSValueNone);
+
+ if (!layers->next()) {
+ if (layers->image())
+ return layers->image()->cssValue();
+
+ return CSSPrimitiveValue::createIdentifier(CSSValueNone);
+ }
+
+ RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
+ if (currLayer->image())
+ list->append(currLayer->image()->cssValue());
+ else
+ list->append(CSSPrimitiveValue::createIdentifier(CSSValueNone));
+ }
+ return list.release();
+ }
case CSSPropertyBackgroundSize:
- case CSSPropertyWebkitBackgroundSize: {
- 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->backgroundSizeLength().width()));
- list->append(CSSPrimitiveValue::create(style->backgroundSizeLength().height()));
+ case CSSPropertyWebkitBackgroundSize:
+ case CSSPropertyWebkitMaskSize: {
+ const FillLayer* layers = propertyID == CSSPropertyWebkitMaskSize ? style->maskLayers() : style->backgroundLayers();
+ if (!layers->next())
+ return fillSizeToCSSValue(layers->size());
+
+ RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ list->append(fillSizeToCSSValue(currLayer->size()));
+
return list.release();
- }
+ }
case CSSPropertyBackgroundRepeat:
- return fillRepeatToCSSValue(style->backgroundRepeatX(), style->backgroundRepeatY());
+ case CSSPropertyWebkitMaskRepeat: {
+ const FillLayer* layers = propertyID == CSSPropertyWebkitMaskRepeat ? style->maskLayers() : style->backgroundLayers();
+ if (!layers->next())
+ return fillRepeatToCSSValue(layers->repeatX(), layers->repeatY());
+
+ RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ list->append(fillRepeatToCSSValue(currLayer->repeatX(), currLayer->repeatY()));
+
+ return list.release();
+ }
case CSSPropertyWebkitBackgroundComposite:
- return CSSPrimitiveValue::create(style->backgroundComposite());
+ case CSSPropertyWebkitMaskComposite: {
+ const FillLayer* layers = propertyID == CSSPropertyWebkitMaskComposite ? style->maskLayers() : style->backgroundLayers();
+ if (!layers->next())
+ return CSSPrimitiveValue::create(layers->composite());
+
+ RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ list->append(CSSPrimitiveValue::create(currLayer->composite()));
+
+ return list.release();
+ }
case CSSPropertyBackgroundAttachment:
- return CSSPrimitiveValue::create(style->backgroundAttachment());
+ case CSSPropertyWebkitMaskAttachment: {
+ const FillLayer* layers = propertyID == CSSPropertyWebkitMaskAttachment ? style->maskLayers() : style->backgroundLayers();
+ if (!layers->next())
+ return CSSPrimitiveValue::create(layers->attachment());
+
+ RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ list->append(CSSPrimitiveValue::create(currLayer->attachment()));
+
+ return list.release();
+ }
case CSSPropertyBackgroundClip:
case CSSPropertyBackgroundOrigin:
case CSSPropertyWebkitBackgroundClip:
- case CSSPropertyWebkitBackgroundOrigin: {
- EFillBox box = (propertyID == CSSPropertyWebkitBackgroundClip || propertyID == CSSPropertyBackgroundClip) ? style->backgroundClip() : style->backgroundOrigin();
- return CSSPrimitiveValue::create(box);
+ case CSSPropertyWebkitBackgroundOrigin:
+ case CSSPropertyWebkitMaskClip:
+ case CSSPropertyWebkitMaskOrigin: {
+ const FillLayer* layers = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? style->maskLayers() : style->backgroundLayers();
+ bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == CSSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip;
+ if (!layers->next()) {
+ EFillBox box = isClip ? layers->clip() : layers->origin();
+ return CSSPrimitiveValue::create(box);
+ }
+
+ RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
+ EFillBox box = isClip ? currLayer->clip() : currLayer->origin();
+ list->append(CSSPrimitiveValue::create(box));
+ }
+
+ return list.release();
}
- case CSSPropertyBackgroundPosition: {
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ case CSSPropertyBackgroundPosition:
+ case CSSPropertyWebkitMaskPosition: {
+ const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPosition ? style->maskLayers() : style->backgroundLayers();
+ if (!layers->next()) {
+ RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ list->append(CSSPrimitiveValue::create(layers->xPosition()));
+ list->append(CSSPrimitiveValue::create(layers->yPosition()));
+ return list.release();
+ }
- list->append(CSSPrimitiveValue::create(style->backgroundXPosition()));
- list->append(CSSPrimitiveValue::create(style->backgroundYPosition()));
+ RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
+ RefPtr<CSSValueList> positionList = CSSValueList::createSpaceSeparated();
+ positionList->append(CSSPrimitiveValue::create(currLayer->xPosition()));
+ positionList->append(CSSPrimitiveValue::create(currLayer->yPosition()));
+ list->append(positionList);
+ }
return list.release();
}
case CSSPropertyBackgroundPositionX:
- return CSSPrimitiveValue::create(style->backgroundXPosition());
+ case CSSPropertyWebkitMaskPositionX: {
+ const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionX ? style->maskLayers() : style->backgroundLayers();
+ if (!layers->next())
+ return CSSPrimitiveValue::create(layers->xPosition());
+
+ RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ list->append(CSSPrimitiveValue::create(currLayer->xPosition()));
+
+ return list.release();
+ }
case CSSPropertyBackgroundPositionY:
- return CSSPrimitiveValue::create(style->backgroundYPosition());
+ case CSSPropertyWebkitMaskPositionY: {
+ const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionY ? style->maskLayers() : style->backgroundLayers();
+ if (!layers->next())
+ return CSSPrimitiveValue::create(layers->yPosition());
+
+ RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+ list->append(CSSPrimitiveValue::create(currLayer->yPosition()));
+
+ return list.release();
+ }
case CSSPropertyBorderCollapse:
if (style->borderCollapse())
return CSSPrimitiveValue::createIdentifier(CSSValueCollapse);
@@ -1059,44 +1168,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::create(style->marqueeLoopCount(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyWebkitMarqueeStyle:
return CSSPrimitiveValue::create(style->marqueeBehavior());
- case CSSPropertyWebkitMaskImage:
- if (style->maskImage())
- return style->maskImage()->cssValue();
- return CSSPrimitiveValue::createIdentifier(CSSValueNone);
- case CSSPropertyWebkitMaskSize: {
- EFillSizeType size = style->maskSizeType();
- if (size == Contain)
- return CSSPrimitiveValue::createIdentifier(CSSValueContain);
- if (size == Cover)
- return CSSPrimitiveValue::createIdentifier(CSSValueCover);
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- list->append(CSSPrimitiveValue::create(style->maskSizeLength().width()));
- list->append(CSSPrimitiveValue::create(style->maskSizeLength().height()));
- return list.release();
- }
- case CSSPropertyWebkitMaskRepeat:
- return fillRepeatToCSSValue(style->maskRepeatX(), style->maskRepeatY());
- case CSSPropertyWebkitMaskAttachment:
- return CSSPrimitiveValue::create(style->maskAttachment());
- case CSSPropertyWebkitMaskComposite:
- return CSSPrimitiveValue::create(style->maskComposite());
- case CSSPropertyWebkitMaskClip:
- case CSSPropertyWebkitMaskOrigin: {
- EFillBox box = (propertyID == CSSPropertyWebkitMaskClip ? style->maskClip() : style->maskOrigin());
- return CSSPrimitiveValue::create(box);
- }
- case CSSPropertyWebkitMaskPosition: {
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-
- list->append(CSSPrimitiveValue::create(style->maskXPosition()));
- list->append(CSSPrimitiveValue::create(style->maskYPosition()));
-
- return list.release();
- }
- case CSSPropertyWebkitMaskPositionX:
- return CSSPrimitiveValue::create(style->maskXPosition());
- case CSSPropertyWebkitMaskPositionY:
- return CSSPrimitiveValue::create(style->maskYPosition());
case CSSPropertyWebkitUserModify:
return CSSPrimitiveValue::create(style->userModify());
case CSSPropertyMaxHeight: {
@@ -1284,7 +1355,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::create(style->zIndex(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyZoom:
return CSSPrimitiveValue::create(style->zoom(), CSSPrimitiveValue::CSS_NUMBER);
- case CSSPropertyWebkitBoxSizing:
+ case CSSPropertyBoxSizing:
if (style->boxSizing() == CONTENT_BOX)
return CSSPrimitiveValue::createIdentifier(CSSValueContentBox);
return CSSPrimitiveValue::createIdentifier(CSSValueBorderBox);
@@ -1381,9 +1452,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
const AnimationList* t = style->animations();
if (t) {
- for (size_t i = 0; i < t->size(); ++i) {
+ for (size_t i = 0; i < t->size(); ++i)
list->append(CSSPrimitiveValue::create(t->animation(i)->name(), CSSPrimitiveValue::CSS_STRING));
- }
} else
list->append(CSSPrimitiveValue::createIdentifier(CSSValueNone));
return list.release();
@@ -1518,6 +1588,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::create(style->colorSpace());
case CSSPropertyWebkitWritingMode:
return CSSPrimitiveValue::create(style->writingMode());
+ case CSSPropertyWebkitTextCombine:
+ return CSSPrimitiveValue::create(style->textCombine());
/* Shorthand properties, currently not supported see bug 13658*/
case CSSPropertyBackground: