[CSS Grid Layout] Implement support for grid-template
[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, 2012 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 "BasicShapeFunctions.h"
29 #include "BasicShapes.h"
30 #include "CSSAspectRatioValue.h"
31 #include "CSSBasicShapes.h"
32 #include "CSSBorderImage.h"
33 #include "CSSFontFeatureValue.h"
34 #include "CSSFontValue.h"
35 #include "CSSFunctionValue.h"
36 #include "CSSGridTemplateValue.h"
37 #include "CSSLineBoxContainValue.h"
38 #include "CSSParser.h"
39 #include "CSSPrimitiveValue.h"
40 #include "CSSPrimitiveValueMappings.h"
41 #include "CSSPropertyNames.h"
42 #include "CSSReflectValue.h"
43 #include "CSSSelector.h"
44 #include "CSSShadowValue.h"
45 #include "CSSTimingFunctionValue.h"
46 #include "CSSValueList.h"
47 #include "CSSValuePool.h"
48 #include "ContentData.h"
49 #include "CounterContent.h"
50 #include "CursorList.h"
51 #include "Document.h"
52 #include "ExceptionCode.h"
53 #include "FontFeatureSettings.h"
54 #include "HTMLFrameOwnerElement.h"
55 #include "Pair.h"
56 #include "PseudoElement.h"
57 #include "Rect.h"
58 #include "RenderBox.h"
59 #include "RenderStyle.h"
60 #include "RenderView.h"
61 #include "StyleInheritedData.h"
62 #include "StylePropertySet.h"
63 #include "StylePropertyShorthand.h"
64 #include "StyleResolver.h"
65 #include "WebKitCSSTransformValue.h"
66 #include "WebKitFontFamilyNames.h"
67 #include <wtf/text/StringBuilder.h>
68
69 #if ENABLE(CSS_SHAPES)
70 #include "ShapeValue.h"
71 #endif
72
73 #if ENABLE(CSS_SHADERS)
74 #include "CustomFilterArrayParameter.h"
75 #include "CustomFilterColorParameter.h"
76 #include "CustomFilterNumberParameter.h"
77 #include "CustomFilterOperation.h"
78 #include "CustomFilterParameter.h"
79 #include "CustomFilterTransformParameter.h"
80 #include "WebKitCSSArrayFunctionValue.h"
81 #include "WebKitCSSMatFunctionValue.h"
82 #include "WebKitCSSMixFunctionValue.h"
83 #endif
84
85 #if ENABLE(CSS_FILTERS)
86 #include "StyleCustomFilterProgram.h"
87 #include "WebKitCSSFilterValue.h"
88 #endif
89
90 #if ENABLE(DASHBOARD_SUPPORT)
91 #include "DashboardRegion.h"
92 #endif
93
94 namespace WebCore {
95
96 // List of all properties we know how to compute, omitting shorthands.
97 static const CSSPropertyID computedProperties[] = {
98     CSSPropertyBackgroundAttachment,
99     CSSPropertyBackgroundClip,
100     CSSPropertyBackgroundColor,
101     CSSPropertyBackgroundImage,
102     CSSPropertyBackgroundOrigin,
103     CSSPropertyBackgroundPosition, // more-specific background-position-x/y are non-standard
104     CSSPropertyBackgroundRepeat,
105     CSSPropertyBackgroundSize,
106     CSSPropertyBorderBottomColor,
107     CSSPropertyBorderBottomLeftRadius,
108     CSSPropertyBorderBottomRightRadius,
109     CSSPropertyBorderBottomStyle,
110     CSSPropertyBorderBottomWidth,
111     CSSPropertyBorderCollapse,
112     CSSPropertyBorderImageOutset,
113     CSSPropertyBorderImageRepeat,
114     CSSPropertyBorderImageSlice,
115     CSSPropertyBorderImageSource,
116     CSSPropertyBorderImageWidth,
117     CSSPropertyBorderLeftColor,
118     CSSPropertyBorderLeftStyle,
119     CSSPropertyBorderLeftWidth,
120     CSSPropertyBorderRightColor,
121     CSSPropertyBorderRightStyle,
122     CSSPropertyBorderRightWidth,
123     CSSPropertyBorderTopColor,
124     CSSPropertyBorderTopLeftRadius,
125     CSSPropertyBorderTopRightRadius,
126     CSSPropertyBorderTopStyle,
127     CSSPropertyBorderTopWidth,
128     CSSPropertyBottom,
129     CSSPropertyBoxShadow,
130     CSSPropertyBoxSizing,
131     CSSPropertyCaptionSide,
132     CSSPropertyClear,
133     CSSPropertyClip,
134     CSSPropertyColor,
135     CSSPropertyCursor,
136     CSSPropertyDirection,
137     CSSPropertyDisplay,
138     CSSPropertyEmptyCells,
139     CSSPropertyFloat,
140     CSSPropertyFontFamily,
141     CSSPropertyFontSize,
142     CSSPropertyFontStyle,
143     CSSPropertyFontVariant,
144     CSSPropertyFontWeight,
145     CSSPropertyHeight,
146 #if ENABLE(CSS_IMAGE_ORIENTATION)
147     CSSPropertyImageOrientation,
148 #endif
149     CSSPropertyImageRendering,
150 #if ENABLE(CSS_IMAGE_RESOLUTION)
151     CSSPropertyImageResolution,
152 #endif
153     CSSPropertyLeft,
154     CSSPropertyLetterSpacing,
155     CSSPropertyLineHeight,
156     CSSPropertyListStyleImage,
157     CSSPropertyListStylePosition,
158     CSSPropertyListStyleType,
159     CSSPropertyMarginBottom,
160     CSSPropertyMarginLeft,
161     CSSPropertyMarginRight,
162     CSSPropertyMarginTop,
163     CSSPropertyMaxHeight,
164     CSSPropertyMaxWidth,
165     CSSPropertyMinHeight,
166     CSSPropertyMinWidth,
167     CSSPropertyOpacity,
168     CSSPropertyOrphans,
169     CSSPropertyOutlineColor,
170     CSSPropertyOutlineOffset,
171     CSSPropertyOutlineStyle,
172     CSSPropertyOutlineWidth,
173     CSSPropertyOverflowWrap,
174     CSSPropertyOverflowX,
175     CSSPropertyOverflowY,
176     CSSPropertyPaddingBottom,
177     CSSPropertyPaddingLeft,
178     CSSPropertyPaddingRight,
179     CSSPropertyPaddingTop,
180     CSSPropertyPageBreakAfter,
181     CSSPropertyPageBreakBefore,
182     CSSPropertyPageBreakInside,
183     CSSPropertyPointerEvents,
184     CSSPropertyPosition,
185     CSSPropertyResize,
186     CSSPropertyRight,
187     CSSPropertySpeak,
188     CSSPropertyTableLayout,
189     CSSPropertyTabSize,
190     CSSPropertyTextAlign,
191     CSSPropertyTextDecoration,
192 #if ENABLE(CSS3_TEXT)
193     CSSPropertyWebkitTextDecorationLine,
194     CSSPropertyWebkitTextDecorationStyle,
195     CSSPropertyWebkitTextDecorationColor,
196     CSSPropertyWebkitTextAlignLast,
197     CSSPropertyWebkitTextJustify,
198     CSSPropertyWebkitTextUnderlinePosition,
199 #endif // CSS3_TEXT
200     CSSPropertyTextIndent,
201     CSSPropertyTextRendering,
202     CSSPropertyTextShadow,
203     CSSPropertyTextOverflow,
204     CSSPropertyTextTransform,
205     CSSPropertyTop,
206     CSSPropertyTransitionDelay,
207     CSSPropertyTransitionDuration,
208     CSSPropertyTransitionProperty,
209     CSSPropertyTransitionTimingFunction,
210     CSSPropertyUnicodeBidi,
211     CSSPropertyVerticalAlign,
212     CSSPropertyVisibility,
213     CSSPropertyWhiteSpace,
214     CSSPropertyWidows,
215     CSSPropertyWidth,
216     CSSPropertyWordBreak,
217     CSSPropertyWordSpacing,
218     CSSPropertyWordWrap,
219     CSSPropertyZIndex,
220     CSSPropertyZoom,
221
222     CSSPropertyWebkitAnimationDelay,
223     CSSPropertyWebkitAnimationDirection,
224     CSSPropertyWebkitAnimationDuration,
225     CSSPropertyWebkitAnimationFillMode,
226     CSSPropertyWebkitAnimationIterationCount,
227     CSSPropertyWebkitAnimationName,
228     CSSPropertyWebkitAnimationPlayState,
229     CSSPropertyWebkitAnimationTimingFunction,
230     CSSPropertyWebkitAppearance,
231     CSSPropertyWebkitBackfaceVisibility,
232     CSSPropertyWebkitBackgroundBlendMode,
233     CSSPropertyWebkitBackgroundClip,
234     CSSPropertyWebkitBackgroundComposite,
235     CSSPropertyWebkitBackgroundOrigin,
236     CSSPropertyWebkitBackgroundSize,
237 #if ENABLE(CSS_COMPOSITING)
238     CSSPropertyWebkitBlendMode,
239 #endif
240     CSSPropertyWebkitBorderFit,
241     CSSPropertyWebkitBorderHorizontalSpacing,
242     CSSPropertyWebkitBorderImage,
243     CSSPropertyWebkitBorderVerticalSpacing,
244     CSSPropertyWebkitBoxAlign,
245 #if ENABLE(CSS_BOX_DECORATION_BREAK)
246     CSSPropertyWebkitBoxDecorationBreak,
247 #endif
248     CSSPropertyWebkitBoxDirection,
249     CSSPropertyWebkitBoxFlex,
250     CSSPropertyWebkitBoxFlexGroup,
251     CSSPropertyWebkitBoxLines,
252     CSSPropertyWebkitBoxOrdinalGroup,
253     CSSPropertyWebkitBoxOrient,
254     CSSPropertyWebkitBoxPack,
255     CSSPropertyWebkitBoxReflect,
256     CSSPropertyWebkitBoxShadow,
257     CSSPropertyWebkitClipPath,
258     CSSPropertyWebkitColorCorrection,
259     CSSPropertyWebkitColumnBreakAfter,
260     CSSPropertyWebkitColumnBreakBefore,
261     CSSPropertyWebkitColumnBreakInside,
262     CSSPropertyWebkitColumnAxis,
263     CSSPropertyWebkitColumnCount,
264     CSSPropertyWebkitColumnGap,
265     CSSPropertyWebkitColumnProgression,
266     CSSPropertyWebkitColumnRuleColor,
267     CSSPropertyWebkitColumnRuleStyle,
268     CSSPropertyWebkitColumnRuleWidth,
269     CSSPropertyWebkitColumnSpan,
270     CSSPropertyWebkitColumnWidth,
271 #if ENABLE(CURSOR_VISIBILITY)
272     CSSPropertyWebkitCursorVisibility,
273 #endif
274 #if ENABLE(DASHBOARD_SUPPORT)
275     CSSPropertyWebkitDashboardRegion,
276 #endif
277 #if ENABLE(CSS_FILTERS)
278     CSSPropertyWebkitFilter,
279 #endif
280     CSSPropertyWebkitAlignContent,
281     CSSPropertyWebkitAlignItems,
282     CSSPropertyWebkitAlignSelf,
283     CSSPropertyWebkitFlexBasis,
284     CSSPropertyWebkitFlexGrow,
285     CSSPropertyWebkitFlexShrink,
286     CSSPropertyWebkitFlexDirection,
287     CSSPropertyWebkitFlexWrap,
288     CSSPropertyWebkitJustifyContent,
289     CSSPropertyWebkitFontKerning,
290     CSSPropertyWebkitFontSmoothing,
291     CSSPropertyWebkitFontVariantLigatures,
292     CSSPropertyWebkitGridAutoColumns,
293     CSSPropertyWebkitGridAutoFlow,
294     CSSPropertyWebkitGridAutoRows,
295     CSSPropertyWebkitGridColumnEnd,
296     CSSPropertyWebkitGridColumnStart,
297     CSSPropertyWebkitGridDefinitionColumns,
298     CSSPropertyWebkitGridDefinitionRows,
299     CSSPropertyWebkitGridRowEnd,
300     CSSPropertyWebkitGridRowStart,
301     CSSPropertyWebkitHighlight,
302     CSSPropertyWebkitHyphenateCharacter,
303     CSSPropertyWebkitHyphenateLimitAfter,
304     CSSPropertyWebkitHyphenateLimitBefore,
305     CSSPropertyWebkitHyphenateLimitLines,
306     CSSPropertyWebkitHyphens,
307     CSSPropertyWebkitLineAlign,
308     CSSPropertyWebkitLineBoxContain,
309     CSSPropertyWebkitLineBreak,
310     CSSPropertyWebkitLineClamp,
311     CSSPropertyWebkitLineGrid,
312     CSSPropertyWebkitLineSnap,
313     CSSPropertyWebkitLocale,
314     CSSPropertyWebkitMarginBeforeCollapse,
315     CSSPropertyWebkitMarginAfterCollapse,
316     CSSPropertyWebkitMarqueeDirection,
317     CSSPropertyWebkitMarqueeIncrement,
318     CSSPropertyWebkitMarqueeRepetition,
319     CSSPropertyWebkitMarqueeStyle,
320     CSSPropertyWebkitMaskBoxImage,
321     CSSPropertyWebkitMaskBoxImageOutset,
322     CSSPropertyWebkitMaskBoxImageRepeat,
323     CSSPropertyWebkitMaskBoxImageSlice,
324     CSSPropertyWebkitMaskBoxImageSource,
325     CSSPropertyWebkitMaskBoxImageWidth,
326     CSSPropertyWebkitMaskClip,
327     CSSPropertyWebkitMaskComposite,
328     CSSPropertyWebkitMaskImage,
329     CSSPropertyWebkitMaskOrigin,
330     CSSPropertyWebkitMaskPosition,
331     CSSPropertyWebkitMaskRepeat,
332     CSSPropertyWebkitMaskSize,
333     CSSPropertyWebkitMaskSourceType,
334     CSSPropertyWebkitNbspMode,
335     CSSPropertyWebkitOrder,
336 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
337     CSSPropertyWebkitOverflowScrolling,
338 #endif
339     CSSPropertyWebkitPerspective,
340     CSSPropertyWebkitPerspectiveOrigin,
341     CSSPropertyWebkitPrintColorAdjust,
342     CSSPropertyWebkitRtlOrdering,
343 #if PLATFORM(IOS)
344     CSSPropertyWebkitTouchCallout,
345 #endif
346 #if ENABLE(CSS_SHAPES)
347     CSSPropertyWebkitShapeInside,
348     CSSPropertyWebkitShapeOutside,
349 #endif
350 #if ENABLE(TOUCH_EVENTS)
351     CSSPropertyWebkitTapHighlightColor,
352 #endif
353     CSSPropertyWebkitTextCombine,
354     CSSPropertyWebkitTextDecorationsInEffect,
355     CSSPropertyWebkitTextEmphasisColor,
356     CSSPropertyWebkitTextEmphasisPosition,
357     CSSPropertyWebkitTextEmphasisStyle,
358     CSSPropertyWebkitTextFillColor,
359     CSSPropertyWebkitTextOrientation,
360     CSSPropertyWebkitTextSecurity,
361 #if ENABLE(IOS_TEXT_AUTOSIZING)
362     CSSPropertyWebkitTextSizeAdjust,
363 #endif
364     CSSPropertyWebkitTextStrokeColor,
365     CSSPropertyWebkitTextStrokeWidth,
366     CSSPropertyWebkitTransform,
367     CSSPropertyWebkitTransformOrigin,
368     CSSPropertyWebkitTransformStyle,
369     CSSPropertyWebkitTransitionDelay,
370     CSSPropertyWebkitTransitionDuration,
371     CSSPropertyWebkitTransitionProperty,
372     CSSPropertyWebkitTransitionTimingFunction,
373     CSSPropertyWebkitUserDrag,
374     CSSPropertyWebkitUserModify,
375     CSSPropertyWebkitUserSelect,
376     CSSPropertyWebkitWritingMode,
377 #if ENABLE(CSS_REGIONS)
378     CSSPropertyWebkitFlowInto,
379     CSSPropertyWebkitFlowFrom,
380     CSSPropertyWebkitRegionBreakAfter,
381     CSSPropertyWebkitRegionBreakBefore,
382     CSSPropertyWebkitRegionBreakInside,
383     CSSPropertyWebkitRegionFragment,
384 #endif
385 #if ENABLE(DRAGGABLE_REGION)
386     CSSPropertyWebkitAppRegion,
387 #endif
388 #if ENABLE(CSS_EXCLUSIONS)
389     CSSPropertyWebkitWrapFlow,
390     CSSPropertyWebkitWrapThrough,
391 #endif
392 #if ENABLE(CSS_SHAPES)
393     CSSPropertyWebkitShapeMargin,
394     CSSPropertyWebkitShapePadding,
395     CSSPropertyWebkitShapeImageThreshold,
396 #endif
397 #if ENABLE(SVG)
398     CSSPropertyBufferedRendering,
399     CSSPropertyClipPath,
400     CSSPropertyClipRule,
401     CSSPropertyMask,
402     CSSPropertyFilter,
403     CSSPropertyFloodColor,
404     CSSPropertyFloodOpacity,
405     CSSPropertyLightingColor,
406     CSSPropertyStopColor,
407     CSSPropertyStopOpacity,
408     CSSPropertyColorInterpolation,
409     CSSPropertyColorInterpolationFilters,
410     CSSPropertyColorRendering,
411     CSSPropertyFill,
412     CSSPropertyFillOpacity,
413     CSSPropertyFillRule,
414     CSSPropertyMarkerEnd,
415     CSSPropertyMarkerMid,
416     CSSPropertyMarkerStart,
417     CSSPropertyMaskType,
418     CSSPropertyShapeRendering,
419     CSSPropertyStroke,
420     CSSPropertyStrokeDasharray,
421     CSSPropertyStrokeDashoffset,
422     CSSPropertyStrokeLinecap,
423     CSSPropertyStrokeLinejoin,
424     CSSPropertyStrokeMiterlimit,
425     CSSPropertyStrokeOpacity,
426     CSSPropertyStrokeWidth,
427     CSSPropertyAlignmentBaseline,
428     CSSPropertyBaselineShift,
429     CSSPropertyDominantBaseline,
430     CSSPropertyKerning,
431     CSSPropertyTextAnchor,
432     CSSPropertyWritingMode,
433     CSSPropertyGlyphOrientationHorizontal,
434     CSSPropertyGlyphOrientationVertical,
435     CSSPropertyWebkitSvgShadow,
436     CSSPropertyVectorEffect
437 #endif
438 };
439
440 const unsigned numComputedProperties = WTF_ARRAY_LENGTH(computedProperties);
441
442 static CSSValueID valueForRepeatRule(int rule)
443 {
444     switch (rule) {
445         case RepeatImageRule:
446             return CSSValueRepeat;
447         case RoundImageRule:
448             return CSSValueRound;
449         case SpaceImageRule:
450             return CSSValueSpace;
451         default:
452             return CSSValueStretch;
453     }
454 }
455
456 static PassRefPtr<CSSBorderImageSliceValue> valueForNinePieceImageSlice(const NinePieceImage& image)
457 {
458     // Create the slices.
459     RefPtr<CSSPrimitiveValue> top;
460     RefPtr<CSSPrimitiveValue> right;
461     RefPtr<CSSPrimitiveValue> bottom;
462     RefPtr<CSSPrimitiveValue> left;
463
464     if (image.imageSlices().top().isPercent())
465         top = cssValuePool().createValue(image.imageSlices().top().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
466     else
467         top = cssValuePool().createValue(image.imageSlices().top().value(), CSSPrimitiveValue::CSS_NUMBER);
468
469     if (image.imageSlices().right() == image.imageSlices().top() && image.imageSlices().bottom() == image.imageSlices().top()
470         && image.imageSlices().left() == image.imageSlices().top()) {
471         right = top;
472         bottom = top;
473         left = top;
474     } else {
475         if (image.imageSlices().right().isPercent())
476             right = cssValuePool().createValue(image.imageSlices().right().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
477         else
478             right = cssValuePool().createValue(image.imageSlices().right().value(), CSSPrimitiveValue::CSS_NUMBER);
479
480         if (image.imageSlices().bottom() == image.imageSlices().top() && image.imageSlices().right() == image.imageSlices().left()) {
481             bottom = top;
482             left = right;
483         } else {
484             if (image.imageSlices().bottom().isPercent())
485                 bottom = cssValuePool().createValue(image.imageSlices().bottom().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
486             else
487                 bottom = cssValuePool().createValue(image.imageSlices().bottom().value(), CSSPrimitiveValue::CSS_NUMBER);
488
489             if (image.imageSlices().left() == image.imageSlices().right())
490                 left = right;
491             else {
492                 if (image.imageSlices().left().isPercent())
493                     left = cssValuePool().createValue(image.imageSlices().left().value(), CSSPrimitiveValue::CSS_PERCENTAGE);
494                 else
495                     left = cssValuePool().createValue(image.imageSlices().left().value(), CSSPrimitiveValue::CSS_NUMBER);
496             }
497         }
498     }
499
500     RefPtr<Quad> quad = Quad::create();
501     quad->setTop(top);
502     quad->setRight(right);
503     quad->setBottom(bottom);
504     quad->setLeft(left);
505
506     return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.release()), image.fill());
507 }
508
509 static PassRefPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(const LengthBox& box)
510 {
511     // Create the slices.
512     RefPtr<CSSPrimitiveValue> top;
513     RefPtr<CSSPrimitiveValue> right;
514     RefPtr<CSSPrimitiveValue> bottom;
515     RefPtr<CSSPrimitiveValue> left;
516
517     if (box.top().isRelative())
518         top = cssValuePool().createValue(box.top().value(), CSSPrimitiveValue::CSS_NUMBER);
519     else
520         top = cssValuePool().createValue(box.top());
521
522     if (box.right() == box.top() && box.bottom() == box.top() && box.left() == box.top()) {
523         right = top;
524         bottom = top;
525         left = top;
526     } else {
527         if (box.right().isRelative())
528             right = cssValuePool().createValue(box.right().value(), CSSPrimitiveValue::CSS_NUMBER);
529         else
530             right = cssValuePool().createValue(box.right());
531
532         if (box.bottom() == box.top() && box.right() == box.left()) {
533             bottom = top;
534             left = right;
535         } else {
536             if (box.bottom().isRelative())
537                 bottom = cssValuePool().createValue(box.bottom().value(), CSSPrimitiveValue::CSS_NUMBER);
538             else
539                 bottom = cssValuePool().createValue(box.bottom());
540
541             if (box.left() == box.right())
542                 left = right;
543             else {
544                 if (box.left().isRelative())
545                     left = cssValuePool().createValue(box.left().value(), CSSPrimitiveValue::CSS_NUMBER);
546                 else
547                     left = cssValuePool().createValue(box.left());
548             }
549         }
550     }
551
552     RefPtr<Quad> quad = Quad::create();
553     quad->setTop(top);
554     quad->setRight(right);
555     quad->setBottom(bottom);
556     quad->setLeft(left);
557
558     return cssValuePool().createValue(quad.release());
559 }
560
561 static PassRefPtr<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& image)
562 {
563     RefPtr<CSSPrimitiveValue> horizontalRepeat;
564     RefPtr<CSSPrimitiveValue> verticalRepeat;
565
566     horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(image.horizontalRule()));
567     if (image.horizontalRule() == image.verticalRule())
568         verticalRepeat = horizontalRepeat;
569     else
570         verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(image.verticalRule()));
571     return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), verticalRepeat.release()));
572 }
573
574 static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image)
575 {
576     if (!image.hasImage())
577         return cssValuePool().createIdentifierValue(CSSValueNone);
578
579     // Image first.
580     RefPtr<CSSValue> imageValue;
581     if (image.image())
582         imageValue = image.image()->cssValue();
583
584     // Create the image slice.
585     RefPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePieceImageSlice(image);
586
587     // Create the border area slices.
588     RefPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image.borderSlices());
589
590     // Create the border outset.
591     RefPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outset());
592
593     // Create the repeat rules.
594     RefPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image);
595
596     return createBorderImageValue(imageValue.release(), imageSlices.release(), borderSlices.release(), outset.release(), repeat.release());
597 }
598
599 inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(double value, const RenderStyle* style)
600 {
601     return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX);
602 }
603
604 inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, const RenderStyle* style)
605 {
606     return cssValuePool().createValue(value / style->effectiveZoom(), CSSPrimitiveValue::CSS_NUMBER);
607 }
608
609 static PassRefPtr<CSSValue> zoomAdjustedPixelValueForLength(const Length& length, const RenderStyle* style)
610 {
611     if (length.isFixed())
612         return zoomAdjustedPixelValue(length.value(), style);
613     return cssValuePool().createValue(length);
614 }
615
616 static PassRefPtr<CSSValue> valueForReflection(const StyleReflection* reflection, const RenderStyle* style)
617 {
618     if (!reflection)
619         return cssValuePool().createIdentifierValue(CSSValueNone);
620
621     RefPtr<CSSPrimitiveValue> offset;
622     if (reflection->offset().isPercent())
623         offset = cssValuePool().createValue(reflection->offset().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
624     else
625         offset = zoomAdjustedPixelValue(reflection->offset().value(), style);
626
627     RefPtr<CSSPrimitiveValue> direction;
628     switch (reflection->direction()) {
629     case ReflectionBelow:
630         direction = cssValuePool().createIdentifierValue(CSSValueBelow);
631         break;
632     case ReflectionAbove:
633         direction = cssValuePool().createIdentifierValue(CSSValueAbove);
634         break;
635     case ReflectionLeft:
636         direction = cssValuePool().createIdentifierValue(CSSValueLeft);
637         break;
638     case ReflectionRight:
639         direction = cssValuePool().createIdentifierValue(CSSValueRight);
640         break;
641     }
642
643     return CSSReflectValue::create(direction.release(), offset.release(), valueForNinePieceImage(reflection->mask()));
644 }
645
646 static PassRefPtr<CSSValueList> createPositionListForLayer(CSSPropertyID propertyID, const FillLayer* layer, const RenderStyle* style)
647 {
648     RefPtr<CSSValueList> positionList = CSSValueList::createSpaceSeparated();
649     if (layer->isBackgroundOriginSet()) {
650         ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
651         positionList->append(cssValuePool().createValue(layer->backgroundXOrigin()));
652     }
653     positionList->append(zoomAdjustedPixelValueForLength(layer->xPosition(), style));
654     if (layer->isBackgroundOriginSet()) {
655         ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
656         positionList->append(cssValuePool().createValue(layer->backgroundYOrigin()));
657     }
658     positionList->append(zoomAdjustedPixelValueForLength(layer->yPosition(), style));
659     return positionList.release();
660 }
661
662 static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, CSSPropertyID propertyID, RenderView* renderView)
663 {
664     if (!style)
665         return 0;
666
667     Length l;
668     switch (propertyID) {
669         case CSSPropertyLeft:
670             l = style->left();
671             break;
672         case CSSPropertyRight:
673             l = style->right();
674             break;
675         case CSSPropertyTop:
676             l = style->top();
677             break;
678         case CSSPropertyBottom:
679             l = style->bottom();
680             break;
681         default:
682             return 0;
683     }
684
685     if (style->hasOutOfFlowPosition()) {
686         if (l.type() == WebCore::Fixed)
687             return zoomAdjustedPixelValue(l.value(), style);
688         else if (l.isViewportPercentage())
689             return zoomAdjustedPixelValue(valueForLength(l, 0, renderView), style);
690         return cssValuePool().createValue(l);
691     }
692
693     if (style->hasInFlowPosition()) {
694         // FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined.
695         // In other words if left is auto and right is not auto, then left's computed value is negative right().
696         // So we should get the opposite length unit and see if it is auto.
697         return cssValuePool().createValue(l);
698     }
699
700     return cssValuePool().createIdentifierValue(CSSValueAuto);
701 }
702
703 PassRefPtr<CSSPrimitiveValue> ComputedStyleExtractor::currentColorOrValidColor(RenderStyle* style, const Color& color) const
704 {
705     // This function does NOT look at visited information, so that computed style doesn't expose that.
706     if (!color.isValid())
707         return cssValuePool().createColorValue(style->color().rgb());
708     return cssValuePool().createColorValue(color.rgb());
709 }
710
711 static PassRefPtr<CSSValueList> getBorderRadiusCornerValues(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
712 {
713     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
714     if (radius.width().type() == Percent)
715         list->append(cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
716     else
717         list->append(zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style));
718     if (radius.height().type() == Percent)
719         list->append(cssValuePool().createValue(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
720     else
721         list->append(zoomAdjustedPixelValue(valueForLength(radius.height(), 0, renderView), style));
722     return list.release();
723 }
724
725 static PassRefPtr<CSSValue> getBorderRadiusCornerValue(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
726 {
727     if (radius.width() == radius.height()) {
728         if (radius.width().type() == Percent)
729             return cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
730         return zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style);
731     }
732     return getBorderRadiusCornerValues(radius, style, renderView);
733 }
734
735 static PassRefPtr<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* style, RenderView* renderView)
736 {
737     RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
738     bool showHorizontalBottomLeft = style->borderTopRightRadius().width() != style->borderBottomLeftRadius().width();
739     bool showHorizontalBottomRight = style->borderBottomRightRadius().width() != style->borderTopLeftRadius().width();
740     bool showHorizontalTopRight = style->borderTopRightRadius().width() != style->borderTopLeftRadius().width();
741
742     bool showVerticalBottomLeft = style->borderTopRightRadius().height() != style->borderBottomLeftRadius().height();
743     bool showVerticalBottomRight = (style->borderBottomRightRadius().height() != style->borderTopLeftRadius().height()) || showVerticalBottomLeft;
744     bool showVerticalTopRight = (style->borderTopRightRadius().height() != style->borderTopLeftRadius().height()) || showVerticalBottomRight;
745     bool showVerticalTopLeft = (style->borderTopLeftRadius().width() != style->borderTopLeftRadius().height());
746
747     RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style->borderTopLeftRadius(), style, renderView);
748     RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style->borderTopRightRadius(), style, renderView);
749     RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style->borderBottomRightRadius(), style, renderView);
750     RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style, renderView);
751
752     RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated();
753     horizontalRadii->append(topLeftRadius->item(0));
754     if (showHorizontalTopRight)
755         horizontalRadii->append(topRightRadius->item(0));
756     if (showHorizontalBottomRight)
757         horizontalRadii->append(bottomRightRadius->item(0));
758     if (showHorizontalBottomLeft)
759         horizontalRadii->append(bottomLeftRadius->item(0));
760
761     list->append(horizontalRadii.release());
762
763     if (showVerticalTopLeft) {
764         RefPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSeparated();
765         verticalRadii->append(topLeftRadius->item(1));
766         if (showVerticalTopRight)
767             verticalRadii->append(topRightRadius->item(1));
768         if (showVerticalBottomRight)
769             verticalRadii->append(bottomRightRadius->item(1));
770         if (showVerticalBottomLeft)
771             verticalRadii->append(bottomLeftRadius->item(1));
772         list->append(verticalRadii.release());
773     }
774     return list.release();
775 }
776
777 static LayoutRect sizingBox(RenderObject* renderer)
778 {
779     if (!renderer->isBox())
780         return LayoutRect();
781
782     RenderBox* box = toRenderBox(renderer);
783     return box->style()->boxSizing() == BORDER_BOX ? box->borderBoxRect() : box->computedCSSContentBoxRect();
784 }
785
786 static PassRefPtr<WebKitCSSTransformValue> matrixTransformValue(const TransformationMatrix& transform, const RenderStyle* style)
787 {
788     RefPtr<WebKitCSSTransformValue> transformValue;
789     if (transform.isAffine()) {
790         transformValue = WebKitCSSTransformValue::create(WebKitCSSTransformValue::MatrixTransformOperation);
791
792         transformValue->append(cssValuePool().createValue(transform.a(), CSSPrimitiveValue::CSS_NUMBER));
793         transformValue->append(cssValuePool().createValue(transform.b(), CSSPrimitiveValue::CSS_NUMBER));
794         transformValue->append(cssValuePool().createValue(transform.c(), CSSPrimitiveValue::CSS_NUMBER));
795         transformValue->append(cssValuePool().createValue(transform.d(), CSSPrimitiveValue::CSS_NUMBER));
796         transformValue->append(zoomAdjustedNumberValue(transform.e(), style));
797         transformValue->append(zoomAdjustedNumberValue(transform.f(), style));
798     } else {
799         transformValue = WebKitCSSTransformValue::create(WebKitCSSTransformValue::Matrix3DTransformOperation);
800
801         transformValue->append(cssValuePool().createValue(transform.m11(), CSSPrimitiveValue::CSS_NUMBER));
802         transformValue->append(cssValuePool().createValue(transform.m12(), CSSPrimitiveValue::CSS_NUMBER));
803         transformValue->append(cssValuePool().createValue(transform.m13(), CSSPrimitiveValue::CSS_NUMBER));
804         transformValue->append(cssValuePool().createValue(transform.m14(), CSSPrimitiveValue::CSS_NUMBER));
805
806         transformValue->append(cssValuePool().createValue(transform.m21(), CSSPrimitiveValue::CSS_NUMBER));
807         transformValue->append(cssValuePool().createValue(transform.m22(), CSSPrimitiveValue::CSS_NUMBER));
808         transformValue->append(cssValuePool().createValue(transform.m23(), CSSPrimitiveValue::CSS_NUMBER));
809         transformValue->append(cssValuePool().createValue(transform.m24(), CSSPrimitiveValue::CSS_NUMBER));
810
811         transformValue->append(cssValuePool().createValue(transform.m31(), CSSPrimitiveValue::CSS_NUMBER));
812         transformValue->append(cssValuePool().createValue(transform.m32(), CSSPrimitiveValue::CSS_NUMBER));
813         transformValue->append(cssValuePool().createValue(transform.m33(), CSSPrimitiveValue::CSS_NUMBER));
814         transformValue->append(cssValuePool().createValue(transform.m34(), CSSPrimitiveValue::CSS_NUMBER));
815
816         transformValue->append(zoomAdjustedNumberValue(transform.m41(), style));
817         transformValue->append(zoomAdjustedNumberValue(transform.m42(), style));
818         transformValue->append(zoomAdjustedNumberValue(transform.m43(), style));
819         transformValue->append(cssValuePool().createValue(transform.m44(), CSSPrimitiveValue::CSS_NUMBER));
820     }
821
822     return transformValue.release();
823 }
824
825 static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle* style)
826 {
827     if (!renderer || !renderer->hasTransform() || !style->hasTransform())
828         return cssValuePool().createIdentifierValue(CSSValueNone);
829
830     IntRect box;
831     if (renderer->isBox())
832         box = pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect());
833
834     TransformationMatrix transform;
835     style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin);
836     // Note that this does not flatten to an affine transform if ENABLE(3D_RENDERING) is off, by design.
837
838     // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
839     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
840     list->append(matrixTransformValue(transform, style));
841
842     return list.release();
843 }
844
845 #if ENABLE(CSS_SHADERS)
846 static PassRefPtr<CSSValue> valueForCustomFilterArrayParameter(const CustomFilterArrayParameter* arrayParameter)
847 {
848     RefPtr<WebKitCSSArrayFunctionValue> arrayParameterValue = WebKitCSSArrayFunctionValue::create();
849     for (unsigned i = 0, size = arrayParameter->size(); i < size; ++i)
850         arrayParameterValue->append(cssValuePool().createValue(arrayParameter->valueAt(i), CSSPrimitiveValue::CSS_NUMBER));
851     return arrayParameterValue.release();
852 }
853
854 static PassRefPtr<CSSValue> valueForCustomFilterMatParameter(const CustomFilterArrayParameter* matrixParameter)
855 {
856     RefPtr<WebKitCSSMatFunctionValue> matrixParameterValue = WebKitCSSMatFunctionValue::create();
857     for (unsigned i = 0, size = matrixParameter->size(); i < size; ++i)
858         matrixParameterValue->append(cssValuePool().createValue(matrixParameter->valueAt(i), CSSPrimitiveValue::CSS_NUMBER));
859     return matrixParameterValue.release();
860 }
861
862 static PassRefPtr<CSSValue> valueForCustomFilterColorParameter(const CustomFilterColorParameter* colorParameter)
863 {
864     RefPtr<CSSValueList> colorParameterValue = CSSValueList::createSpaceSeparated();
865     colorParameterValue->append(cssValuePool().createColorValue(colorParameter->color().rgb()));
866     return colorParameterValue.release();
867 }
868
869 static PassRefPtr<CSSValue> valueForCustomFilterNumberParameter(const CustomFilterNumberParameter* numberParameter)
870 {
871     RefPtr<CSSValueList> numberParameterValue = CSSValueList::createSpaceSeparated();
872     for (unsigned i = 0; i < numberParameter->size(); ++i)
873         numberParameterValue->append(cssValuePool().createValue(numberParameter->valueAt(i), CSSPrimitiveValue::CSS_NUMBER));
874     return numberParameterValue.release();
875 }
876
877 static PassRefPtr<CSSValue> valueForCustomFilterTransformParameter(const RenderObject* renderer, const RenderStyle* style, const CustomFilterTransformParameter* transformParameter)
878 {
879     IntSize size;
880     if (renderer && renderer->isBox())
881         size = pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect()).size();
882
883     TransformationMatrix transform;
884     transformParameter->applyTransform(transform, size);
885     // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
886     return matrixTransformValue(transform, style);
887 }
888
889 static PassRefPtr<CSSValue> valueForCustomFilterParameter(const RenderObject* renderer, const RenderStyle* style, const CustomFilterParameter* parameter)
890 {
891     // FIXME: Add here computed style for the other types: boolean, transform, matrix, texture.
892     ASSERT(parameter);
893     switch (parameter->parameterType()) {
894     case CustomFilterParameter::ARRAY:
895         return valueForCustomFilterArrayParameter(static_cast<const CustomFilterArrayParameter*>(parameter));
896     case CustomFilterParameter::COLOR:
897         return valueForCustomFilterColorParameter(static_cast<const CustomFilterColorParameter*>(parameter));
898     case CustomFilterParameter::MATRIX:
899         return valueForCustomFilterMatParameter(static_cast<const CustomFilterArrayParameter*>(parameter));
900     case CustomFilterParameter::NUMBER:
901         return valueForCustomFilterNumberParameter(static_cast<const CustomFilterNumberParameter*>(parameter));
902     case CustomFilterParameter::TRANSFORM:
903         return valueForCustomFilterTransformParameter(renderer, style, static_cast<const CustomFilterTransformParameter*>(parameter));
904     }
905     
906     ASSERT_NOT_REACHED();
907     return 0;
908 }
909 #endif // ENABLE(CSS_SHADERS)
910
911 static inline PassRefPtr<CSSPrimitiveValue> adjustLengthForZoom(double length, const RenderStyle* style, AdjustPixelValuesForComputedStyle adjust)
912 {
913     return adjust == AdjustPixelValues ? zoomAdjustedPixelValue(length, style) : cssValuePool().createValue(length, CSSPrimitiveValue::CSS_PX);
914 }
915
916 static inline PassRefPtr<CSSPrimitiveValue> adjustLengthForZoom(const Length& length, const RenderStyle* style, AdjustPixelValuesForComputedStyle adjust)
917 {
918     return adjust == AdjustPixelValues ? zoomAdjustedPixelValue(length.value(), style) : cssValuePool().createValue(length);
919 }
920
921 PassRefPtr<CSSValue> ComputedStyleExtractor::valueForShadow(const ShadowData* shadow, CSSPropertyID propertyID, const RenderStyle* style, AdjustPixelValuesForComputedStyle adjust)
922 {
923     if (!shadow)
924         return cssValuePool().createIdentifierValue(CSSValueNone);
925
926     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
927     for (const ShadowData* currShadowData = shadow; currShadowData; currShadowData = currShadowData->next()) {
928         RefPtr<CSSPrimitiveValue> x = adjustLengthForZoom(currShadowData->x(), style, adjust);
929         RefPtr<CSSPrimitiveValue> y = adjustLengthForZoom(currShadowData->y(), style, adjust);
930         RefPtr<CSSPrimitiveValue> blur = adjustLengthForZoom(currShadowData->radius(), style, adjust);
931         RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? PassRefPtr<CSSPrimitiveValue>() : adjustLengthForZoom(currShadowData->spread(), style, adjust);
932         RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || currShadowData->style() == Normal ? PassRefPtr<CSSPrimitiveValue>() : cssValuePool().createIdentifierValue(CSSValueInset);
933         RefPtr<CSSPrimitiveValue> color = cssValuePool().createColorValue(currShadowData->color().rgb());
934         list->prepend(CSSShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release()));
935     }
936     return list.release();
937 }
938
939 #if ENABLE(CSS_FILTERS)
940 PassRefPtr<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderObject* renderer, const RenderStyle* style, const FilterOperations& filterOperations, AdjustPixelValuesForComputedStyle adjust)
941 {
942 #if !ENABLE(CSS_SHADERS)
943     UNUSED_PARAM(renderer);
944 #endif
945     if (filterOperations.operations().isEmpty())
946         return cssValuePool().createIdentifierValue(CSSValueNone);
947
948     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
949
950     RefPtr<WebKitCSSFilterValue> filterValue;
951
952     Vector<RefPtr<FilterOperation> >::const_iterator end = filterOperations.operations().end();
953     for (Vector<RefPtr<FilterOperation> >::const_iterator it = filterOperations.operations().begin(); it != end; ++it) {
954         FilterOperation* filterOperation = (*it).get();
955         switch (filterOperation->getOperationType()) {
956         case FilterOperation::REFERENCE: {
957             ReferenceFilterOperation* referenceOperation = static_cast<ReferenceFilterOperation*>(filterOperation);
958             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::ReferenceFilterOperation);
959             filterValue->append(cssValuePool().createValue(referenceOperation->url(), CSSPrimitiveValue::CSS_STRING));
960             break;
961         }
962         case FilterOperation::GRAYSCALE: {
963             BasicColorMatrixFilterOperation* colorMatrixOperation = static_cast<BasicColorMatrixFilterOperation*>(filterOperation);
964             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::GrayscaleFilterOperation);
965             filterValue->append(cssValuePool().createValue(colorMatrixOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
966             break;
967         }
968         case FilterOperation::SEPIA: {
969             BasicColorMatrixFilterOperation* colorMatrixOperation = static_cast<BasicColorMatrixFilterOperation*>(filterOperation);
970             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::SepiaFilterOperation);
971             filterValue->append(cssValuePool().createValue(colorMatrixOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
972             break;
973         }
974         case FilterOperation::SATURATE: {
975             BasicColorMatrixFilterOperation* colorMatrixOperation = static_cast<BasicColorMatrixFilterOperation*>(filterOperation);
976             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::SaturateFilterOperation);
977             filterValue->append(cssValuePool().createValue(colorMatrixOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
978             break;
979         }
980         case FilterOperation::HUE_ROTATE: {
981             BasicColorMatrixFilterOperation* colorMatrixOperation = static_cast<BasicColorMatrixFilterOperation*>(filterOperation);
982             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::HueRotateFilterOperation);
983             filterValue->append(cssValuePool().createValue(colorMatrixOperation->amount(), CSSPrimitiveValue::CSS_DEG));
984             break;
985         }
986         case FilterOperation::INVERT: {
987             BasicComponentTransferFilterOperation* componentTransferOperation = static_cast<BasicComponentTransferFilterOperation*>(filterOperation);
988             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::InvertFilterOperation);
989             filterValue->append(cssValuePool().createValue(componentTransferOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
990             break;
991         }
992         case FilterOperation::OPACITY: {
993             BasicComponentTransferFilterOperation* componentTransferOperation = static_cast<BasicComponentTransferFilterOperation*>(filterOperation);
994             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::OpacityFilterOperation);
995             filterValue->append(cssValuePool().createValue(componentTransferOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
996             break;
997         }
998         case FilterOperation::BRIGHTNESS: {
999             BasicComponentTransferFilterOperation* brightnessOperation = static_cast<BasicComponentTransferFilterOperation*>(filterOperation);
1000             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::BrightnessFilterOperation);
1001             filterValue->append(cssValuePool().createValue(brightnessOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
1002             break;
1003         }
1004         case FilterOperation::CONTRAST: {
1005             BasicComponentTransferFilterOperation* contrastOperation = static_cast<BasicComponentTransferFilterOperation*>(filterOperation);
1006             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::ContrastFilterOperation);
1007             filterValue->append(cssValuePool().createValue(contrastOperation->amount(), CSSPrimitiveValue::CSS_NUMBER));
1008             break;
1009         }
1010         case FilterOperation::BLUR: {
1011             BlurFilterOperation* blurOperation = static_cast<BlurFilterOperation*>(filterOperation);
1012             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::BlurFilterOperation);
1013             filterValue->append(adjustLengthForZoom(blurOperation->stdDeviation(), style, adjust));
1014             break;
1015         }
1016         case FilterOperation::DROP_SHADOW: {
1017             DropShadowFilterOperation* dropShadowOperation = static_cast<DropShadowFilterOperation*>(filterOperation);
1018             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::DropShadowFilterOperation);
1019             // We want our computed style to look like that of a text shadow (has neither spread nor inset style).
1020             ShadowData shadowData = ShadowData(dropShadowOperation->location(), dropShadowOperation->stdDeviation(), 0, Normal, false, dropShadowOperation->color());
1021             filterValue->append(valueForShadow(&shadowData, CSSPropertyTextShadow, style, adjust));
1022             break;
1023         }
1024 #if ENABLE(CSS_SHADERS)
1025         case FilterOperation::VALIDATED_CUSTOM:
1026             // ValidatedCustomFilterOperation is not supposed to end up in the RenderStyle.
1027             ASSERT_NOT_REACHED();
1028             break;
1029         case FilterOperation::CUSTOM: {
1030             CustomFilterOperation* customOperation = static_cast<CustomFilterOperation*>(filterOperation);
1031             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::CustomFilterOperation);
1032             
1033             // The output should be verbose, even if the values are the default ones.
1034             
1035             ASSERT(customOperation->program());
1036             StyleCustomFilterProgram* program = static_cast<StyleCustomFilterProgram*>(customOperation->program());
1037             
1038             RefPtr<CSSValueList> shadersList = CSSValueList::createSpaceSeparated();
1039             if (program->vertexShader())
1040                 shadersList->append(program->vertexShader()->cssValue());
1041             else
1042                 shadersList->append(cssValuePool().createIdentifierValue(CSSValueNone));
1043
1044             const CustomFilterProgramMixSettings mixSettings = program->mixSettings();
1045             if (program->fragmentShader()) {
1046                 if (program->programType() == PROGRAM_TYPE_BLENDS_ELEMENT_TEXTURE) {
1047                     RefPtr<WebKitCSSMixFunctionValue> mixFunction = WebKitCSSMixFunctionValue::create();
1048                     mixFunction->append(program->fragmentShader()->cssValue());
1049                     mixFunction->append(cssValuePool().createValue(mixSettings.blendMode));
1050                     mixFunction->append(cssValuePool().createValue(mixSettings.compositeOperator));
1051                     shadersList->append(mixFunction.release());
1052                 } else
1053                     shadersList->append(program->fragmentShader()->cssValue());
1054             }
1055             else
1056                 shadersList->append(cssValuePool().createIdentifierValue(CSSValueNone));
1057
1058             filterValue->append(shadersList.release());
1059             
1060             RefPtr<CSSValueList> meshParameters = CSSValueList::createSpaceSeparated();
1061             meshParameters->append(cssValuePool().createValue(customOperation->meshColumns(), CSSPrimitiveValue::CSS_NUMBER));
1062             meshParameters->append(cssValuePool().createValue(customOperation->meshRows(), CSSPrimitiveValue::CSS_NUMBER));
1063             
1064             // FIXME: The specification doesn't have any "attached" identifier. Should we add one?
1065             // https://bugs.webkit.org/show_bug.cgi?id=72700
1066             if (customOperation->meshType() == MeshTypeDetached)
1067                 meshParameters->append(cssValuePool().createIdentifierValue(CSSValueDetached));
1068             
1069             filterValue->append(meshParameters.release());
1070             
1071             const CustomFilterParameterList& parameters = customOperation->parameters();
1072             size_t parametersSize = parameters.size();
1073             if (!parametersSize)
1074                 break;
1075             RefPtr<CSSValueList> parametersCSSValue = CSSValueList::createCommaSeparated();
1076             for (size_t i = 0; i < parametersSize; ++i) {
1077                 const CustomFilterParameter* parameter = parameters.at(i).get();
1078                 RefPtr<CSSValueList> parameterCSSNameAndValue = CSSValueList::createSpaceSeparated();
1079                 parameterCSSNameAndValue->append(cssValuePool().createValue(parameter->name(), CSSPrimitiveValue::CSS_STRING));
1080                 parameterCSSNameAndValue->append(valueForCustomFilterParameter(renderer, style, parameter));
1081                 parametersCSSValue->append(parameterCSSNameAndValue.release());
1082             }
1083             
1084             filterValue->append(parametersCSSValue.release());
1085             break;
1086         }
1087 #endif
1088         default:
1089             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::UnknownFilterOperation);
1090             break;
1091         }
1092         list->append(filterValue.release());
1093     }
1094
1095     return list.release();
1096 }
1097 #endif
1098
1099 static PassRefPtr<CSSValue> valueForGridTrackBreadth(const Length& trackBreadth, const RenderStyle* style, RenderView *renderView)
1100 {
1101     if (trackBreadth.isAuto())
1102         return cssValuePool().createIdentifierValue(CSSValueAuto);
1103     if (trackBreadth.isViewportPercentage())
1104         return zoomAdjustedPixelValue(valueForLength(trackBreadth, 0, renderView), style);
1105     return zoomAdjustedPixelValueForLength(trackBreadth, style);
1106 }
1107
1108 static PassRefPtr<CSSValue> valueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style, RenderView* renderView)
1109 {
1110     switch (trackSize.type()) {
1111     case LengthTrackSizing:
1112         return valueForGridTrackBreadth(trackSize.length(), style, renderView);
1113     case MinMaxTrackSizing:
1114         RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSeparated();
1115         minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.minTrackBreadth(), style, renderView));
1116         minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.maxTrackBreadth(), style, renderView));
1117         return CSSFunctionValue::create("minmax(", minMaxTrackBreadths);
1118     }
1119     ASSERT_NOT_REACHED();
1120     return 0;
1121 }
1122
1123 static void addValuesForNamedGridLinesAtIndex(const NamedGridLinesMap& namedGridLines, size_t i, CSSValueList& list)
1124 {
1125     // Note that this won't return the results in the order specified in the style sheet,
1126     // which is probably fine as we still *do* return all the expected values.
1127     NamedGridLinesMap::const_iterator it = namedGridLines.begin();
1128     NamedGridLinesMap::const_iterator end = namedGridLines.end();
1129     for (; it != end; ++it) {
1130         const Vector<size_t>& linesIndexes = it->value;
1131         for (size_t j = 0; j < linesIndexes.size(); ++j) {
1132             if (linesIndexes[j] != i)
1133                 continue;
1134
1135             list.append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_STRING));
1136             break;
1137         }
1138     }
1139 }
1140
1141 static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& trackSizes, const NamedGridLinesMap& namedGridLines, const RenderStyle* style, RenderView* renderView)
1142 {
1143     // Handle the 'none' case here.
1144     if (!trackSizes.size()) {
1145         ASSERT(namedGridLines.isEmpty());
1146         return cssValuePool().createIdentifierValue(CSSValueNone);
1147     }
1148
1149     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1150     for (size_t i = 0; i < trackSizes.size(); ++i) {
1151         addValuesForNamedGridLinesAtIndex(namedGridLines, i, *list);
1152         list->append(valueForGridTrackSize(trackSizes[i], style, renderView));
1153     }
1154     // Those are the trailing <string>* allowed in the syntax.
1155     addValuesForNamedGridLinesAtIndex(namedGridLines, trackSizes.size(), *list);
1156     return list.release();
1157 }
1158
1159 static PassRefPtr<CSSValue> valueForGridPosition(const GridPosition& position)
1160 {
1161     if (position.isAuto())
1162         return cssValuePool().createIdentifierValue(CSSValueAuto);
1163
1164     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1165     if (position.isSpan()) {
1166         list->append(cssValuePool().createIdentifierValue(CSSValueSpan));
1167         list->append(cssValuePool().createValue(position.spanPosition(), CSSPrimitiveValue::CSS_NUMBER));
1168     } else
1169         list->append(cssValuePool().createValue(position.integerPosition(), CSSPrimitiveValue::CSS_NUMBER));
1170
1171     if (!position.namedGridLine().isNull())
1172         list->append(cssValuePool().createValue(position.namedGridLine(), CSSPrimitiveValue::CSS_STRING));
1173     return list.release();
1174 }
1175
1176 static PassRefPtr<CSSValue> createTransitionPropertyValue(const Animation& animation)
1177 {
1178     RefPtr<CSSValue> propertyValue;
1179     if (animation.animationMode() == Animation::AnimateNone)
1180         propertyValue = cssValuePool().createIdentifierValue(CSSValueNone);
1181     else if (animation.animationMode() == Animation::AnimateAll)
1182         propertyValue = cssValuePool().createIdentifierValue(CSSValueAll);
1183     else
1184         propertyValue = cssValuePool().createValue(getPropertyNameString(animation.property()), CSSPrimitiveValue::CSS_STRING);
1185     return propertyValue.release();
1186 }
1187
1188 static PassRefPtr<CSSValue> getTransitionPropertyValue(const AnimationList* animList)
1189 {
1190     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1191     if (animList) {
1192         for (size_t i = 0; i < animList->size(); ++i)
1193             list->append(createTransitionPropertyValue(animList->animation(i)));
1194     } else
1195         list->append(cssValuePool().createIdentifierValue(CSSValueAll));
1196     return list.release();
1197 }
1198
1199 static PassRefPtr<CSSValue> getDelayValue(const AnimationList* animList)
1200 {
1201     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1202     if (animList) {
1203         for (size_t i = 0; i < animList->size(); ++i)
1204             list->append(cssValuePool().createValue(animList->animation(i).delay(), CSSPrimitiveValue::CSS_S));
1205     } else {
1206         // Note that initialAnimationDelay() is used for both transitions and animations
1207         list->append(cssValuePool().createValue(Animation::initialAnimationDelay(), CSSPrimitiveValue::CSS_S));
1208     }
1209     return list.release();
1210 }
1211
1212 static PassRefPtr<CSSValue> getDurationValue(const AnimationList* animList)
1213 {
1214     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1215     if (animList) {
1216         for (size_t i = 0; i < animList->size(); ++i)
1217             list->append(cssValuePool().createValue(animList->animation(i).duration(), CSSPrimitiveValue::CSS_S));
1218     } else {
1219         // Note that initialAnimationDuration() is used for both transitions and animations
1220         list->append(cssValuePool().createValue(Animation::initialAnimationDuration(), CSSPrimitiveValue::CSS_S));
1221     }
1222     return list.release();
1223 }
1224
1225 static PassRefPtr<CSSValue> createTimingFunctionValue(const TimingFunction* timingFunction)
1226 {
1227     switch (timingFunction->type()) {
1228     case TimingFunction::CubicBezierFunction: {
1229         const CubicBezierTimingFunction* bezierTimingFunction = static_cast<const CubicBezierTimingFunction*>(timingFunction);
1230         if (bezierTimingFunction->timingFunctionPreset() != CubicBezierTimingFunction::Custom) {
1231             CSSValueID valueId = CSSValueInvalid;
1232             switch (bezierTimingFunction->timingFunctionPreset()) {
1233             case CubicBezierTimingFunction::Ease:
1234                 valueId = CSSValueEase;
1235                 break;
1236             case CubicBezierTimingFunction::EaseIn:
1237                 valueId = CSSValueEaseIn;
1238                 break;
1239             case CubicBezierTimingFunction::EaseOut:
1240                 valueId = CSSValueEaseOut;
1241                 break;
1242             case CubicBezierTimingFunction::EaseInOut:
1243                 valueId = CSSValueEaseInOut;
1244                 break;
1245             default:
1246                 ASSERT_NOT_REACHED();
1247                 return 0;
1248             }
1249             return cssValuePool().createIdentifierValue(valueId);
1250         }
1251         return CSSCubicBezierTimingFunctionValue::create(bezierTimingFunction->x1(), bezierTimingFunction->y1(), bezierTimingFunction->x2(), bezierTimingFunction->y2());
1252     }
1253     case TimingFunction::StepsFunction: {
1254         const StepsTimingFunction* stepsTimingFunction = static_cast<const StepsTimingFunction*>(timingFunction);
1255         return CSSStepsTimingFunctionValue::create(stepsTimingFunction->numberOfSteps(), stepsTimingFunction->stepAtStart());
1256     }
1257     case TimingFunction::LinearFunction:
1258         return cssValuePool().createIdentifierValue(CSSValueLinear);
1259     }
1260     ASSERT_NOT_REACHED();
1261     return 0;
1262 }
1263
1264 static PassRefPtr<CSSValue> getTimingFunctionValue(const AnimationList* animList)
1265 {
1266     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1267     if (animList) {
1268         for (size_t i = 0; i < animList->size(); ++i)
1269             list->append(createTimingFunctionValue(animList->animation(i).timingFunction().get()));
1270     } else
1271         // Note that initialAnimationTimingFunction() is used for both transitions and animations
1272         list->append(createTimingFunctionValue(Animation::initialAnimationTimingFunction().get()));
1273     return list.release();
1274 }
1275
1276 static PassRefPtr<CSSValue> createLineBoxContainValue(unsigned lineBoxContain)
1277 {
1278     if (!lineBoxContain)
1279         return cssValuePool().createIdentifierValue(CSSValueNone);
1280     return CSSLineBoxContainValue::create(lineBoxContain);
1281 }
1282
1283 ComputedStyleExtractor::ComputedStyleExtractor(PassRefPtr<Node> node, bool allowVisitedStyle, PseudoId pseudoElementSpecifier)
1284     : m_node(node)
1285     , m_pseudoElementSpecifier(pseudoElementSpecifier)
1286     , m_allowVisitedStyle(allowVisitedStyle)
1287 {
1288 }
1289
1290
1291 CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n, bool allowVisitedStyle, const String& pseudoElementName)
1292     : m_node(n)
1293     , m_allowVisitedStyle(allowVisitedStyle)
1294     , m_refCount(1)
1295 {
1296     unsigned nameWithoutColonsStart = pseudoElementName[0] == ':' ? (pseudoElementName[1] == ':' ? 2 : 1) : 0;
1297     m_pseudoElementSpecifier = CSSSelector::pseudoId(CSSSelector::parsePseudoType(
1298         AtomicString(pseudoElementName.substring(nameWithoutColonsStart))));
1299 }
1300
1301 CSSComputedStyleDeclaration::~CSSComputedStyleDeclaration()
1302 {
1303 }
1304
1305 void CSSComputedStyleDeclaration::ref()
1306 {
1307     ++m_refCount;
1308 }
1309
1310 void CSSComputedStyleDeclaration::deref()
1311 {
1312     ASSERT(m_refCount);
1313     if (!--m_refCount)
1314         delete this;
1315 }
1316
1317 String CSSComputedStyleDeclaration::cssText() const
1318 {
1319     StringBuilder result;
1320
1321     for (unsigned i = 0; i < numComputedProperties; i++) {
1322         if (i)
1323             result.append(' ');
1324         result.append(getPropertyName(computedProperties[i]));
1325         result.append(": ", 2);
1326         result.append(getPropertyValue(computedProperties[i]));
1327         result.append(';');
1328     }
1329
1330     return result.toString();
1331 }
1332
1333 void CSSComputedStyleDeclaration::setCssText(const String&, ExceptionCode& ec)
1334 {
1335     ec = NO_MODIFICATION_ALLOWED_ERR;
1336 }
1337
1338 static CSSValueID cssIdentifierForFontSizeKeyword(int keywordSize)
1339 {
1340     ASSERT_ARG(keywordSize, keywordSize);
1341     ASSERT_ARG(keywordSize, keywordSize <= 8);
1342     return static_cast<CSSValueID>(CSSValueXxSmall + keywordSize - 1);
1343 }
1344
1345 PassRefPtr<CSSPrimitiveValue> ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword() const
1346 {
1347     if (!m_node)
1348         return 0;
1349
1350     m_node->document().updateLayoutIgnorePendingStylesheets();
1351
1352     RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier);
1353     if (!style)
1354         return 0;
1355
1356     if (int keywordSize = style->fontDescription().keywordSize())
1357         return cssValuePool().createIdentifierValue(cssIdentifierForFontSizeKeyword(keywordSize));
1358
1359     return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style.get());
1360 }
1361
1362 bool ComputedStyleExtractor::useFixedFontDefaultSize() const
1363 {
1364     if (!m_node)
1365         return false;
1366
1367     RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier);
1368     if (!style)
1369         return false;
1370
1371     return style->fontDescription().useFixedDefaultSize();
1372 }
1373
1374
1375 static CSSValueID identifierForFamily(const AtomicString& family)
1376 {
1377     if (family == cursiveFamily)
1378         return CSSValueCursive;
1379     if (family == fantasyFamily)
1380         return CSSValueFantasy;
1381     if (family == monospaceFamily)
1382         return CSSValueMonospace;
1383     if (family == pictographFamily)
1384         return CSSValueWebkitPictograph;
1385     if (family == sansSerifFamily)
1386         return CSSValueSansSerif;
1387     if (family == serifFamily)
1388         return CSSValueSerif;
1389     return CSSValueInvalid;
1390 }
1391
1392 static PassRefPtr<CSSPrimitiveValue> valueForFamily(const AtomicString& family)
1393 {
1394     if (CSSValueID familyIdentifier = identifierForFamily(family))
1395         return cssValuePool().createIdentifierValue(familyIdentifier);
1396     return cssValuePool().createValue(family.string(), CSSPrimitiveValue::CSS_STRING);
1397 }
1398
1399 static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration)
1400 {
1401     // Blink value is ignored.
1402     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1403     if (textDecoration & TextDecorationUnderline)
1404         list->append(cssValuePool().createIdentifierValue(CSSValueUnderline));
1405     if (textDecoration & TextDecorationOverline)
1406         list->append(cssValuePool().createIdentifierValue(CSSValueOverline));
1407     if (textDecoration & TextDecorationLineThrough)
1408         list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough));
1409
1410     if (!list->length())
1411         return cssValuePool().createIdentifierValue(CSSValueNone);
1412     return list.release();
1413 }
1414
1415 #if ENABLE(CSS3_TEXT)
1416 static PassRefPtr<CSSValue> renderTextDecorationStyleFlagsToCSSValue(TextDecorationStyle textDecorationStyle)
1417 {
1418     switch (textDecorationStyle) {
1419     case TextDecorationStyleSolid:
1420         return cssValuePool().createIdentifierValue(CSSValueSolid);
1421     case TextDecorationStyleDouble:
1422         return cssValuePool().createIdentifierValue(CSSValueDouble);
1423     case TextDecorationStyleDotted:
1424         return cssValuePool().createIdentifierValue(CSSValueDotted);
1425     case TextDecorationStyleDashed:
1426         return cssValuePool().createIdentifierValue(CSSValueDashed);
1427     case TextDecorationStyleWavy:
1428         return cssValuePool().createIdentifierValue(CSSValueWavy);
1429     }
1430
1431     ASSERT_NOT_REACHED();
1432     return cssValuePool().createExplicitInitialValue();
1433 }
1434 #endif // CSS3_TEXT
1435
1436 static PassRefPtr<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat)
1437 {
1438     // For backwards compatibility, if both values are equal, just return one of them. And
1439     // if the two values are equivalent to repeat-x or repeat-y, just return the shorthand.
1440     if (xRepeat == yRepeat)
1441         return cssValuePool().createValue(xRepeat);
1442     if (xRepeat == RepeatFill && yRepeat == NoRepeatFill)
1443         return cssValuePool().createIdentifierValue(CSSValueRepeatX);
1444     if (xRepeat == NoRepeatFill && yRepeat == RepeatFill)
1445         return cssValuePool().createIdentifierValue(CSSValueRepeatY);
1446
1447     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1448     list->append(cssValuePool().createValue(xRepeat));
1449     list->append(cssValuePool().createValue(yRepeat));
1450     return list.release();
1451 }
1452
1453 static PassRefPtr<CSSValue> fillSourceTypeToCSSValue(EMaskSourceType type)
1454 {
1455     switch (type) {
1456     case MaskAlpha:
1457         return cssValuePool().createValue(CSSValueAlpha);
1458     case MaskLuminance:
1459         return cssValuePool().createValue(CSSValueLuminance);
1460     }
1461
1462     ASSERT_NOT_REACHED();
1463
1464     return 0;
1465 }
1466 static PassRefPtr<CSSValue> fillSizeToCSSValue(const FillSize& fillSize, const RenderStyle* style)
1467 {
1468     if (fillSize.type == Contain)
1469         return cssValuePool().createIdentifierValue(CSSValueContain);
1470
1471     if (fillSize.type == Cover)
1472         return cssValuePool().createIdentifierValue(CSSValueCover);
1473
1474     if (fillSize.size.height().isAuto())
1475         return zoomAdjustedPixelValueForLength(fillSize.size.width(), style);
1476
1477     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1478     list->append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style));
1479     list->append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style));
1480     return list.release();
1481 }
1482
1483 static PassRefPtr<CSSValue> contentToCSSValue(const RenderStyle* style)
1484 {
1485     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1486     for (const ContentData* contentData = style->contentData(); contentData; contentData = contentData->next()) {
1487         if (contentData->isCounter()) {
1488             const CounterContent* counter = static_cast<const CounterContentData*>(contentData)->counter();
1489             ASSERT(counter);
1490             list->append(cssValuePool().createValue(counter->identifier(), CSSPrimitiveValue::CSS_COUNTER_NAME));
1491         } else if (contentData->isImage()) {
1492             const StyleImage* image = static_cast<const ImageContentData*>(contentData)->image();
1493             ASSERT(image);
1494             list->append(image->cssValue());
1495         } else if (contentData->isText())
1496             list->append(cssValuePool().createValue(static_cast<const TextContentData*>(contentData)->text(), CSSPrimitiveValue::CSS_STRING));
1497     }
1498     if (!style->regionThread().isNull())
1499         list->append(cssValuePool().createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING));
1500     return list.release();
1501 }
1502
1503 static PassRefPtr<CSSValue> counterToCSSValue(const RenderStyle* style, CSSPropertyID propertyID)
1504 {
1505     const CounterDirectiveMap* map = style->counterDirectives();
1506     if (!map)
1507         return 0;
1508
1509     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1510     for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end(); ++it) {
1511         list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_STRING));
1512         short number = propertyID == CSSPropertyCounterIncrement ? it->value.incrementValue() : it->value.resetValue();
1513         list->append(cssValuePool().createValue((double)number, CSSPrimitiveValue::CSS_NUMBER));
1514     }
1515     return list.release();
1516 }
1517
1518 static void logUnimplementedPropertyID(CSSPropertyID propertyID)
1519 {
1520     DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ());
1521     if (!propertyIDSet.add(propertyID).isNewEntry)
1522         return;
1523
1524     LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(propertyID));
1525 }
1526
1527 static PassRefPtr<CSSValueList> fontFamilyFromStyle(RenderStyle* style)
1528     {
1529     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1530     for (unsigned i = 0; i < style->font().familyCount(); ++i)
1531         list->append(valueForFamily(style->font().familyAt(i)));
1532     return list.release();
1533 }
1534
1535 static PassRefPtr<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, RenderView* renderView)
1536 {
1537     Length length = style->lineHeight();
1538     if (length.isNegative())
1539         return cssValuePool().createIdentifierValue(CSSValueNormal);
1540     if (length.isPercent())
1541         // This is imperfect, because it doesn't include the zoom factor and the real computation
1542         // for how high to be in pixels does include things like minimum font size and the zoom factor.
1543         // On the other hand, since font-size doesn't include the zoom factor, we really can't do
1544         // that here either.
1545         return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style);
1546     return zoomAdjustedPixelValue(valueForLength(length, 0, renderView), style);
1547 }
1548
1549 static PassRefPtr<CSSPrimitiveValue> fontSizeFromStyle(RenderStyle* style)
1550 {
1551     return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style);
1552 }
1553
1554 static PassRefPtr<CSSPrimitiveValue> fontStyleFromStyle(RenderStyle* style)
1555 {
1556     if (style->fontDescription().italic())
1557         return cssValuePool().createIdentifierValue(CSSValueItalic);
1558     return cssValuePool().createIdentifierValue(CSSValueNormal);
1559 }
1560
1561 static PassRefPtr<CSSPrimitiveValue> fontVariantFromStyle(RenderStyle* style)
1562 {
1563     if (style->fontDescription().smallCaps())
1564         return cssValuePool().createIdentifierValue(CSSValueSmallCaps);
1565     return cssValuePool().createIdentifierValue(CSSValueNormal);
1566 }
1567
1568 static PassRefPtr<CSSPrimitiveValue> fontWeightFromStyle(RenderStyle* style)
1569 {
1570     switch (style->fontDescription().weight()) {
1571     case FontWeight100:
1572         return cssValuePool().createIdentifierValue(CSSValue100);
1573     case FontWeight200:
1574         return cssValuePool().createIdentifierValue(CSSValue200);
1575     case FontWeight300:
1576         return cssValuePool().createIdentifierValue(CSSValue300);
1577     case FontWeightNormal:
1578         return cssValuePool().createIdentifierValue(CSSValueNormal);
1579     case FontWeight500:
1580         return cssValuePool().createIdentifierValue(CSSValue500);
1581     case FontWeight600:
1582         return cssValuePool().createIdentifierValue(CSSValue600);
1583     case FontWeightBold:
1584         return cssValuePool().createIdentifierValue(CSSValueBold);
1585     case FontWeight800:
1586         return cssValuePool().createIdentifierValue(CSSValue800);
1587     case FontWeight900:
1588         return cssValuePool().createIdentifierValue(CSSValue900);
1589     }
1590     ASSERT_NOT_REACHED();
1591     return cssValuePool().createIdentifierValue(CSSValueNormal);
1592 }
1593
1594 typedef const Length& (RenderStyle::*RenderStyleLengthGetter)() const;
1595 typedef LayoutUnit (RenderBoxModelObject::*RenderBoxComputedCSSValueGetter)() const;
1596
1597 template<RenderStyleLengthGetter lengthGetter, RenderBoxComputedCSSValueGetter computedCSSValueGetter>
1598 inline PassRefPtr<CSSValue> zoomAdjustedPaddingOrMarginPixelValue(RenderStyle* style, RenderObject* renderer)
1599 {
1600     Length unzoomzedLength = (style->*lengthGetter)();
1601     if (!renderer || !renderer->isBox() || unzoomzedLength.isFixed())
1602         return zoomAdjustedPixelValueForLength(unzoomzedLength, style);
1603     return zoomAdjustedPixelValue((toRenderBox(renderer)->*computedCSSValueGetter)(), style);
1604 }
1605
1606 template<RenderStyleLengthGetter lengthGetter>
1607 inline bool paddingOrMarginIsRendererDependent(RenderStyle* style, RenderObject* renderer)
1608 {
1609     if (!renderer || !renderer->isBox())
1610         return false;
1611     return !(style && (style->*lengthGetter)().isFixed());
1612 }
1613
1614 static bool isLayoutDependent(CSSPropertyID propertyID, RenderStyle* style, RenderObject* renderer)
1615 {
1616     switch (propertyID) {
1617     case CSSPropertyWidth:
1618     case CSSPropertyHeight:
1619     case CSSPropertyWebkitPerspectiveOrigin:
1620     case CSSPropertyWebkitTransformOrigin:
1621     case CSSPropertyWebkitTransform:
1622 #if ENABLE(CSS_FILTERS)
1623     case CSSPropertyWebkitFilter:
1624 #endif
1625         return true;
1626     case CSSPropertyMargin: {
1627         if (!renderer || !renderer->isBox())
1628             return false;
1629         return !(style && style->marginTop().isFixed() && style->marginRight().isFixed()
1630             && style->marginBottom().isFixed() && style->marginLeft().isFixed());
1631     }
1632     case CSSPropertyMarginTop:
1633         return paddingOrMarginIsRendererDependent<&RenderStyle::marginTop>(style, renderer);
1634     case CSSPropertyMarginRight:
1635         return paddingOrMarginIsRendererDependent<&RenderStyle::marginRight>(style, renderer);
1636     case CSSPropertyMarginBottom:
1637         return paddingOrMarginIsRendererDependent<&RenderStyle::marginBottom>(style, renderer);
1638     case CSSPropertyMarginLeft:
1639         return paddingOrMarginIsRendererDependent<&RenderStyle::marginLeft>(style, renderer);
1640     case CSSPropertyPadding: {
1641         if (!renderer || !renderer->isBox())
1642             return false;
1643         return !(style && style->paddingTop().isFixed() && style->paddingRight().isFixed()
1644             && style->paddingBottom().isFixed() && style->paddingLeft().isFixed());
1645     }
1646     case CSSPropertyPaddingTop:
1647         return paddingOrMarginIsRendererDependent<&RenderStyle::paddingTop>(style, renderer);
1648     case CSSPropertyPaddingRight:
1649         return paddingOrMarginIsRendererDependent<&RenderStyle::paddingRight>(style, renderer);
1650     case CSSPropertyPaddingBottom:
1651         return paddingOrMarginIsRendererDependent<&RenderStyle::paddingBottom>(style, renderer);
1652     case CSSPropertyPaddingLeft:
1653         return paddingOrMarginIsRendererDependent<&RenderStyle::paddingLeft>(style, renderer); 
1654     default:
1655         return false;
1656     }
1657 }
1658
1659 Node* ComputedStyleExtractor::styledNode() const
1660 {
1661     if (!m_node)
1662         return 0;
1663     if (!m_node->isElementNode())
1664         return m_node.get();
1665     Element* element = toElement(m_node.get());
1666     PseudoElement* pseudoElement;
1667     if (m_pseudoElementSpecifier == BEFORE && (pseudoElement = element->beforePseudoElement()))
1668         return pseudoElement;
1669     if (m_pseudoElementSpecifier == AFTER && (pseudoElement = element->afterPseudoElement()))
1670         return pseudoElement;
1671     return element;
1672 }
1673
1674 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
1675 {
1676     return ComputedStyleExtractor(m_node, m_allowVisitedStyle, m_pseudoElementSpecifier).propertyValue(propertyID, updateLayout);
1677 }
1678
1679 PassRefPtr<MutableStylePropertySet> CSSComputedStyleDeclaration::copyProperties() const
1680 {
1681     return ComputedStyleExtractor(m_node, m_allowVisitedStyle, m_pseudoElementSpecifier).copyProperties();
1682 }
1683
1684 static inline bool nodeOrItsAncestorNeedsStyleRecalc(Node* styledNode)
1685 {
1686     if (styledNode->document().hasPendingForcedStyleRecalc())
1687         return true;
1688     for (Node* n = styledNode; n; n = n->parentNode()) {// FIXME: Call parentOrShadowHostNode() instead
1689         if (n->needsStyleRecalc())
1690             return true;
1691     }
1692     return false;
1693 }
1694
1695 static inline PassRefPtr<RenderStyle> computeRenderStyleForProperty(Node* styledNode, PseudoId pseudoElementSpecifier, CSSPropertyID propertyID)
1696 {
1697     RenderObject* renderer = styledNode->renderer();
1698
1699     if (renderer && renderer->isComposited() && AnimationController::supportsAcceleratedAnimationOfProperty(propertyID)) {
1700         AnimationUpdateBlock animationUpdateBlock(&renderer->animation());
1701         RefPtr<RenderStyle> style = renderer->animation().getAnimatedStyleForRenderer(toRenderElement(renderer));
1702         if (pseudoElementSpecifier && !styledNode->isPseudoElement()) {
1703             // FIXME: This cached pseudo style will only exist if the animation has been run at least once.
1704             return style->getCachedPseudoStyle(pseudoElementSpecifier);
1705         }
1706         return style.release();
1707     }
1708
1709     return styledNode->computedStyle(styledNode->isPseudoElement() ? NOPSEUDO : pseudoElementSpecifier);
1710 }
1711
1712 PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
1713 {
1714     Node* styledNode = this->styledNode();
1715     if (!styledNode)
1716         return 0;
1717
1718     RefPtr<RenderStyle> style;
1719     RenderObject* renderer = 0;
1720     bool forceFullLayout = false;
1721     if (updateLayout) {
1722         Document& document = styledNode->document();
1723
1724         if (nodeOrItsAncestorNeedsStyleRecalc(styledNode)) {
1725             document.updateStyleIfNeeded();
1726             // The style recalc could have caused the styled node to be discarded or replaced
1727             // if it was a PseudoElement so we need to update it.
1728             styledNode = this->styledNode();
1729         }
1730
1731         style = computeRenderStyleForProperty(styledNode, m_pseudoElementSpecifier, propertyID);
1732         renderer = styledNode->renderer();
1733
1734         // FIXME: Some of these cases could be narrowed down or optimized better.
1735         forceFullLayout = isLayoutDependent(propertyID, style.get(), renderer)
1736             || styledNode->isInShadowTree()
1737             || (document.styleResolverIfExists() && document.styleResolverIfExists()->hasViewportDependentMediaQueries() && document.ownerElement())
1738             || document.seamlessParentIFrame();
1739
1740         if (forceFullLayout) {
1741             document.updateLayoutIgnorePendingStylesheets();
1742             styledNode = this->styledNode();
1743         }
1744     }
1745
1746     if (!updateLayout || forceFullLayout) {
1747         style = computeRenderStyleForProperty(styledNode, m_pseudoElementSpecifier, propertyID);
1748         renderer = styledNode->renderer();
1749     }
1750
1751     if (!style)
1752         return 0;
1753
1754     propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction(), style->writingMode());
1755
1756     switch (propertyID) {
1757         case CSSPropertyInvalid:
1758 #if ENABLE(CSS_VARIABLES)
1759         case CSSPropertyVariable:
1760 #endif
1761             break;
1762
1763         case CSSPropertyBackgroundColor:
1764             return cssValuePool().createColorValue(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor().rgb());
1765         case CSSPropertyBackgroundImage:
1766         case CSSPropertyWebkitMaskImage: {
1767             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskImage ? style->maskLayers() : style->backgroundLayers();
1768             if (!layers)
1769                 return cssValuePool().createIdentifierValue(CSSValueNone);
1770
1771             if (!layers->next()) {
1772                 if (layers->image())
1773                     return layers->image()->cssValue();
1774
1775                 return cssValuePool().createIdentifierValue(CSSValueNone);
1776             }
1777
1778             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1779             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
1780                 if (currLayer->image())
1781                     list->append(currLayer->image()->cssValue());
1782                 else
1783                     list->append(cssValuePool().createIdentifierValue(CSSValueNone));
1784             }
1785             return list.release();
1786         }
1787         case CSSPropertyBackgroundSize:
1788         case CSSPropertyWebkitBackgroundSize:
1789         case CSSPropertyWebkitMaskSize: {
1790             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskSize ? style->maskLayers() : style->backgroundLayers();
1791             if (!layers->next())
1792                 return fillSizeToCSSValue(layers->size(), style.get());
1793
1794             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1795             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1796                 list->append(fillSizeToCSSValue(currLayer->size(), style.get()));
1797
1798             return list.release();
1799         }
1800         case CSSPropertyBackgroundRepeat:
1801         case CSSPropertyWebkitMaskRepeat: {
1802             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskRepeat ? style->maskLayers() : style->backgroundLayers();
1803             if (!layers->next())
1804                 return fillRepeatToCSSValue(layers->repeatX(), layers->repeatY());
1805
1806             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1807             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1808                 list->append(fillRepeatToCSSValue(currLayer->repeatX(), currLayer->repeatY()));
1809
1810             return list.release();
1811         }
1812         case CSSPropertyWebkitMaskSourceType: {
1813             const FillLayer* layers = style->maskLayers();
1814
1815             if (!layers)
1816                 return cssValuePool().createIdentifierValue(CSSValueNone);
1817
1818             if (!layers->next())
1819                 return fillSourceTypeToCSSValue(layers->maskSourceType());
1820
1821             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1822             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1823                 list->append(fillSourceTypeToCSSValue(currLayer->maskSourceType()));
1824
1825             return list.release();
1826         }
1827         case CSSPropertyWebkitBackgroundComposite:
1828         case CSSPropertyWebkitMaskComposite: {
1829             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskComposite ? style->maskLayers() : style->backgroundLayers();
1830             if (!layers->next())
1831                 return cssValuePool().createValue(layers->composite());
1832
1833             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1834             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1835                 list->append(cssValuePool().createValue(currLayer->composite()));
1836
1837             return list.release();
1838         }
1839         case CSSPropertyBackgroundAttachment: {
1840             const FillLayer* layers = style->backgroundLayers();
1841             if (!layers->next())
1842                 return cssValuePool().createValue(layers->attachment());
1843
1844             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1845             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1846                 list->append(cssValuePool().createValue(currLayer->attachment()));
1847
1848             return list.release();
1849         }
1850         case CSSPropertyBackgroundClip:
1851         case CSSPropertyBackgroundOrigin:
1852         case CSSPropertyWebkitBackgroundClip:
1853         case CSSPropertyWebkitBackgroundOrigin:
1854         case CSSPropertyWebkitMaskClip:
1855         case CSSPropertyWebkitMaskOrigin: {
1856             const FillLayer* layers = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? style->maskLayers() : style->backgroundLayers();
1857             bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == CSSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip;
1858             if (!layers->next()) {
1859                 EFillBox box = isClip ? layers->clip() : layers->origin();
1860                 return cssValuePool().createValue(box);
1861             }
1862
1863             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1864             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
1865                 EFillBox box = isClip ? currLayer->clip() : currLayer->origin();
1866                 list->append(cssValuePool().createValue(box));
1867             }
1868
1869             return list.release();
1870         }
1871         case CSSPropertyBackgroundPosition:
1872         case CSSPropertyWebkitMaskPosition: {
1873             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPosition ? style->maskLayers() : style->backgroundLayers();
1874             if (!layers->next())
1875                 return createPositionListForLayer(propertyID, layers, style.get());
1876
1877             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1878             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1879                 list->append(createPositionListForLayer(propertyID, currLayer, style.get()));
1880             return list.release();
1881         }
1882         case CSSPropertyBackgroundPositionX:
1883         case CSSPropertyWebkitMaskPositionX: {
1884             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionX ? style->maskLayers() : style->backgroundLayers();
1885             if (!layers->next())
1886                 return cssValuePool().createValue(layers->xPosition());
1887
1888             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1889             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1890                 list->append(cssValuePool().createValue(currLayer->xPosition()));
1891
1892             return list.release();
1893         }
1894         case CSSPropertyBackgroundPositionY:
1895         case CSSPropertyWebkitMaskPositionY: {
1896             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionY ? style->maskLayers() : style->backgroundLayers();
1897             if (!layers->next())
1898                 return cssValuePool().createValue(layers->yPosition());
1899
1900             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1901             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1902                 list->append(cssValuePool().createValue(currLayer->yPosition()));
1903
1904             return list.release();
1905         }
1906         case CSSPropertyBorderCollapse:
1907             if (style->borderCollapse())
1908                 return cssValuePool().createIdentifierValue(CSSValueCollapse);
1909             return cssValuePool().createIdentifierValue(CSSValueSeparate);
1910         case CSSPropertyBorderSpacing: {
1911             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1912             list->append(zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get()));
1913             list->append(zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get()));
1914             return list.release();
1915         }
1916         case CSSPropertyWebkitBorderHorizontalSpacing:
1917             return zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get());
1918         case CSSPropertyWebkitBorderVerticalSpacing:
1919             return zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get());
1920         case CSSPropertyBorderImageSource:
1921             if (style->borderImageSource())
1922                 return style->borderImageSource()->cssValue();
1923             return cssValuePool().createIdentifierValue(CSSValueNone);
1924         case CSSPropertyBorderTopColor:
1925             return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidColor(style.get(), style->borderTopColor());
1926         case CSSPropertyBorderRightColor:
1927             return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderRightColor).rgb()) : currentColorOrValidColor(style.get(), style->borderRightColor());
1928         case CSSPropertyBorderBottomColor:
1929             return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderBottomColor).rgb()) : currentColorOrValidColor(style.get(), style->borderBottomColor());
1930         case CSSPropertyBorderLeftColor:
1931             return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderLeftColor).rgb()) : currentColorOrValidColor(style.get(), style->borderLeftColor());
1932         case CSSPropertyBorderTopStyle:
1933             return cssValuePool().createValue(style->borderTopStyle());
1934         case CSSPropertyBorderRightStyle:
1935             return cssValuePool().createValue(style->borderRightStyle());
1936         case CSSPropertyBorderBottomStyle:
1937             return cssValuePool().createValue(style->borderBottomStyle());
1938         case CSSPropertyBorderLeftStyle:
1939             return cssValuePool().createValue(style->borderLeftStyle());
1940         case CSSPropertyBorderTopWidth:
1941             return zoomAdjustedPixelValue(style->borderTopWidth(), style.get());
1942         case CSSPropertyBorderRightWidth:
1943             return zoomAdjustedPixelValue(style->borderRightWidth(), style.get());
1944         case CSSPropertyBorderBottomWidth:
1945             return zoomAdjustedPixelValue(style->borderBottomWidth(), style.get());
1946         case CSSPropertyBorderLeftWidth:
1947             return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get());
1948         case CSSPropertyBottom:
1949             return getPositionOffsetValue(style.get(), CSSPropertyBottom, m_node->document().renderView());
1950         case CSSPropertyWebkitBoxAlign:
1951             return cssValuePool().createValue(style->boxAlign());
1952 #if ENABLE(CSS_BOX_DECORATION_BREAK)
1953         case CSSPropertyWebkitBoxDecorationBreak:
1954             if (style->boxDecorationBreak() == DSLICE)
1955                 return cssValuePool().createIdentifierValue(CSSValueSlice);
1956         return cssValuePool().createIdentifierValue(CSSValueClone);
1957 #endif
1958         case CSSPropertyWebkitBoxDirection:
1959             return cssValuePool().createValue(style->boxDirection());
1960         case CSSPropertyWebkitBoxFlex:
1961             return cssValuePool().createValue(style->boxFlex(), CSSPrimitiveValue::CSS_NUMBER);
1962         case CSSPropertyWebkitBoxFlexGroup:
1963             return cssValuePool().createValue(style->boxFlexGroup(), CSSPrimitiveValue::CSS_NUMBER);
1964         case CSSPropertyWebkitBoxLines:
1965             return cssValuePool().createValue(style->boxLines());
1966         case CSSPropertyWebkitBoxOrdinalGroup:
1967             return cssValuePool().createValue(style->boxOrdinalGroup(), CSSPrimitiveValue::CSS_NUMBER);
1968         case CSSPropertyWebkitBoxOrient:
1969             return cssValuePool().createValue(style->boxOrient());
1970         case CSSPropertyWebkitBoxPack:
1971             return cssValuePool().createValue(style->boxPack());
1972         case CSSPropertyWebkitBoxReflect:
1973             return valueForReflection(style->boxReflect(), style.get());
1974         case CSSPropertyBoxShadow:
1975         case CSSPropertyWebkitBoxShadow:
1976             return valueForShadow(style->boxShadow(), propertyID, style.get());
1977         case CSSPropertyCaptionSide:
1978             return cssValuePool().createValue(style->captionSide());
1979         case CSSPropertyClear:
1980             return cssValuePool().createValue(style->clear());
1981         case CSSPropertyColor:
1982             return cssValuePool().createColorValue(m_allowVisitedStyle ? style->visitedDependentColor(CSSPropertyColor).rgb() : style->color().rgb());
1983         case CSSPropertyWebkitPrintColorAdjust:
1984             return cssValuePool().createValue(style->printColorAdjust());
1985         case CSSPropertyWebkitColumnAxis:
1986             return cssValuePool().createValue(style->columnAxis());
1987         case CSSPropertyWebkitColumnCount:
1988             if (style->hasAutoColumnCount())
1989                 return cssValuePool().createIdentifierValue(CSSValueAuto);
1990             return cssValuePool().createValue(style->columnCount(), CSSPrimitiveValue::CSS_NUMBER);
1991         case CSSPropertyWebkitColumnGap:
1992             if (style->hasNormalColumnGap())
1993                 return cssValuePool().createIdentifierValue(CSSValueNormal);
1994             return zoomAdjustedPixelValue(style->columnGap(), style.get());
1995         case CSSPropertyWebkitColumnProgression:
1996             return cssValuePool().createValue(style->columnProgression());
1997         case CSSPropertyWebkitColumnRuleColor:
1998             return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->columnRuleColor());
1999         case CSSPropertyWebkitColumnRuleStyle:
2000             return cssValuePool().createValue(style->columnRuleStyle());
2001         case CSSPropertyWebkitColumnRuleWidth:
2002             return zoomAdjustedPixelValue(style->columnRuleWidth(), style.get());
2003         case CSSPropertyWebkitColumnSpan:
2004             return cssValuePool().createIdentifierValue(style->columnSpan() ? CSSValueAll : CSSValueNone);
2005         case CSSPropertyWebkitColumnBreakAfter:
2006             return cssValuePool().createValue(style->columnBreakAfter());
2007         case CSSPropertyWebkitColumnBreakBefore:
2008             return cssValuePool().createValue(style->columnBreakBefore());
2009         case CSSPropertyWebkitColumnBreakInside:
2010             return cssValuePool().createValue(style->columnBreakInside());
2011         case CSSPropertyWebkitColumnWidth:
2012             if (style->hasAutoColumnWidth())
2013                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2014             return zoomAdjustedPixelValue(style->columnWidth(), style.get());
2015         case CSSPropertyTabSize:
2016             return cssValuePool().createValue(style->tabSize(), CSSPrimitiveValue::CSS_NUMBER);
2017 #if ENABLE(CSS_REGIONS)
2018         case CSSPropertyWebkitRegionBreakAfter:
2019             return cssValuePool().createValue(style->regionBreakAfter());
2020         case CSSPropertyWebkitRegionBreakBefore:
2021             return cssValuePool().createValue(style->regionBreakBefore());
2022         case CSSPropertyWebkitRegionBreakInside:
2023             return cssValuePool().createValue(style->regionBreakInside());
2024 #endif
2025         case CSSPropertyCursor: {
2026             RefPtr<CSSValueList> list;
2027             CursorList* cursors = style->cursors();
2028             if (cursors && cursors->size() > 0) {
2029                 list = CSSValueList::createCommaSeparated();
2030                 for (unsigned i = 0; i < cursors->size(); ++i)
2031                     if (StyleImage* image = cursors->at(i).image())
2032                         list->append(image->cssValue());
2033             }
2034             RefPtr<CSSValue> value = cssValuePool().createValue(style->cursor());
2035             if (list) {
2036                 list->append(value.release());
2037                 return list.release();
2038             }
2039             return value.release();
2040         }
2041 #if ENABLE(CURSOR_VISIBILITY)
2042         case CSSPropertyWebkitCursorVisibility:
2043             return cssValuePool().createValue(style->cursorVisibility());
2044 #endif
2045         case CSSPropertyDirection:
2046             return cssValuePool().createValue(style->direction());
2047         case CSSPropertyDisplay:
2048             return cssValuePool().createValue(style->display());
2049         case CSSPropertyEmptyCells:
2050             return cssValuePool().createValue(style->emptyCells());
2051         case CSSPropertyWebkitAlignContent:
2052             return cssValuePool().createValue(style->alignContent());
2053         case CSSPropertyWebkitAlignItems:
2054             return cssValuePool().createValue(style->alignItems());
2055         case CSSPropertyWebkitAlignSelf:
2056             if (style->alignSelf() == AlignAuto) {
2057                 Node* parent = styledNode->parentNode();
2058                 if (parent && parent->computedStyle())
2059                     return cssValuePool().createValue(parent->computedStyle()->alignItems());
2060                 return cssValuePool().createValue(AlignStretch);
2061             }
2062             return cssValuePool().createValue(style->alignSelf());
2063         case CSSPropertyWebkitFlex:
2064             return getCSSPropertyValuesForShorthandProperties(webkitFlexShorthand());
2065         case CSSPropertyWebkitFlexBasis:
2066             return cssValuePool().createValue(style->flexBasis());
2067         case CSSPropertyWebkitFlexDirection:
2068             return cssValuePool().createValue(style->flexDirection());
2069         case CSSPropertyWebkitFlexFlow:
2070             return getCSSPropertyValuesForShorthandProperties(webkitFlexFlowShorthand());
2071         case CSSPropertyWebkitFlexGrow:
2072             return cssValuePool().createValue(style->flexGrow());
2073         case CSSPropertyWebkitFlexShrink:
2074             return cssValuePool().createValue(style->flexShrink());
2075         case CSSPropertyWebkitFlexWrap:
2076             return cssValuePool().createValue(style->flexWrap());
2077         case CSSPropertyWebkitJustifyContent:
2078             return cssValuePool().createValue(style->justifyContent());
2079         case CSSPropertyWebkitOrder:
2080             return cssValuePool().createValue(style->order(), CSSPrimitiveValue::CSS_NUMBER);
2081         case CSSPropertyFloat:
2082             if (style->display() != NONE && style->hasOutOfFlowPosition())
2083                 return cssValuePool().createIdentifierValue(CSSValueNone);
2084             return cssValuePool().createValue(style->floating());
2085         case CSSPropertyFont: {
2086             RefPtr<CSSFontValue> computedFont = CSSFontValue::create();
2087             computedFont->style = fontStyleFromStyle(style.get());
2088             computedFont->variant = fontVariantFromStyle(style.get());
2089             computedFont->weight = fontWeightFromStyle(style.get());
2090             computedFont->size = fontSizeFromStyle(style.get());
2091             computedFont->lineHeight = lineHeightFromStyle(style.get(), m_node->document().renderView());
2092             computedFont->family = fontFamilyFromStyle(style.get());
2093             return computedFont.release();
2094         }
2095         case CSSPropertyFontFamily: {
2096             RefPtr<CSSValueList> fontFamilyList = fontFamilyFromStyle(style.get());
2097             // If there's only a single family, return that as a CSSPrimitiveValue.
2098             // NOTE: Gecko always returns this as a comma-separated CSSPrimitiveValue string.
2099             if (fontFamilyList->length() == 1)
2100                 return fontFamilyList->item(0);
2101             return fontFamilyList.release();
2102         }
2103         case CSSPropertyFontSize:
2104             return fontSizeFromStyle(style.get());
2105         case CSSPropertyFontStyle:
2106             return fontStyleFromStyle(style.get());
2107         case CSSPropertyFontVariant:
2108             return fontVariantFromStyle(style.get());
2109         case CSSPropertyFontWeight:
2110             return fontWeightFromStyle(style.get());
2111         case CSSPropertyWebkitFontFeatureSettings: {
2112             const FontFeatureSettings* featureSettings = style->fontDescription().featureSettings();
2113             if (!featureSettings || !featureSettings->size())
2114                 return cssValuePool().createIdentifierValue(CSSValueNormal);
2115             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2116             for (unsigned i = 0; i < featureSettings->size(); ++i) {
2117                 const FontFeature& feature = featureSettings->at(i);
2118                 RefPtr<CSSFontFeatureValue> featureValue = CSSFontFeatureValue::create(feature.tag(), feature.value());
2119                 list->append(featureValue.release());
2120             }
2121             return list.release();
2122         }
2123         case CSSPropertyWebkitGridAutoColumns:
2124             return valueForGridTrackSize(style->gridAutoColumns(), style.get(), m_node->document().renderView());
2125         case CSSPropertyWebkitGridAutoFlow:
2126             return cssValuePool().createValue(style->gridAutoFlow());
2127         case CSSPropertyWebkitGridAutoRows:
2128             return valueForGridTrackSize(style->gridAutoRows(), style.get(), m_node->document().renderView());
2129         case CSSPropertyWebkitGridDefinitionColumns:
2130             return valueForGridTrackList(style->gridColumns(), style->namedGridColumnLines(), style.get(), m_node->document().renderView());
2131         case CSSPropertyWebkitGridDefinitionRows:
2132             return valueForGridTrackList(style->gridRows(), style->namedGridRowLines(), style.get(), m_node->document().renderView());
2133
2134         case CSSPropertyWebkitGridColumnStart:
2135             return valueForGridPosition(style->gridItemColumnStart());
2136         case CSSPropertyWebkitGridColumnEnd:
2137             return valueForGridPosition(style->gridItemColumnEnd());
2138         case CSSPropertyWebkitGridRowStart:
2139             return valueForGridPosition(style->gridItemRowStart());
2140         case CSSPropertyWebkitGridRowEnd:
2141             return valueForGridPosition(style->gridItemRowEnd());
2142         case CSSPropertyWebkitGridArea:
2143             return getCSSPropertyValuesForGridShorthand(webkitGridAreaShorthand());
2144         case CSSPropertyWebkitGridColumn:
2145             return getCSSPropertyValuesForGridShorthand(webkitGridColumnShorthand());
2146         case CSSPropertyWebkitGridRow:
2147             return getCSSPropertyValuesForGridShorthand(webkitGridRowShorthand());
2148
2149         case CSSPropertyWebkitGridTemplate:
2150             if (!style->namedGridAreaRowCount()) {
2151                 ASSERT(!style->namedGridAreaColumnCount());
2152                 return cssValuePool().createIdentifierValue(CSSValueNone);
2153             }
2154
2155             return CSSGridTemplateValue::create(style->namedGridArea(), style->namedGridAreaRowCount(), style->namedGridAreaColumnCount());
2156
2157         case CSSPropertyHeight:
2158             if (renderer) {
2159                 // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-property,
2160                 // the "height" property does not apply for non-replaced inline elements.
2161                 if (!renderer->isReplaced() && renderer->isInline())
2162                     return cssValuePool().createIdentifierValue(CSSValueAuto);
2163                 return zoomAdjustedPixelValue(sizingBox(renderer).height(), style.get());
2164             }
2165             return zoomAdjustedPixelValueForLength(style->height(), style.get());
2166         case CSSPropertyWebkitHighlight:
2167             if (style->highlight() == nullAtom)
2168                 return cssValuePool().createIdentifierValue(CSSValueNone);
2169             return cssValuePool().createValue(style->highlight(), CSSPrimitiveValue::CSS_STRING);
2170         case CSSPropertyWebkitHyphens:
2171             return cssValuePool().createValue(style->hyphens());
2172         case CSSPropertyWebkitHyphenateCharacter:
2173             if (style->hyphenationString().isNull())
2174                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2175             return cssValuePool().createValue(style->hyphenationString(), CSSPrimitiveValue::CSS_STRING);
2176         case CSSPropertyWebkitHyphenateLimitAfter:
2177             if (style->hyphenationLimitAfter() < 0)
2178                 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
2179             return CSSPrimitiveValue::create(style->hyphenationLimitAfter(), CSSPrimitiveValue::CSS_NUMBER);
2180         case CSSPropertyWebkitHyphenateLimitBefore:
2181             if (style->hyphenationLimitBefore() < 0)
2182                 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
2183             return CSSPrimitiveValue::create(style->hyphenationLimitBefore(), CSSPrimitiveValue::CSS_NUMBER);
2184         case CSSPropertyWebkitHyphenateLimitLines:
2185             if (style->hyphenationLimitLines() < 0)
2186                 return CSSPrimitiveValue::createIdentifier(CSSValueNoLimit);
2187             return CSSPrimitiveValue::create(style->hyphenationLimitLines(), CSSPrimitiveValue::CSS_NUMBER);
2188         case CSSPropertyWebkitBorderFit:
2189             if (style->borderFit() == BorderFitBorder)
2190                 return cssValuePool().createIdentifierValue(CSSValueBorder);
2191             return cssValuePool().createIdentifierValue(CSSValueLines);
2192 #if ENABLE(CSS_IMAGE_ORIENTATION)
2193         case CSSPropertyImageOrientation:
2194             return cssValuePool().createValue(style->imageOrientation());
2195 #endif
2196         case CSSPropertyImageRendering:
2197             return CSSPrimitiveValue::create(style->imageRendering());
2198 #if ENABLE(CSS_IMAGE_RESOLUTION)
2199         case CSSPropertyImageResolution:
2200             return cssValuePool().createValue(style->imageResolution(), CSSPrimitiveValue::CSS_DPPX);
2201 #endif
2202         case CSSPropertyLeft:
2203             return getPositionOffsetValue(style.get(), CSSPropertyLeft, m_node->document().renderView());
2204         case CSSPropertyLetterSpacing:
2205             if (!style->letterSpacing())
2206                 return cssValuePool().createIdentifierValue(CSSValueNormal);
2207             return zoomAdjustedPixelValue(style->letterSpacing(), style.get());
2208         case CSSPropertyWebkitLineClamp:
2209             if (style->lineClamp().isNone())
2210                 return cssValuePool().createIdentifierValue(CSSValueNone);
2211             return cssValuePool().createValue(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER);
2212         case CSSPropertyLineHeight:
2213             return lineHeightFromStyle(style.get(), m_node->document().renderView());
2214         case CSSPropertyListStyleImage:
2215             if (style->listStyleImage())
2216                 return style->listStyleImage()->cssValue();
2217             return cssValuePool().createIdentifierValue(CSSValueNone);
2218         case CSSPropertyListStylePosition:
2219             return cssValuePool().createValue(style->listStylePosition());
2220         case CSSPropertyListStyleType:
2221             return cssValuePool().createValue(style->listStyleType());
2222         case CSSPropertyWebkitLocale:
2223             if (style->locale().isNull())
2224                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2225             return cssValuePool().createValue(style->locale(), CSSPrimitiveValue::CSS_STRING);
2226         case CSSPropertyMarginTop:
2227             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::marginTop, &RenderBoxModelObject::marginTop>(style.get(), renderer);
2228         case CSSPropertyMarginRight: {
2229             Length marginRight = style->marginRight();
2230             if (marginRight.isFixed() || !renderer || !renderer->isBox())
2231                 return zoomAdjustedPixelValueForLength(marginRight, style.get());
2232             float value;
2233             if (marginRight.isPercent() || marginRight.isViewportPercentage())
2234                 // RenderBox gives a marginRight() that is the distance between the right-edge of the child box
2235                 // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
2236                 // value of the specified margin-right % instead of relying on RenderBox's marginRight() value.
2237                 value = minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent(), m_node->document().renderView());
2238             else
2239                 value = toRenderBox(renderer)->marginRight();
2240             return zoomAdjustedPixelValue(value, style.get());
2241         }
2242         case CSSPropertyMarginBottom:
2243             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::marginBottom, &RenderBoxModelObject::marginBottom>(style.get(), renderer);
2244         case CSSPropertyMarginLeft:
2245             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::marginLeft, &RenderBoxModelObject::marginLeft>(style.get(), renderer);
2246         case CSSPropertyWebkitMarqueeDirection:
2247             return cssValuePool().createValue(style->marqueeDirection());
2248         case CSSPropertyWebkitMarqueeIncrement:
2249             return cssValuePool().createValue(style->marqueeIncrement());
2250         case CSSPropertyWebkitMarqueeRepetition:
2251             if (style->marqueeLoopCount() < 0)
2252                 return cssValuePool().createIdentifierValue(CSSValueInfinite);
2253             return cssValuePool().createValue(style->marqueeLoopCount(), CSSPrimitiveValue::CSS_NUMBER);
2254         case CSSPropertyWebkitMarqueeStyle:
2255             return cssValuePool().createValue(style->marqueeBehavior());
2256         case CSSPropertyWebkitUserModify:
2257             return cssValuePool().createValue(style->userModify());
2258         case CSSPropertyMaxHeight: {
2259             const Length& maxHeight = style->maxHeight();
2260             if (maxHeight.isUndefined())
2261                 return cssValuePool().createIdentifierValue(CSSValueNone);
2262             return zoomAdjustedPixelValueForLength(maxHeight, style.get());
2263         }
2264         case CSSPropertyMaxWidth: {
2265             const Length& maxWidth = style->maxWidth();
2266             if (maxWidth.isUndefined())
2267                 return cssValuePool().createIdentifierValue(CSSValueNone);
2268             return zoomAdjustedPixelValueForLength(maxWidth, style.get());
2269         }
2270         case CSSPropertyMinHeight:
2271             // FIXME: For flex-items, min-height:auto should compute to min-content.
2272             if (style->minHeight().isAuto())
2273                 return zoomAdjustedPixelValue(0, style.get());
2274             return zoomAdjustedPixelValueForLength(style->minHeight(), style.get());
2275         case CSSPropertyMinWidth:
2276             // FIXME: For flex-items, min-width:auto should compute to min-content.
2277             if (style->minWidth().isAuto())
2278                 return zoomAdjustedPixelValue(0, style.get());
2279             return zoomAdjustedPixelValueForLength(style->minWidth(), style.get());
2280         case CSSPropertyObjectFit:
2281             return cssValuePool().createValue(style->objectFit());
2282         case CSSPropertyOpacity:
2283             return cssValuePool().createValue(style->opacity(), CSSPrimitiveValue::CSS_NUMBER);
2284         case CSSPropertyOrphans:
2285             if (style->hasAutoOrphans())
2286                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2287             return cssValuePool().createValue(style->orphans(), CSSPrimitiveValue::CSS_NUMBER);
2288         case CSSPropertyOutlineColor:
2289             return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->outlineColor());
2290         case CSSPropertyOutlineOffset:
2291             return zoomAdjustedPixelValue(style->outlineOffset(), style.get());
2292         case CSSPropertyOutlineStyle:
2293             if (style->outlineStyleIsAuto())
2294                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2295             return cssValuePool().createValue(style->outlineStyle());
2296         case CSSPropertyOutlineWidth:
2297             return zoomAdjustedPixelValue(style->outlineWidth(), style.get());
2298         case CSSPropertyOverflow:
2299             return cssValuePool().createValue(max(style->overflowX(), style->overflowY()));
2300         case CSSPropertyOverflowWrap:
2301             return cssValuePool().createValue(style->overflowWrap());
2302         case CSSPropertyOverflowX:
2303             return cssValuePool().createValue(style->overflowX());
2304         case CSSPropertyOverflowY:
2305             return cssValuePool().createValue(style->overflowY());
2306         case CSSPropertyPaddingTop:
2307             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingTop, &RenderBoxModelObject::computedCSSPaddingTop>(style.get(), renderer);
2308         case CSSPropertyPaddingRight:
2309             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingRight, &RenderBoxModelObject::computedCSSPaddingRight>(style.get(), renderer);
2310         case CSSPropertyPaddingBottom:
2311             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingBottom, &RenderBoxModelObject::computedCSSPaddingBottom>(style.get(), renderer);
2312         case CSSPropertyPaddingLeft:
2313             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingLeft, &RenderBoxModelObject::computedCSSPaddingLeft>(style.get(), renderer);
2314         case CSSPropertyPageBreakAfter:
2315             return cssValuePool().createValue(style->pageBreakAfter());
2316         case CSSPropertyPageBreakBefore:
2317             return cssValuePool().createValue(style->pageBreakBefore());
2318         case CSSPropertyPageBreakInside: {
2319             EPageBreak pageBreak = style->pageBreakInside();
2320             ASSERT(pageBreak != PBALWAYS);
2321             if (pageBreak == PBALWAYS)
2322                 return 0;
2323             return cssValuePool().createValue(style->pageBreakInside());
2324         }
2325         case CSSPropertyPosition:
2326             return cssValuePool().createValue(style->position());
2327         case CSSPropertyRight:
2328             return getPositionOffsetValue(style.get(), CSSPropertyRight, m_node->document().renderView());
2329         case CSSPropertyWebkitRubyPosition:
2330             return cssValuePool().createValue(style->rubyPosition());
2331         case CSSPropertyTableLayout:
2332             return cssValuePool().createValue(style->tableLayout());
2333         case CSSPropertyTextAlign:
2334             return cssValuePool().createValue(style->textAlign());
2335         case CSSPropertyTextDecoration:
2336             return renderTextDecorationFlagsToCSSValue(style->textDecoration());
2337 #if ENABLE(CSS3_TEXT)
2338         case CSSPropertyWebkitTextDecoration:
2339             return getCSSPropertyValuesForShorthandProperties(webkitTextDecorationShorthand());
2340         case CSSPropertyWebkitTextDecorationLine:
2341             return renderTextDecorationFlagsToCSSValue(style->textDecoration());
2342         case CSSPropertyWebkitTextDecorationStyle:
2343             return renderTextDecorationStyleFlagsToCSSValue(style->textDecorationStyle());
2344         case CSSPropertyWebkitTextDecorationColor:
2345             return currentColorOrValidColor(style.get(), style->textDecorationColor());
2346         case CSSPropertyWebkitTextAlignLast:
2347             return cssValuePool().createValue(style->textAlignLast());
2348         case CSSPropertyWebkitTextJustify:
2349             return cssValuePool().createValue(style->textJustify());
2350         case CSSPropertyWebkitTextUnderlinePosition:
2351             return cssValuePool().createValue(style->textUnderlinePosition());
2352 #endif // CSS3_TEXT
2353         case CSSPropertyWebkitTextDecorationsInEffect:
2354             return renderTextDecorationFlagsToCSSValue(style->textDecorationsInEffect());
2355         case CSSPropertyWebkitTextFillColor:
2356             return currentColorOrValidColor(style.get(), style->textFillColor());
2357         case CSSPropertyWebkitTextEmphasisColor:
2358             return currentColorOrValidColor(style.get(), style->textEmphasisColor());
2359         case CSSPropertyWebkitTextEmphasisPosition:
2360             return cssValuePool().createValue(style->textEmphasisPosition());
2361         case CSSPropertyWebkitTextEmphasisStyle:
2362             switch (style->textEmphasisMark()) {
2363             case TextEmphasisMarkNone:
2364                 return cssValuePool().createIdentifierValue(CSSValueNone);
2365             case TextEmphasisMarkCustom:
2366                 return cssValuePool().createValue(style->textEmphasisCustomMark(), CSSPrimitiveValue::CSS_STRING);
2367             case TextEmphasisMarkAuto:
2368                 ASSERT_NOT_REACHED();
2369                 // Fall through
2370             case TextEmphasisMarkDot:
2371             case TextEmphasisMarkCircle:
2372             case TextEmphasisMarkDoubleCircle:
2373             case TextEmphasisMarkTriangle:
2374             case TextEmphasisMarkSesame: {
2375                 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2376                 list->append(cssValuePool().createValue(style->textEmphasisFill()));
2377                 list->append(cssValuePool().createValue(style->textEmphasisMark()));
2378                 return list.release();
2379             }
2380             }
2381         case CSSPropertyTextIndent: {
2382             // If CSS3_TEXT is disabled or text-indent has only one value(<length> | <percentage>),
2383             // getPropertyCSSValue() returns CSSValue.
2384             RefPtr<CSSValue> textIndent = zoomAdjustedPixelValueForLength(style->textIndent(), style.get());
2385 #if ENABLE(CSS3_TEXT)
2386             // If CSS3_TEXT is enabled and text-indent has -webkit-each-line or -webkit-hanging,
2387             // getPropertyCSSValue() returns CSSValueList.
2388             if (style->textIndentLine() == TextIndentEachLine || style->textIndentType() == TextIndentHanging) {
2389                 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2390                 list->append(textIndent.release());
2391                 if (style->textIndentLine() == TextIndentEachLine)
2392                     list->append(cssValuePool().createIdentifierValue(CSSValueWebkitEachLine));
2393                 if (style->textIndentType() == TextIndentHanging)
2394                     list->append(cssValuePool().createIdentifierValue(CSSValueWebkitHanging));
2395                 return list.release();
2396             }
2397 #endif
2398             return textIndent.release();
2399         }
2400         case CSSPropertyTextShadow:
2401             return valueForShadow(style->textShadow(), propertyID, style.get());
2402         case CSSPropertyTextRendering:
2403             return cssValuePool().createValue(style->fontDescription().textRenderingMode());
2404         case CSSPropertyTextOverflow:
2405             if (style->textOverflow())
2406                 return cssValuePool().createIdentifierValue(CSSValueEllipsis);
2407             return cssValuePool().createIdentifierValue(CSSValueClip);
2408         case CSSPropertyWebkitTextSecurity:
2409             return cssValuePool().createValue(style->textSecurity());
2410 #if ENABLE(IOS_TEXT_AUTOSIZING)
2411         case CSSPropertyWebkitTextSizeAdjust:
2412             if (style->textSizeAdjust().isAuto())
2413                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2414             if (style->textSizeAdjust().isNone())
2415                 return cssValuePool().createIdentifierValue(CSSValueNone);
2416             return CSSPrimitiveValue::create(style->textSizeAdjust().percentage(), CSSPrimitiveValue::CSS_PERCENTAGE);
2417 #endif
2418         case CSSPropertyWebkitTextStrokeColor:
2419             return currentColorOrValidColor(style.get(), style->textStrokeColor());
2420         case CSSPropertyWebkitTextStrokeWidth:
2421             return zoomAdjustedPixelValue(style->textStrokeWidth(), style.get());
2422         case CSSPropertyTextTransform:
2423             return cssValuePool().createValue(style->textTransform());
2424         case CSSPropertyTop:
2425             return getPositionOffsetValue(style.get(), CSSPropertyTop, m_node->document().renderView());
2426         case CSSPropertyUnicodeBidi:
2427             return cssValuePool().createValue(style->unicodeBidi());
2428         case CSSPropertyVerticalAlign:
2429             switch (style->verticalAlign()) {
2430                 case BASELINE:
2431                     return cssValuePool().createIdentifierValue(CSSValueBaseline);
2432                 case MIDDLE:
2433                     return cssValuePool().createIdentifierValue(CSSValueMiddle);
2434                 case SUB:
2435                     return cssValuePool().createIdentifierValue(CSSValueSub);
2436                 case SUPER:
2437                     return cssValuePool().createIdentifierValue(CSSValueSuper);
2438                 case TEXT_TOP:
2439                     return cssValuePool().createIdentifierValue(CSSValueTextTop);
2440                 case TEXT_BOTTOM:
2441                     return cssValuePool().createIdentifierValue(CSSValueTextBottom);
2442                 case TOP:
2443                     return cssValuePool().createIdentifierValue(CSSValueTop);
2444                 case BOTTOM:
2445                     return cssValuePool().createIdentifierValue(CSSValueBottom);
2446                 case BASELINE_MIDDLE:
2447                     return cssValuePool().createIdentifierValue(CSSValueWebkitBaselineMiddle);
2448                 case LENGTH:
2449                     return cssValuePool().createValue(style->verticalAlignLength());
2450             }
2451             ASSERT_NOT_REACHED();
2452             return 0;
2453         case CSSPropertyVisibility:
2454             return cssValuePool().createValue(style->visibility());
2455         case CSSPropertyWhiteSpace:
2456             return cssValuePool().createValue(style->whiteSpace());
2457         case CSSPropertyWidows:
2458             if (style->hasAutoWidows())
2459                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2460             return cssValuePool().createValue(style->widows(), CSSPrimitiveValue::CSS_NUMBER);
2461         case CSSPropertyWidth:
2462             if (renderer) {
2463                 // According to http://www.w3.org/TR/CSS2/visudet.html#the-width-property,
2464                 // the "width" property does not apply for non-replaced inline elements.
2465                 if (!renderer->isReplaced() && renderer->isInline())
2466                     return cssValuePool().createIdentifierValue(CSSValueAuto);
2467                 return zoomAdjustedPixelValue(sizingBox(renderer).width(), style.get());
2468             }
2469             return zoomAdjustedPixelValueForLength(style->width(), style.get());
2470         case CSSPropertyWordBreak:
2471             return cssValuePool().createValue(style->wordBreak());
2472         case CSSPropertyWordSpacing:
2473             return zoomAdjustedPixelValue(style->wordSpacing(), style.get());
2474         case CSSPropertyWordWrap:
2475             return cssValuePool().createValue(style->overflowWrap());
2476         case CSSPropertyWebkitLineBreak:
2477             return cssValuePool().createValue(style->lineBreak());
2478         case CSSPropertyWebkitNbspMode:
2479             return cssValuePool().createValue(style->nbspMode());
2480         case CSSPropertyResize:
2481             return cssValuePool().createValue(style->resize());
2482         case CSSPropertyWebkitFontKerning:
2483             return cssValuePool().createValue(style->fontDescription().kerning());
2484         case CSSPropertyWebkitFontSmoothing:
2485             return cssValuePool().createValue(style->fontDescription().fontSmoothing());
2486         case CSSPropertyWebkitFontVariantLigatures: {
2487             FontDescription::LigaturesState commonLigaturesState = style->fontDescription().commonLigaturesState();
2488             FontDescription::LigaturesState discretionaryLigaturesState = style->fontDescription().discretionaryLigaturesState();
2489             FontDescription::LigaturesState historicalLigaturesState = style->fontDescription().historicalLigaturesState();
2490             if (commonLigaturesState == FontDescription::NormalLigaturesState && discretionaryLigaturesState == FontDescription::NormalLigaturesState
2491                 && historicalLigaturesState == FontDescription::NormalLigaturesState)
2492                 return cssValuePool().createIdentifierValue(CSSValueNormal);
2493
2494             RefPtr<CSSValueList> valueList = CSSValueList::createSpaceSeparated();
2495             if (commonLigaturesState != FontDescription::NormalLigaturesState)
2496                 valueList->append(cssValuePool().createIdentifierValue(commonLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures : CSSValueCommonLigatures));
2497             if (discretionaryLigaturesState != FontDescription::NormalLigaturesState)
2498                 valueList->append(cssValuePool().createIdentifierValue(discretionaryLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretionaryLigatures : CSSValueDiscretionaryLigatures));
2499             if (historicalLigaturesState != FontDescription::NormalLigaturesState)
2500                 valueList->append(cssValuePool().createIdentifierValue(historicalLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLigatures : CSSValueHistoricalLigatures));
2501             return valueList;
2502         }
2503         case CSSPropertyZIndex:
2504             if (style->hasAutoZIndex())
2505                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2506             return cssValuePool().createValue(style->zIndex(), CSSPrimitiveValue::CSS_NUMBER);
2507         case CSSPropertyZoom:
2508             return cssValuePool().createValue(style->zoom(), CSSPrimitiveValue::CSS_NUMBER);
2509         case CSSPropertyBoxSizing:
2510             if (style->boxSizing() == CONTENT_BOX)
2511                 return cssValuePool().createIdentifierValue(CSSValueContentBox);
2512             return cssValuePool().createIdentifierValue(CSSValueBorderBox);
2513 #if ENABLE(DASHBOARD_SUPPORT)
2514         case CSSPropertyWebkitDashboardRegion:
2515         {
2516             const Vector<StyleDashboardRegion>& regions = style->dashboardRegions();
2517             unsigned count = regions.size();
2518             if (count == 1 && regions[0].type == StyleDashboardRegion::None)
2519                 return cssValuePool().createIdentifierValue(CSSValueNone);
2520
2521             RefPtr<DashboardRegion> firstRegion;
2522             DashboardRegion* previousRegion = 0;
2523             for (unsigned i = 0; i < count; i++) {
2524                 RefPtr<DashboardRegion> region = DashboardRegion::create();
2525                 StyleDashboardRegion styleRegion = regions[i];
2526
2527                 region->m_label = styleRegion.label;
2528                 LengthBox offset = styleRegion.offset;
2529                 region->setTop(zoomAdjustedPixelValue(offset.top().value(), style.get()));
2530                 region->setRight(zoomAdjustedPixelValue(offset.right().value(), style.get()));
2531                 region->setBottom(zoomAdjustedPixelValue(offset.bottom().value(), style.get()));
2532                 region->setLeft(zoomAdjustedPixelValue(offset.left().value(), style.get()));
2533                 region->m_isRectangle = (styleRegion.type == StyleDashboardRegion::Rectangle);
2534                 region->m_isCircle = (styleRegion.type == StyleDashboardRegion::Circle);
2535
2536                 if (previousRegion)
2537                     previousRegion->m_next = region;
2538                 else
2539                     firstRegion = region;
2540                 previousRegion = region.get();
2541             }
2542             return cssValuePool().createValue(firstRegion.release());
2543         }
2544 #endif
2545 #if ENABLE(DRAGGABLE_REGION)
2546         case CSSPropertyWebkitAppRegion:
2547             return cssValuePool().createIdentifierValue(style->getDraggableRegionMode() == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag);
2548 #endif
2549         case CSSPropertyWebkitAnimationDelay:
2550             return getDelayValue(style->animations());
2551         case CSSPropertyWebkitAnimationDirection: {
2552             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2553             const AnimationList* t = style->animations();
2554             if (t) {
2555                 for (size_t i = 0; i < t->size(); ++i) {
2556                     if (t->animation(i).direction())
2557                         list->append(cssValuePool().createIdentifierValue(CSSValueAlternate));
2558                     else
2559                         list->append(cssValuePool().createIdentifierValue(CSSValueNormal));
2560                 }
2561             } else
2562                 list->append(cssValuePool().createIdentifierValue(CSSValueNormal));
2563             return list.release();
2564         }
2565         case CSSPropertyWebkitAnimationDuration:
2566             return getDurationValue(style->animations());
2567         case CSSPropertyWebkitAnimationFillMode: {
2568             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2569             const AnimationList* t = style->animations();
2570             if (t) {
2571                 for (size_t i = 0; i < t->size(); ++i) {
2572                     switch (t->animation(i).fillMode()) {
2573                     case AnimationFillModeNone:
2574                         list->append(cssValuePool().createIdentifierValue(CSSValueNone));
2575                         break;
2576                     case AnimationFillModeForwards:
2577                         list->append(cssValuePool().createIdentifierValue(CSSValueForwards));
2578                         break;
2579                     case AnimationFillModeBackwards:
2580                         list->append(cssValuePool().createIdentifierValue(CSSValueBackwards));
2581                         break;
2582                     case AnimationFillModeBoth:
2583                         list->append(cssValuePool().createIdentifierValue(CSSValueBoth));
2584                         break;
2585                     }
2586                 }
2587             } else
2588                 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
2589             return list.release();
2590         }
2591         case CSSPropertyWebkitAnimationIterationCount: {
2592             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2593             const AnimationList* t = style->animations();
2594             if (t) {
2595                 for (size_t i = 0; i < t->size(); ++i) {
2596                     double iterationCount = t->animation(i).iterationCount();
2597                     if (iterationCount == Animation::IterationCountInfinite)
2598                         list->append(cssValuePool().createIdentifierValue(CSSValueInfinite));
2599                     else
2600                         list->append(cssValuePool().createValue(iterationCount, CSSPrimitiveValue::CSS_NUMBER));
2601                 }
2602             } else
2603                 list->append(cssValuePool().createValue(Animation::initialAnimationIterationCount(), CSSPrimitiveValue::CSS_NUMBER));
2604             return list.release();
2605         }
2606         case CSSPropertyWebkitAnimationName: {
2607             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2608             const AnimationList* t = style->animations();
2609             if (t) {
2610                 for (size_t i = 0; i < t->size(); ++i)
2611                     list->append(cssValuePool().createValue(t->animation(i).name(), CSSPrimitiveValue::CSS_STRING));
2612             } else
2613                 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
2614             return list.release();
2615         }
2616         case CSSPropertyWebkitAnimationPlayState: {
2617             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2618             const AnimationList* t = style->animations();
2619             if (t) {
2620                 for (size_t i = 0; i < t->size(); ++i) {
2621                     int prop = t->animation(i).playState();
2622                     if (prop == AnimPlayStatePlaying)
2623                         list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
2624                     else
2625                         list->append(cssValuePool().createIdentifierValue(CSSValuePaused));
2626                 }
2627             } else
2628                 list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
2629             return list.release();
2630         }
2631         case CSSPropertyWebkitAnimationTimingFunction:
2632             return getTimingFunctionValue(style->animations());
2633         case CSSPropertyWebkitAppearance:
2634             return cssValuePool().createValue(style->appearance());
2635         case CSSPropertyWebkitAspectRatio:
2636             if (!style->hasAspectRatio())
2637                 return cssValuePool().createIdentifierValue(CSSValueNone);
2638             return CSSAspectRatioValue::create(style->aspectRatioNumerator(), style->aspectRatioDenominator());
2639         case CSSPropertyWebkitBackfaceVisibility:
2640             return cssValuePool().createIdentifierValue((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
2641         case CSSPropertyWebkitBorderImage:
2642             return valueForNinePieceImage(style->borderImage());
2643         case CSSPropertyBorderImageOutset:
2644             return valueForNinePieceImageQuad(style->borderImage().outset());
2645         case CSSPropertyBorderImageRepeat:
2646             return valueForNinePieceImageRepeat(style->borderImage());
2647         case CSSPropertyBorderImageSlice:
2648             return valueForNinePieceImageSlice(style->borderImage());
2649         case CSSPropertyBorderImageWidth:
2650             return valueForNinePieceImageQuad(style->borderImage().borderSlices());
2651         case CSSPropertyWebkitMaskBoxImage:
2652             return valueForNinePieceImage(style->maskBoxImage());
2653         case CSSPropertyWebkitMaskBoxImageOutset:
2654             return valueForNinePieceImageQuad(style->maskBoxImage().outset());
2655         case CSSPropertyWebkitMaskBoxImageRepeat:
2656             return valueForNinePieceImageRepeat(style->maskBoxImage());
2657         case CSSPropertyWebkitMaskBoxImageSlice:
2658             return valueForNinePieceImageSlice(style->maskBoxImage());
2659         case CSSPropertyWebkitMaskBoxImageWidth:
2660             return valueForNinePieceImageQuad(style->maskBoxImage().borderSlices());
2661         case CSSPropertyWebkitMaskBoxImageSource:
2662             if (style->maskBoxImageSource())
2663                 return style->maskBoxImageSource()->cssValue();
2664             return cssValuePool().createIdentifierValue(CSSValueNone);
2665         case CSSPropertyWebkitFontSizeDelta:
2666             // Not a real style property -- used by the editing engine -- so has no computed value.
2667             break;
2668         case CSSPropertyWebkitMarginBottomCollapse:
2669         case CSSPropertyWebkitMarginAfterCollapse:
2670             return cssValuePool().createValue(style->marginAfterCollapse());
2671         case CSSPropertyWebkitMarginTopCollapse:
2672         case CSSPropertyWebkitMarginBeforeCollapse:
2673             return cssValuePool().createValue(style->marginBeforeCollapse());
2674 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
2675         case CSSPropertyWebkitOverflowScrolling:
2676             if (!style->useTouchOverflowScrolling())
2677                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2678             return cssValuePool().createIdentifierValue(CSSValueTouch);
2679 #endif
2680         case CSSPropertyWebkitPerspective:
2681             if (!style->hasPerspective())
2682                 return cssValuePool().createIdentifierValue(CSSValueNone);
2683             return zoomAdjustedPixelValue(style->perspective(), style.get());
2684         case CSSPropertyWebkitPerspectiveOrigin: {
2685             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2686             if (renderer) {
2687                 LayoutRect box;
2688                 if (renderer->isBox())
2689                     box = toRenderBox(renderer)->borderBoxRect();
2690
2691                 RenderView* renderView = m_node->document().renderView();
2692                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width(), renderView), style.get()));
2693                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height(), renderView), style.get()));
2694             }
2695             else {
2696                 list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginX(), style.get()));
2697                 list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginY(), style.get()));
2698
2699             }
2700             return list.release();
2701         }
2702         case CSSPropertyWebkitRtlOrdering:
2703             return cssValuePool().createIdentifierValue(style->rtlOrdering() ? CSSValueVisual : CSSValueLogical);
2704 #if ENABLE(TOUCH_EVENTS)
2705         case CSSPropertyWebkitTapHighlightColor:
2706             return currentColorOrValidColor(style.get(), style->tapHighlightColor());
2707 #endif
2708 #if PLATFORM(IOS)
2709         case CSSPropertyWebkitTouchCallout:
2710             return cssValuePool().createIdentifierValue(style->touchCalloutEnabled() ? CSSValueDefault : CSSValueNone);
2711 #endif
2712         case CSSPropertyWebkitUserDrag:
2713             return cssValuePool().createValue(style->userDrag());
2714         case CSSPropertyWebkitUserSelect:
2715             return cssValuePool().createValue(style->userSelect());
2716         case CSSPropertyBorderBottomLeftRadius:
2717             return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get(), m_node->document().renderView());
2718         case CSSPropertyBorderBottomRightRadius:
2719             return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get(), m_node->document().renderView());
2720         case CSSPropertyBorderTopLeftRadius:
2721             return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get(), m_node->document().renderView());
2722         case CSSPropertyBorderTopRightRadius:
2723             return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get(), m_node->document().renderView());
2724         case CSSPropertyClip: {
2725             if (!style->hasClip())
2726                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2727             RefPtr<Rect> rect = Rect::create();
2728             rect->setTop(zoomAdjustedPixelValue(style->clip().top().value(), style.get()));
2729             rect->setRight(zoomAdjustedPixelValue(style->clip().right().value(), style.get()));
2730             rect->setBottom(zoomAdjustedPixelValue(style->clip().bottom().value(), style.get()));
2731             rect->setLeft(zoomAdjustedPixelValue(style->clip().left().value(), style.get()));
2732             return cssValuePool().createValue(rect.release());
2733         }
2734         case CSSPropertySpeak:
2735             return cssValuePool().createValue(style->speak());
2736         case CSSPropertyWebkitTransform:
2737             return computedTransform(renderer, style.get());
2738         case CSSPropertyWebkitTransformOrigin: {
2739             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2740             if (renderer) {
2741                 LayoutRect box;
2742                 if (renderer->isBox())
2743                     box = toRenderBox(renderer)->borderBoxRect();
2744
2745                 RenderView* renderView = m_node->document().renderView();
2746                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width(), renderView), style.get()));
2747                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height(), renderView), style.get()));
2748                 if (style->transformOriginZ() != 0)
2749                     list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
2750             } else {
2751                 list->append(zoomAdjustedPixelValueForLength(style->transformOriginX(), style.get()));
2752                 list->append(zoomAdjustedPixelValueForLength(style->transformOriginY(), style.get()));
2753                 if (style->transformOriginZ() != 0)
2754                     list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
2755             }
2756             return list.release();
2757         }
2758         case CSSPropertyWebkitTransformStyle:
2759             return cssValuePool().createIdentifierValue((style->transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat);
2760         case CSSPropertyTransitionDelay:
2761         case CSSPropertyWebkitTransitionDelay:
2762             return getDelayValue(style->transitions());
2763         case CSSPropertyTransitionDuration:
2764         case CSSPropertyWebkitTransitionDuration:
2765             return getDurationValue(style->transitions());
2766         case CSSPropertyTransitionProperty:
2767         case CSSPropertyWebkitTransitionProperty:
2768             return getTransitionPropertyValue(style->transitions());
2769         case CSSPropertyTransitionTimingFunction:
2770         case CSSPropertyWebkitTransitionTimingFunction:
2771             return getTimingFunctionValue(style->transitions());
2772         case CSSPropertyTransition:
2773         case CSSPropertyWebkitTransition: {
2774             const AnimationList* animList = style->transitions();
2775             if (animList) {
2776                 RefPtr<CSSValueList> transitionsList = CSSValueList::createCommaSeparated();
2777                 for (size_t i = 0; i < animList->size(); ++i) {
2778                     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2779                     const Animation& animation = animList->animation(i);
2780                     list->append(createTransitionPropertyValue(animation));
2781                     list->append(cssValuePool().createValue(animation.duration(), CSSPrimitiveValue::CSS_S));
2782                     list->append(createTimingFunctionValue(animation.timingFunction().get()));
2783                     list->append(cssValuePool().createValue(animation.delay(), CSSPrimitiveValue::CSS_S));
2784                     transitionsList->append(list);
2785                 }
2786                 return transitionsList.release();
2787             }
2788
2789             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2790             // transition-property default value.
2791             list->append(cssValuePool().createIdentifierValue(CSSValueAll));
2792             list->append(cssValuePool().createValue(Animation::initialAnimationDuration(), CSSPrimitiveValue::CSS_S));
2793             list->append(createTimingFunctionValue(Animation::initialAnimationTimingFunction().get()));
2794             list->append(cssValuePool().createValue(Animation::initialAnimationDelay(), CSSPrimitiveValue::CSS_S));
2795             return list.release();
2796         }
2797         case CSSPropertyPointerEvents:
2798             return cssValuePool().createValue(style->pointerEvents());
2799         case CSSPropertyWebkitColorCorrection:
2800             return cssValuePool().createValue(style->colorSpace());
2801         case CSSPropertyWebkitLineGrid:
2802             if (style->lineGrid().isNull())
2803                 return cssValuePool().createIdentifierValue(CSSValueNone);
2804             return cssValuePool().createValue(style->lineGrid(), CSSPrimitiveValue::CSS_STRING);
2805         case CSSPropertyWebkitLineSnap:
2806             return CSSPrimitiveValue::create(style->lineSnap());
2807         case CSSPropertyWebkitLineAlign:
2808             return CSSPrimitiveValue::create(style->lineAlign());
2809         case CSSPropertyWebkitWritingMode:
2810             return cssValuePool().createValue(style->writingMode());
2811         case CSSPropertyWebkitTextCombine:
2812             return cssValuePool().createValue(style->textCombine());
2813         case CSSPropertyWebkitTextOrientation:
2814             return CSSPrimitiveValue::create(style->textOrientation());
2815         case CSSPropertyWebkitLineBoxContain:
2816             return createLineBoxContainValue(style->lineBoxContain());
2817         case CSSPropertyContent:
2818             return contentToCSSValue(style.get());
2819         case CSSPropertyCounterIncrement:
2820             return counterToCSSValue(style.get(), propertyID);
2821         case CSSPropertyCounterReset:
2822             return counterToCSSValue(style.get(), propertyID);
2823         case CSSPropertyWebkitClipPath:
2824             if (ClipPathOperation* operation = style->clipPath()) {
2825                 if (operation->getOperationType() == ClipPathOperation::SHAPE)
2826                     return valueForBasicShape(style.get(), static_cast<ShapeClipPathOperation*>(operation)->basicShape());
2827 #if ENABLE(SVG)
2828                 else if (operation->getOperationType() == ClipPathOperation::REFERENCE) {
2829                     ReferenceClipPathOperation* referenceOperation = static_cast<ReferenceClipPathOperation*>(operation);
2830                     return CSSPrimitiveValue::create(referenceOperation->url(), CSSPrimitiveValue::CSS_URI);
2831                 }
2832 #endif
2833             }
2834             return cssValuePool().createIdentifierValue(CSSValueNone);
2835 #if ENABLE(CSS_REGIONS)
2836         case CSSPropertyWebkitFlowInto:
2837             if (style->flowThread().isNull())
2838                 return cssValuePool().createIdentifierValue(CSSValueNone);
2839             return cssValuePool().createValue(style->flowThread(), CSSPrimitiveValue::CSS_STRING);
2840         case CSSPropertyWebkitFlowFrom:
2841             if (style->regionThread().isNull())
2842                 return cssValuePool().createIdentifierValue(CSSValueNone);
2843             return cssValuePool().createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING);
2844         case CSSPropertyWebkitRegionFragment:
2845             return cssValuePool().createValue(style->regionFragment());
2846 #endif
2847 #if ENABLE(CSS_EXCLUSIONS)
2848         case CSSPropertyWebkitWrapFlow:
2849             return cssValuePool().createValue(style->wrapFlow());
2850         case CSSPropertyWebkitWrapThrough:
2851             return cssValuePool().createValue(style->wrapThrough());
2852 #endif
2853 #if ENABLE(CSS_SHAPES)
2854         case CSSPropertyWebkitShapeMargin:
2855             return cssValuePool().createValue(style->shapeMargin());
2856         case CSSPropertyWebkitShapePadding:
2857             return cssValuePool().createValue(style->shapePadding());
2858         case CSSPropertyWebkitShapeImageThreshold:
2859             return cssValuePool().createValue(style->shapeImageThreshold(), CSSPrimitiveValue::CSS_NUMBER);
2860         case CSSPropertyWebkitShapeInside:
2861             if (!style->shapeInside())
2862                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2863             if (style->shapeInside()->type() == ShapeValue::Outside)
2864                 return cssValuePool().createIdentifierValue(CSSValueOutsideShape);
2865             if (style->shapeInside()->type() == ShapeValue::Image) {
2866                 if (style->shapeInside()->image())
2867                     return style->shapeInside()->image()->cssValue();
2868                 return cssValuePool().createIdentifierValue(CSSValueNone);
2869             }
2870             ASSERT(style->shapeInside()->type() == ShapeValue::Shape);
2871             return valueForBasicShape(style.get(), style->shapeInside()->shape());
2872         case CSSPropertyWebkitShapeOutside:
2873             if (!style->shapeOutside())
2874                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2875             if (style->shapeOutside()->type() == ShapeValue::Image) {
2876                 if (style->shapeOutside()->image())
2877                     return style->shapeOutside()->image()->cssValue();
2878                 return cssValuePool().createIdentifierValue(CSSValueNone);
2879             }
2880             ASSERT(style->shapeOutside()->type() == ShapeValue::Shape);
2881             return valueForBasicShape(style.get(), style->shapeOutside()->shape());
2882 #endif
2883 #if ENABLE(CSS_FILTERS)
2884         case CSSPropertyWebkitFilter:
2885             return valueForFilter(renderer, style.get(), style->filter());
2886 #endif
2887 #if ENABLE(CSS_COMPOSITING)
2888         case CSSPropertyWebkitBlendMode:
2889             return cssValuePool().createValue(style->blendMode());
2890 #endif
2891         case CSSPropertyWebkitBackgroundBlendMode: {
2892             const FillLayer* layers = style->backgroundLayers();
2893             if (!layers->next())
2894                 return cssValuePool().createValue(layers->blendMode());
2895
2896             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2897             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
2898                 list->append(cssValuePool().createValue(currLayer->blendMode()));
2899
2900             return list.release();
2901         }
2902         case CSSPropertyBackground:
2903             return getBackgroundShorthandValue();
2904         case CSSPropertyBorder: {
2905             RefPtr<CSSValue> value = propertyValue(CSSPropertyBorderTop, DoNotUpdateLayout);
2906             const CSSPropertyID properties[3] = { CSSPropertyBorderRight, CSSPropertyBorderBottom,
2907                                         CSSPropertyBorderLeft };
2908             for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
2909                 if (!compareCSSValuePtr<CSSValue>(value, propertyValue(properties[i], DoNotUpdateLayout)))
2910                     return 0;
2911             }
2912             return value.release();
2913         }
2914         case CSSPropertyBorderBottom:
2915             return getCSSPropertyValuesForShorthandProperties(borderBottomShorthand());
2916         case CSSPropertyBorderColor:
2917             return getCSSPropertyValuesForSidesShorthand(borderColorShorthand());
2918         case CSSPropertyBorderLeft:
2919             return getCSSPropertyValuesForShorthandProperties(borderLeftShorthand());
2920         case CSSPropertyBorderImage:
2921             return valueForNinePieceImage(style->borderImage());
2922         case CSSPropertyBorderRadius:
2923             return getBorderRadiusShorthandValue(style.get(), m_node->document().renderView());
2924         case CSSPropertyBorderRight:
2925             return getCSSPropertyValuesForShorthandProperties(borderRightShorthand());
2926         case CSSPropertyBorderStyle:
2927             return getCSSPropertyValuesForSidesShorthand(borderStyleShorthand());
2928         case CSSPropertyBorderTop:
2929             return getCSSPropertyValuesForShorthandProperties(borderTopShorthand());
2930         case CSSPropertyBorderWidth:
2931             return getCSSPropertyValuesForSidesShorthand(borderWidthShorthand());
2932         case CSSPropertyWebkitColumnRule:
2933             return getCSSPropertyValuesForShorthandProperties(webkitColumnRuleShorthand());
2934         case CSSPropertyWebkitColumns:
2935             return getCSSPropertyValuesForShorthandProperties(webkitColumnsShorthand());
2936         case CSSPropertyListStyle:
2937             return getCSSPropertyValuesForShorthandProperties(listStyleShorthand());
2938         case CSSPropertyMargin:
2939             return getCSSPropertyValuesForSidesShorthand(marginShorthand());
2940         case CSSPropertyOutline:
2941             return getCSSPropertyValuesForShorthandProperties(outlineShorthand());
2942         case CSSPropertyPadding:
2943             return getCSSPropertyValuesForSidesShorthand(paddingShorthand());
2944         /* Individual properties not part of the spec */
2945         case CSSPropertyBackgroundRepeatX:
2946         case CSSPropertyBackgroundRepeatY:
2947             break;
2948
2949         /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
2950         case CSSPropertyWebkitTextEmphasis:
2951         case CSSPropertyTextLineThrough:
2952         case CSSPropertyTextLineThroughColor:
2953         case CSSPropertyTextLineThroughMode:
2954         case CSSPropertyTextLineThroughStyle:
2955         case CSSPropertyTextLineThroughWidth:
2956         case CSSPropertyTextOverline:
2957         case CSSPropertyTextOverlineColor:
2958         case CSSPropertyTextOverlineMode:
2959         case CSSPropertyTextOverlineStyle:
2960         case CSSPropertyTextOverlineWidth:
2961         case CSSPropertyTextUnderline:
2962         case CSSPropertyTextUnderlineColor:
2963         case CSSPropertyTextUnderlineMode:
2964         case CSSPropertyTextUnderlineStyle:
2965         case CSSPropertyTextUnderlineWidth:
2966             break;
2967
2968         /* Directional properties are resolved by resolveDirectionAwareProperty() before the switch. */
2969         case CSSPropertyWebkitBorderEnd:
2970         case CSSPropertyWebkitBorderEndColor:
2971         case CSSPropertyWebkitBorderEndStyle:
2972         case CSSPropertyWebkitBorderEndWidth:
2973         case CSSPropertyWebkitBorderStart:
2974         case CSSPropertyWebkitBorderStartColor:
2975         case CSSPropertyWebkitBorderStartStyle:
2976         case CSSPropertyWebkitBorderStartWidth:
2977         case CSSPropertyWebkitBorderAfter:
2978         case CSSPropertyWebkitBorderAfterColor:
2979         case CSSPropertyWebkitBorderAfterStyle:
2980         case CSSPropertyWebkitBorderAfterWidth:
2981         case CSSPropertyWebkitBorderBefore:
2982         case CSSPropertyWebkitBorderBeforeColor:
2983         case CSSPropertyWebkitBorderBeforeStyle:
2984         case CSSPropertyWebkitBorderBeforeWidth:
2985         case CSSPropertyWebkitMarginEnd:
2986         case CSSPropertyWebkitMarginStart:
2987         case CSSPropertyWebkitMarginAfter:
2988         case CSSPropertyWebkitMarginBefore:
2989         case CSSPropertyWebkitPaddingEnd:
2990         case CSSPropertyWebkitPaddingStart:
2991         case CSSPropertyWebkitPaddingAfter:
2992         case CSSPropertyWebkitPaddingBefore:
2993         case CSSPropertyWebkitLogicalWidth:
2994         case CSSPropertyWebkitLogicalHeight:
2995         case CSSPropertyWebkitMinLogicalWidth:
2996         case CSSPropertyWebkitMinLogicalHeight:
2997         case CSSPropertyWebkitMaxLogicalWidth:
2998         case CSSPropertyWebkitMaxLogicalHeight:
2999             ASSERT_NOT_REACHED();
3000             break;
3001
3002         /* Unimplemented @font-face properties */
3003         case CSSPropertyFontStretch:
3004         case CSSPropertySrc:
3005         case CSSPropertyUnicodeRange:
3006             break;
3007
3008         /* Other unimplemented properties */
3009 #if ENABLE(CSS_SHADERS)
3010         case CSSPropertyGeometry:
3011 #endif
3012         case CSSPropertyPage: // for @page
3013         case CSSPropertyQuotes: // FIXME: needs implementation
3014         case CSSPropertySize: // for @page
3015             break;
3016
3017         /* Unimplemented -webkit- properties */
3018         case CSSPropertyWebkitAnimation:
3019         case CSSPropertyWebkitBorderRadius:
3020         case CSSPropertyWebkitMarginCollapse:
3021         case CSSPropertyWebkitMarquee:
3022         case CSSPropertyWebkitMarqueeSpeed:
3023         case CSSPropertyWebkitMask:
3024         case CSSPropertyWebkitMaskRepeatX:
3025         case CSSPropertyWebkitMaskRepeatY:
3026         case CSSPropertyWebkitPerspectiveOriginX:
3027         case CSSPropertyWebkitPerspectiveOriginY:
3028         case CSSPropertyWebkitTextStroke:
3029         case CSSPropertyWebkitTransformOriginX:
3030         case CSSPropertyWebkitTransformOriginY:
3031         case CSSPropertyWebkitTransformOriginZ:
3032 #if ENABLE(CSS_SHADERS)
3033         case CSSPropertyMix:
3034         case CSSPropertyParameters:
3035 #endif
3036             break;
3037
3038 #if ENABLE(CSS_DEVICE_ADAPTATION)
3039         case CSSPropertyMaxZoom:
3040         case CSSPropertyMinZoom:
3041         case CSSPropertyOrientation:
3042         case CSSPropertyUserZoom:
3043             break;
3044 #endif
3045
3046 #if ENABLE(SVG)
3047         case CSSPropertyBufferedRendering:
3048         case CSSPropertyClipPath:
3049         case CSSPropertyClipRule:
3050         case CSSPropertyMask:
3051         case CSSPropertyEnableBackground:
3052         case CSSPropertyFilter:
3053         case CSSPropertyFloodColor:
3054         case CSSPropertyFloodOpacity:
3055         case CSSPropertyLightingColor:
3056         case CSSPropertyStopColor:
3057         case CSSPropertyStopOpacity:
3058         case CSSPropertyColorInterpolation:
3059         case CSSPropertyColorInterpolationFilters:
3060         case CSSPropertyColorProfile:
3061         case CSSPropertyColorRendering:
3062         case CSSPropertyFill:
3063         case CSSPropertyFillOpacity:
3064         case CSSPropertyFillRule:
3065         case CSSPropertyMarker:
3066         case CSSPropertyMarkerEnd:
3067         case CSSPropertyMarkerMid:
3068         case CSSPropertyMarkerStart:
3069         case CSSPropertyMaskType:
3070         case CSSPropertyShapeRendering:
3071         case CSSPropertyStroke:
3072         case CSSPropertyStrokeDasharray:
3073         case CSSPropertyStrokeDashoffset:
3074         case CSSPropertyStrokeLinecap:
3075         case CSSPropertyStrokeLinejoin:
3076         case CSSPropertyStrokeMiterlimit:
3077         case CSSPropertyStrokeOpacity:
3078         case CSSPropertyStrokeWidth:
3079         case CSSPropertyAlignmentBaseline:
3080         case CSSPropertyBaselineShift:
3081         case CSSPropertyDominantBaseline:
3082         case CSSPropertyGlyphOrientationHorizontal:
3083         case CSSPropertyGlyphOrientationVertical:
3084         case CSSPropertyKerning:
3085         case CSSPropertyTextAnchor:
3086         case CSSPropertyVectorEffect:
3087         case CSSPropertyWritingMode:
3088         case CSSPropertyWebkitSvgShadow:
3089             return svgPropertyValue(propertyID, DoNotUpdateLayout);
3090 #endif
3091     }
3092
3093     logUnimplementedPropertyID(propertyID);
3094     return 0;
3095 }
3096
3097 String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) const
3098 {
3099     RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
3100     if (value)
3101         return value->cssText();
3102     return "";
3103 }
3104
3105 unsigned CSSComputedStyleDeclaration::length() const
3106 {
3107     Node* node = m_node.get();
3108     if (!node)
3109         return 0;
3110
3111     RenderStyle* style = node->computedStyle(m_pseudoElementSpecifier);
3112     if (!style)
3113         return 0;
3114
3115     return numComputedProperties;
3116 }
3117
3118 String CSSComputedStyleDeclaration::item(unsigned i) const
3119 {
3120     if (i >= length())
3121         return "";
3122
3123     return getPropertyNameString(computedProperties[i]);
3124 }
3125
3126 bool ComputedStyleExtractor::propertyMatches(CSSPropertyID propertyID, const CSSValue* value) const
3127 {
3128     if (propertyID == CSSPropertyFontSize && value->isPrimitiveValue() && m_node) {
3129         m_node->document().updateLayoutIgnorePendingStylesheets();
3130         RenderStyle* style = m_node->computedStyle(m_pseudoElementSpecifier);
3131         if (style && style->fontDescription().keywordSize()) {
3132             CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->fontDescription().keywordSize());
3133             const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
3134             if (primitiveValue->isValueID() && primitiveValue->getValueID() == sizeValue)
3135                 return true;
3136         }
3137     }
3138     RefPtr<CSSValue> computedValue = propertyValue(propertyID);
3139     return computedValue && value && computedValue->equals(*value);
3140 }
3141
3142 PassRefPtr<MutableStylePropertySet> ComputedStyleExtractor::copyProperties() const
3143 {
3144     return copyPropertiesInSet(computedProperties, numComputedProperties);
3145 }
3146
3147 PassRefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties(const StylePropertyShorthand& shorthand) const
3148 {
3149     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
3150     for (size_t i = 0; i < shorthand.length(); ++i) {
3151         RefPtr<CSSValue> value = propertyValue(shorthand.properties()[i], DoNotUpdateLayout);
3152         list->append(value);
3153     }
3154     return list.release();
3155 }
3156
3157 PassRefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForSidesShorthand(const StylePropertyShorthand& shorthand) const
3158 {
3159     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
3160     // Assume the properties are in the usual order top, right, bottom, left.
3161     RefPtr<CSSValue> topValue = propertyValue(shorthand.properties()[0], DoNotUpdateLayout);
3162     RefPtr<CSSValue> rightValue = propertyValue(shorthand.properties()[1], DoNotUpdateLayout);
3163     RefPtr<CSSValue> bottomValue = propertyValue(shorthand.properties()[2], DoNotUpdateLayout);
3164     RefPtr<CSSValue> leftValue = propertyValue(shorthand.properties()[3], DoNotUpdateLayout);
3165
3166     // All 4 properties must be specified.
3167     if (!topValue || !rightValue || !bottomValue || !leftValue)
3168         return 0;
3169
3170     bool showLeft = !compareCSSValuePtr(rightValue, leftValue);
3171     bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft;
3172     bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom;
3173
3174     list->append(topValue.release());
3175     if (showRight)
3176         list->append(rightValue.release());
3177     if (showBottom)
3178         list->append(bottomValue.release());
3179     if (showLeft)
3180         list->append(leftValue.release());
3181
3182     return list.release();
3183 }
3184
3185 PassRefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand(const StylePropertyShorthand& shorthand) const
3186 {
3187     RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3188     for (size_t i = 0; i < shorthand.length(); ++i) {
3189         RefPtr<CSSValue> value = propertyValue(shorthand.properties()[i], DoNotUpdateLayout);
3190         list->append(value.release());
3191     }
3192     return list.release();
3193 }
3194
3195 PassRefPtr<MutableStylePropertySet> ComputedStyleExtractor::copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const
3196 {
3197     Vector<CSSProperty, 256> list;
3198     list.reserveInitialCapacity(length);
3199     for (unsigned i = 0; i < length; ++i) {
3200         RefPtr<CSSValue> value = propertyValue(set[i]);
3201         if (value)
3202             list.append(CSSProperty(set[i], value.release(), false));
3203     }
3204     return MutableStylePropertySet::create(list.data(), list.size());
3205 }
3206
3207 CSSRule* CSSComputedStyleDeclaration::parentRule() const
3208 {
3209     return 0;
3210 }
3211
3212 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(const String& propertyName)
3213 {
3214     CSSPropertyID propertyID = cssPropertyID(propertyName);
3215     if (!propertyID)
3216         return 0;
3217     RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
3218     return value ? value->cloneForCSSOM() : 0;
3219 }
3220
3221 String CSSComputedStyleDeclaration::getPropertyValue(const String &propertyName)
3222 {
3223     CSSPropertyID propertyID = cssPropertyID(propertyName);
3224     if (!propertyID)
3225         return String();
3226     return getPropertyValue(propertyID);
3227 }
3228
3229 String CSSComputedStyleDeclaration::getPropertyPriority(const String&)
3230 {
3231     // All computed styles have a priority of not "important".
3232     return "";
3233 }
3234
3235 String CSSComputedStyleDeclaration::getPropertyShorthand(const String&)
3236 {
3237     return "";
3238 }
3239
3240 bool CSSComputedStyleDeclaration::isPropertyImplicit(const String&)
3241 {
3242     return false;
3243 }
3244
3245 void CSSComputedStyleDeclaration::setProperty(const String&, const String&, const String&, ExceptionCode& ec)
3246 {
3247     ec = NO_MODIFICATION_ALLOWED_ERR;
3248 }
3249
3250 String CSSComputedStyleDeclaration::removeProperty(const String&, ExceptionCode& ec)
3251 {
3252     ec = NO_MODIFICATION_ALLOWED_ERR;
3253     return String();
3254 }
3255     
3256 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID)
3257 {
3258     return getPropertyCSSValue(propertyID);
3259 }
3260
3261 String CSSComputedStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID)
3262 {
3263     return getPropertyValue(propertyID);
3264 }
3265
3266 void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const String&, bool, ExceptionCode& ec)
3267 {
3268     ec = NO_MODIFICATION_ALLOWED_ERR;
3269 }
3270
3271 PassRefPtr<CSSValueList> ComputedStyleExtractor::getBackgroundShorthandValue() const
3272 {
3273     static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSPropertyBackgroundColor, CSSPropertyBackgroundImage,
3274                                                                      CSSPropertyBackgroundRepeat, CSSPropertyBackgroundAttachment,  
3275                                                                      CSSPropertyBackgroundPosition };
3276     static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyBackgroundSize, CSSPropertyBackgroundOrigin, 
3277                                                                     CSSPropertyBackgroundClip };
3278
3279     RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3280     list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperator))));
3281     list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator))));
3282     return list.release();
3283 }
3284
3285 } // namespace WebCore