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