CSS parsing for -webkit-flex-flow
[WebKit-https.git] / Source / WebCore / css / CSSComputedStyleDeclaration.cpp
1 /*
2  * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3  * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
4  * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5  * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6  * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301  USA
22  */
23
24 #include "config.h"
25 #include "CSSComputedStyleDeclaration.h"
26
27 #include "AnimationController.h"
28 #include "ContentData.h"
29 #include "CounterContent.h"
30 #include "CursorList.h"
31 #include "CSSBorderImageValue.h"
32 #include "CSSLineBoxContainValue.h"
33 #include "CSSMutableStyleDeclaration.h"
34 #include "CSSPrimitiveValue.h"
35 #include "CSSPrimitiveValueCache.h"
36 #include "CSSPrimitiveValueMappings.h"
37 #include "CSSProperty.h"
38 #include "CSSPropertyNames.h"
39 #include "CSSReflectValue.h"
40 #include "CSSSelector.h"
41 #include "CSSTimingFunctionValue.h"
42 #include "CSSValueList.h"
43 #include "Document.h"
44 #include "ExceptionCode.h"
45 #include "FontFeatureSettings.h"
46 #include "FontFeatureValue.h"
47 #include "Rect.h"
48 #include "RenderBox.h"
49 #include "RenderLayer.h"
50 #include "ShadowValue.h"
51 #include "WebKitCSSTransformValue.h"
52 #include "WebKitFontFamilyNames.h"
53
54 #if ENABLE(DASHBOARD_SUPPORT)
55 #include "DashboardRegion.h"
56 #endif
57
58 namespace WebCore {
59
60 // List of all properties we know how to compute, omitting shorthands.
61 static const int computedProperties[] = {
62     CSSPropertyBackgroundAttachment,
63     CSSPropertyBackgroundClip,
64     CSSPropertyBackgroundColor,
65     CSSPropertyBackgroundImage,
66     CSSPropertyBackgroundOrigin,
67     CSSPropertyBackgroundPosition, // more-specific background-position-x/y are non-standard
68     CSSPropertyBackgroundRepeat,
69     CSSPropertyBackgroundSize,
70     CSSPropertyBorderBottomColor,
71     CSSPropertyBorderBottomLeftRadius,
72     CSSPropertyBorderBottomRightRadius,
73     CSSPropertyBorderBottomStyle,
74     CSSPropertyBorderBottomWidth,
75     CSSPropertyBorderCollapse,
76     CSSPropertyBorderLeftColor,
77     CSSPropertyBorderLeftStyle,
78     CSSPropertyBorderLeftWidth,
79     CSSPropertyBorderRightColor,
80     CSSPropertyBorderRightStyle,
81     CSSPropertyBorderRightWidth,
82     CSSPropertyBorderTopColor,
83     CSSPropertyBorderTopLeftRadius,
84     CSSPropertyBorderTopRightRadius,
85     CSSPropertyBorderTopStyle,
86     CSSPropertyBorderTopWidth,
87     CSSPropertyBottom,
88     CSSPropertyBoxShadow,
89     CSSPropertyBoxSizing,
90     CSSPropertyCaptionSide,
91     CSSPropertyClear,
92     CSSPropertyClip,
93     CSSPropertyColor,
94     CSSPropertyCursor,
95     CSSPropertyDirection,
96     CSSPropertyDisplay,
97     CSSPropertyEmptyCells,
98     CSSPropertyFloat,
99     CSSPropertyFontFamily,
100     CSSPropertyFontSize,
101     CSSPropertyFontStyle,
102     CSSPropertyFontVariant,
103     CSSPropertyFontWeight,
104     CSSPropertyHeight,
105     CSSPropertyImageRendering,
106     CSSPropertyLeft,
107     CSSPropertyLetterSpacing,
108     CSSPropertyLineHeight,
109     CSSPropertyListStyleImage,
110     CSSPropertyListStylePosition,
111     CSSPropertyListStyleType,
112     CSSPropertyMarginBottom,
113     CSSPropertyMarginLeft,
114     CSSPropertyMarginRight,
115     CSSPropertyMarginTop,
116     CSSPropertyMaxHeight,
117     CSSPropertyMaxWidth,
118     CSSPropertyMinHeight,
119     CSSPropertyMinWidth,
120     CSSPropertyOpacity,
121     CSSPropertyOrphans,
122     CSSPropertyOutlineColor,
123     CSSPropertyOutlineStyle,
124     CSSPropertyOutlineWidth,
125     CSSPropertyOverflowX,
126     CSSPropertyOverflowY,
127     CSSPropertyPaddingBottom,
128     CSSPropertyPaddingLeft,
129     CSSPropertyPaddingRight,
130     CSSPropertyPaddingTop,
131     CSSPropertyPageBreakAfter,
132     CSSPropertyPageBreakBefore,
133     CSSPropertyPageBreakInside,
134     CSSPropertyPointerEvents,
135     CSSPropertyPosition,
136     CSSPropertyResize,
137     CSSPropertyRight,
138     CSSPropertySpeak,
139     CSSPropertyTableLayout,
140     CSSPropertyTextAlign,
141     CSSPropertyTextDecoration,
142     CSSPropertyTextIndent,
143     CSSPropertyTextRendering,
144     CSSPropertyTextShadow,
145     CSSPropertyTextOverflow,
146     CSSPropertyTextTransform,
147     CSSPropertyTop,
148     CSSPropertyUnicodeBidi,
149     CSSPropertyVerticalAlign,
150     CSSPropertyVisibility,
151     CSSPropertyWhiteSpace,
152     CSSPropertyWidows,
153     CSSPropertyWidth,
154     CSSPropertyWordBreak,
155     CSSPropertyWordSpacing,
156     CSSPropertyWordWrap,
157     CSSPropertyZIndex,
158     CSSPropertyZoom,
159
160     CSSPropertyWebkitAnimationDelay,
161     CSSPropertyWebkitAnimationDirection,
162     CSSPropertyWebkitAnimationDuration,
163     CSSPropertyWebkitAnimationFillMode,
164     CSSPropertyWebkitAnimationIterationCount,
165     CSSPropertyWebkitAnimationName,
166     CSSPropertyWebkitAnimationPlayState,
167     CSSPropertyWebkitAnimationTimingFunction,
168     CSSPropertyWebkitAppearance,
169     CSSPropertyWebkitBackfaceVisibility,
170     CSSPropertyWebkitBackgroundClip,
171     CSSPropertyWebkitBackgroundComposite,
172     CSSPropertyWebkitBackgroundOrigin,
173     CSSPropertyWebkitBackgroundSize,
174     CSSPropertyWebkitBorderFit,
175     CSSPropertyWebkitBorderHorizontalSpacing,
176     CSSPropertyWebkitBorderImage,
177     CSSPropertyWebkitBorderVerticalSpacing,
178     CSSPropertyWebkitBoxAlign,
179     CSSPropertyWebkitBoxDirection,
180     CSSPropertyWebkitBoxFlex,
181     CSSPropertyWebkitBoxFlexGroup,
182     CSSPropertyWebkitBoxLines,
183     CSSPropertyWebkitBoxOrdinalGroup,
184     CSSPropertyWebkitBoxOrient,
185     CSSPropertyWebkitBoxPack,
186     CSSPropertyWebkitBoxReflect,
187     CSSPropertyWebkitBoxShadow,
188     CSSPropertyWebkitColorCorrection,
189     CSSPropertyWebkitColumnBreakAfter,
190     CSSPropertyWebkitColumnBreakBefore,
191     CSSPropertyWebkitColumnBreakInside,
192     CSSPropertyWebkitColumnCount,
193     CSSPropertyWebkitColumnGap,
194     CSSPropertyWebkitColumnRuleColor,
195     CSSPropertyWebkitColumnRuleStyle,
196     CSSPropertyWebkitColumnRuleWidth,
197     CSSPropertyWebkitColumnSpan,
198     CSSPropertyWebkitColumnWidth,
199 #if ENABLE(DASHBOARD_SUPPORT)
200     CSSPropertyWebkitDashboardRegion,
201 #endif
202 #if ENABLE(CSS3_FLEXBOX)
203     CSSPropertyWebkitFlexOrder,
204     CSSPropertyWebkitFlexPack,
205     CSSPropertyWebkitFlexAlign,
206     CSSPropertyWebkitFlexFlow,
207 #endif
208     CSSPropertyWebkitFontSmoothing,
209     CSSPropertyWebkitHighlight,
210     CSSPropertyWebkitHyphenateCharacter,
211     CSSPropertyWebkitHyphenateLimitAfter,
212     CSSPropertyWebkitHyphenateLimitBefore,
213     CSSPropertyWebkitHyphens,
214     CSSPropertyWebkitLineBoxContain,
215     CSSPropertyWebkitLineBreak,
216     CSSPropertyWebkitLineClamp,
217     CSSPropertyWebkitLocale,
218     CSSPropertyWebkitMarginBeforeCollapse,
219     CSSPropertyWebkitMarginAfterCollapse,
220     CSSPropertyWebkitMarqueeDirection,
221     CSSPropertyWebkitMarqueeIncrement,
222     CSSPropertyWebkitMarqueeRepetition,
223     CSSPropertyWebkitMarqueeStyle,
224     CSSPropertyWebkitMaskAttachment,
225     CSSPropertyWebkitMaskBoxImage,
226     CSSPropertyWebkitMaskClip,
227     CSSPropertyWebkitMaskComposite,
228     CSSPropertyWebkitMaskImage,
229     CSSPropertyWebkitMaskOrigin,
230     CSSPropertyWebkitMaskPosition,
231     CSSPropertyWebkitMaskRepeat,
232     CSSPropertyWebkitMaskSize,
233     CSSPropertyWebkitNbspMode,
234     CSSPropertyWebkitPerspective,
235     CSSPropertyWebkitPerspectiveOrigin,
236     CSSPropertyWebkitRtlOrdering,
237     CSSPropertyWebkitTextCombine,
238     CSSPropertyWebkitTextDecorationsInEffect,
239     CSSPropertyWebkitTextEmphasisColor,
240     CSSPropertyWebkitTextEmphasisPosition,
241     CSSPropertyWebkitTextEmphasisStyle,
242     CSSPropertyWebkitTextFillColor,
243     CSSPropertyWebkitTextOrientation,
244     CSSPropertyWebkitTextSecurity,
245     CSSPropertyWebkitTextStrokeColor,
246     CSSPropertyWebkitTextStrokeWidth,
247     CSSPropertyWebkitTransform,
248     CSSPropertyWebkitTransformOrigin,
249     CSSPropertyWebkitTransformStyle,
250     CSSPropertyWebkitTransitionDelay,
251     CSSPropertyWebkitTransitionDuration,
252     CSSPropertyWebkitTransitionProperty,
253     CSSPropertyWebkitTransitionTimingFunction,
254     CSSPropertyWebkitUserDrag,
255     CSSPropertyWebkitUserModify,
256     CSSPropertyWebkitUserSelect,
257     CSSPropertyWebkitWritingMode,
258     CSSPropertyWebkitFlow,
259     CSSPropertyWebkitContentOrder,
260     CSSPropertyWebkitRegionOverflow,
261     CSSPropertyWebkitRegionBreakAfter,
262     CSSPropertyWebkitRegionBreakBefore,
263     CSSPropertyWebkitRegionBreakInside
264 #if ENABLE(SVG)
265     ,
266     CSSPropertyClipPath,
267     CSSPropertyClipRule,
268     CSSPropertyMask,
269     CSSPropertyFilter,
270     CSSPropertyFloodColor,
271     CSSPropertyFloodOpacity,
272     CSSPropertyLightingColor,
273     CSSPropertyStopColor,
274     CSSPropertyStopOpacity,
275     CSSPropertyColorInterpolation,
276     CSSPropertyColorInterpolationFilters,
277     CSSPropertyColorRendering,
278     CSSPropertyFill,
279     CSSPropertyFillOpacity,
280     CSSPropertyFillRule,
281     CSSPropertyMarkerEnd,
282     CSSPropertyMarkerMid,
283     CSSPropertyMarkerStart,
284     CSSPropertyShapeRendering,
285     CSSPropertyStroke,
286     CSSPropertyStrokeDasharray,
287     CSSPropertyStrokeDashoffset,
288     CSSPropertyStrokeLinecap,
289     CSSPropertyStrokeLinejoin,
290     CSSPropertyStrokeMiterlimit,
291     CSSPropertyStrokeOpacity,
292     CSSPropertyStrokeWidth,
293     CSSPropertyAlignmentBaseline,
294     CSSPropertyBaselineShift,
295     CSSPropertyDominantBaseline,
296     CSSPropertyKerning,
297     CSSPropertyTextAnchor,
298     CSSPropertyWritingMode,
299     CSSPropertyGlyphOrientationHorizontal,
300     CSSPropertyGlyphOrientationVertical,
301     CSSPropertyWebkitSvgShadow,
302     CSSPropertyVectorEffect
303 #endif
304 };
305
306 const unsigned numComputedProperties = WTF_ARRAY_LENGTH(computedProperties);
307
308 static int valueForRepeatRule(int rule)
309 {
310     switch (rule) {
311         case RepeatImageRule:
312             return CSSValueRepeat;
313         case RoundImageRule:
314             return CSSValueRound;
315         default:
316             return CSSValueStretch;
317     }
318 }
319         
320 static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, CSSPrimitiveValueCache* primitiveValueCache)
321 {
322     if (!image.hasImage())
323         return primitiveValueCache->createIdentifierValue(CSSValueNone);
324     
325     // Image first.
326     RefPtr<CSSValue> imageValue;
327     if (image.image())
328         imageValue = image.image()->cssValue();
329     
330     // Create the slices.
331     RefPtr<CSSPrimitiveValue> top;
332     if (image.slices().top().isPercent())
333         top = primitiveValueCache->createValue(image.slices().top().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
334     else
335         top = primitiveValueCache->createValue(image.slices().top().value(), CSSPrimitiveValue::CSS_NUMBER);
336         
337     RefPtr<CSSPrimitiveValue> right;
338     if (image.slices().right().isPercent())
339         right = primitiveValueCache->createValue(image.slices().right().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
340     else
341         right = primitiveValueCache->createValue(image.slices().right().value(), CSSPrimitiveValue::CSS_NUMBER);
342         
343     RefPtr<CSSPrimitiveValue> bottom;
344     if (image.slices().bottom().isPercent())
345         bottom = primitiveValueCache->createValue(image.slices().bottom().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
346     else
347         bottom = primitiveValueCache->createValue(image.slices().bottom().value(), CSSPrimitiveValue::CSS_NUMBER);
348     
349     RefPtr<CSSPrimitiveValue> left;
350     if (image.slices().left().isPercent())
351         left = primitiveValueCache->createValue(image.slices().left().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
352     else
353         left = primitiveValueCache->createValue(image.slices().left().value(), CSSPrimitiveValue::CSS_NUMBER);
354
355     RefPtr<Rect> rect = Rect::create();
356     rect->setTop(top);
357     rect->setRight(right);
358     rect->setBottom(bottom);
359     rect->setLeft(left);
360
361     return CSSBorderImageValue::create(imageValue, rect, valueForRepeatRule(image.horizontalRule()), valueForRepeatRule(image.verticalRule()));
362 }
363
364 inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(int value, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache)
365 {
366     return primitiveValueCache->createValue(adjustForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX);
367 }
368
369 inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache)
370 {
371     return primitiveValueCache->createValue(value / style->effectiveZoom(), CSSPrimitiveValue::CSS_NUMBER);
372 }
373
374 static PassRefPtr<CSSValue> zoomAdjustedPixelValueForLength(const Length& length, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache)
375 {
376     if (length.isFixed())
377         return zoomAdjustedPixelValue(length.value(), style, primitiveValueCache);
378     return primitiveValueCache->createValue(length);
379 }
380
381 static PassRefPtr<CSSValue> valueForReflection(const StyleReflection* reflection, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache)
382 {
383     if (!reflection)
384         return primitiveValueCache->createIdentifierValue(CSSValueNone);
385
386     RefPtr<CSSPrimitiveValue> offset;
387     if (reflection->offset().isPercent())
388         offset = primitiveValueCache->createValue(reflection->offset().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
389     else
390         offset = zoomAdjustedPixelValue(reflection->offset().value(), style, primitiveValueCache);
391     
392     return CSSReflectValue::create(reflection->direction(), offset.release(), valueForNinePieceImage(reflection->mask(), primitiveValueCache));
393 }
394
395 static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, int propertyID, CSSPrimitiveValueCache* primitiveValueCache)
396 {
397     if (!style)
398         return 0;
399
400     Length l;
401     switch (propertyID) {
402         case CSSPropertyLeft:
403             l = style->left();
404             break;
405         case CSSPropertyRight:
406             l = style->right();
407             break;
408         case CSSPropertyTop:
409             l = style->top();
410             break;
411         case CSSPropertyBottom:
412             l = style->bottom();
413             break;
414         default:
415             return 0;
416     }
417
418     if (style->position() == AbsolutePosition || style->position() == FixedPosition) {
419         if (l.type() == WebCore::Fixed)
420             return zoomAdjustedPixelValue(l.value(), style, primitiveValueCache);
421         return primitiveValueCache->createValue(l);
422     }
423
424     if (style->position() == RelativePosition)
425         // FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined.
426         // In other words if left is auto and right is not auto, then left's computed value is negative right().
427         // So we should get the opposite length unit and see if it is auto.
428         return primitiveValueCache->createValue(l);
429
430     return primitiveValueCache->createIdentifierValue(CSSValueAuto);
431 }
432
433 PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidColor(RenderStyle* style, const Color& color) const
434 {
435     // This function does NOT look at visited information, so that computed style doesn't expose that.
436     CSSPrimitiveValueCache* primitiveValueCache = m_node->document()->cssPrimitiveValueCache().get();
437     if (!color.isValid())
438         return primitiveValueCache->createColorValue(style->color().rgb());
439     return primitiveValueCache->createColorValue(color.rgb());
440 }
441
442 static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache)
443 {
444     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
445     if (radius.width() == radius.height()) {
446         if (radius.width().type() == Percent)
447             return primitiveValueCache->createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
448         return zoomAdjustedPixelValue(radius.width().value(), style, primitiveValueCache);
449     }
450     if (radius.width().type() == Percent)
451         list->append(primitiveValueCache->createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
452     else
453         list->append(zoomAdjustedPixelValue(radius.width().value(), style, primitiveValueCache));
454     if (radius.height().type() == Percent)
455         list->append(primitiveValueCache->createValue(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
456     else
457         list->append(zoomAdjustedPixelValue(radius.height().value(), style, primitiveValueCache));
458     return list.release();
459 }
460
461 static LayoutRect sizingBox(RenderObject* renderer)
462 {
463     if (!renderer->isBox())
464         return LayoutRect();
465     
466     RenderBox* box = toRenderBox(renderer);
467     return box->style()->boxSizing() == CONTENT_BOX ? box->contentBoxRect() : box->borderBoxRect();
468 }
469
470 static inline bool hasCompositedLayer(RenderObject* renderer)
471 {
472     return renderer && renderer->hasLayer() && toRenderBoxModelObject(renderer)->layer()->isComposited();
473 }
474
475 static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache)
476 {
477     if (!renderer || style->transform().operations().isEmpty())
478         return primitiveValueCache->createIdentifierValue(CSSValueNone);
479     
480     IntRect box = sizingBox(renderer);
481
482     TransformationMatrix transform;
483     style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin);
484     // Note that this does not flatten to an affine transform if ENABLE(3D_RENDERING) is off, by design.
485
486     RefPtr<WebKitCSSTransformValue> transformVal;
487
488     // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
489     if (transform.isAffine()) {
490         transformVal = WebKitCSSTransformValue::create(WebKitCSSTransformValue::MatrixTransformOperation);
491
492         transformVal->append(primitiveValueCache->createValue(transform.a(), CSSPrimitiveValue::CSS_NUMBER));
493         transformVal->append(primitiveValueCache->createValue(transform.b(), CSSPrimitiveValue::CSS_NUMBER));
494         transformVal->append(primitiveValueCache->createValue(transform.c(), CSSPrimitiveValue::CSS_NUMBER));
495         transformVal->append(primitiveValueCache->createValue(transform.d(), CSSPrimitiveValue::CSS_NUMBER));
496         transformVal->append(zoomAdjustedNumberValue(transform.e(), style, primitiveValueCache));
497         transformVal->append(zoomAdjustedNumberValue(transform.f(), style, primitiveValueCache));
498     } else {
499         transformVal = WebKitCSSTransformValue::create(WebKitCSSTransformValue::Matrix3DTransformOperation);
500
501         transformVal->append(primitiveValueCache->createValue(transform.m11(), CSSPrimitiveValue::CSS_NUMBER));
502         transformVal->append(primitiveValueCache->createValue(transform.m12(), CSSPrimitiveValue::CSS_NUMBER));
503         transformVal->append(primitiveValueCache->createValue(transform.m13(), CSSPrimitiveValue::CSS_NUMBER));
504         transformVal->append(primitiveValueCache->createValue(transform.m14(), CSSPrimitiveValue::CSS_NUMBER));
505
506         transformVal->append(primitiveValueCache->createValue(transform.m21(), CSSPrimitiveValue::CSS_NUMBER));
507         transformVal->append(primitiveValueCache->createValue(transform.m22(), CSSPrimitiveValue::CSS_NUMBER));
508         transformVal->append(primitiveValueCache->createValue(transform.m23(), CSSPrimitiveValue::CSS_NUMBER));
509         transformVal->append(primitiveValueCache->createValue(transform.m24(), CSSPrimitiveValue::CSS_NUMBER));
510
511         transformVal->append(primitiveValueCache->createValue(transform.m31(), CSSPrimitiveValue::CSS_NUMBER));
512         transformVal->append(primitiveValueCache->createValue(transform.m32(), CSSPrimitiveValue::CSS_NUMBER));
513         transformVal->append(primitiveValueCache->createValue(transform.m33(), CSSPrimitiveValue::CSS_NUMBER));
514         transformVal->append(primitiveValueCache->createValue(transform.m34(), CSSPrimitiveValue::CSS_NUMBER));
515
516         transformVal->append(zoomAdjustedNumberValue(transform.m41(), style, primitiveValueCache));
517         transformVal->append(zoomAdjustedNumberValue(transform.m42(), style, primitiveValueCache));
518         transformVal->append(zoomAdjustedNumberValue(transform.m43(), style, primitiveValueCache));
519         transformVal->append(primitiveValueCache->createValue(transform.m44(), CSSPrimitiveValue::CSS_NUMBER));
520     }
521
522     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
523     list->append(transformVal);
524
525     return list.release();
526 }
527
528 static PassRefPtr<CSSValue> getDelayValue(const AnimationList* animList, CSSPrimitiveValueCache* primitiveValueCache)
529 {
530     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
531     if (animList) {
532         for (size_t i = 0; i < animList->size(); ++i)
533             list->append(primitiveValueCache->createValue(animList->animation(i)->delay(), CSSPrimitiveValue::CSS_S));
534     } else {
535         // Note that initialAnimationDelay() is used for both transitions and animations
536         list->append(primitiveValueCache->createValue(Animation::initialAnimationDelay(), CSSPrimitiveValue::CSS_S));
537     }
538     return list.release();
539 }
540
541 static PassRefPtr<CSSValue> getDurationValue(const AnimationList* animList, CSSPrimitiveValueCache* primitiveValueCache)
542 {
543     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
544     if (animList) {
545         for (size_t i = 0; i < animList->size(); ++i)
546             list->append(primitiveValueCache->createValue(animList->animation(i)->duration(), CSSPrimitiveValue::CSS_S));
547     } else {
548         // Note that initialAnimationDuration() is used for both transitions and animations
549         list->append(primitiveValueCache->createValue(Animation::initialAnimationDuration(), CSSPrimitiveValue::CSS_S));
550     }
551     return list.release();
552 }
553
554 static PassRefPtr<CSSValue> getTimingFunctionValue(const AnimationList* animList)
555 {
556     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
557     if (animList) {
558         for (size_t i = 0; i < animList->size(); ++i) {
559             const TimingFunction* tf = animList->animation(i)->timingFunction().get();
560             if (tf->isCubicBezierTimingFunction()) {
561                 const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(tf);
562                 list->append(CSSCubicBezierTimingFunctionValue::create(ctf->x1(), ctf->y1(), ctf->x2(), ctf->y2()));
563             } else if (tf->isStepsTimingFunction()) {
564                 const StepsTimingFunction* stf = static_cast<const StepsTimingFunction*>(tf);
565                 list->append(CSSStepsTimingFunctionValue::create(stf->numberOfSteps(), stf->stepAtStart()));
566             } else {
567                 list->append(CSSLinearTimingFunctionValue::create());
568             }
569         }
570     } else {
571         // Note that initialAnimationTimingFunction() is used for both transitions and animations
572         RefPtr<TimingFunction> tf = Animation::initialAnimationTimingFunction();
573         if (tf->isCubicBezierTimingFunction()) {
574             const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(tf.get());
575             list->append(CSSCubicBezierTimingFunctionValue::create(ctf->x1(), ctf->y1(), ctf->x2(), ctf->y2()));
576         } else if (tf->isStepsTimingFunction()) {
577             const StepsTimingFunction* stf = static_cast<const StepsTimingFunction*>(tf.get());
578             list->append(CSSStepsTimingFunctionValue::create(stf->numberOfSteps(), stf->stepAtStart()));
579         } else {
580             list->append(CSSLinearTimingFunctionValue::create());
581         }
582     }
583     return list.release();
584 }
585
586 static PassRefPtr<CSSValue> createLineBoxContainValue(CSSPrimitiveValueCache* primitiveValueCache, unsigned lineBoxContain)
587 {
588     if (!lineBoxContain)
589         return primitiveValueCache->createIdentifierValue(CSSValueNone);
590     return CSSLineBoxContainValue::create(lineBoxContain);
591 }
592
593 CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n, bool allowVisitedStyle, const String& pseudoElementName)
594     : m_node(n)
595     , m_allowVisitedStyle(allowVisitedStyle)
596 {
597     unsigned nameWithoutColonsStart = pseudoElementName[0] == ':' ? (pseudoElementName[1] == ':' ? 2 : 1) : 0;
598     m_pseudoElementSpecifier = CSSSelector::pseudoId(CSSSelector::parsePseudoType(
599         AtomicString(pseudoElementName.substring(nameWithoutColonsStart))));
600 }
601
602 CSSComputedStyleDeclaration::~CSSComputedStyleDeclaration()
603 {
604 }
605
606 String CSSComputedStyleDeclaration::cssText() const
607 {
608     String result("");
609
610     for (unsigned i = 0; i < numComputedProperties; i++) {
611         if (i)
612             result += " ";
613         result += getPropertyName(static_cast<CSSPropertyID>(computedProperties[i]));
614         result += ": ";
615         result += getPropertyValue(computedProperties[i]);
616         result += ";";
617     }
618
619     return result;
620 }
621
622 void CSSComputedStyleDeclaration::setCssText(const String&, ExceptionCode& ec)
623 {
624     ec = NO_MODIFICATION_ALLOWED_ERR;
625 }
626
627 static int cssIdentifierForFontSizeKeyword(int keywordSize)
628 {
629     ASSERT_ARG(keywordSize, keywordSize);
630     ASSERT_ARG(keywordSize, keywordSize <= 8);
631     return CSSValueXxSmall + keywordSize - 1;
632 }
633
634 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringKeyword() const
635 {
636     if (!m_node)
637         return 0;
638
639     m_node->document()->updateLayoutIgnorePendingStylesheets();
640
641     RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier);
642     if (!style)
643         return 0;
644     
645     CSSPrimitiveValueCache* primitiveValueCache = m_node->document()->cssPrimitiveValueCache().get();
646
647     if (int keywordSize = style->fontDescription().keywordSize())
648         return primitiveValueCache->createIdentifierValue(cssIdentifierForFontSizeKeyword(keywordSize));
649
650
651     return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style.get(), primitiveValueCache);
652 }
653
654 bool CSSComputedStyleDeclaration::useFixedFontDefaultSize() const
655 {
656     if (!m_node)
657         return false;
658
659     RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier);
660     if (!style)
661         return false;
662
663     return style->fontDescription().useFixedDefaultSize();
664 }
665
666 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, int id, RenderStyle* style) const
667 {
668     CSSPrimitiveValueCache* primitiveValueCache = m_node->document()->cssPrimitiveValueCache().get();
669     if (!shadow)
670         return primitiveValueCache->createIdentifierValue(CSSValueNone);
671
672     CSSPropertyID propertyID = static_cast<CSSPropertyID>(id);
673
674     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
675     for (const ShadowData* s = shadow; s; s = s->next()) {
676         RefPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(s->x(), style, primitiveValueCache);
677         RefPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(s->y(), style, primitiveValueCache);
678         RefPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(s->blur(), style, primitiveValueCache);
679         RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? PassRefPtr<CSSPrimitiveValue>() : zoomAdjustedPixelValue(s->spread(), style, primitiveValueCache);
680         RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || s->style() == Normal ? PassRefPtr<CSSPrimitiveValue>() : primitiveValueCache->createIdentifierValue(CSSValueInset);
681         RefPtr<CSSPrimitiveValue> color = primitiveValueCache->createColorValue(s->color().rgb());
682         list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release()));
683     }
684     return list.release();
685 }
686
687 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int propertyID) const
688 {
689     return getPropertyCSSValue(propertyID, UpdateLayout);
690 }
691
692 static int identifierForFamily(const AtomicString& family)
693 {
694     if (family == cursiveFamily)
695         return CSSValueCursive;
696     if (family == fantasyFamily)
697         return CSSValueFantasy;
698     if (family == monospaceFamily)
699         return CSSValueMonospace;
700     if (family == pictographFamily)
701         return CSSValueWebkitPictograph;
702     if (family == sansSerifFamily)
703         return CSSValueSansSerif;
704     if (family == serifFamily)
705         return CSSValueSerif;
706     return 0;
707 }
708
709 static PassRefPtr<CSSPrimitiveValue> valueForFamily(const AtomicString& family, CSSPrimitiveValueCache* primitiveValueCache)
710 {
711     if (int familyIdentifier = identifierForFamily(family))
712         return primitiveValueCache->createIdentifierValue(familyIdentifier);
713     return primitiveValueCache->createValue(family.string(), CSSPrimitiveValue::CSS_STRING);
714 }
715
716 static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration, CSSPrimitiveValueCache* primitiveValueCache)
717 {
718     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
719     if (textDecoration & UNDERLINE)
720         list->append(primitiveValueCache->createIdentifierValue(CSSValueUnderline));
721     if (textDecoration & OVERLINE)
722         list->append(primitiveValueCache->createIdentifierValue(CSSValueOverline));
723     if (textDecoration & LINE_THROUGH)
724         list->append(primitiveValueCache->createIdentifierValue(CSSValueLineThrough));
725     if (textDecoration & BLINK)
726         list->append(primitiveValueCache->createIdentifierValue(CSSValueBlink));
727
728     if (!list->length())
729         return primitiveValueCache->createIdentifierValue(CSSValueNone);
730     return list;
731 }
732
733 static PassRefPtr<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat, CSSPrimitiveValueCache* primitiveValueCache)
734 {
735     // For backwards compatibility, if both values are equal, just return one of them. And
736     // if the two values are equivalent to repeat-x or repeat-y, just return the shorthand.
737     if (xRepeat == yRepeat)
738         return primitiveValueCache->createValue(xRepeat);
739     if (xRepeat == RepeatFill && yRepeat == NoRepeatFill)
740         return primitiveValueCache->createIdentifierValue(CSSValueRepeatX);
741     if (xRepeat == NoRepeatFill && yRepeat == RepeatFill)
742         return primitiveValueCache->createIdentifierValue(CSSValueRepeatY);
743
744     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
745     list->append(primitiveValueCache->createValue(xRepeat));
746     list->append(primitiveValueCache->createValue(yRepeat));
747     return list.release();
748 }
749
750 static PassRefPtr<CSSValue> fillSizeToCSSValue(const FillSize& fillSize, CSSPrimitiveValueCache* primitiveValueCache)
751 {
752     if (fillSize.type == Contain)
753         return primitiveValueCache->createIdentifierValue(CSSValueContain);
754
755     if (fillSize.type == Cover)
756         return primitiveValueCache->createIdentifierValue(CSSValueCover);
757
758     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
759     list->append(primitiveValueCache->createValue(fillSize.size.width()));
760     list->append(primitiveValueCache->createValue(fillSize.size.height()));
761     return list.release();
762 }
763
764 static PassRefPtr<CSSValue> contentToCSSValue(const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache)
765 {
766     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
767     for (const ContentData* contentData = style->contentData(); contentData; contentData = contentData->next()) {
768         if (contentData->isCounter()) {
769             const CounterContent* counter = static_cast<const CounterContentData*>(contentData)->counter();
770             ASSERT(counter);
771             list->append(primitiveValueCache->createValue(counter->identifier(), CSSPrimitiveValue::CSS_COUNTER_NAME));
772         } else if (contentData->isImage()) {
773             const StyleImage* image = static_cast<const ImageContentData*>(contentData)->image();
774             ASSERT(image);
775             list->append(image->cssValue());
776         } else if (contentData->isText())
777             list->append(primitiveValueCache->createValue(static_cast<const TextContentData*>(contentData)->text(), CSSPrimitiveValue::CSS_STRING));
778     }
779     if (!style->regionThread().isNull())
780         list->append(primitiveValueCache->createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING));
781     return list.release();
782 }
783
784 static PassRefPtr<CSSValue> counterToCSSValue(const RenderStyle* style, int propertyID, CSSPrimitiveValueCache* primitiveValueCache)
785 {
786     const CounterDirectiveMap* map = style->counterDirectives();
787     if (!map)
788         return 0;
789
790     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
791     for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end(); ++it) {
792         list->append(primitiveValueCache->createValue(it->first.get(), CSSPrimitiveValue::CSS_STRING));
793         short number = propertyID == CSSPropertyCounterIncrement ? it->second.m_incrementValue : it->second.m_resetValue;
794         list->append(primitiveValueCache->createValue((double)number, CSSPrimitiveValue::CSS_NUMBER));
795     }
796     return list.release();
797 }
798
799 static void logUnimplementedPropertyID(int propertyID)
800 {
801     DEFINE_STATIC_LOCAL(HashSet<int>, propertyIDSet, ());
802     if (!propertyIDSet.add(propertyID).second)
803         return;
804
805     LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(static_cast<CSSPropertyID>(propertyID)));
806
807
808 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int propertyID, EUpdateLayout updateLayout) const
809 {
810     Node* node = m_node.get();
811     if (!node)
812         return 0;
813
814     // Make sure our layout is up to date before we allow a query on these attributes.
815     if (updateLayout)
816         node->document()->updateLayoutIgnorePendingStylesheets();
817
818     RenderObject* renderer = node->renderer();
819
820     RefPtr<RenderStyle> style;
821     if (renderer && hasCompositedLayer(renderer) && AnimationController::supportsAcceleratedAnimationOfProperty(static_cast<CSSPropertyID>(propertyID))) {
822         style = renderer->animation()->getAnimatedStyleForRenderer(renderer);
823         if (m_pseudoElementSpecifier) {
824             // FIXME: This cached pseudo style will only exist if the animation has been run at least once.
825             style = style->getCachedPseudoStyle(m_pseudoElementSpecifier);
826         }
827     } else
828         style = node->computedStyle(m_pseudoElementSpecifier);
829
830     if (!style)
831         return 0;
832     
833     CSSPrimitiveValueCache* primitiveValueCache = node->document()->cssPrimitiveValueCache().get();
834
835     propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction(), style->writingMode());
836
837     switch (static_cast<CSSPropertyID>(propertyID)) {
838         case CSSPropertyInvalid:
839             break;
840
841         case CSSPropertyBackgroundColor:
842             return primitiveValueCache->createColorValue(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor().rgb());
843         case CSSPropertyBackgroundImage:
844         case CSSPropertyWebkitMaskImage: {
845             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskImage ? style->maskLayers() : style->backgroundLayers();
846             if (!layers)
847                 return primitiveValueCache->createIdentifierValue(CSSValueNone);
848
849             if (!layers->next()) {
850                 if (layers->image())
851                     return layers->image()->cssValue();
852
853                 return primitiveValueCache->createIdentifierValue(CSSValueNone);
854             }
855
856             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
857             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
858                 if (currLayer->image())
859                     list->append(currLayer->image()->cssValue());
860                 else
861                     list->append(primitiveValueCache->createIdentifierValue(CSSValueNone));
862             }
863             return list.release();
864         }
865         case CSSPropertyBackgroundSize:
866         case CSSPropertyWebkitBackgroundSize:
867         case CSSPropertyWebkitMaskSize: {
868             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskSize ? style->maskLayers() : style->backgroundLayers();
869             if (!layers->next())
870                 return fillSizeToCSSValue(layers->size(), primitiveValueCache);
871
872             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
873             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
874                 list->append(fillSizeToCSSValue(currLayer->size(), primitiveValueCache));
875
876             return list.release();
877         }
878         case CSSPropertyBackgroundRepeat:
879         case CSSPropertyWebkitMaskRepeat: {
880             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskRepeat ? style->maskLayers() : style->backgroundLayers();
881             if (!layers->next())
882                 return fillRepeatToCSSValue(layers->repeatX(), layers->repeatY(), primitiveValueCache);
883
884             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
885             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
886                 list->append(fillRepeatToCSSValue(currLayer->repeatX(), currLayer->repeatY(), primitiveValueCache));
887
888             return list.release();
889         }
890         case CSSPropertyWebkitBackgroundComposite:
891         case CSSPropertyWebkitMaskComposite: {
892             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskComposite ? style->maskLayers() : style->backgroundLayers();
893             if (!layers->next())
894                 return primitiveValueCache->createValue(layers->composite());
895
896             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
897             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
898                 list->append(primitiveValueCache->createValue(currLayer->composite()));
899
900             return list.release();
901         }
902         case CSSPropertyBackgroundAttachment:
903         case CSSPropertyWebkitMaskAttachment: {
904             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskAttachment ? style->maskLayers() : style->backgroundLayers();
905             if (!layers->next())
906                 return primitiveValueCache->createValue(layers->attachment());
907
908             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
909             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
910                 list->append(primitiveValueCache->createValue(currLayer->attachment()));
911
912             return list.release();
913         }
914         case CSSPropertyBackgroundClip:
915         case CSSPropertyBackgroundOrigin:
916         case CSSPropertyWebkitBackgroundClip:
917         case CSSPropertyWebkitBackgroundOrigin:
918         case CSSPropertyWebkitMaskClip:
919         case CSSPropertyWebkitMaskOrigin: {
920             const FillLayer* layers = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? style->maskLayers() : style->backgroundLayers();
921             bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == CSSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip;
922             if (!layers->next()) {
923                 EFillBox box = isClip ? layers->clip() : layers->origin();
924                 return primitiveValueCache->createValue(box);
925             }
926             
927             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
928             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
929                 EFillBox box = isClip ? currLayer->clip() : currLayer->origin();
930                 list->append(primitiveValueCache->createValue(box));
931             }
932
933             return list.release();
934         }
935         case CSSPropertyBackgroundPosition:
936         case CSSPropertyWebkitMaskPosition: {
937             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPosition ? style->maskLayers() : style->backgroundLayers();
938             if (!layers->next()) {
939                 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
940                 list->append(primitiveValueCache->createValue(layers->xPosition()));
941                 list->append(primitiveValueCache->createValue(layers->yPosition()));
942                 return list.release();
943             }
944
945             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
946             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
947                 RefPtr<CSSValueList> positionList = CSSValueList::createSpaceSeparated();
948                 positionList->append(primitiveValueCache->createValue(currLayer->xPosition()));
949                 positionList->append(primitiveValueCache->createValue(currLayer->yPosition()));
950                 list->append(positionList);
951             }
952
953             return list.release();
954         }
955         case CSSPropertyBackgroundPositionX:
956         case CSSPropertyWebkitMaskPositionX: {
957             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionX ? style->maskLayers() : style->backgroundLayers();
958             if (!layers->next())
959                 return primitiveValueCache->createValue(layers->xPosition());
960
961             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
962             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
963                 list->append(primitiveValueCache->createValue(currLayer->xPosition()));
964
965             return list.release();
966         }
967         case CSSPropertyBackgroundPositionY:
968         case CSSPropertyWebkitMaskPositionY: {
969             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionY ? style->maskLayers() : style->backgroundLayers();
970             if (!layers->next())
971                 return primitiveValueCache->createValue(layers->yPosition());
972
973             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
974             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
975                 list->append(primitiveValueCache->createValue(currLayer->yPosition()));
976
977             return list.release();
978         }
979         case CSSPropertyBorderCollapse:
980             if (style->borderCollapse())
981                 return primitiveValueCache->createIdentifierValue(CSSValueCollapse);
982             return primitiveValueCache->createIdentifierValue(CSSValueSeparate);
983         case CSSPropertyBorderSpacing: {
984             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
985             list->append(zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get(), primitiveValueCache));
986             list->append(zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get(), primitiveValueCache));
987             return list.release();
988         }  
989         case CSSPropertyWebkitBorderHorizontalSpacing:
990             return zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get(), primitiveValueCache);
991         case CSSPropertyWebkitBorderVerticalSpacing:
992             return zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get(), primitiveValueCache);
993         case CSSPropertyBorderTopColor:
994             return m_allowVisitedStyle ? primitiveValueCache->createColorValue(style->visitedDependentColor(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidColor(style.get(), style->borderTopColor());
995         case CSSPropertyBorderRightColor:
996             return m_allowVisitedStyle ? primitiveValueCache->createColorValue(style->visitedDependentColor(CSSPropertyBorderRightColor).rgb()) : currentColorOrValidColor(style.get(), style->borderRightColor());
997         case CSSPropertyBorderBottomColor:
998             return m_allowVisitedStyle ? primitiveValueCache->createColorValue(style->visitedDependentColor(CSSPropertyBorderBottomColor).rgb()) : currentColorOrValidColor(style.get(), style->borderBottomColor());
999         case CSSPropertyBorderLeftColor:
1000             return m_allowVisitedStyle ? primitiveValueCache->createColorValue(style->visitedDependentColor(CSSPropertyBorderLeftColor).rgb()) : currentColorOrValidColor(style.get(), style->borderLeftColor());
1001         case CSSPropertyBorderTopStyle:
1002             return primitiveValueCache->createValue(style->borderTopStyle());
1003         case CSSPropertyBorderRightStyle:
1004             return primitiveValueCache->createValue(style->borderRightStyle());
1005         case CSSPropertyBorderBottomStyle:
1006             return primitiveValueCache->createValue(style->borderBottomStyle());
1007         case CSSPropertyBorderLeftStyle:
1008             return primitiveValueCache->createValue(style->borderLeftStyle());
1009         case CSSPropertyBorderTopWidth:
1010             return zoomAdjustedPixelValue(style->borderTopWidth(), style.get(), primitiveValueCache);
1011         case CSSPropertyBorderRightWidth:
1012             return zoomAdjustedPixelValue(style->borderRightWidth(), style.get(), primitiveValueCache);
1013         case CSSPropertyBorderBottomWidth:
1014             return zoomAdjustedPixelValue(style->borderBottomWidth(), style.get(), primitiveValueCache);
1015         case CSSPropertyBorderLeftWidth:
1016             return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get(), primitiveValueCache);
1017         case CSSPropertyBottom:
1018             return getPositionOffsetValue(style.get(), CSSPropertyBottom, primitiveValueCache);
1019         case CSSPropertyWebkitBoxAlign:
1020             return primitiveValueCache->createValue(style->boxAlign());
1021         case CSSPropertyWebkitBoxDirection:
1022             return primitiveValueCache->createValue(style->boxDirection());
1023         case CSSPropertyWebkitBoxFlex:
1024             return primitiveValueCache->createValue(style->boxFlex(), CSSPrimitiveValue::CSS_NUMBER);
1025         case CSSPropertyWebkitBoxFlexGroup:
1026             return primitiveValueCache->createValue(style->boxFlexGroup(), CSSPrimitiveValue::CSS_NUMBER);
1027         case CSSPropertyWebkitBoxLines:
1028             return primitiveValueCache->createValue(style->boxLines());
1029         case CSSPropertyWebkitBoxOrdinalGroup:
1030             return primitiveValueCache->createValue(style->boxOrdinalGroup(), CSSPrimitiveValue::CSS_NUMBER);
1031         case CSSPropertyWebkitBoxOrient:
1032             return primitiveValueCache->createValue(style->boxOrient());
1033         case CSSPropertyWebkitBoxPack: {
1034             EBoxAlignment boxPack = style->boxPack();
1035             ASSERT(boxPack != BSTRETCH);
1036             ASSERT(boxPack != BBASELINE);
1037             if (boxPack == BJUSTIFY || boxPack== BBASELINE)
1038                 return 0;
1039             return primitiveValueCache->createValue(boxPack);
1040         }
1041         case CSSPropertyWebkitBoxReflect:
1042             return valueForReflection(style->boxReflect(), style.get(), primitiveValueCache);
1043         case CSSPropertyBoxShadow:
1044         case CSSPropertyWebkitBoxShadow:
1045             return valueForShadow(style->boxShadow(), propertyID, style.get());
1046         case CSSPropertyCaptionSide:
1047             return primitiveValueCache->createValue(style->captionSide());
1048         case CSSPropertyClear:
1049             return primitiveValueCache->createValue(style->clear());
1050         case CSSPropertyColor:
1051             return primitiveValueCache->createColorValue(m_allowVisitedStyle ? style->visitedDependentColor(CSSPropertyColor).rgb() : style->color().rgb());
1052         case CSSPropertyWebkitColumnCount:
1053             if (style->hasAutoColumnCount())
1054                 return primitiveValueCache->createIdentifierValue(CSSValueAuto);
1055             return primitiveValueCache->createValue(style->columnCount(), CSSPrimitiveValue::CSS_NUMBER);
1056         case CSSPropertyWebkitColumnGap:
1057             if (style->hasNormalColumnGap())
1058                 return primitiveValueCache->createIdentifierValue(CSSValueNormal);
1059             return zoomAdjustedPixelValue(style->columnGap(), style.get(), primitiveValueCache);
1060         case CSSPropertyWebkitColumnRuleColor:
1061             return m_allowVisitedStyle ? primitiveValueCache->createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->columnRuleColor());
1062         case CSSPropertyWebkitColumnRuleStyle:
1063             return primitiveValueCache->createValue(style->columnRuleStyle());
1064         case CSSPropertyWebkitColumnRuleWidth:
1065             return zoomAdjustedPixelValue(style->columnRuleWidth(), style.get(), primitiveValueCache);
1066         case CSSPropertyWebkitColumnSpan:
1067             if (style->columnSpan())
1068                 return primitiveValueCache->createIdentifierValue(CSSValueAll);
1069             return primitiveValueCache->createValue(1, CSSPrimitiveValue::CSS_NUMBER);
1070         case CSSPropertyWebkitColumnBreakAfter:
1071             return primitiveValueCache->createValue(style->columnBreakAfter());
1072         case CSSPropertyWebkitColumnBreakBefore:
1073             return primitiveValueCache->createValue(style->columnBreakBefore());
1074         case CSSPropertyWebkitColumnBreakInside:
1075             return primitiveValueCache->createValue(style->columnBreakInside());
1076         case CSSPropertyWebkitColumnWidth:
1077             if (style->hasAutoColumnWidth())
1078                 return primitiveValueCache->createIdentifierValue(CSSValueAuto);
1079             return zoomAdjustedPixelValue(style->columnWidth(), style.get(), primitiveValueCache);
1080         case CSSPropertyWebkitRegionBreakAfter:
1081             return primitiveValueCache->createValue(style->regionBreakAfter());
1082         case CSSPropertyWebkitRegionBreakBefore:
1083             return primitiveValueCache->createValue(style->regionBreakBefore());
1084         case CSSPropertyWebkitRegionBreakInside:
1085             return primitiveValueCache->createValue(style->regionBreakInside());
1086         case CSSPropertyCursor: {
1087             RefPtr<CSSValueList> list;
1088             CursorList* cursors = style->cursors();
1089             if (cursors && cursors->size() > 0) {
1090                 list = CSSValueList::createCommaSeparated();
1091                 for (unsigned i = 0; i < cursors->size(); ++i)
1092                     if (StyleImage* image = cursors->at(i).image())
1093                         list->append(image->cssValue());
1094             }
1095             RefPtr<CSSValue> value = primitiveValueCache->createValue(style->cursor());
1096             if (list) {
1097                 list->append(value);
1098                 return list.release();
1099             }
1100             return value.release();
1101         }
1102         case CSSPropertyDirection:
1103             return primitiveValueCache->createValue(style->direction());
1104         case CSSPropertyDisplay:
1105             return primitiveValueCache->createValue(style->display());
1106         case CSSPropertyEmptyCells:
1107             return primitiveValueCache->createValue(style->emptyCells());
1108 #if ENABLE(CSS3_FLEXBOX)
1109         case CSSPropertyWebkitFlexOrder:
1110             return primitiveValueCache->createValue(style->flexOrder(), CSSPrimitiveValue::CSS_NUMBER);
1111         case CSSPropertyWebkitFlexPack:
1112             return primitiveValueCache->createValue(style->flexPack());
1113         case CSSPropertyWebkitFlexAlign:
1114             return primitiveValueCache->createValue(style->flexAlign());
1115         case CSSPropertyWebkitFlexFlow:
1116             return primitiveValueCache->createValue(style->flexFlow());
1117 #endif
1118         case CSSPropertyFloat:
1119             return primitiveValueCache->createValue(style->floating());
1120         case CSSPropertyFontFamily: {
1121             const FontFamily& firstFamily = style->fontDescription().family();
1122             if (!firstFamily.next())
1123                 return valueForFamily(firstFamily.family(), primitiveValueCache);
1124             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1125             for (const FontFamily* family = &firstFamily; family; family = family->next())
1126                 list->append(valueForFamily(family->family(), primitiveValueCache));
1127             return list.release();
1128         }
1129         case CSSPropertyFontSize:
1130             return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style.get(), primitiveValueCache);
1131         case CSSPropertyFontStyle:
1132             if (style->fontDescription().italic())
1133                 return primitiveValueCache->createIdentifierValue(CSSValueItalic);
1134             return primitiveValueCache->createIdentifierValue(CSSValueNormal);
1135         case CSSPropertyFontVariant:
1136             if (style->fontDescription().smallCaps())
1137                 return primitiveValueCache->createIdentifierValue(CSSValueSmallCaps);
1138             return primitiveValueCache->createIdentifierValue(CSSValueNormal);
1139         case CSSPropertyFontWeight:
1140             switch (style->fontDescription().weight()) {
1141                 case FontWeight100:
1142                     return primitiveValueCache->createIdentifierValue(CSSValue100);
1143                 case FontWeight200:
1144                     return primitiveValueCache->createIdentifierValue(CSSValue200);
1145                 case FontWeight300:
1146                     return primitiveValueCache->createIdentifierValue(CSSValue300);
1147                 case FontWeightNormal:
1148                     return primitiveValueCache->createIdentifierValue(CSSValueNormal);
1149                 case FontWeight500:
1150                     return primitiveValueCache->createIdentifierValue(CSSValue500);
1151                 case FontWeight600:
1152                     return primitiveValueCache->createIdentifierValue(CSSValue600);
1153                 case FontWeightBold:
1154                     return primitiveValueCache->createIdentifierValue(CSSValueBold);
1155                 case FontWeight800:
1156                     return primitiveValueCache->createIdentifierValue(CSSValue800);
1157                 case FontWeight900:
1158                     return primitiveValueCache->createIdentifierValue(CSSValue900);
1159             }
1160             ASSERT_NOT_REACHED();
1161             return primitiveValueCache->createIdentifierValue(CSSValueNormal);
1162         case CSSPropertyWebkitFontFeatureSettings: {
1163             const FontFeatureSettings* featureSettings = style->fontDescription().featureSettings();
1164             if (!featureSettings || !featureSettings->size())
1165                 return primitiveValueCache->createIdentifierValue(CSSValueNormal);
1166             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1167             for (unsigned i = 0; i < featureSettings->size(); ++i) {
1168                 const FontFeature& feature = featureSettings->at(i);
1169                 RefPtr<FontFeatureValue> featureValue = FontFeatureValue::create(feature.tag(), feature.value());
1170                 list->append(featureValue.release());
1171             }
1172             return list.release();
1173         }
1174         case CSSPropertyHeight:
1175             if (renderer)
1176                 return zoomAdjustedPixelValue(sizingBox(renderer).height(), style.get(), primitiveValueCache);
1177             return zoomAdjustedPixelValueForLength(style->height(), style.get(), primitiveValueCache);
1178         case CSSPropertyWebkitHighlight:
1179             if (style->highlight() == nullAtom)
1180                 return primitiveValueCache->createIdentifierValue(CSSValueNone);
1181             return primitiveValueCache->createValue(style->highlight(), CSSPrimitiveValue::CSS_STRING);
1182         case CSSPropertyWebkitHyphens:
1183             return primitiveValueCache->createValue(style->hyphens());
1184         case CSSPropertyWebkitHyphenateCharacter:
1185             if (style->hyphenationString().isNull())
1186                 return primitiveValueCache->createIdentifierValue(CSSValueAuto);
1187             return primitiveValueCache->createValue(style->hyphenationString(), CSSPrimitiveValue::CSS_STRING);
1188         case CSSPropertyWebkitHyphenateLimitAfter:
1189             if (style->hyphenationLimitAfter() < 0)
1190                 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
1191             return CSSPrimitiveValue::create(style->hyphenationLimitAfter(), CSSPrimitiveValue::CSS_NUMBER);
1192         case CSSPropertyWebkitHyphenateLimitBefore:
1193             if (style->hyphenationLimitBefore() < 0)
1194                 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
1195             return CSSPrimitiveValue::create(style->hyphenationLimitBefore(), CSSPrimitiveValue::CSS_NUMBER);
1196         case CSSPropertyWebkitBorderFit:
1197             if (style->borderFit() == BorderFitBorder)
1198                 return primitiveValueCache->createIdentifierValue(CSSValueBorder);
1199             return primitiveValueCache->createIdentifierValue(CSSValueLines);
1200         case CSSPropertyImageRendering:
1201             return CSSPrimitiveValue::create(style->imageRendering());
1202         case CSSPropertyLeft:
1203             return getPositionOffsetValue(style.get(), CSSPropertyLeft, primitiveValueCache);
1204         case CSSPropertyLetterSpacing:
1205             if (!style->letterSpacing())
1206                 return primitiveValueCache->createIdentifierValue(CSSValueNormal);
1207             return zoomAdjustedPixelValue(style->letterSpacing(), style.get(), primitiveValueCache);
1208         case CSSPropertyWebkitLineClamp:
1209             if (style->lineClamp().isNone())
1210                 return primitiveValueCache->createIdentifierValue(CSSValueNone);
1211             return primitiveValueCache->createValue(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER);
1212         case CSSPropertyLineHeight: {
1213             Length length = style->lineHeight();
1214             if (length.isNegative())
1215                 return primitiveValueCache->createIdentifierValue(CSSValueNormal);
1216             if (length.isPercent())
1217                 // This is imperfect, because it doesn't include the zoom factor and the real computation
1218                 // for how high to be in pixels does include things like minimum font size and the zoom factor.
1219                 // On the other hand, since font-size doesn't include the zoom factor, we really can't do
1220                 // that here either.
1221                 return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style.get(), primitiveValueCache);
1222             return zoomAdjustedPixelValue(length.value(), style.get(), primitiveValueCache);
1223         }
1224         case CSSPropertyListStyleImage:
1225             if (style->listStyleImage())
1226                 return style->listStyleImage()->cssValue();
1227             return primitiveValueCache->createIdentifierValue(CSSValueNone);
1228         case CSSPropertyListStylePosition:
1229             return primitiveValueCache->createValue(style->listStylePosition());
1230         case CSSPropertyListStyleType:
1231             return primitiveValueCache->createValue(style->listStyleType());
1232         case CSSPropertyWebkitLocale:
1233             if (style->locale().isNull())
1234                 return primitiveValueCache->createIdentifierValue(CSSValueAuto);
1235             return primitiveValueCache->createValue(style->locale(), CSSPrimitiveValue::CSS_STRING);
1236         case CSSPropertyMarginTop: {
1237             Length marginTop = style->marginTop();
1238             if (marginTop.isPercent())
1239                 return primitiveValueCache->createValue(marginTop);
1240             return zoomAdjustedPixelValue(marginTop.value(), style.get(), primitiveValueCache);
1241         }
1242         case CSSPropertyMarginRight: {
1243             Length marginRight = style->marginRight();
1244             if (marginRight.isPercent())
1245                 return primitiveValueCache->createValue(marginRight);
1246             return zoomAdjustedPixelValue(marginRight.value(), style.get(), primitiveValueCache);
1247         }
1248         case CSSPropertyMarginBottom: {
1249             Length marginBottom = style->marginBottom();
1250             if (marginBottom.isPercent())
1251                 return primitiveValueCache->createValue(marginBottom);
1252             return zoomAdjustedPixelValue(marginBottom.value(), style.get(), primitiveValueCache);
1253         }
1254         case CSSPropertyMarginLeft: {
1255             Length marginLeft = style->marginLeft();
1256             if (marginLeft.isPercent())
1257                 return primitiveValueCache->createValue(marginLeft);
1258             return zoomAdjustedPixelValue(marginLeft.value(), style.get(), primitiveValueCache);
1259         }
1260         case CSSPropertyWebkitMarqueeDirection:
1261             return primitiveValueCache->createValue(style->marqueeDirection());
1262         case CSSPropertyWebkitMarqueeIncrement:
1263             return primitiveValueCache->createValue(style->marqueeIncrement());
1264         case CSSPropertyWebkitMarqueeRepetition:
1265             if (style->marqueeLoopCount() < 0)
1266                 return primitiveValueCache->createIdentifierValue(CSSValueInfinite);
1267             return primitiveValueCache->createValue(style->marqueeLoopCount(), CSSPrimitiveValue::CSS_NUMBER);
1268         case CSSPropertyWebkitMarqueeStyle:
1269             return primitiveValueCache->createValue(style->marqueeBehavior());
1270         case CSSPropertyWebkitUserModify:
1271             return primitiveValueCache->createValue(style->userModify());
1272         case CSSPropertyMaxHeight: {
1273             const Length& maxHeight = style->maxHeight();
1274             if (maxHeight.isFixed() && maxHeight.value() == undefinedLength)
1275                 return primitiveValueCache->createIdentifierValue(CSSValueNone);
1276             return primitiveValueCache->createValue(maxHeight);
1277         }
1278         case CSSPropertyMaxWidth: {
1279             const Length& maxWidth = style->maxWidth();
1280             if (maxWidth.isFixed() && maxWidth.value() == undefinedLength)
1281                 return primitiveValueCache->createIdentifierValue(CSSValueNone);
1282             return primitiveValueCache->createValue(maxWidth);
1283         }
1284         case CSSPropertyMinHeight:
1285             return primitiveValueCache->createValue(style->minHeight());
1286         case CSSPropertyMinWidth:
1287             return primitiveValueCache->createValue(style->minWidth());
1288         case CSSPropertyOpacity:
1289             return primitiveValueCache->createValue(style->opacity(), CSSPrimitiveValue::CSS_NUMBER);
1290         case CSSPropertyOrphans:
1291             return primitiveValueCache->createValue(style->orphans(), CSSPrimitiveValue::CSS_NUMBER);
1292         case CSSPropertyOutlineColor:
1293             return m_allowVisitedStyle ? primitiveValueCache->createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->outlineColor());
1294         case CSSPropertyOutlineOffset:
1295             return zoomAdjustedPixelValue(style->outlineOffset(), style.get(), primitiveValueCache);
1296         case CSSPropertyOutlineStyle:
1297             if (style->outlineStyleIsAuto())
1298                 return primitiveValueCache->createIdentifierValue(CSSValueAuto);
1299             return primitiveValueCache->createValue(style->outlineStyle());
1300         case CSSPropertyOutlineWidth:
1301             return zoomAdjustedPixelValue(style->outlineWidth(), style.get(), primitiveValueCache);
1302         case CSSPropertyOverflow:
1303             return primitiveValueCache->createValue(max(style->overflowX(), style->overflowY()));
1304         case CSSPropertyOverflowX:
1305             return primitiveValueCache->createValue(style->overflowX());
1306         case CSSPropertyOverflowY:
1307             return primitiveValueCache->createValue(style->overflowY());
1308         case CSSPropertyPaddingTop:
1309             if (renderer && renderer->isBox())
1310                 return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingTop(false), style.get(), primitiveValueCache);
1311             return primitiveValueCache->createValue(style->paddingTop());
1312         case CSSPropertyPaddingRight:
1313             if (renderer && renderer->isBox())
1314                 return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingRight(false), style.get(), primitiveValueCache);
1315             return primitiveValueCache->createValue(style->paddingRight());
1316         case CSSPropertyPaddingBottom:
1317             if (renderer && renderer->isBox())
1318                 return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingBottom(false), style.get(), primitiveValueCache);
1319             return primitiveValueCache->createValue(style->paddingBottom());
1320         case CSSPropertyPaddingLeft:
1321             if (renderer && renderer->isBox())
1322                 return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingLeft(false), style.get(), primitiveValueCache);
1323             return primitiveValueCache->createValue(style->paddingLeft());
1324         case CSSPropertyPageBreakAfter:
1325             return primitiveValueCache->createValue(style->pageBreakAfter());
1326         case CSSPropertyPageBreakBefore:
1327             return primitiveValueCache->createValue(style->pageBreakBefore());
1328         case CSSPropertyPageBreakInside: {
1329             EPageBreak pageBreak = style->pageBreakInside();
1330             ASSERT(pageBreak != PBALWAYS);
1331             if (pageBreak == PBALWAYS)
1332                 return 0;
1333             return primitiveValueCache->createValue(style->pageBreakInside());
1334         }
1335         case CSSPropertyPosition:
1336             return primitiveValueCache->createValue(style->position());
1337         case CSSPropertyRight:
1338             return getPositionOffsetValue(style.get(), CSSPropertyRight, primitiveValueCache);
1339         case CSSPropertyTableLayout:
1340             return primitiveValueCache->createValue(style->tableLayout());
1341         case CSSPropertyTextAlign:
1342             return primitiveValueCache->createValue(style->textAlign());
1343         case CSSPropertyTextDecoration:
1344             return renderTextDecorationFlagsToCSSValue(style->textDecoration(), primitiveValueCache);
1345         case CSSPropertyWebkitTextDecorationsInEffect:
1346             return renderTextDecorationFlagsToCSSValue(style->textDecorationsInEffect(), primitiveValueCache);
1347         case CSSPropertyWebkitTextFillColor:
1348             return currentColorOrValidColor(style.get(), style->textFillColor());
1349         case CSSPropertyWebkitTextEmphasisColor:
1350             return currentColorOrValidColor(style.get(), style->textEmphasisColor());
1351         case CSSPropertyWebkitTextEmphasisPosition:
1352             return primitiveValueCache->createValue(style->textEmphasisPosition());
1353         case CSSPropertyWebkitTextEmphasisStyle:
1354             switch (style->textEmphasisMark()) {
1355             case TextEmphasisMarkNone:
1356                 return primitiveValueCache->createIdentifierValue(CSSValueNone);
1357             case TextEmphasisMarkCustom:
1358                 return primitiveValueCache->createValue(style->textEmphasisCustomMark(), CSSPrimitiveValue::CSS_STRING);
1359             case TextEmphasisMarkAuto:
1360                 ASSERT_NOT_REACHED();
1361                 // Fall through
1362             case TextEmphasisMarkDot:
1363             case TextEmphasisMarkCircle:
1364             case TextEmphasisMarkDoubleCircle:
1365             case TextEmphasisMarkTriangle:
1366             case TextEmphasisMarkSesame: {
1367                 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1368                 list->append(primitiveValueCache->createValue(style->textEmphasisFill()));
1369                 list->append(primitiveValueCache->createValue(style->textEmphasisMark()));
1370                 return list.release();
1371             }
1372             }
1373         case CSSPropertyTextIndent:
1374             return primitiveValueCache->createValue(style->textIndent());
1375         case CSSPropertyTextShadow:
1376             return valueForShadow(style->textShadow(), propertyID, style.get());
1377         case CSSPropertyTextRendering:
1378             return primitiveValueCache->createValue(style->fontDescription().textRenderingMode());
1379         case CSSPropertyTextOverflow:
1380             if (style->textOverflow())
1381                 return primitiveValueCache->createIdentifierValue(CSSValueEllipsis);
1382             return primitiveValueCache->createIdentifierValue(CSSValueClip);
1383         case CSSPropertyWebkitTextSecurity:
1384             return primitiveValueCache->createValue(style->textSecurity());
1385         case CSSPropertyWebkitTextSizeAdjust:
1386             if (style->textSizeAdjust())
1387                 return primitiveValueCache->createIdentifierValue(CSSValueAuto);
1388             return primitiveValueCache->createIdentifierValue(CSSValueNone);
1389         case CSSPropertyWebkitTextStrokeColor:
1390             return currentColorOrValidColor(style.get(), style->textStrokeColor());
1391         case CSSPropertyWebkitTextStrokeWidth:
1392             return zoomAdjustedPixelValue(style->textStrokeWidth(), style.get(), primitiveValueCache);
1393         case CSSPropertyTextTransform:
1394             return primitiveValueCache->createValue(style->textTransform());
1395         case CSSPropertyTop:
1396             return getPositionOffsetValue(style.get(), CSSPropertyTop, primitiveValueCache);
1397         case CSSPropertyUnicodeBidi:
1398             return primitiveValueCache->createValue(style->unicodeBidi());
1399         case CSSPropertyVerticalAlign:
1400             switch (style->verticalAlign()) {
1401                 case BASELINE:
1402                     return primitiveValueCache->createIdentifierValue(CSSValueBaseline);
1403                 case MIDDLE:
1404                     return primitiveValueCache->createIdentifierValue(CSSValueMiddle);
1405                 case SUB:
1406                     return primitiveValueCache->createIdentifierValue(CSSValueSub);
1407                 case SUPER:
1408                     return primitiveValueCache->createIdentifierValue(CSSValueSuper);
1409                 case TEXT_TOP:
1410                     return primitiveValueCache->createIdentifierValue(CSSValueTextTop);
1411                 case TEXT_BOTTOM:
1412                     return primitiveValueCache->createIdentifierValue(CSSValueTextBottom);
1413                 case TOP:
1414                     return primitiveValueCache->createIdentifierValue(CSSValueTop);
1415                 case BOTTOM:
1416                     return primitiveValueCache->createIdentifierValue(CSSValueBottom);
1417                 case BASELINE_MIDDLE:
1418                     return primitiveValueCache->createIdentifierValue(CSSValueWebkitBaselineMiddle);
1419                 case LENGTH:
1420                     return primitiveValueCache->createValue(style->verticalAlignLength());
1421             }
1422             ASSERT_NOT_REACHED();
1423             return 0;
1424         case CSSPropertyVisibility:
1425             return primitiveValueCache->createValue(style->visibility());
1426         case CSSPropertyWhiteSpace:
1427             return primitiveValueCache->createValue(style->whiteSpace());
1428         case CSSPropertyWidows:
1429             return primitiveValueCache->createValue(style->widows(), CSSPrimitiveValue::CSS_NUMBER);
1430         case CSSPropertyWidth:
1431             if (renderer)
1432                 return zoomAdjustedPixelValue(sizingBox(renderer).width(), style.get(), primitiveValueCache);
1433             return zoomAdjustedPixelValueForLength(style->width(), style.get(), primitiveValueCache);
1434         case CSSPropertyWordBreak:
1435             return primitiveValueCache->createValue(style->wordBreak());
1436         case CSSPropertyWordSpacing:
1437             return zoomAdjustedPixelValue(style->wordSpacing(), style.get(), primitiveValueCache);
1438         case CSSPropertyWordWrap:
1439             return primitiveValueCache->createValue(style->wordWrap());
1440         case CSSPropertyWebkitLineBreak:
1441             return primitiveValueCache->createValue(style->khtmlLineBreak());
1442         case CSSPropertyWebkitNbspMode:
1443             return primitiveValueCache->createValue(style->nbspMode());
1444         case CSSPropertyWebkitMatchNearestMailBlockquoteColor:
1445             return primitiveValueCache->createValue(style->matchNearestMailBlockquoteColor());
1446         case CSSPropertyResize:
1447             return primitiveValueCache->createValue(style->resize());
1448         case CSSPropertyWebkitFontSmoothing:
1449             return primitiveValueCache->createValue(style->fontDescription().fontSmoothing());
1450         case CSSPropertyZIndex:
1451             if (style->hasAutoZIndex())
1452                 return primitiveValueCache->createIdentifierValue(CSSValueAuto);
1453             return primitiveValueCache->createValue(style->zIndex(), CSSPrimitiveValue::CSS_NUMBER);
1454         case CSSPropertyZoom:
1455             return primitiveValueCache->createValue(style->zoom(), CSSPrimitiveValue::CSS_NUMBER);
1456         case CSSPropertyBoxSizing:
1457             if (style->boxSizing() == CONTENT_BOX)
1458                 return primitiveValueCache->createIdentifierValue(CSSValueContentBox);
1459             return primitiveValueCache->createIdentifierValue(CSSValueBorderBox);
1460 #if ENABLE(DASHBOARD_SUPPORT)
1461         case CSSPropertyWebkitDashboardRegion:
1462         {
1463             const Vector<StyleDashboardRegion>& regions = style->dashboardRegions();
1464             unsigned count = regions.size();
1465             if (count == 1 && regions[0].type == StyleDashboardRegion::None)
1466                 return primitiveValueCache->createIdentifierValue(CSSValueNone);
1467
1468             RefPtr<DashboardRegion> firstRegion;
1469             DashboardRegion* previousRegion = 0;
1470             for (unsigned i = 0; i < count; i++) {
1471                 RefPtr<DashboardRegion> region = DashboardRegion::create();
1472                 StyleDashboardRegion styleRegion = regions[i];
1473
1474                 region->m_label = styleRegion.label;
1475                 LengthBox offset = styleRegion.offset;
1476                 region->setTop(zoomAdjustedPixelValue(offset.top().value(), style.get(), primitiveValueCache));
1477                 region->setRight(zoomAdjustedPixelValue(offset.right().value(), style.get(), primitiveValueCache));
1478                 region->setBottom(zoomAdjustedPixelValue(offset.bottom().value(), style.get(), primitiveValueCache));
1479                 region->setLeft(zoomAdjustedPixelValue(offset.left().value(), style.get(), primitiveValueCache));
1480                 region->m_isRectangle = (styleRegion.type == StyleDashboardRegion::Rectangle);
1481                 region->m_isCircle = (styleRegion.type == StyleDashboardRegion::Circle);
1482
1483                 if (previousRegion)
1484                     previousRegion->m_next = region;
1485                 else
1486                     firstRegion = region;
1487                 previousRegion = region.get();
1488             }
1489             return primitiveValueCache->createValue(firstRegion.release());
1490         }
1491 #endif
1492         case CSSPropertyWebkitAnimationDelay:
1493             return getDelayValue(style->animations(), primitiveValueCache);
1494         case CSSPropertyWebkitAnimationDirection: {
1495             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1496             const AnimationList* t = style->animations();
1497             if (t) {
1498                 for (size_t i = 0; i < t->size(); ++i) {
1499                     if (t->animation(i)->direction())
1500                         list->append(primitiveValueCache->createIdentifierValue(CSSValueAlternate));
1501                     else
1502                         list->append(primitiveValueCache->createIdentifierValue(CSSValueNormal));
1503                 }
1504             } else
1505                 list->append(primitiveValueCache->createIdentifierValue(CSSValueNormal));
1506             return list.release();
1507         }
1508         case CSSPropertyWebkitAnimationDuration:
1509             return getDurationValue(style->animations(), primitiveValueCache);
1510         case CSSPropertyWebkitAnimationFillMode: {
1511             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1512             const AnimationList* t = style->animations();
1513             if (t) {
1514                 for (size_t i = 0; i < t->size(); ++i) {
1515                     switch (t->animation(i)->fillMode()) {
1516                     case AnimationFillModeNone:
1517                         list->append(primitiveValueCache->createIdentifierValue(CSSValueNone));
1518                         break;
1519                     case AnimationFillModeForwards:
1520                         list->append(primitiveValueCache->createIdentifierValue(CSSValueForwards));
1521                         break;
1522                     case AnimationFillModeBackwards:
1523                         list->append(primitiveValueCache->createIdentifierValue(CSSValueBackwards));
1524                         break;
1525                     case AnimationFillModeBoth:
1526                         list->append(primitiveValueCache->createIdentifierValue(CSSValueBoth));
1527                         break;
1528                     }
1529                 }
1530             } else
1531                 list->append(primitiveValueCache->createIdentifierValue(CSSValueNone));
1532             return list.release();
1533         }
1534         case CSSPropertyWebkitAnimationIterationCount: {
1535             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1536             const AnimationList* t = style->animations();
1537             if (t) {
1538                 for (size_t i = 0; i < t->size(); ++i) {
1539                     int iterationCount = t->animation(i)->iterationCount();
1540                     if (iterationCount == Animation::IterationCountInfinite)
1541                         list->append(primitiveValueCache->createIdentifierValue(CSSValueInfinite));
1542                     else
1543                         list->append(primitiveValueCache->createValue(iterationCount, CSSPrimitiveValue::CSS_NUMBER));
1544                 }
1545             } else
1546                 list->append(primitiveValueCache->createValue(Animation::initialAnimationIterationCount(), CSSPrimitiveValue::CSS_NUMBER));
1547             return list.release();
1548         }
1549         case CSSPropertyWebkitAnimationName: {
1550             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1551             const AnimationList* t = style->animations();
1552             if (t) {
1553                 for (size_t i = 0; i < t->size(); ++i)
1554                     list->append(primitiveValueCache->createValue(t->animation(i)->name(), CSSPrimitiveValue::CSS_STRING));
1555             } else
1556                 list->append(primitiveValueCache->createIdentifierValue(CSSValueNone));
1557             return list.release();
1558         }
1559         case CSSPropertyWebkitAnimationPlayState: {
1560             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1561             const AnimationList* t = style->animations();
1562             if (t) {
1563                 for (size_t i = 0; i < t->size(); ++i) {
1564                     int prop = t->animation(i)->playState();
1565                     if (prop == AnimPlayStatePlaying)
1566                         list->append(primitiveValueCache->createIdentifierValue(CSSValueRunning));
1567                     else
1568                         list->append(primitiveValueCache->createIdentifierValue(CSSValuePaused));
1569                 }
1570             } else
1571                 list->append(primitiveValueCache->createIdentifierValue(CSSValueRunning));
1572             return list.release();
1573         }
1574         case CSSPropertyWebkitAnimationTimingFunction:
1575             return getTimingFunctionValue(style->animations());
1576         case CSSPropertyWebkitAppearance:
1577             return primitiveValueCache->createValue(style->appearance());
1578         case CSSPropertyWebkitBackfaceVisibility:
1579             return primitiveValueCache->createIdentifierValue((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
1580         case CSSPropertyWebkitBorderImage:
1581             return valueForNinePieceImage(style->borderImage(), primitiveValueCache);
1582         case CSSPropertyWebkitMaskBoxImage:
1583             return valueForNinePieceImage(style->maskBoxImage(), primitiveValueCache);
1584         case CSSPropertyWebkitFontSizeDelta:
1585             // Not a real style property -- used by the editing engine -- so has no computed value.
1586             break;
1587         case CSSPropertyWebkitMarginBottomCollapse:
1588         case CSSPropertyWebkitMarginAfterCollapse:
1589             return primitiveValueCache->createValue(style->marginAfterCollapse());
1590         case CSSPropertyWebkitMarginTopCollapse:
1591         case CSSPropertyWebkitMarginBeforeCollapse:
1592             return primitiveValueCache->createValue(style->marginBeforeCollapse());
1593         case CSSPropertyWebkitPerspective:
1594             if (!style->hasPerspective())
1595                 return primitiveValueCache->createIdentifierValue(CSSValueNone);
1596             return zoomAdjustedPixelValue(style->perspective(), style.get(), primitiveValueCache);
1597         case CSSPropertyWebkitPerspectiveOrigin: {
1598             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1599             if (renderer) {
1600                 IntRect box = sizingBox(renderer);
1601                 list->append(zoomAdjustedPixelValue(style->perspectiveOriginX().calcMinValue(box.width()), style.get(), primitiveValueCache));
1602                 list->append(zoomAdjustedPixelValue(style->perspectiveOriginY().calcMinValue(box.height()), style.get(), primitiveValueCache));
1603             }
1604             else {
1605                 list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginX(), style.get(), primitiveValueCache));
1606                 list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginY(), style.get(), primitiveValueCache));
1607                 
1608             }
1609             return list.release();
1610         }
1611         case CSSPropertyWebkitRtlOrdering:
1612             return primitiveValueCache->createIdentifierValue(style->rtlOrdering() ? CSSValueVisual : CSSValueLogical);
1613         case CSSPropertyWebkitUserDrag:
1614             return primitiveValueCache->createValue(style->userDrag());
1615         case CSSPropertyWebkitUserSelect:
1616             return primitiveValueCache->createValue(style->userSelect());
1617         case CSSPropertyBorderBottomLeftRadius:
1618             return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get(), primitiveValueCache);
1619         case CSSPropertyBorderBottomRightRadius:
1620             return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get(), primitiveValueCache);
1621         case CSSPropertyBorderTopLeftRadius:
1622             return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get(), primitiveValueCache);
1623         case CSSPropertyBorderTopRightRadius:
1624             return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get(), primitiveValueCache);
1625         case CSSPropertyClip: {
1626             if (!style->hasClip())
1627                 return primitiveValueCache->createIdentifierValue(CSSValueAuto);
1628             RefPtr<Rect> rect = Rect::create();
1629             rect->setTop(zoomAdjustedPixelValue(style->clip().top().value(), style.get(), primitiveValueCache));
1630             rect->setRight(zoomAdjustedPixelValue(style->clip().right().value(), style.get(), primitiveValueCache));
1631             rect->setBottom(zoomAdjustedPixelValue(style->clip().bottom().value(), style.get(), primitiveValueCache));
1632             rect->setLeft(zoomAdjustedPixelValue(style->clip().left().value(), style.get(), primitiveValueCache));
1633             return primitiveValueCache->createValue(rect.release());
1634         }
1635         case CSSPropertySpeak:
1636             return primitiveValueCache->createValue(style->speak());
1637         case CSSPropertyWebkitTransform:
1638             return computedTransform(renderer, style.get(), primitiveValueCache);
1639         case CSSPropertyWebkitTransformOrigin: {
1640             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1641             if (renderer) {
1642                 IntRect box = sizingBox(renderer);
1643                 list->append(zoomAdjustedPixelValue(style->transformOriginX().calcMinValue(box.width()), style.get(), primitiveValueCache));
1644                 list->append(zoomAdjustedPixelValue(style->transformOriginY().calcMinValue(box.height()), style.get(), primitiveValueCache));
1645                 if (style->transformOriginZ() != 0)
1646                     list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get(), primitiveValueCache));
1647             } else {
1648                 list->append(zoomAdjustedPixelValueForLength(style->transformOriginX(), style.get(), primitiveValueCache));
1649                 list->append(zoomAdjustedPixelValueForLength(style->transformOriginY(), style.get(), primitiveValueCache));
1650                 if (style->transformOriginZ() != 0)
1651                     list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get(), primitiveValueCache));
1652             }
1653             return list.release();
1654         }
1655         case CSSPropertyWebkitTransformStyle:
1656             return primitiveValueCache->createIdentifierValue((style->transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat);
1657         case CSSPropertyWebkitTransitionDelay:
1658             return getDelayValue(style->transitions(), primitiveValueCache);
1659         case CSSPropertyWebkitTransitionDuration:
1660             return getDurationValue(style->transitions(), primitiveValueCache);
1661         case CSSPropertyWebkitTransitionProperty: {
1662             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1663             const AnimationList* t = style->transitions();
1664             if (t) {
1665                 for (size_t i = 0; i < t->size(); ++i) {
1666                     int prop = t->animation(i)->property();
1667                     RefPtr<CSSValue> propertyValue;
1668                     if (prop == cAnimateNone)
1669                         propertyValue = primitiveValueCache->createIdentifierValue(CSSValueNone);
1670                     else if (prop == cAnimateAll)
1671                         propertyValue = primitiveValueCache->createIdentifierValue(CSSValueAll);
1672                     else
1673                         propertyValue = primitiveValueCache->createValue(getPropertyName(static_cast<CSSPropertyID>(prop)), CSSPrimitiveValue::CSS_STRING);
1674                     list->append(propertyValue);
1675                 }
1676             } else
1677                 list->append(primitiveValueCache->createIdentifierValue(CSSValueAll));
1678             return list.release();
1679         }
1680         case CSSPropertyWebkitTransitionTimingFunction:
1681             return getTimingFunctionValue(style->transitions());
1682         case CSSPropertyPointerEvents:
1683             return primitiveValueCache->createValue(style->pointerEvents());
1684         case CSSPropertyWebkitColorCorrection:
1685             return primitiveValueCache->createValue(style->colorSpace());
1686         case CSSPropertyWebkitWritingMode:
1687             return primitiveValueCache->createValue(style->writingMode());
1688         case CSSPropertyWebkitTextCombine:
1689             return primitiveValueCache->createValue(style->textCombine());
1690         case CSSPropertyWebkitTextOrientation:
1691             return CSSPrimitiveValue::create(style->fontDescription().textOrientation());
1692         case CSSPropertyWebkitLineBoxContain:
1693             return createLineBoxContainValue(primitiveValueCache, style->lineBoxContain());
1694         case CSSPropertyContent:
1695             return contentToCSSValue(style.get(), primitiveValueCache);
1696         case CSSPropertyCounterIncrement:
1697             return counterToCSSValue(style.get(), propertyID, primitiveValueCache);
1698         case CSSPropertyCounterReset:
1699             return counterToCSSValue(style.get(), propertyID, primitiveValueCache);
1700         case CSSPropertyWebkitFlow:
1701             if (style->flowThread().isNull())
1702                 return primitiveValueCache->createIdentifierValue(CSSValueAuto);
1703             return primitiveValueCache->createValue(style->flowThread(), CSSPrimitiveValue::CSS_STRING);
1704         case CSSPropertyWebkitContentOrder:
1705             return primitiveValueCache->createValue(style->regionIndex(), CSSPrimitiveValue::CSS_NUMBER);
1706         case CSSPropertyWebkitRegionOverflow:
1707             return primitiveValueCache->createValue(style->regionOverflow());
1708
1709         /* Shorthand properties, currently not supported see bug 13658*/
1710         case CSSPropertyBackground:
1711         case CSSPropertyBorder:
1712         case CSSPropertyBorderBottom:
1713         case CSSPropertyBorderColor:
1714         case CSSPropertyBorderLeft:
1715         case CSSPropertyBorderRadius:
1716         case CSSPropertyBorderRight:
1717         case CSSPropertyBorderStyle:
1718         case CSSPropertyBorderTop:
1719         case CSSPropertyBorderWidth:
1720         case CSSPropertyFont:
1721         case CSSPropertyListStyle:
1722         case CSSPropertyMargin:
1723         case CSSPropertyOutline:
1724         case CSSPropertyPadding:
1725             break;
1726
1727         /* Individual properties not part of the spec */
1728         case CSSPropertyBackgroundRepeatX:
1729         case CSSPropertyBackgroundRepeatY:
1730             break;
1731
1732         /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
1733         case CSSPropertyWebkitTextEmphasis:
1734         case CSSPropertyTextLineThrough:
1735         case CSSPropertyTextLineThroughColor:
1736         case CSSPropertyTextLineThroughMode:
1737         case CSSPropertyTextLineThroughStyle:
1738         case CSSPropertyTextLineThroughWidth:
1739         case CSSPropertyTextOverline:
1740         case CSSPropertyTextOverlineColor:
1741         case CSSPropertyTextOverlineMode:
1742         case CSSPropertyTextOverlineStyle:
1743         case CSSPropertyTextOverlineWidth:
1744         case CSSPropertyTextUnderline:
1745         case CSSPropertyTextUnderlineColor:
1746         case CSSPropertyTextUnderlineMode:
1747         case CSSPropertyTextUnderlineStyle:
1748         case CSSPropertyTextUnderlineWidth:
1749             break;
1750
1751         /* Directional properties are resolved by resolveDirectionAwareProperty() before the switch. */
1752         case CSSPropertyWebkitBorderEnd:
1753         case CSSPropertyWebkitBorderEndColor:
1754         case CSSPropertyWebkitBorderEndStyle:
1755         case CSSPropertyWebkitBorderEndWidth:
1756         case CSSPropertyWebkitBorderStart:
1757         case CSSPropertyWebkitBorderStartColor:
1758         case CSSPropertyWebkitBorderStartStyle:
1759         case CSSPropertyWebkitBorderStartWidth:
1760         case CSSPropertyWebkitBorderAfter:
1761         case CSSPropertyWebkitBorderAfterColor:
1762         case CSSPropertyWebkitBorderAfterStyle:
1763         case CSSPropertyWebkitBorderAfterWidth:
1764         case CSSPropertyWebkitBorderBefore:
1765         case CSSPropertyWebkitBorderBeforeColor:
1766         case CSSPropertyWebkitBorderBeforeStyle:
1767         case CSSPropertyWebkitBorderBeforeWidth:
1768         case CSSPropertyWebkitMarginEnd:
1769         case CSSPropertyWebkitMarginStart:
1770         case CSSPropertyWebkitMarginAfter:
1771         case CSSPropertyWebkitMarginBefore:
1772         case CSSPropertyWebkitPaddingEnd:
1773         case CSSPropertyWebkitPaddingStart:
1774         case CSSPropertyWebkitPaddingAfter:
1775         case CSSPropertyWebkitPaddingBefore:
1776         case CSSPropertyWebkitLogicalWidth:
1777         case CSSPropertyWebkitLogicalHeight:
1778         case CSSPropertyWebkitMinLogicalWidth:
1779         case CSSPropertyWebkitMinLogicalHeight:
1780         case CSSPropertyWebkitMaxLogicalWidth:
1781         case CSSPropertyWebkitMaxLogicalHeight:
1782             ASSERT_NOT_REACHED();
1783             break;
1784
1785         /* Unimplemented @font-face properties */
1786         case CSSPropertyFontStretch:
1787         case CSSPropertySrc:
1788         case CSSPropertyUnicodeRange:
1789             break;
1790
1791         /* Other unimplemented properties */
1792         case CSSPropertyPage: // for @page
1793         case CSSPropertyQuotes: // FIXME: needs implementation
1794         case CSSPropertySize: // for @page
1795             break;
1796
1797         /* Unimplemented -webkit- properties */
1798         case CSSPropertyWebkitAnimation:
1799         case CSSPropertyWebkitBorderRadius:
1800         case CSSPropertyWebkitColumns:
1801         case CSSPropertyWebkitColumnRule:
1802         case CSSPropertyWebkitMarginCollapse:
1803         case CSSPropertyWebkitMarquee:
1804         case CSSPropertyWebkitMarqueeSpeed:
1805         case CSSPropertyWebkitMask:
1806         case CSSPropertyWebkitMaskRepeatX:
1807         case CSSPropertyWebkitMaskRepeatY:
1808         case CSSPropertyWebkitPerspectiveOriginX:
1809         case CSSPropertyWebkitPerspectiveOriginY:
1810         case CSSPropertyWebkitTextStroke:
1811         case CSSPropertyWebkitTransformOriginX:
1812         case CSSPropertyWebkitTransformOriginY:
1813         case CSSPropertyWebkitTransformOriginZ:
1814         case CSSPropertyWebkitTransition:
1815             break;
1816
1817         case CSSPropertyWebkitWrapShape:
1818             if (!style->wrapShape())
1819                 return primitiveValueCache->createIdentifierValue(CSSValueAuto);
1820
1821             return primitiveValueCache->createValue(style->wrapShape());
1822
1823 #if ENABLE(SVG)
1824         case CSSPropertyClipPath:
1825         case CSSPropertyClipRule:
1826         case CSSPropertyMask:
1827         case CSSPropertyEnableBackground:
1828         case CSSPropertyFilter:
1829         case CSSPropertyFloodColor:
1830         case CSSPropertyFloodOpacity:
1831         case CSSPropertyLightingColor:
1832         case CSSPropertyStopColor:
1833         case CSSPropertyStopOpacity:
1834         case CSSPropertyColorInterpolation:
1835         case CSSPropertyColorInterpolationFilters:
1836         case CSSPropertyColorProfile:
1837         case CSSPropertyColorRendering:
1838         case CSSPropertyFill:
1839         case CSSPropertyFillOpacity:
1840         case CSSPropertyFillRule:
1841         case CSSPropertyMarker:
1842         case CSSPropertyMarkerEnd:
1843         case CSSPropertyMarkerMid:
1844         case CSSPropertyMarkerStart:
1845         case CSSPropertyShapeRendering:
1846         case CSSPropertyStroke:
1847         case CSSPropertyStrokeDasharray:
1848         case CSSPropertyStrokeDashoffset:
1849         case CSSPropertyStrokeLinecap:
1850         case CSSPropertyStrokeLinejoin:
1851         case CSSPropertyStrokeMiterlimit:
1852         case CSSPropertyStrokeOpacity:
1853         case CSSPropertyStrokeWidth:
1854         case CSSPropertyAlignmentBaseline:
1855         case CSSPropertyBaselineShift:
1856         case CSSPropertyDominantBaseline:
1857         case CSSPropertyGlyphOrientationHorizontal:
1858         case CSSPropertyGlyphOrientationVertical:
1859         case CSSPropertyKerning:
1860         case CSSPropertyTextAnchor:
1861         case CSSPropertyVectorEffect:
1862         case CSSPropertyWritingMode:
1863         case CSSPropertyWebkitSvgShadow:
1864             return getSVGPropertyCSSValue(propertyID, DoNotUpdateLayout);
1865 #endif
1866     }
1867
1868     logUnimplementedPropertyID(propertyID);
1869     return 0;
1870 }
1871
1872 String CSSComputedStyleDeclaration::getPropertyValue(int propertyID) const
1873 {
1874     RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
1875     if (value)
1876         return value->cssText();
1877     return "";
1878 }
1879
1880 bool CSSComputedStyleDeclaration::getPropertyPriority(int /*propertyID*/) const
1881 {
1882     // All computed styles have a priority of false (not "important").
1883     return false;
1884 }
1885
1886 String CSSComputedStyleDeclaration::removeProperty(int /*propertyID*/, ExceptionCode& ec)
1887 {
1888     ec = NO_MODIFICATION_ALLOWED_ERR;
1889     return String();
1890 }
1891
1892 void CSSComputedStyleDeclaration::setProperty(int /*propertyID*/, const String& /*value*/, bool /*important*/, ExceptionCode& ec)
1893 {
1894     ec = NO_MODIFICATION_ALLOWED_ERR;
1895 }
1896
1897 unsigned CSSComputedStyleDeclaration::virtualLength() const
1898 {
1899     Node* node = m_node.get();
1900     if (!node)
1901         return 0;
1902
1903     RenderStyle* style = node->computedStyle(m_pseudoElementSpecifier);
1904     if (!style)
1905         return 0;
1906
1907     return numComputedProperties;
1908 }
1909
1910 String CSSComputedStyleDeclaration::item(unsigned i) const
1911 {
1912     if (i >= length())
1913         return "";
1914
1915     return getPropertyName(static_cast<CSSPropertyID>(computedProperties[i]));
1916 }
1917
1918 bool CSSComputedStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const
1919 {
1920     if (property->id() == CSSPropertyFontSize && property->value()->isPrimitiveValue() && m_node) {
1921         m_node->document()->updateLayoutIgnorePendingStylesheets();
1922         RenderStyle* style = m_node->computedStyle(m_pseudoElementSpecifier);
1923         if (style && style->fontDescription().keywordSize()) {
1924             int sizeValue = cssIdentifierForFontSizeKeyword(style->fontDescription().keywordSize());
1925             CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(property->value());
1926             if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_IDENT && primitiveValue->getIdent() == sizeValue)
1927                 return true;
1928         }
1929     }
1930
1931     return CSSStyleDeclaration::cssPropertyMatches(property);
1932 }
1933
1934 PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::copy() const
1935 {
1936     return copyPropertiesInSet(computedProperties, numComputedProperties);
1937 }
1938
1939 PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::makeMutable()
1940 {
1941     return copy();
1942 }
1943
1944 } // namespace WebCore