Add support for the column-fill property
[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 GridLength& trackBreadth, const RenderStyle* style, RenderView* renderView)
1100 {
1101     if (!trackBreadth.isLength())
1102         return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue::CSS_FR);
1103
1104     const Length& trackBreadthLength = trackBreadth.length();
1105     if (trackBreadthLength.isAuto())
1106         return cssValuePool().createIdentifierValue(CSSValueAuto);
1107     if (trackBreadthLength.isViewportPercentage())
1108         return zoomAdjustedPixelValue(valueForLength(trackBreadthLength, 0, renderView), style);
1109     return zoomAdjustedPixelValueForLength(trackBreadthLength, style);
1110 }
1111
1112 static PassRefPtr<CSSValue> valueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style, RenderView* renderView)
1113 {
1114     switch (trackSize.type()) {
1115     case LengthTrackSizing:
1116         return valueForGridTrackBreadth(trackSize.length(), style, renderView);
1117     case MinMaxTrackSizing:
1118         RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSeparated();
1119         minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.minTrackBreadth(), style, renderView));
1120         minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.maxTrackBreadth(), style, renderView));
1121         return CSSFunctionValue::create("minmax(", minMaxTrackBreadths);
1122     }
1123     ASSERT_NOT_REACHED();
1124     return 0;
1125 }
1126
1127 static void addValuesForNamedGridLinesAtIndex(const NamedGridLinesMap& namedGridLines, size_t i, CSSValueList& list)
1128 {
1129     // Note that this won't return the results in the order specified in the style sheet,
1130     // which is probably fine as we still *do* return all the expected values.
1131     NamedGridLinesMap::const_iterator it = namedGridLines.begin();
1132     NamedGridLinesMap::const_iterator end = namedGridLines.end();
1133     for (; it != end; ++it) {
1134         const Vector<size_t>& linesIndexes = it->value;
1135         for (size_t j = 0; j < linesIndexes.size(); ++j) {
1136             if (linesIndexes[j] != i)
1137                 continue;
1138
1139             list.append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_STRING));
1140             break;
1141         }
1142     }
1143 }
1144
1145 static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& trackSizes, const NamedGridLinesMap& namedGridLines, const RenderStyle* style, RenderView* renderView)
1146 {
1147     // Handle the 'none' case here.
1148     if (!trackSizes.size()) {
1149         ASSERT(namedGridLines.isEmpty());
1150         return cssValuePool().createIdentifierValue(CSSValueNone);
1151     }
1152
1153     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1154     for (size_t i = 0; i < trackSizes.size(); ++i) {
1155         addValuesForNamedGridLinesAtIndex(namedGridLines, i, *list);
1156         list->append(valueForGridTrackSize(trackSizes[i], style, renderView));
1157     }
1158     // Those are the trailing <string>* allowed in the syntax.
1159     addValuesForNamedGridLinesAtIndex(namedGridLines, trackSizes.size(), *list);
1160     return list.release();
1161 }
1162
1163 static PassRefPtr<CSSValue> valueForGridPosition(const GridPosition& position)
1164 {
1165     if (position.isAuto())
1166         return cssValuePool().createIdentifierValue(CSSValueAuto);
1167
1168     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1169     if (position.isSpan()) {
1170         list->append(cssValuePool().createIdentifierValue(CSSValueSpan));
1171         list->append(cssValuePool().createValue(position.spanPosition(), CSSPrimitiveValue::CSS_NUMBER));
1172     } else
1173         list->append(cssValuePool().createValue(position.integerPosition(), CSSPrimitiveValue::CSS_NUMBER));
1174
1175     if (!position.namedGridLine().isNull())
1176         list->append(cssValuePool().createValue(position.namedGridLine(), CSSPrimitiveValue::CSS_STRING));
1177     return list.release();
1178 }
1179
1180 static PassRefPtr<CSSValue> createTransitionPropertyValue(const Animation& animation)
1181 {
1182     RefPtr<CSSValue> propertyValue;
1183     if (animation.animationMode() == Animation::AnimateNone)
1184         propertyValue = cssValuePool().createIdentifierValue(CSSValueNone);
1185     else if (animation.animationMode() == Animation::AnimateAll)
1186         propertyValue = cssValuePool().createIdentifierValue(CSSValueAll);
1187     else
1188         propertyValue = cssValuePool().createValue(getPropertyNameString(animation.property()), CSSPrimitiveValue::CSS_STRING);
1189     return propertyValue.release();
1190 }
1191
1192 static PassRefPtr<CSSValue> getTransitionPropertyValue(const AnimationList* animList)
1193 {
1194     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1195     if (animList) {
1196         for (size_t i = 0; i < animList->size(); ++i)
1197             list->append(createTransitionPropertyValue(animList->animation(i)));
1198     } else
1199         list->append(cssValuePool().createIdentifierValue(CSSValueAll));
1200     return list.release();
1201 }
1202
1203 static PassRefPtr<CSSValue> getDelayValue(const AnimationList* animList)
1204 {
1205     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1206     if (animList) {
1207         for (size_t i = 0; i < animList->size(); ++i)
1208             list->append(cssValuePool().createValue(animList->animation(i).delay(), CSSPrimitiveValue::CSS_S));
1209     } else {
1210         // Note that initialAnimationDelay() is used for both transitions and animations
1211         list->append(cssValuePool().createValue(Animation::initialAnimationDelay(), CSSPrimitiveValue::CSS_S));
1212     }
1213     return list.release();
1214 }
1215
1216 static PassRefPtr<CSSValue> getDurationValue(const AnimationList* animList)
1217 {
1218     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1219     if (animList) {
1220         for (size_t i = 0; i < animList->size(); ++i)
1221             list->append(cssValuePool().createValue(animList->animation(i).duration(), CSSPrimitiveValue::CSS_S));
1222     } else {
1223         // Note that initialAnimationDuration() is used for both transitions and animations
1224         list->append(cssValuePool().createValue(Animation::initialAnimationDuration(), CSSPrimitiveValue::CSS_S));
1225     }
1226     return list.release();
1227 }
1228
1229 static PassRefPtr<CSSValue> createTimingFunctionValue(const TimingFunction* timingFunction)
1230 {
1231     switch (timingFunction->type()) {
1232     case TimingFunction::CubicBezierFunction: {
1233         const CubicBezierTimingFunction* bezierTimingFunction = static_cast<const CubicBezierTimingFunction*>(timingFunction);
1234         if (bezierTimingFunction->timingFunctionPreset() != CubicBezierTimingFunction::Custom) {
1235             CSSValueID valueId = CSSValueInvalid;
1236             switch (bezierTimingFunction->timingFunctionPreset()) {
1237             case CubicBezierTimingFunction::Ease:
1238                 valueId = CSSValueEase;
1239                 break;
1240             case CubicBezierTimingFunction::EaseIn:
1241                 valueId = CSSValueEaseIn;
1242                 break;
1243             case CubicBezierTimingFunction::EaseOut:
1244                 valueId = CSSValueEaseOut;
1245                 break;
1246             case CubicBezierTimingFunction::EaseInOut:
1247                 valueId = CSSValueEaseInOut;
1248                 break;
1249             default:
1250                 ASSERT_NOT_REACHED();
1251                 return 0;
1252             }
1253             return cssValuePool().createIdentifierValue(valueId);
1254         }
1255         return CSSCubicBezierTimingFunctionValue::create(bezierTimingFunction->x1(), bezierTimingFunction->y1(), bezierTimingFunction->x2(), bezierTimingFunction->y2());
1256     }
1257     case TimingFunction::StepsFunction: {
1258         const StepsTimingFunction* stepsTimingFunction = static_cast<const StepsTimingFunction*>(timingFunction);
1259         return CSSStepsTimingFunctionValue::create(stepsTimingFunction->numberOfSteps(), stepsTimingFunction->stepAtStart());
1260     }
1261     case TimingFunction::LinearFunction:
1262         return cssValuePool().createIdentifierValue(CSSValueLinear);
1263     }
1264     ASSERT_NOT_REACHED();
1265     return 0;
1266 }
1267
1268 static PassRefPtr<CSSValue> getTimingFunctionValue(const AnimationList* animList)
1269 {
1270     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1271     if (animList) {
1272         for (size_t i = 0; i < animList->size(); ++i)
1273             list->append(createTimingFunctionValue(animList->animation(i).timingFunction().get()));
1274     } else
1275         // Note that initialAnimationTimingFunction() is used for both transitions and animations
1276         list->append(createTimingFunctionValue(Animation::initialAnimationTimingFunction().get()));
1277     return list.release();
1278 }
1279
1280 static PassRefPtr<CSSValue> createLineBoxContainValue(unsigned lineBoxContain)
1281 {
1282     if (!lineBoxContain)
1283         return cssValuePool().createIdentifierValue(CSSValueNone);
1284     return CSSLineBoxContainValue::create(lineBoxContain);
1285 }
1286
1287 ComputedStyleExtractor::ComputedStyleExtractor(PassRefPtr<Node> node, bool allowVisitedStyle, PseudoId pseudoElementSpecifier)
1288     : m_node(node)
1289     , m_pseudoElementSpecifier(pseudoElementSpecifier)
1290     , m_allowVisitedStyle(allowVisitedStyle)
1291 {
1292 }
1293
1294
1295 CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n, bool allowVisitedStyle, const String& pseudoElementName)
1296     : m_node(n)
1297     , m_allowVisitedStyle(allowVisitedStyle)
1298     , m_refCount(1)
1299 {
1300     unsigned nameWithoutColonsStart = pseudoElementName[0] == ':' ? (pseudoElementName[1] == ':' ? 2 : 1) : 0;
1301     m_pseudoElementSpecifier = CSSSelector::pseudoId(CSSSelector::parsePseudoType(
1302         AtomicString(pseudoElementName.substring(nameWithoutColonsStart))));
1303 }
1304
1305 CSSComputedStyleDeclaration::~CSSComputedStyleDeclaration()
1306 {
1307 }
1308
1309 void CSSComputedStyleDeclaration::ref()
1310 {
1311     ++m_refCount;
1312 }
1313
1314 void CSSComputedStyleDeclaration::deref()
1315 {
1316     ASSERT(m_refCount);
1317     if (!--m_refCount)
1318         delete this;
1319 }
1320
1321 String CSSComputedStyleDeclaration::cssText() const
1322 {
1323     StringBuilder result;
1324
1325     for (unsigned i = 0; i < numComputedProperties; i++) {
1326         if (i)
1327             result.append(' ');
1328         result.append(getPropertyName(computedProperties[i]));
1329         result.append(": ", 2);
1330         result.append(getPropertyValue(computedProperties[i]));
1331         result.append(';');
1332     }
1333
1334     return result.toString();
1335 }
1336
1337 void CSSComputedStyleDeclaration::setCssText(const String&, ExceptionCode& ec)
1338 {
1339     ec = NO_MODIFICATION_ALLOWED_ERR;
1340 }
1341
1342 static CSSValueID cssIdentifierForFontSizeKeyword(int keywordSize)
1343 {
1344     ASSERT_ARG(keywordSize, keywordSize);
1345     ASSERT_ARG(keywordSize, keywordSize <= 8);
1346     return static_cast<CSSValueID>(CSSValueXxSmall + keywordSize - 1);
1347 }
1348
1349 PassRefPtr<CSSPrimitiveValue> ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword() const
1350 {
1351     if (!m_node)
1352         return 0;
1353
1354     m_node->document().updateLayoutIgnorePendingStylesheets();
1355
1356     RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier);
1357     if (!style)
1358         return 0;
1359
1360     if (int keywordSize = style->fontDescription().keywordSize())
1361         return cssValuePool().createIdentifierValue(cssIdentifierForFontSizeKeyword(keywordSize));
1362
1363     return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style.get());
1364 }
1365
1366 bool ComputedStyleExtractor::useFixedFontDefaultSize() const
1367 {
1368     if (!m_node)
1369         return false;
1370
1371     RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier);
1372     if (!style)
1373         return false;
1374
1375     return style->fontDescription().useFixedDefaultSize();
1376 }
1377
1378
1379 static CSSValueID identifierForFamily(const AtomicString& family)
1380 {
1381     if (family == cursiveFamily)
1382         return CSSValueCursive;
1383     if (family == fantasyFamily)
1384         return CSSValueFantasy;
1385     if (family == monospaceFamily)
1386         return CSSValueMonospace;
1387     if (family == pictographFamily)
1388         return CSSValueWebkitPictograph;
1389     if (family == sansSerifFamily)
1390         return CSSValueSansSerif;
1391     if (family == serifFamily)
1392         return CSSValueSerif;
1393     return CSSValueInvalid;
1394 }
1395
1396 static PassRefPtr<CSSPrimitiveValue> valueForFamily(const AtomicString& family)
1397 {
1398     if (CSSValueID familyIdentifier = identifierForFamily(family))
1399         return cssValuePool().createIdentifierValue(familyIdentifier);
1400     return cssValuePool().createValue(family.string(), CSSPrimitiveValue::CSS_STRING);
1401 }
1402
1403 static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration)
1404 {
1405     // Blink value is ignored.
1406     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1407     if (textDecoration & TextDecorationUnderline)
1408         list->append(cssValuePool().createIdentifierValue(CSSValueUnderline));
1409     if (textDecoration & TextDecorationOverline)
1410         list->append(cssValuePool().createIdentifierValue(CSSValueOverline));
1411     if (textDecoration & TextDecorationLineThrough)
1412         list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough));
1413
1414     if (!list->length())
1415         return cssValuePool().createIdentifierValue(CSSValueNone);
1416     return list.release();
1417 }
1418
1419 #if ENABLE(CSS3_TEXT)
1420 static PassRefPtr<CSSValue> renderTextDecorationStyleFlagsToCSSValue(TextDecorationStyle textDecorationStyle)
1421 {
1422     switch (textDecorationStyle) {
1423     case TextDecorationStyleSolid:
1424         return cssValuePool().createIdentifierValue(CSSValueSolid);
1425     case TextDecorationStyleDouble:
1426         return cssValuePool().createIdentifierValue(CSSValueDouble);
1427     case TextDecorationStyleDotted:
1428         return cssValuePool().createIdentifierValue(CSSValueDotted);
1429     case TextDecorationStyleDashed:
1430         return cssValuePool().createIdentifierValue(CSSValueDashed);
1431     case TextDecorationStyleWavy:
1432         return cssValuePool().createIdentifierValue(CSSValueWavy);
1433     }
1434
1435     ASSERT_NOT_REACHED();
1436     return cssValuePool().createExplicitInitialValue();
1437 }
1438 #endif // CSS3_TEXT
1439
1440 static PassRefPtr<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat)
1441 {
1442     // For backwards compatibility, if both values are equal, just return one of them. And
1443     // if the two values are equivalent to repeat-x or repeat-y, just return the shorthand.
1444     if (xRepeat == yRepeat)
1445         return cssValuePool().createValue(xRepeat);
1446     if (xRepeat == RepeatFill && yRepeat == NoRepeatFill)
1447         return cssValuePool().createIdentifierValue(CSSValueRepeatX);
1448     if (xRepeat == NoRepeatFill && yRepeat == RepeatFill)
1449         return cssValuePool().createIdentifierValue(CSSValueRepeatY);
1450
1451     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1452     list->append(cssValuePool().createValue(xRepeat));
1453     list->append(cssValuePool().createValue(yRepeat));
1454     return list.release();
1455 }
1456
1457 static PassRefPtr<CSSValue> fillSourceTypeToCSSValue(EMaskSourceType type)
1458 {
1459     switch (type) {
1460     case MaskAlpha:
1461         return cssValuePool().createValue(CSSValueAlpha);
1462     case MaskLuminance:
1463         return cssValuePool().createValue(CSSValueLuminance);
1464     }
1465
1466     ASSERT_NOT_REACHED();
1467
1468     return 0;
1469 }
1470 static PassRefPtr<CSSValue> fillSizeToCSSValue(const FillSize& fillSize, const RenderStyle* style)
1471 {
1472     if (fillSize.type == Contain)
1473         return cssValuePool().createIdentifierValue(CSSValueContain);
1474
1475     if (fillSize.type == Cover)
1476         return cssValuePool().createIdentifierValue(CSSValueCover);
1477
1478     if (fillSize.size.height().isAuto())
1479         return zoomAdjustedPixelValueForLength(fillSize.size.width(), style);
1480
1481     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1482     list->append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style));
1483     list->append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style));
1484     return list.release();
1485 }
1486
1487 static PassRefPtr<CSSValue> contentToCSSValue(const RenderStyle* style)
1488 {
1489     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1490     for (const ContentData* contentData = style->contentData(); contentData; contentData = contentData->next()) {
1491         if (contentData->isCounter()) {
1492             const CounterContent* counter = static_cast<const CounterContentData*>(contentData)->counter();
1493             ASSERT(counter);
1494             list->append(cssValuePool().createValue(counter->identifier(), CSSPrimitiveValue::CSS_COUNTER_NAME));
1495         } else if (contentData->isImage()) {
1496             const StyleImage* image = static_cast<const ImageContentData*>(contentData)->image();
1497             ASSERT(image);
1498             list->append(image->cssValue());
1499         } else if (contentData->isText())
1500             list->append(cssValuePool().createValue(static_cast<const TextContentData*>(contentData)->text(), CSSPrimitiveValue::CSS_STRING));
1501     }
1502     if (!style->regionThread().isNull())
1503         list->append(cssValuePool().createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING));
1504     return list.release();
1505 }
1506
1507 static PassRefPtr<CSSValue> counterToCSSValue(const RenderStyle* style, CSSPropertyID propertyID)
1508 {
1509     const CounterDirectiveMap* map = style->counterDirectives();
1510     if (!map)
1511         return 0;
1512
1513     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1514     for (CounterDirectiveMap::const_iterator it = map->begin(); it != map->end(); ++it) {
1515         list->append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_STRING));
1516         short number = propertyID == CSSPropertyCounterIncrement ? it->value.incrementValue() : it->value.resetValue();
1517         list->append(cssValuePool().createValue((double)number, CSSPrimitiveValue::CSS_NUMBER));
1518     }
1519     return list.release();
1520 }
1521
1522 static void logUnimplementedPropertyID(CSSPropertyID propertyID)
1523 {
1524     DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ());
1525     if (!propertyIDSet.add(propertyID).isNewEntry)
1526         return;
1527
1528     LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(propertyID));
1529 }
1530
1531 static PassRefPtr<CSSValueList> fontFamilyFromStyle(RenderStyle* style)
1532     {
1533     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1534     for (unsigned i = 0; i < style->font().familyCount(); ++i)
1535         list->append(valueForFamily(style->font().familyAt(i)));
1536     return list.release();
1537 }
1538
1539 static PassRefPtr<CSSPrimitiveValue> lineHeightFromStyle(RenderStyle* style, RenderView* renderView)
1540 {
1541     Length length = style->lineHeight();
1542     if (length.isNegative())
1543         return cssValuePool().createIdentifierValue(CSSValueNormal);
1544     if (length.isPercent())
1545         // This is imperfect, because it doesn't include the zoom factor and the real computation
1546         // for how high to be in pixels does include things like minimum font size and the zoom factor.
1547         // On the other hand, since font-size doesn't include the zoom factor, we really can't do
1548         // that here either.
1549         return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style);
1550     return zoomAdjustedPixelValue(valueForLength(length, 0, renderView), style);
1551 }
1552
1553 static PassRefPtr<CSSPrimitiveValue> fontSizeFromStyle(RenderStyle* style)
1554 {
1555     return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style);
1556 }
1557
1558 static PassRefPtr<CSSPrimitiveValue> fontStyleFromStyle(RenderStyle* style)
1559 {
1560     if (style->fontDescription().italic())
1561         return cssValuePool().createIdentifierValue(CSSValueItalic);
1562     return cssValuePool().createIdentifierValue(CSSValueNormal);
1563 }
1564
1565 static PassRefPtr<CSSPrimitiveValue> fontVariantFromStyle(RenderStyle* style)
1566 {
1567     if (style->fontDescription().smallCaps())
1568         return cssValuePool().createIdentifierValue(CSSValueSmallCaps);
1569     return cssValuePool().createIdentifierValue(CSSValueNormal);
1570 }
1571
1572 static PassRefPtr<CSSPrimitiveValue> fontWeightFromStyle(RenderStyle* style)
1573 {
1574     switch (style->fontDescription().weight()) {
1575     case FontWeight100:
1576         return cssValuePool().createIdentifierValue(CSSValue100);
1577     case FontWeight200:
1578         return cssValuePool().createIdentifierValue(CSSValue200);
1579     case FontWeight300:
1580         return cssValuePool().createIdentifierValue(CSSValue300);
1581     case FontWeightNormal:
1582         return cssValuePool().createIdentifierValue(CSSValueNormal);
1583     case FontWeight500:
1584         return cssValuePool().createIdentifierValue(CSSValue500);
1585     case FontWeight600:
1586         return cssValuePool().createIdentifierValue(CSSValue600);
1587     case FontWeightBold:
1588         return cssValuePool().createIdentifierValue(CSSValueBold);
1589     case FontWeight800:
1590         return cssValuePool().createIdentifierValue(CSSValue800);
1591     case FontWeight900:
1592         return cssValuePool().createIdentifierValue(CSSValue900);
1593     }
1594     ASSERT_NOT_REACHED();
1595     return cssValuePool().createIdentifierValue(CSSValueNormal);
1596 }
1597
1598 typedef const Length& (RenderStyle::*RenderStyleLengthGetter)() const;
1599 typedef LayoutUnit (RenderBoxModelObject::*RenderBoxComputedCSSValueGetter)() const;
1600
1601 template<RenderStyleLengthGetter lengthGetter, RenderBoxComputedCSSValueGetter computedCSSValueGetter>
1602 inline PassRefPtr<CSSValue> zoomAdjustedPaddingOrMarginPixelValue(RenderStyle* style, RenderObject* renderer)
1603 {
1604     Length unzoomzedLength = (style->*lengthGetter)();
1605     if (!renderer || !renderer->isBox() || unzoomzedLength.isFixed())
1606         return zoomAdjustedPixelValueForLength(unzoomzedLength, style);
1607     return zoomAdjustedPixelValue((toRenderBox(renderer)->*computedCSSValueGetter)(), style);
1608 }
1609
1610 template<RenderStyleLengthGetter lengthGetter>
1611 inline bool paddingOrMarginIsRendererDependent(RenderStyle* style, RenderObject* renderer)
1612 {
1613     if (!renderer || !renderer->isBox())
1614         return false;
1615     return !(style && (style->*lengthGetter)().isFixed());
1616 }
1617
1618 static bool isLayoutDependent(CSSPropertyID propertyID, RenderStyle* style, RenderObject* renderer)
1619 {
1620     switch (propertyID) {
1621     case CSSPropertyWidth:
1622     case CSSPropertyHeight:
1623     case CSSPropertyWebkitPerspectiveOrigin:
1624     case CSSPropertyWebkitTransformOrigin:
1625     case CSSPropertyWebkitTransform:
1626 #if ENABLE(CSS_FILTERS)
1627     case CSSPropertyWebkitFilter:
1628 #endif
1629         return true;
1630     case CSSPropertyMargin: {
1631         if (!renderer || !renderer->isBox())
1632             return false;
1633         return !(style && style->marginTop().isFixed() && style->marginRight().isFixed()
1634             && style->marginBottom().isFixed() && style->marginLeft().isFixed());
1635     }
1636     case CSSPropertyMarginTop:
1637         return paddingOrMarginIsRendererDependent<&RenderStyle::marginTop>(style, renderer);
1638     case CSSPropertyMarginRight:
1639         return paddingOrMarginIsRendererDependent<&RenderStyle::marginRight>(style, renderer);
1640     case CSSPropertyMarginBottom:
1641         return paddingOrMarginIsRendererDependent<&RenderStyle::marginBottom>(style, renderer);
1642     case CSSPropertyMarginLeft:
1643         return paddingOrMarginIsRendererDependent<&RenderStyle::marginLeft>(style, renderer);
1644     case CSSPropertyPadding: {
1645         if (!renderer || !renderer->isBox())
1646             return false;
1647         return !(style && style->paddingTop().isFixed() && style->paddingRight().isFixed()
1648             && style->paddingBottom().isFixed() && style->paddingLeft().isFixed());
1649     }
1650     case CSSPropertyPaddingTop:
1651         return paddingOrMarginIsRendererDependent<&RenderStyle::paddingTop>(style, renderer);
1652     case CSSPropertyPaddingRight:
1653         return paddingOrMarginIsRendererDependent<&RenderStyle::paddingRight>(style, renderer);
1654     case CSSPropertyPaddingBottom:
1655         return paddingOrMarginIsRendererDependent<&RenderStyle::paddingBottom>(style, renderer);
1656     case CSSPropertyPaddingLeft:
1657         return paddingOrMarginIsRendererDependent<&RenderStyle::paddingLeft>(style, renderer); 
1658     default:
1659         return false;
1660     }
1661 }
1662
1663 Node* ComputedStyleExtractor::styledNode() const
1664 {
1665     if (!m_node)
1666         return 0;
1667     if (!m_node->isElementNode())
1668         return m_node.get();
1669     Element* element = toElement(m_node.get());
1670     PseudoElement* pseudoElement;
1671     if (m_pseudoElementSpecifier == BEFORE && (pseudoElement = element->beforePseudoElement()))
1672         return pseudoElement;
1673     if (m_pseudoElementSpecifier == AFTER && (pseudoElement = element->afterPseudoElement()))
1674         return pseudoElement;
1675     return element;
1676 }
1677
1678 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
1679 {
1680     return ComputedStyleExtractor(m_node, m_allowVisitedStyle, m_pseudoElementSpecifier).propertyValue(propertyID, updateLayout);
1681 }
1682
1683 PassRefPtr<MutableStylePropertySet> CSSComputedStyleDeclaration::copyProperties() const
1684 {
1685     return ComputedStyleExtractor(m_node, m_allowVisitedStyle, m_pseudoElementSpecifier).copyProperties();
1686 }
1687
1688 static inline bool nodeOrItsAncestorNeedsStyleRecalc(Node* styledNode)
1689 {
1690     if (styledNode->document().hasPendingForcedStyleRecalc())
1691         return true;
1692     for (Node* n = styledNode; n; n = n->parentNode()) {// FIXME: Call parentOrShadowHostNode() instead
1693         if (n->needsStyleRecalc())
1694             return true;
1695     }
1696     return false;
1697 }
1698
1699 static inline PassRefPtr<RenderStyle> computeRenderStyleForProperty(Node* styledNode, PseudoId pseudoElementSpecifier, CSSPropertyID propertyID)
1700 {
1701     RenderObject* renderer = styledNode->renderer();
1702
1703     if (renderer && renderer->isComposited() && AnimationController::supportsAcceleratedAnimationOfProperty(propertyID)) {
1704         AnimationUpdateBlock animationUpdateBlock(&renderer->animation());
1705         RefPtr<RenderStyle> style = renderer->animation().getAnimatedStyleForRenderer(toRenderElement(renderer));
1706         if (pseudoElementSpecifier && !styledNode->isPseudoElement()) {
1707             // FIXME: This cached pseudo style will only exist if the animation has been run at least once.
1708             return style->getCachedPseudoStyle(pseudoElementSpecifier);
1709         }
1710         return style.release();
1711     }
1712
1713     return styledNode->computedStyle(styledNode->isPseudoElement() ? NOPSEUDO : pseudoElementSpecifier);
1714 }
1715
1716 PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
1717 {
1718     Node* styledNode = this->styledNode();
1719     if (!styledNode)
1720         return 0;
1721
1722     RefPtr<RenderStyle> style;
1723     RenderObject* renderer = 0;
1724     bool forceFullLayout = false;
1725     if (updateLayout) {
1726         Document& document = styledNode->document();
1727
1728         if (nodeOrItsAncestorNeedsStyleRecalc(styledNode)) {
1729             document.updateStyleIfNeeded();
1730             // The style recalc could have caused the styled node to be discarded or replaced
1731             // if it was a PseudoElement so we need to update it.
1732             styledNode = this->styledNode();
1733         }
1734
1735         style = computeRenderStyleForProperty(styledNode, m_pseudoElementSpecifier, propertyID);
1736         renderer = styledNode->renderer();
1737
1738         // FIXME: Some of these cases could be narrowed down or optimized better.
1739         forceFullLayout = isLayoutDependent(propertyID, style.get(), renderer)
1740             || styledNode->isInShadowTree()
1741             || (document.styleResolverIfExists() && document.styleResolverIfExists()->hasViewportDependentMediaQueries() && document.ownerElement())
1742             || document.seamlessParentIFrame();
1743
1744         if (forceFullLayout) {
1745             document.updateLayoutIgnorePendingStylesheets();
1746             styledNode = this->styledNode();
1747         }
1748     }
1749
1750     if (!updateLayout || forceFullLayout) {
1751         style = computeRenderStyleForProperty(styledNode, m_pseudoElementSpecifier, propertyID);
1752         renderer = styledNode->renderer();
1753     }
1754
1755     if (!style)
1756         return 0;
1757
1758     propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction(), style->writingMode());
1759
1760     switch (propertyID) {
1761         case CSSPropertyInvalid:
1762 #if ENABLE(CSS_VARIABLES)
1763         case CSSPropertyVariable:
1764 #endif
1765             break;
1766
1767         case CSSPropertyBackgroundColor:
1768             return cssValuePool().createColorValue(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor().rgb());
1769         case CSSPropertyBackgroundImage:
1770         case CSSPropertyWebkitMaskImage: {
1771             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskImage ? style->maskLayers() : style->backgroundLayers();
1772             if (!layers)
1773                 return cssValuePool().createIdentifierValue(CSSValueNone);
1774
1775             if (!layers->next()) {
1776                 if (layers->image())
1777                     return layers->image()->cssValue();
1778
1779                 return cssValuePool().createIdentifierValue(CSSValueNone);
1780             }
1781
1782             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1783             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
1784                 if (currLayer->image())
1785                     list->append(currLayer->image()->cssValue());
1786                 else
1787                     list->append(cssValuePool().createIdentifierValue(CSSValueNone));
1788             }
1789             return list.release();
1790         }
1791         case CSSPropertyBackgroundSize:
1792         case CSSPropertyWebkitBackgroundSize:
1793         case CSSPropertyWebkitMaskSize: {
1794             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskSize ? style->maskLayers() : style->backgroundLayers();
1795             if (!layers->next())
1796                 return fillSizeToCSSValue(layers->size(), style.get());
1797
1798             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1799             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1800                 list->append(fillSizeToCSSValue(currLayer->size(), style.get()));
1801
1802             return list.release();
1803         }
1804         case CSSPropertyBackgroundRepeat:
1805         case CSSPropertyWebkitMaskRepeat: {
1806             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskRepeat ? style->maskLayers() : style->backgroundLayers();
1807             if (!layers->next())
1808                 return fillRepeatToCSSValue(layers->repeatX(), layers->repeatY());
1809
1810             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1811             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1812                 list->append(fillRepeatToCSSValue(currLayer->repeatX(), currLayer->repeatY()));
1813
1814             return list.release();
1815         }
1816         case CSSPropertyWebkitMaskSourceType: {
1817             const FillLayer* layers = style->maskLayers();
1818
1819             if (!layers)
1820                 return cssValuePool().createIdentifierValue(CSSValueNone);
1821
1822             if (!layers->next())
1823                 return fillSourceTypeToCSSValue(layers->maskSourceType());
1824
1825             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1826             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1827                 list->append(fillSourceTypeToCSSValue(currLayer->maskSourceType()));
1828
1829             return list.release();
1830         }
1831         case CSSPropertyWebkitBackgroundComposite:
1832         case CSSPropertyWebkitMaskComposite: {
1833             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskComposite ? style->maskLayers() : style->backgroundLayers();
1834             if (!layers->next())
1835                 return cssValuePool().createValue(layers->composite());
1836
1837             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1838             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1839                 list->append(cssValuePool().createValue(currLayer->composite()));
1840
1841             return list.release();
1842         }
1843         case CSSPropertyBackgroundAttachment: {
1844             const FillLayer* layers = style->backgroundLayers();
1845             if (!layers->next())
1846                 return cssValuePool().createValue(layers->attachment());
1847
1848             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1849             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1850                 list->append(cssValuePool().createValue(currLayer->attachment()));
1851
1852             return list.release();
1853         }
1854         case CSSPropertyBackgroundClip:
1855         case CSSPropertyBackgroundOrigin:
1856         case CSSPropertyWebkitBackgroundClip:
1857         case CSSPropertyWebkitBackgroundOrigin:
1858         case CSSPropertyWebkitMaskClip:
1859         case CSSPropertyWebkitMaskOrigin: {
1860             const FillLayer* layers = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? style->maskLayers() : style->backgroundLayers();
1861             bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == CSSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip;
1862             if (!layers->next()) {
1863                 EFillBox box = isClip ? layers->clip() : layers->origin();
1864                 return cssValuePool().createValue(box);
1865             }
1866
1867             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1868             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
1869                 EFillBox box = isClip ? currLayer->clip() : currLayer->origin();
1870                 list->append(cssValuePool().createValue(box));
1871             }
1872
1873             return list.release();
1874         }
1875         case CSSPropertyBackgroundPosition:
1876         case CSSPropertyWebkitMaskPosition: {
1877             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPosition ? style->maskLayers() : style->backgroundLayers();
1878             if (!layers->next())
1879                 return createPositionListForLayer(propertyID, layers, style.get());
1880
1881             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1882             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1883                 list->append(createPositionListForLayer(propertyID, currLayer, style.get()));
1884             return list.release();
1885         }
1886         case CSSPropertyBackgroundPositionX:
1887         case CSSPropertyWebkitMaskPositionX: {
1888             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionX ? style->maskLayers() : style->backgroundLayers();
1889             if (!layers->next())
1890                 return cssValuePool().createValue(layers->xPosition());
1891
1892             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1893             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1894                 list->append(cssValuePool().createValue(currLayer->xPosition()));
1895
1896             return list.release();
1897         }
1898         case CSSPropertyBackgroundPositionY:
1899         case CSSPropertyWebkitMaskPositionY: {
1900             const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionY ? style->maskLayers() : style->backgroundLayers();
1901             if (!layers->next())
1902                 return cssValuePool().createValue(layers->yPosition());
1903
1904             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1905             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
1906                 list->append(cssValuePool().createValue(currLayer->yPosition()));
1907
1908             return list.release();
1909         }
1910         case CSSPropertyBorderCollapse:
1911             if (style->borderCollapse())
1912                 return cssValuePool().createIdentifierValue(CSSValueCollapse);
1913             return cssValuePool().createIdentifierValue(CSSValueSeparate);
1914         case CSSPropertyBorderSpacing: {
1915             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1916             list->append(zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get()));
1917             list->append(zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get()));
1918             return list.release();
1919         }
1920         case CSSPropertyWebkitBorderHorizontalSpacing:
1921             return zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get());
1922         case CSSPropertyWebkitBorderVerticalSpacing:
1923             return zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get());
1924         case CSSPropertyBorderImageSource:
1925             if (style->borderImageSource())
1926                 return style->borderImageSource()->cssValue();
1927             return cssValuePool().createIdentifierValue(CSSValueNone);
1928         case CSSPropertyBorderTopColor:
1929             return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidColor(style.get(), style->borderTopColor());
1930         case CSSPropertyBorderRightColor:
1931             return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderRightColor).rgb()) : currentColorOrValidColor(style.get(), style->borderRightColor());
1932         case CSSPropertyBorderBottomColor:
1933             return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderBottomColor).rgb()) : currentColorOrValidColor(style.get(), style->borderBottomColor());
1934         case CSSPropertyBorderLeftColor:
1935             return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyBorderLeftColor).rgb()) : currentColorOrValidColor(style.get(), style->borderLeftColor());
1936         case CSSPropertyBorderTopStyle:
1937             return cssValuePool().createValue(style->borderTopStyle());
1938         case CSSPropertyBorderRightStyle:
1939             return cssValuePool().createValue(style->borderRightStyle());
1940         case CSSPropertyBorderBottomStyle:
1941             return cssValuePool().createValue(style->borderBottomStyle());
1942         case CSSPropertyBorderLeftStyle:
1943             return cssValuePool().createValue(style->borderLeftStyle());
1944         case CSSPropertyBorderTopWidth:
1945             return zoomAdjustedPixelValue(style->borderTopWidth(), style.get());
1946         case CSSPropertyBorderRightWidth:
1947             return zoomAdjustedPixelValue(style->borderRightWidth(), style.get());
1948         case CSSPropertyBorderBottomWidth:
1949             return zoomAdjustedPixelValue(style->borderBottomWidth(), style.get());
1950         case CSSPropertyBorderLeftWidth:
1951             return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get());
1952         case CSSPropertyBottom:
1953             return getPositionOffsetValue(style.get(), CSSPropertyBottom, m_node->document().renderView());
1954         case CSSPropertyWebkitBoxAlign:
1955             return cssValuePool().createValue(style->boxAlign());
1956 #if ENABLE(CSS_BOX_DECORATION_BREAK)
1957         case CSSPropertyWebkitBoxDecorationBreak:
1958             if (style->boxDecorationBreak() == DSLICE)
1959                 return cssValuePool().createIdentifierValue(CSSValueSlice);
1960         return cssValuePool().createIdentifierValue(CSSValueClone);
1961 #endif
1962         case CSSPropertyWebkitBoxDirection:
1963             return cssValuePool().createValue(style->boxDirection());
1964         case CSSPropertyWebkitBoxFlex:
1965             return cssValuePool().createValue(style->boxFlex(), CSSPrimitiveValue::CSS_NUMBER);
1966         case CSSPropertyWebkitBoxFlexGroup:
1967             return cssValuePool().createValue(style->boxFlexGroup(), CSSPrimitiveValue::CSS_NUMBER);
1968         case CSSPropertyWebkitBoxLines:
1969             return cssValuePool().createValue(style->boxLines());
1970         case CSSPropertyWebkitBoxOrdinalGroup:
1971             return cssValuePool().createValue(style->boxOrdinalGroup(), CSSPrimitiveValue::CSS_NUMBER);
1972         case CSSPropertyWebkitBoxOrient:
1973             return cssValuePool().createValue(style->boxOrient());
1974         case CSSPropertyWebkitBoxPack:
1975             return cssValuePool().createValue(style->boxPack());
1976         case CSSPropertyWebkitBoxReflect:
1977             return valueForReflection(style->boxReflect(), style.get());
1978         case CSSPropertyBoxShadow:
1979         case CSSPropertyWebkitBoxShadow:
1980             return valueForShadow(style->boxShadow(), propertyID, style.get());
1981         case CSSPropertyCaptionSide:
1982             return cssValuePool().createValue(style->captionSide());
1983         case CSSPropertyClear:
1984             return cssValuePool().createValue(style->clear());
1985         case CSSPropertyColor:
1986             return cssValuePool().createColorValue(m_allowVisitedStyle ? style->visitedDependentColor(CSSPropertyColor).rgb() : style->color().rgb());
1987         case CSSPropertyWebkitPrintColorAdjust:
1988             return cssValuePool().createValue(style->printColorAdjust());
1989         case CSSPropertyWebkitColumnAxis:
1990             return cssValuePool().createValue(style->columnAxis());
1991         case CSSPropertyWebkitColumnCount:
1992             if (style->hasAutoColumnCount())
1993                 return cssValuePool().createIdentifierValue(CSSValueAuto);
1994             return cssValuePool().createValue(style->columnCount(), CSSPrimitiveValue::CSS_NUMBER);
1995         case CSSPropertyWebkitColumnFill:
1996             return cssValuePool().createValue(style->columnFill());
1997         case CSSPropertyWebkitColumnGap:
1998             if (style->hasNormalColumnGap())
1999                 return cssValuePool().createIdentifierValue(CSSValueNormal);
2000             return zoomAdjustedPixelValue(style->columnGap(), style.get());
2001         case CSSPropertyWebkitColumnProgression:
2002             return cssValuePool().createValue(style->columnProgression());
2003         case CSSPropertyWebkitColumnRuleColor:
2004             return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->columnRuleColor());
2005         case CSSPropertyWebkitColumnRuleStyle:
2006             return cssValuePool().createValue(style->columnRuleStyle());
2007         case CSSPropertyWebkitColumnRuleWidth:
2008             return zoomAdjustedPixelValue(style->columnRuleWidth(), style.get());
2009         case CSSPropertyWebkitColumnSpan:
2010             return cssValuePool().createIdentifierValue(style->columnSpan() ? CSSValueAll : CSSValueNone);
2011         case CSSPropertyWebkitColumnBreakAfter:
2012             return cssValuePool().createValue(style->columnBreakAfter());
2013         case CSSPropertyWebkitColumnBreakBefore:
2014             return cssValuePool().createValue(style->columnBreakBefore());
2015         case CSSPropertyWebkitColumnBreakInside:
2016             return cssValuePool().createValue(style->columnBreakInside());
2017         case CSSPropertyWebkitColumnWidth:
2018             if (style->hasAutoColumnWidth())
2019                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2020             return zoomAdjustedPixelValue(style->columnWidth(), style.get());
2021         case CSSPropertyTabSize:
2022             return cssValuePool().createValue(style->tabSize(), CSSPrimitiveValue::CSS_NUMBER);
2023 #if ENABLE(CSS_REGIONS)
2024         case CSSPropertyWebkitRegionBreakAfter:
2025             return cssValuePool().createValue(style->regionBreakAfter());
2026         case CSSPropertyWebkitRegionBreakBefore:
2027             return cssValuePool().createValue(style->regionBreakBefore());
2028         case CSSPropertyWebkitRegionBreakInside:
2029             return cssValuePool().createValue(style->regionBreakInside());
2030 #endif
2031         case CSSPropertyCursor: {
2032             RefPtr<CSSValueList> list;
2033             CursorList* cursors = style->cursors();
2034             if (cursors && cursors->size() > 0) {
2035                 list = CSSValueList::createCommaSeparated();
2036                 for (unsigned i = 0; i < cursors->size(); ++i)
2037                     if (StyleImage* image = cursors->at(i).image())
2038                         list->append(image->cssValue());
2039             }
2040             RefPtr<CSSValue> value = cssValuePool().createValue(style->cursor());
2041             if (list) {
2042                 list->append(value.release());
2043                 return list.release();
2044             }
2045             return value.release();
2046         }
2047 #if ENABLE(CURSOR_VISIBILITY)
2048         case CSSPropertyWebkitCursorVisibility:
2049             return cssValuePool().createValue(style->cursorVisibility());
2050 #endif
2051         case CSSPropertyDirection:
2052             return cssValuePool().createValue(style->direction());
2053         case CSSPropertyDisplay:
2054             return cssValuePool().createValue(style->display());
2055         case CSSPropertyEmptyCells:
2056             return cssValuePool().createValue(style->emptyCells());
2057         case CSSPropertyWebkitAlignContent:
2058             return cssValuePool().createValue(style->alignContent());
2059         case CSSPropertyWebkitAlignItems:
2060             return cssValuePool().createValue(style->alignItems());
2061         case CSSPropertyWebkitAlignSelf:
2062             if (style->alignSelf() == AlignAuto) {
2063                 Node* parent = styledNode->parentNode();
2064                 if (parent && parent->computedStyle())
2065                     return cssValuePool().createValue(parent->computedStyle()->alignItems());
2066                 return cssValuePool().createValue(AlignStretch);
2067             }
2068             return cssValuePool().createValue(style->alignSelf());
2069         case CSSPropertyWebkitFlex:
2070             return getCSSPropertyValuesForShorthandProperties(webkitFlexShorthand());
2071         case CSSPropertyWebkitFlexBasis:
2072             return cssValuePool().createValue(style->flexBasis());
2073         case CSSPropertyWebkitFlexDirection:
2074             return cssValuePool().createValue(style->flexDirection());
2075         case CSSPropertyWebkitFlexFlow:
2076             return getCSSPropertyValuesForShorthandProperties(webkitFlexFlowShorthand());
2077         case CSSPropertyWebkitFlexGrow:
2078             return cssValuePool().createValue(style->flexGrow());
2079         case CSSPropertyWebkitFlexShrink:
2080             return cssValuePool().createValue(style->flexShrink());
2081         case CSSPropertyWebkitFlexWrap:
2082             return cssValuePool().createValue(style->flexWrap());
2083         case CSSPropertyWebkitJustifyContent:
2084             return cssValuePool().createValue(style->justifyContent());
2085         case CSSPropertyWebkitOrder:
2086             return cssValuePool().createValue(style->order(), CSSPrimitiveValue::CSS_NUMBER);
2087         case CSSPropertyFloat:
2088             if (style->display() != NONE && style->hasOutOfFlowPosition())
2089                 return cssValuePool().createIdentifierValue(CSSValueNone);
2090             return cssValuePool().createValue(style->floating());
2091         case CSSPropertyFont: {
2092             RefPtr<CSSFontValue> computedFont = CSSFontValue::create();
2093             computedFont->style = fontStyleFromStyle(style.get());
2094             computedFont->variant = fontVariantFromStyle(style.get());
2095             computedFont->weight = fontWeightFromStyle(style.get());
2096             computedFont->size = fontSizeFromStyle(style.get());
2097             computedFont->lineHeight = lineHeightFromStyle(style.get(), m_node->document().renderView());
2098             computedFont->family = fontFamilyFromStyle(style.get());
2099             return computedFont.release();
2100         }
2101         case CSSPropertyFontFamily: {
2102             RefPtr<CSSValueList> fontFamilyList = fontFamilyFromStyle(style.get());
2103             // If there's only a single family, return that as a CSSPrimitiveValue.
2104             // NOTE: Gecko always returns this as a comma-separated CSSPrimitiveValue string.
2105             if (fontFamilyList->length() == 1)
2106                 return fontFamilyList->item(0);
2107             return fontFamilyList.release();
2108         }
2109         case CSSPropertyFontSize:
2110             return fontSizeFromStyle(style.get());
2111         case CSSPropertyFontStyle:
2112             return fontStyleFromStyle(style.get());
2113         case CSSPropertyFontVariant:
2114             return fontVariantFromStyle(style.get());
2115         case CSSPropertyFontWeight:
2116             return fontWeightFromStyle(style.get());
2117         case CSSPropertyWebkitFontFeatureSettings: {
2118             const FontFeatureSettings* featureSettings = style->fontDescription().featureSettings();
2119             if (!featureSettings || !featureSettings->size())
2120                 return cssValuePool().createIdentifierValue(CSSValueNormal);
2121             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2122             for (unsigned i = 0; i < featureSettings->size(); ++i) {
2123                 const FontFeature& feature = featureSettings->at(i);
2124                 RefPtr<CSSFontFeatureValue> featureValue = CSSFontFeatureValue::create(feature.tag(), feature.value());
2125                 list->append(featureValue.release());
2126             }
2127             return list.release();
2128         }
2129         case CSSPropertyWebkitGridAutoColumns:
2130             return valueForGridTrackSize(style->gridAutoColumns(), style.get(), m_node->document().renderView());
2131         case CSSPropertyWebkitGridAutoFlow:
2132             return cssValuePool().createValue(style->gridAutoFlow());
2133         case CSSPropertyWebkitGridAutoRows:
2134             return valueForGridTrackSize(style->gridAutoRows(), style.get(), m_node->document().renderView());
2135         case CSSPropertyWebkitGridDefinitionColumns:
2136             return valueForGridTrackList(style->gridColumns(), style->namedGridColumnLines(), style.get(), m_node->document().renderView());
2137         case CSSPropertyWebkitGridDefinitionRows:
2138             return valueForGridTrackList(style->gridRows(), style->namedGridRowLines(), style.get(), m_node->document().renderView());
2139
2140         case CSSPropertyWebkitGridColumnStart:
2141             return valueForGridPosition(style->gridItemColumnStart());
2142         case CSSPropertyWebkitGridColumnEnd:
2143             return valueForGridPosition(style->gridItemColumnEnd());
2144         case CSSPropertyWebkitGridRowStart:
2145             return valueForGridPosition(style->gridItemRowStart());
2146         case CSSPropertyWebkitGridRowEnd:
2147             return valueForGridPosition(style->gridItemRowEnd());
2148         case CSSPropertyWebkitGridArea:
2149             return getCSSPropertyValuesForGridShorthand(webkitGridAreaShorthand());
2150         case CSSPropertyWebkitGridColumn:
2151             return getCSSPropertyValuesForGridShorthand(webkitGridColumnShorthand());
2152         case CSSPropertyWebkitGridRow:
2153             return getCSSPropertyValuesForGridShorthand(webkitGridRowShorthand());
2154
2155         case CSSPropertyWebkitGridTemplate:
2156             if (!style->namedGridAreaRowCount()) {
2157                 ASSERT(!style->namedGridAreaColumnCount());
2158                 return cssValuePool().createIdentifierValue(CSSValueNone);
2159             }
2160
2161             return CSSGridTemplateValue::create(style->namedGridArea(), style->namedGridAreaRowCount(), style->namedGridAreaColumnCount());
2162
2163         case CSSPropertyHeight:
2164             if (renderer) {
2165                 // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-property,
2166                 // the "height" property does not apply for non-replaced inline elements.
2167                 if (!renderer->isReplaced() && renderer->isInline())
2168                     return cssValuePool().createIdentifierValue(CSSValueAuto);
2169                 return zoomAdjustedPixelValue(sizingBox(renderer).height(), style.get());
2170             }
2171             return zoomAdjustedPixelValueForLength(style->height(), style.get());
2172         case CSSPropertyWebkitHighlight:
2173             if (style->highlight() == nullAtom)
2174                 return cssValuePool().createIdentifierValue(CSSValueNone);
2175             return cssValuePool().createValue(style->highlight(), CSSPrimitiveValue::CSS_STRING);
2176         case CSSPropertyWebkitHyphens:
2177             return cssValuePool().createValue(style->hyphens());
2178         case CSSPropertyWebkitHyphenateCharacter:
2179             if (style->hyphenationString().isNull())
2180                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2181             return cssValuePool().createValue(style->hyphenationString(), CSSPrimitiveValue::CSS_STRING);
2182         case CSSPropertyWebkitHyphenateLimitAfter:
2183             if (style->hyphenationLimitAfter() < 0)
2184                 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
2185             return CSSPrimitiveValue::create(style->hyphenationLimitAfter(), CSSPrimitiveValue::CSS_NUMBER);
2186         case CSSPropertyWebkitHyphenateLimitBefore:
2187             if (style->hyphenationLimitBefore() < 0)
2188                 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
2189             return CSSPrimitiveValue::create(style->hyphenationLimitBefore(), CSSPrimitiveValue::CSS_NUMBER);
2190         case CSSPropertyWebkitHyphenateLimitLines:
2191             if (style->hyphenationLimitLines() < 0)
2192                 return CSSPrimitiveValue::createIdentifier(CSSValueNoLimit);
2193             return CSSPrimitiveValue::create(style->hyphenationLimitLines(), CSSPrimitiveValue::CSS_NUMBER);
2194         case CSSPropertyWebkitBorderFit:
2195             if (style->borderFit() == BorderFitBorder)
2196                 return cssValuePool().createIdentifierValue(CSSValueBorder);
2197             return cssValuePool().createIdentifierValue(CSSValueLines);
2198 #if ENABLE(CSS_IMAGE_ORIENTATION)
2199         case CSSPropertyImageOrientation:
2200             return cssValuePool().createValue(style->imageOrientation());
2201 #endif
2202         case CSSPropertyImageRendering:
2203             return CSSPrimitiveValue::create(style->imageRendering());
2204 #if ENABLE(CSS_IMAGE_RESOLUTION)
2205         case CSSPropertyImageResolution:
2206             return cssValuePool().createValue(style->imageResolution(), CSSPrimitiveValue::CSS_DPPX);
2207 #endif
2208         case CSSPropertyLeft:
2209             return getPositionOffsetValue(style.get(), CSSPropertyLeft, m_node->document().renderView());
2210         case CSSPropertyLetterSpacing:
2211             if (!style->letterSpacing())
2212                 return cssValuePool().createIdentifierValue(CSSValueNormal);
2213             return zoomAdjustedPixelValue(style->letterSpacing(), style.get());
2214         case CSSPropertyWebkitLineClamp:
2215             if (style->lineClamp().isNone())
2216                 return cssValuePool().createIdentifierValue(CSSValueNone);
2217             return cssValuePool().createValue(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER);
2218         case CSSPropertyLineHeight:
2219             return lineHeightFromStyle(style.get(), m_node->document().renderView());
2220         case CSSPropertyListStyleImage:
2221             if (style->listStyleImage())
2222                 return style->listStyleImage()->cssValue();
2223             return cssValuePool().createIdentifierValue(CSSValueNone);
2224         case CSSPropertyListStylePosition:
2225             return cssValuePool().createValue(style->listStylePosition());
2226         case CSSPropertyListStyleType:
2227             return cssValuePool().createValue(style->listStyleType());
2228         case CSSPropertyWebkitLocale:
2229             if (style->locale().isNull())
2230                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2231             return cssValuePool().createValue(style->locale(), CSSPrimitiveValue::CSS_STRING);
2232         case CSSPropertyMarginTop:
2233             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::marginTop, &RenderBoxModelObject::marginTop>(style.get(), renderer);
2234         case CSSPropertyMarginRight: {
2235             Length marginRight = style->marginRight();
2236             if (marginRight.isFixed() || !renderer || !renderer->isBox())
2237                 return zoomAdjustedPixelValueForLength(marginRight, style.get());
2238             float value;
2239             if (marginRight.isPercent() || marginRight.isViewportPercentage())
2240                 // RenderBox gives a marginRight() that is the distance between the right-edge of the child box
2241                 // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
2242                 // value of the specified margin-right % instead of relying on RenderBox's marginRight() value.
2243                 value = minimumValueForLength(marginRight, toRenderBox(renderer)->containingBlockLogicalWidthForContent(), m_node->document().renderView());
2244             else
2245                 value = toRenderBox(renderer)->marginRight();
2246             return zoomAdjustedPixelValue(value, style.get());
2247         }
2248         case CSSPropertyMarginBottom:
2249             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::marginBottom, &RenderBoxModelObject::marginBottom>(style.get(), renderer);
2250         case CSSPropertyMarginLeft:
2251             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::marginLeft, &RenderBoxModelObject::marginLeft>(style.get(), renderer);
2252         case CSSPropertyWebkitMarqueeDirection:
2253             return cssValuePool().createValue(style->marqueeDirection());
2254         case CSSPropertyWebkitMarqueeIncrement:
2255             return cssValuePool().createValue(style->marqueeIncrement());
2256         case CSSPropertyWebkitMarqueeRepetition:
2257             if (style->marqueeLoopCount() < 0)
2258                 return cssValuePool().createIdentifierValue(CSSValueInfinite);
2259             return cssValuePool().createValue(style->marqueeLoopCount(), CSSPrimitiveValue::CSS_NUMBER);
2260         case CSSPropertyWebkitMarqueeStyle:
2261             return cssValuePool().createValue(style->marqueeBehavior());
2262         case CSSPropertyWebkitUserModify:
2263             return cssValuePool().createValue(style->userModify());
2264         case CSSPropertyMaxHeight: {
2265             const Length& maxHeight = style->maxHeight();
2266             if (maxHeight.isUndefined())
2267                 return cssValuePool().createIdentifierValue(CSSValueNone);
2268             return zoomAdjustedPixelValueForLength(maxHeight, style.get());
2269         }
2270         case CSSPropertyMaxWidth: {
2271             const Length& maxWidth = style->maxWidth();
2272             if (maxWidth.isUndefined())
2273                 return cssValuePool().createIdentifierValue(CSSValueNone);
2274             return zoomAdjustedPixelValueForLength(maxWidth, style.get());
2275         }
2276         case CSSPropertyMinHeight:
2277             // FIXME: For flex-items, min-height:auto should compute to min-content.
2278             if (style->minHeight().isAuto())
2279                 return zoomAdjustedPixelValue(0, style.get());
2280             return zoomAdjustedPixelValueForLength(style->minHeight(), style.get());
2281         case CSSPropertyMinWidth:
2282             // FIXME: For flex-items, min-width:auto should compute to min-content.
2283             if (style->minWidth().isAuto())
2284                 return zoomAdjustedPixelValue(0, style.get());
2285             return zoomAdjustedPixelValueForLength(style->minWidth(), style.get());
2286         case CSSPropertyObjectFit:
2287             return cssValuePool().createValue(style->objectFit());
2288         case CSSPropertyOpacity:
2289             return cssValuePool().createValue(style->opacity(), CSSPrimitiveValue::CSS_NUMBER);
2290         case CSSPropertyOrphans:
2291             if (style->hasAutoOrphans())
2292                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2293             return cssValuePool().createValue(style->orphans(), CSSPrimitiveValue::CSS_NUMBER);
2294         case CSSPropertyOutlineColor:
2295             return m_allowVisitedStyle ? cssValuePool().createColorValue(style->visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style.get(), style->outlineColor());
2296         case CSSPropertyOutlineOffset:
2297             return zoomAdjustedPixelValue(style->outlineOffset(), style.get());
2298         case CSSPropertyOutlineStyle:
2299             if (style->outlineStyleIsAuto())
2300                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2301             return cssValuePool().createValue(style->outlineStyle());
2302         case CSSPropertyOutlineWidth:
2303             return zoomAdjustedPixelValue(style->outlineWidth(), style.get());
2304         case CSSPropertyOverflow:
2305             return cssValuePool().createValue(max(style->overflowX(), style->overflowY()));
2306         case CSSPropertyOverflowWrap:
2307             return cssValuePool().createValue(style->overflowWrap());
2308         case CSSPropertyOverflowX:
2309             return cssValuePool().createValue(style->overflowX());
2310         case CSSPropertyOverflowY:
2311             return cssValuePool().createValue(style->overflowY());
2312         case CSSPropertyPaddingTop:
2313             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingTop, &RenderBoxModelObject::computedCSSPaddingTop>(style.get(), renderer);
2314         case CSSPropertyPaddingRight:
2315             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingRight, &RenderBoxModelObject::computedCSSPaddingRight>(style.get(), renderer);
2316         case CSSPropertyPaddingBottom:
2317             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingBottom, &RenderBoxModelObject::computedCSSPaddingBottom>(style.get(), renderer);
2318         case CSSPropertyPaddingLeft:
2319             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingLeft, &RenderBoxModelObject::computedCSSPaddingLeft>(style.get(), renderer);
2320         case CSSPropertyPageBreakAfter:
2321             return cssValuePool().createValue(style->pageBreakAfter());
2322         case CSSPropertyPageBreakBefore:
2323             return cssValuePool().createValue(style->pageBreakBefore());
2324         case CSSPropertyPageBreakInside: {
2325             EPageBreak pageBreak = style->pageBreakInside();
2326             ASSERT(pageBreak != PBALWAYS);
2327             if (pageBreak == PBALWAYS)
2328                 return 0;
2329             return cssValuePool().createValue(style->pageBreakInside());
2330         }
2331         case CSSPropertyPosition:
2332             return cssValuePool().createValue(style->position());
2333         case CSSPropertyRight:
2334             return getPositionOffsetValue(style.get(), CSSPropertyRight, m_node->document().renderView());
2335         case CSSPropertyWebkitRubyPosition:
2336             return cssValuePool().createValue(style->rubyPosition());
2337         case CSSPropertyTableLayout:
2338             return cssValuePool().createValue(style->tableLayout());
2339         case CSSPropertyTextAlign:
2340             return cssValuePool().createValue(style->textAlign());
2341         case CSSPropertyTextDecoration:
2342             return renderTextDecorationFlagsToCSSValue(style->textDecoration());
2343 #if ENABLE(CSS3_TEXT)
2344         case CSSPropertyWebkitTextDecoration:
2345             return getCSSPropertyValuesForShorthandProperties(webkitTextDecorationShorthand());
2346         case CSSPropertyWebkitTextDecorationLine:
2347             return renderTextDecorationFlagsToCSSValue(style->textDecoration());
2348         case CSSPropertyWebkitTextDecorationStyle:
2349             return renderTextDecorationStyleFlagsToCSSValue(style->textDecorationStyle());
2350         case CSSPropertyWebkitTextDecorationColor:
2351             return currentColorOrValidColor(style.get(), style->textDecorationColor());
2352         case CSSPropertyWebkitTextAlignLast:
2353             return cssValuePool().createValue(style->textAlignLast());
2354         case CSSPropertyWebkitTextJustify:
2355             return cssValuePool().createValue(style->textJustify());
2356         case CSSPropertyWebkitTextUnderlinePosition:
2357             return cssValuePool().createValue(style->textUnderlinePosition());
2358 #endif // CSS3_TEXT
2359         case CSSPropertyWebkitTextDecorationsInEffect:
2360             return renderTextDecorationFlagsToCSSValue(style->textDecorationsInEffect());
2361         case CSSPropertyWebkitTextFillColor:
2362             return currentColorOrValidColor(style.get(), style->textFillColor());
2363         case CSSPropertyWebkitTextEmphasisColor:
2364             return currentColorOrValidColor(style.get(), style->textEmphasisColor());
2365         case CSSPropertyWebkitTextEmphasisPosition:
2366             return cssValuePool().createValue(style->textEmphasisPosition());
2367         case CSSPropertyWebkitTextEmphasisStyle:
2368             switch (style->textEmphasisMark()) {
2369             case TextEmphasisMarkNone:
2370                 return cssValuePool().createIdentifierValue(CSSValueNone);
2371             case TextEmphasisMarkCustom:
2372                 return cssValuePool().createValue(style->textEmphasisCustomMark(), CSSPrimitiveValue::CSS_STRING);
2373             case TextEmphasisMarkAuto:
2374                 ASSERT_NOT_REACHED();
2375                 // Fall through
2376             case TextEmphasisMarkDot:
2377             case TextEmphasisMarkCircle:
2378             case TextEmphasisMarkDoubleCircle:
2379             case TextEmphasisMarkTriangle:
2380             case TextEmphasisMarkSesame: {
2381                 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2382                 list->append(cssValuePool().createValue(style->textEmphasisFill()));
2383                 list->append(cssValuePool().createValue(style->textEmphasisMark()));
2384                 return list.release();
2385             }
2386             }
2387         case CSSPropertyTextIndent: {
2388             // If CSS3_TEXT is disabled or text-indent has only one value(<length> | <percentage>),
2389             // getPropertyCSSValue() returns CSSValue.
2390             RefPtr<CSSValue> textIndent = zoomAdjustedPixelValueForLength(style->textIndent(), style.get());
2391 #if ENABLE(CSS3_TEXT)
2392             // If CSS3_TEXT is enabled and text-indent has -webkit-each-line or -webkit-hanging,
2393             // getPropertyCSSValue() returns CSSValueList.
2394             if (style->textIndentLine() == TextIndentEachLine || style->textIndentType() == TextIndentHanging) {
2395                 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2396                 list->append(textIndent.release());
2397                 if (style->textIndentLine() == TextIndentEachLine)
2398                     list->append(cssValuePool().createIdentifierValue(CSSValueWebkitEachLine));
2399                 if (style->textIndentType() == TextIndentHanging)
2400                     list->append(cssValuePool().createIdentifierValue(CSSValueWebkitHanging));
2401                 return list.release();
2402             }
2403 #endif
2404             return textIndent.release();
2405         }
2406         case CSSPropertyTextShadow:
2407             return valueForShadow(style->textShadow(), propertyID, style.get());
2408         case CSSPropertyTextRendering:
2409             return cssValuePool().createValue(style->fontDescription().textRenderingMode());
2410         case CSSPropertyTextOverflow:
2411             if (style->textOverflow())
2412                 return cssValuePool().createIdentifierValue(CSSValueEllipsis);
2413             return cssValuePool().createIdentifierValue(CSSValueClip);
2414         case CSSPropertyWebkitTextSecurity:
2415             return cssValuePool().createValue(style->textSecurity());
2416 #if ENABLE(IOS_TEXT_AUTOSIZING)
2417         case CSSPropertyWebkitTextSizeAdjust:
2418             if (style->textSizeAdjust().isAuto())
2419                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2420             if (style->textSizeAdjust().isNone())
2421                 return cssValuePool().createIdentifierValue(CSSValueNone);
2422             return CSSPrimitiveValue::create(style->textSizeAdjust().percentage(), CSSPrimitiveValue::CSS_PERCENTAGE);
2423 #endif
2424         case CSSPropertyWebkitTextStrokeColor:
2425             return currentColorOrValidColor(style.get(), style->textStrokeColor());
2426         case CSSPropertyWebkitTextStrokeWidth:
2427             return zoomAdjustedPixelValue(style->textStrokeWidth(), style.get());
2428         case CSSPropertyTextTransform:
2429             return cssValuePool().createValue(style->textTransform());
2430         case CSSPropertyTop:
2431             return getPositionOffsetValue(style.get(), CSSPropertyTop, m_node->document().renderView());
2432         case CSSPropertyUnicodeBidi:
2433             return cssValuePool().createValue(style->unicodeBidi());
2434         case CSSPropertyVerticalAlign:
2435             switch (style->verticalAlign()) {
2436                 case BASELINE:
2437                     return cssValuePool().createIdentifierValue(CSSValueBaseline);
2438                 case MIDDLE:
2439                     return cssValuePool().createIdentifierValue(CSSValueMiddle);
2440                 case SUB:
2441                     return cssValuePool().createIdentifierValue(CSSValueSub);
2442                 case SUPER:
2443                     return cssValuePool().createIdentifierValue(CSSValueSuper);
2444                 case TEXT_TOP:
2445                     return cssValuePool().createIdentifierValue(CSSValueTextTop);
2446                 case TEXT_BOTTOM:
2447                     return cssValuePool().createIdentifierValue(CSSValueTextBottom);
2448                 case TOP:
2449                     return cssValuePool().createIdentifierValue(CSSValueTop);
2450                 case BOTTOM:
2451                     return cssValuePool().createIdentifierValue(CSSValueBottom);
2452                 case BASELINE_MIDDLE:
2453                     return cssValuePool().createIdentifierValue(CSSValueWebkitBaselineMiddle);
2454                 case LENGTH:
2455                     return cssValuePool().createValue(style->verticalAlignLength());
2456             }
2457             ASSERT_NOT_REACHED();
2458             return 0;
2459         case CSSPropertyVisibility:
2460             return cssValuePool().createValue(style->visibility());
2461         case CSSPropertyWhiteSpace:
2462             return cssValuePool().createValue(style->whiteSpace());
2463         case CSSPropertyWidows:
2464             if (style->hasAutoWidows())
2465                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2466             return cssValuePool().createValue(style->widows(), CSSPrimitiveValue::CSS_NUMBER);
2467         case CSSPropertyWidth:
2468             if (renderer) {
2469                 // According to http://www.w3.org/TR/CSS2/visudet.html#the-width-property,
2470                 // the "width" property does not apply for non-replaced inline elements.
2471                 if (!renderer->isReplaced() && renderer->isInline())
2472                     return cssValuePool().createIdentifierValue(CSSValueAuto);
2473                 return zoomAdjustedPixelValue(sizingBox(renderer).width(), style.get());
2474             }
2475             return zoomAdjustedPixelValueForLength(style->width(), style.get());
2476         case CSSPropertyWordBreak:
2477             return cssValuePool().createValue(style->wordBreak());
2478         case CSSPropertyWordSpacing:
2479             return zoomAdjustedPixelValue(style->wordSpacing(), style.get());
2480         case CSSPropertyWordWrap:
2481             return cssValuePool().createValue(style->overflowWrap());
2482         case CSSPropertyWebkitLineBreak:
2483             return cssValuePool().createValue(style->lineBreak());
2484         case CSSPropertyWebkitNbspMode:
2485             return cssValuePool().createValue(style->nbspMode());
2486         case CSSPropertyResize:
2487             return cssValuePool().createValue(style->resize());
2488         case CSSPropertyWebkitFontKerning:
2489             return cssValuePool().createValue(style->fontDescription().kerning());
2490         case CSSPropertyWebkitFontSmoothing:
2491             return cssValuePool().createValue(style->fontDescription().fontSmoothing());
2492         case CSSPropertyWebkitFontVariantLigatures: {
2493             FontDescription::LigaturesState commonLigaturesState = style->fontDescription().commonLigaturesState();
2494             FontDescription::LigaturesState discretionaryLigaturesState = style->fontDescription().discretionaryLigaturesState();
2495             FontDescription::LigaturesState historicalLigaturesState = style->fontDescription().historicalLigaturesState();
2496             if (commonLigaturesState == FontDescription::NormalLigaturesState && discretionaryLigaturesState == FontDescription::NormalLigaturesState
2497                 && historicalLigaturesState == FontDescription::NormalLigaturesState)
2498                 return cssValuePool().createIdentifierValue(CSSValueNormal);
2499
2500             RefPtr<CSSValueList> valueList = CSSValueList::createSpaceSeparated();
2501             if (commonLigaturesState != FontDescription::NormalLigaturesState)
2502                 valueList->append(cssValuePool().createIdentifierValue(commonLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures : CSSValueCommonLigatures));
2503             if (discretionaryLigaturesState != FontDescription::NormalLigaturesState)
2504                 valueList->append(cssValuePool().createIdentifierValue(discretionaryLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretionaryLigatures : CSSValueDiscretionaryLigatures));
2505             if (historicalLigaturesState != FontDescription::NormalLigaturesState)
2506                 valueList->append(cssValuePool().createIdentifierValue(historicalLigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLigatures : CSSValueHistoricalLigatures));
2507             return valueList;
2508         }
2509         case CSSPropertyZIndex:
2510             if (style->hasAutoZIndex())
2511                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2512             return cssValuePool().createValue(style->zIndex(), CSSPrimitiveValue::CSS_NUMBER);
2513         case CSSPropertyZoom:
2514             return cssValuePool().createValue(style->zoom(), CSSPrimitiveValue::CSS_NUMBER);
2515         case CSSPropertyBoxSizing:
2516             if (style->boxSizing() == CONTENT_BOX)
2517                 return cssValuePool().createIdentifierValue(CSSValueContentBox);
2518             return cssValuePool().createIdentifierValue(CSSValueBorderBox);
2519 #if ENABLE(DASHBOARD_SUPPORT)
2520         case CSSPropertyWebkitDashboardRegion:
2521         {
2522             const Vector<StyleDashboardRegion>& regions = style->dashboardRegions();
2523             unsigned count = regions.size();
2524             if (count == 1 && regions[0].type == StyleDashboardRegion::None)
2525                 return cssValuePool().createIdentifierValue(CSSValueNone);
2526
2527             RefPtr<DashboardRegion> firstRegion;
2528             DashboardRegion* previousRegion = 0;
2529             for (unsigned i = 0; i < count; i++) {
2530                 RefPtr<DashboardRegion> region = DashboardRegion::create();
2531                 StyleDashboardRegion styleRegion = regions[i];
2532
2533                 region->m_label = styleRegion.label;
2534                 LengthBox offset = styleRegion.offset;
2535                 region->setTop(zoomAdjustedPixelValue(offset.top().value(), style.get()));
2536                 region->setRight(zoomAdjustedPixelValue(offset.right().value(), style.get()));
2537                 region->setBottom(zoomAdjustedPixelValue(offset.bottom().value(), style.get()));
2538                 region->setLeft(zoomAdjustedPixelValue(offset.left().value(), style.get()));
2539                 region->m_isRectangle = (styleRegion.type == StyleDashboardRegion::Rectangle);
2540                 region->m_isCircle = (styleRegion.type == StyleDashboardRegion::Circle);
2541
2542                 if (previousRegion)
2543                     previousRegion->m_next = region;
2544                 else
2545                     firstRegion = region;
2546                 previousRegion = region.get();
2547             }
2548             return cssValuePool().createValue(firstRegion.release());
2549         }
2550 #endif
2551 #if ENABLE(DRAGGABLE_REGION)
2552         case CSSPropertyWebkitAppRegion:
2553             return cssValuePool().createIdentifierValue(style->getDraggableRegionMode() == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag);
2554 #endif
2555         case CSSPropertyWebkitAnimationDelay:
2556             return getDelayValue(style->animations());
2557         case CSSPropertyWebkitAnimationDirection: {
2558             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2559             const AnimationList* t = style->animations();
2560             if (t) {
2561                 for (size_t i = 0; i < t->size(); ++i) {
2562                     if (t->animation(i).direction())
2563                         list->append(cssValuePool().createIdentifierValue(CSSValueAlternate));
2564                     else
2565                         list->append(cssValuePool().createIdentifierValue(CSSValueNormal));
2566                 }
2567             } else
2568                 list->append(cssValuePool().createIdentifierValue(CSSValueNormal));
2569             return list.release();
2570         }
2571         case CSSPropertyWebkitAnimationDuration:
2572             return getDurationValue(style->animations());
2573         case CSSPropertyWebkitAnimationFillMode: {
2574             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2575             const AnimationList* t = style->animations();
2576             if (t) {
2577                 for (size_t i = 0; i < t->size(); ++i) {
2578                     switch (t->animation(i).fillMode()) {
2579                     case AnimationFillModeNone:
2580                         list->append(cssValuePool().createIdentifierValue(CSSValueNone));
2581                         break;
2582                     case AnimationFillModeForwards:
2583                         list->append(cssValuePool().createIdentifierValue(CSSValueForwards));
2584                         break;
2585                     case AnimationFillModeBackwards:
2586                         list->append(cssValuePool().createIdentifierValue(CSSValueBackwards));
2587                         break;
2588                     case AnimationFillModeBoth:
2589                         list->append(cssValuePool().createIdentifierValue(CSSValueBoth));
2590                         break;
2591                     }
2592                 }
2593             } else
2594                 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
2595             return list.release();
2596         }
2597         case CSSPropertyWebkitAnimationIterationCount: {
2598             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2599             const AnimationList* t = style->animations();
2600             if (t) {
2601                 for (size_t i = 0; i < t->size(); ++i) {
2602                     double iterationCount = t->animation(i).iterationCount();
2603                     if (iterationCount == Animation::IterationCountInfinite)
2604                         list->append(cssValuePool().createIdentifierValue(CSSValueInfinite));
2605                     else
2606                         list->append(cssValuePool().createValue(iterationCount, CSSPrimitiveValue::CSS_NUMBER));
2607                 }
2608             } else
2609                 list->append(cssValuePool().createValue(Animation::initialAnimationIterationCount(), CSSPrimitiveValue::CSS_NUMBER));
2610             return list.release();
2611         }
2612         case CSSPropertyWebkitAnimationName: {
2613             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2614             const AnimationList* t = style->animations();
2615             if (t) {
2616                 for (size_t i = 0; i < t->size(); ++i)
2617                     list->append(cssValuePool().createValue(t->animation(i).name(), CSSPrimitiveValue::CSS_STRING));
2618             } else
2619                 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
2620             return list.release();
2621         }
2622         case CSSPropertyWebkitAnimationPlayState: {
2623             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2624             const AnimationList* t = style->animations();
2625             if (t) {
2626                 for (size_t i = 0; i < t->size(); ++i) {
2627                     int prop = t->animation(i).playState();
2628                     if (prop == AnimPlayStatePlaying)
2629                         list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
2630                     else
2631                         list->append(cssValuePool().createIdentifierValue(CSSValuePaused));
2632                 }
2633             } else
2634                 list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
2635             return list.release();
2636         }
2637         case CSSPropertyWebkitAnimationTimingFunction:
2638             return getTimingFunctionValue(style->animations());
2639         case CSSPropertyWebkitAppearance:
2640             return cssValuePool().createValue(style->appearance());
2641         case CSSPropertyWebkitAspectRatio:
2642             if (!style->hasAspectRatio())
2643                 return cssValuePool().createIdentifierValue(CSSValueNone);
2644             return CSSAspectRatioValue::create(style->aspectRatioNumerator(), style->aspectRatioDenominator());
2645         case CSSPropertyWebkitBackfaceVisibility:
2646             return cssValuePool().createIdentifierValue((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
2647         case CSSPropertyWebkitBorderImage:
2648             return valueForNinePieceImage(style->borderImage());
2649         case CSSPropertyBorderImageOutset:
2650             return valueForNinePieceImageQuad(style->borderImage().outset());
2651         case CSSPropertyBorderImageRepeat:
2652             return valueForNinePieceImageRepeat(style->borderImage());
2653         case CSSPropertyBorderImageSlice:
2654             return valueForNinePieceImageSlice(style->borderImage());
2655         case CSSPropertyBorderImageWidth:
2656             return valueForNinePieceImageQuad(style->borderImage().borderSlices());
2657         case CSSPropertyWebkitMaskBoxImage:
2658             return valueForNinePieceImage(style->maskBoxImage());
2659         case CSSPropertyWebkitMaskBoxImageOutset:
2660             return valueForNinePieceImageQuad(style->maskBoxImage().outset());
2661         case CSSPropertyWebkitMaskBoxImageRepeat:
2662             return valueForNinePieceImageRepeat(style->maskBoxImage());
2663         case CSSPropertyWebkitMaskBoxImageSlice:
2664             return valueForNinePieceImageSlice(style->maskBoxImage());
2665         case CSSPropertyWebkitMaskBoxImageWidth:
2666             return valueForNinePieceImageQuad(style->maskBoxImage().borderSlices());
2667         case CSSPropertyWebkitMaskBoxImageSource:
2668             if (style->maskBoxImageSource())
2669                 return style->maskBoxImageSource()->cssValue();
2670             return cssValuePool().createIdentifierValue(CSSValueNone);
2671         case CSSPropertyWebkitFontSizeDelta:
2672             // Not a real style property -- used by the editing engine -- so has no computed value.
2673             break;
2674         case CSSPropertyWebkitMarginBottomCollapse:
2675         case CSSPropertyWebkitMarginAfterCollapse:
2676             return cssValuePool().createValue(style->marginAfterCollapse());
2677         case CSSPropertyWebkitMarginTopCollapse:
2678         case CSSPropertyWebkitMarginBeforeCollapse:
2679             return cssValuePool().createValue(style->marginBeforeCollapse());
2680 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
2681         case CSSPropertyWebkitOverflowScrolling:
2682             if (!style->useTouchOverflowScrolling())
2683                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2684             return cssValuePool().createIdentifierValue(CSSValueTouch);
2685 #endif
2686         case CSSPropertyWebkitPerspective:
2687             if (!style->hasPerspective())
2688                 return cssValuePool().createIdentifierValue(CSSValueNone);
2689             return zoomAdjustedPixelValue(style->perspective(), style.get());
2690         case CSSPropertyWebkitPerspectiveOrigin: {
2691             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2692             if (renderer) {
2693                 LayoutRect box;
2694                 if (renderer->isBox())
2695                     box = toRenderBox(renderer)->borderBoxRect();
2696
2697                 RenderView* renderView = m_node->document().renderView();
2698                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width(), renderView), style.get()));
2699                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height(), renderView), style.get()));
2700             }
2701             else {
2702                 list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginX(), style.get()));
2703                 list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginY(), style.get()));
2704
2705             }
2706             return list.release();
2707         }
2708         case CSSPropertyWebkitRtlOrdering:
2709             return cssValuePool().createIdentifierValue(style->rtlOrdering() ? CSSValueVisual : CSSValueLogical);
2710 #if ENABLE(TOUCH_EVENTS)
2711         case CSSPropertyWebkitTapHighlightColor:
2712             return currentColorOrValidColor(style.get(), style->tapHighlightColor());
2713 #endif
2714 #if PLATFORM(IOS)
2715         case CSSPropertyWebkitTouchCallout:
2716             return cssValuePool().createIdentifierValue(style->touchCalloutEnabled() ? CSSValueDefault : CSSValueNone);
2717 #endif
2718         case CSSPropertyWebkitUserDrag:
2719             return cssValuePool().createValue(style->userDrag());
2720         case CSSPropertyWebkitUserSelect:
2721             return cssValuePool().createValue(style->userSelect());
2722         case CSSPropertyBorderBottomLeftRadius:
2723             return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get(), m_node->document().renderView());
2724         case CSSPropertyBorderBottomRightRadius:
2725             return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get(), m_node->document().renderView());
2726         case CSSPropertyBorderTopLeftRadius:
2727             return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get(), m_node->document().renderView());
2728         case CSSPropertyBorderTopRightRadius:
2729             return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get(), m_node->document().renderView());
2730         case CSSPropertyClip: {
2731             if (!style->hasClip())
2732                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2733             RefPtr<Rect> rect = Rect::create();
2734             rect->setTop(zoomAdjustedPixelValue(style->clip().top().value(), style.get()));
2735             rect->setRight(zoomAdjustedPixelValue(style->clip().right().value(), style.get()));
2736             rect->setBottom(zoomAdjustedPixelValue(style->clip().bottom().value(), style.get()));
2737             rect->setLeft(zoomAdjustedPixelValue(style->clip().left().value(), style.get()));
2738             return cssValuePool().createValue(rect.release());
2739         }
2740         case CSSPropertySpeak:
2741             return cssValuePool().createValue(style->speak());
2742         case CSSPropertyWebkitTransform:
2743             return computedTransform(renderer, style.get());
2744         case CSSPropertyWebkitTransformOrigin: {
2745             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2746             if (renderer) {
2747                 LayoutRect box;
2748                 if (renderer->isBox())
2749                     box = toRenderBox(renderer)->borderBoxRect();
2750
2751                 RenderView* renderView = m_node->document().renderView();
2752                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width(), renderView), style.get()));
2753                 list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height(), renderView), style.get()));
2754                 if (style->transformOriginZ() != 0)
2755                     list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
2756             } else {
2757                 list->append(zoomAdjustedPixelValueForLength(style->transformOriginX(), style.get()));
2758                 list->append(zoomAdjustedPixelValueForLength(style->transformOriginY(), style.get()));
2759                 if (style->transformOriginZ() != 0)
2760                     list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
2761             }
2762             return list.release();
2763         }
2764         case CSSPropertyWebkitTransformStyle:
2765             return cssValuePool().createIdentifierValue((style->transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat);
2766         case CSSPropertyTransitionDelay:
2767         case CSSPropertyWebkitTransitionDelay:
2768             return getDelayValue(style->transitions());
2769         case CSSPropertyTransitionDuration:
2770         case CSSPropertyWebkitTransitionDuration:
2771             return getDurationValue(style->transitions());
2772         case CSSPropertyTransitionProperty:
2773         case CSSPropertyWebkitTransitionProperty:
2774             return getTransitionPropertyValue(style->transitions());
2775         case CSSPropertyTransitionTimingFunction:
2776         case CSSPropertyWebkitTransitionTimingFunction:
2777             return getTimingFunctionValue(style->transitions());
2778         case CSSPropertyTransition:
2779         case CSSPropertyWebkitTransition: {
2780             const AnimationList* animList = style->transitions();
2781             if (animList) {
2782                 RefPtr<CSSValueList> transitionsList = CSSValueList::createCommaSeparated();
2783                 for (size_t i = 0; i < animList->size(); ++i) {
2784                     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2785                     const Animation& animation = animList->animation(i);
2786                     list->append(createTransitionPropertyValue(animation));
2787                     list->append(cssValuePool().createValue(animation.duration(), CSSPrimitiveValue::CSS_S));
2788                     list->append(createTimingFunctionValue(animation.timingFunction().get()));
2789                     list->append(cssValuePool().createValue(animation.delay(), CSSPrimitiveValue::CSS_S));
2790                     transitionsList->append(list);
2791                 }
2792                 return transitionsList.release();
2793             }
2794
2795             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2796             // transition-property default value.
2797             list->append(cssValuePool().createIdentifierValue(CSSValueAll));
2798             list->append(cssValuePool().createValue(Animation::initialAnimationDuration(), CSSPrimitiveValue::CSS_S));
2799             list->append(createTimingFunctionValue(Animation::initialAnimationTimingFunction().get()));
2800             list->append(cssValuePool().createValue(Animation::initialAnimationDelay(), CSSPrimitiveValue::CSS_S));
2801             return list.release();
2802         }
2803         case CSSPropertyPointerEvents:
2804             return cssValuePool().createValue(style->pointerEvents());
2805         case CSSPropertyWebkitColorCorrection:
2806             return cssValuePool().createValue(style->colorSpace());
2807         case CSSPropertyWebkitLineGrid:
2808             if (style->lineGrid().isNull())
2809                 return cssValuePool().createIdentifierValue(CSSValueNone);
2810             return cssValuePool().createValue(style->lineGrid(), CSSPrimitiveValue::CSS_STRING);
2811         case CSSPropertyWebkitLineSnap:
2812             return CSSPrimitiveValue::create(style->lineSnap());
2813         case CSSPropertyWebkitLineAlign:
2814             return CSSPrimitiveValue::create(style->lineAlign());
2815         case CSSPropertyWebkitWritingMode:
2816             return cssValuePool().createValue(style->writingMode());
2817         case CSSPropertyWebkitTextCombine:
2818             return cssValuePool().createValue(style->textCombine());
2819         case CSSPropertyWebkitTextOrientation:
2820             return CSSPrimitiveValue::create(style->textOrientation());
2821         case CSSPropertyWebkitLineBoxContain:
2822             return createLineBoxContainValue(style->lineBoxContain());
2823         case CSSPropertyContent:
2824             return contentToCSSValue(style.get());
2825         case CSSPropertyCounterIncrement:
2826             return counterToCSSValue(style.get(), propertyID);
2827         case CSSPropertyCounterReset:
2828             return counterToCSSValue(style.get(), propertyID);
2829         case CSSPropertyWebkitClipPath:
2830             if (ClipPathOperation* operation = style->clipPath()) {
2831                 if (operation->getOperationType() == ClipPathOperation::SHAPE)
2832                     return valueForBasicShape(style.get(), static_cast<ShapeClipPathOperation*>(operation)->basicShape());
2833 #if ENABLE(SVG)
2834                 else if (operation->getOperationType() == ClipPathOperation::REFERENCE) {
2835                     ReferenceClipPathOperation* referenceOperation = static_cast<ReferenceClipPathOperation*>(operation);
2836                     return CSSPrimitiveValue::create(referenceOperation->url(), CSSPrimitiveValue::CSS_URI);
2837                 }
2838 #endif
2839             }
2840             return cssValuePool().createIdentifierValue(CSSValueNone);
2841 #if ENABLE(CSS_REGIONS)
2842         case CSSPropertyWebkitFlowInto:
2843             if (style->flowThread().isNull())
2844                 return cssValuePool().createIdentifierValue(CSSValueNone);
2845             return cssValuePool().createValue(style->flowThread(), CSSPrimitiveValue::CSS_STRING);
2846         case CSSPropertyWebkitFlowFrom:
2847             if (style->regionThread().isNull())
2848                 return cssValuePool().createIdentifierValue(CSSValueNone);
2849             return cssValuePool().createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING);
2850         case CSSPropertyWebkitRegionFragment:
2851             return cssValuePool().createValue(style->regionFragment());
2852 #endif
2853 #if ENABLE(CSS_EXCLUSIONS)
2854         case CSSPropertyWebkitWrapFlow:
2855             return cssValuePool().createValue(style->wrapFlow());
2856         case CSSPropertyWebkitWrapThrough:
2857             return cssValuePool().createValue(style->wrapThrough());
2858 #endif
2859 #if ENABLE(CSS_SHAPES)
2860         case CSSPropertyWebkitShapeMargin:
2861             return cssValuePool().createValue(style->shapeMargin());
2862         case CSSPropertyWebkitShapePadding:
2863             return cssValuePool().createValue(style->shapePadding());
2864         case CSSPropertyWebkitShapeImageThreshold:
2865             return cssValuePool().createValue(style->shapeImageThreshold(), CSSPrimitiveValue::CSS_NUMBER);
2866         case CSSPropertyWebkitShapeInside:
2867             if (!style->shapeInside())
2868                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2869             if (style->shapeInside()->type() == ShapeValue::Outside)
2870                 return cssValuePool().createIdentifierValue(CSSValueOutsideShape);
2871             if (style->shapeInside()->type() == ShapeValue::Image) {
2872                 if (style->shapeInside()->image())
2873                     return style->shapeInside()->image()->cssValue();
2874                 return cssValuePool().createIdentifierValue(CSSValueNone);
2875             }
2876             ASSERT(style->shapeInside()->type() == ShapeValue::Shape);
2877             return valueForBasicShape(style.get(), style->shapeInside()->shape());
2878         case CSSPropertyWebkitShapeOutside:
2879             if (!style->shapeOutside())
2880                 return cssValuePool().createIdentifierValue(CSSValueAuto);
2881             if (style->shapeOutside()->type() == ShapeValue::Image) {
2882                 if (style->shapeOutside()->image())
2883                     return style->shapeOutside()->image()->cssValue();
2884                 return cssValuePool().createIdentifierValue(CSSValueNone);
2885             }
2886             ASSERT(style->shapeOutside()->type() == ShapeValue::Shape);
2887             return valueForBasicShape(style.get(), style->shapeOutside()->shape());
2888 #endif
2889 #if ENABLE(CSS_FILTERS)
2890         case CSSPropertyWebkitFilter:
2891             return valueForFilter(renderer, style.get(), style->filter());
2892 #endif
2893 #if ENABLE(CSS_COMPOSITING)
2894         case CSSPropertyWebkitBlendMode:
2895             return cssValuePool().createValue(style->blendMode());
2896 #endif
2897         case CSSPropertyWebkitBackgroundBlendMode: {
2898             const FillLayer* layers = style->backgroundLayers();
2899             if (!layers->next())
2900                 return cssValuePool().createValue(layers->blendMode());
2901
2902             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2903             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
2904                 list->append(cssValuePool().createValue(currLayer->blendMode()));
2905
2906             return list.release();
2907         }
2908         case CSSPropertyBackground:
2909             return getBackgroundShorthandValue();
2910         case CSSPropertyBorder: {
2911             RefPtr<CSSValue> value = propertyValue(CSSPropertyBorderTop, DoNotUpdateLayout);
2912             const CSSPropertyID properties[3] = { CSSPropertyBorderRight, CSSPropertyBorderBottom,
2913                                         CSSPropertyBorderLeft };
2914             for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
2915                 if (!compareCSSValuePtr<CSSValue>(value, propertyValue(properties[i], DoNotUpdateLayout)))
2916                     return 0;
2917             }
2918             return value.release();
2919         }
2920         case CSSPropertyBorderBottom:
2921             return getCSSPropertyValuesForShorthandProperties(borderBottomShorthand());
2922         case CSSPropertyBorderColor:
2923             return getCSSPropertyValuesForSidesShorthand(borderColorShorthand());
2924         case CSSPropertyBorderLeft:
2925             return getCSSPropertyValuesForShorthandProperties(borderLeftShorthand());
2926         case CSSPropertyBorderImage:
2927             return valueForNinePieceImage(style->borderImage());
2928         case CSSPropertyBorderRadius:
2929             return getBorderRadiusShorthandValue(style.get(), m_node->document().renderView());
2930         case CSSPropertyBorderRight:
2931             return getCSSPropertyValuesForShorthandProperties(borderRightShorthand());
2932         case CSSPropertyBorderStyle:
2933             return getCSSPropertyValuesForSidesShorthand(borderStyleShorthand());
2934         case CSSPropertyBorderTop:
2935             return getCSSPropertyValuesForShorthandProperties(borderTopShorthand());
2936         case CSSPropertyBorderWidth:
2937             return getCSSPropertyValuesForSidesShorthand(borderWidthShorthand());
2938         case CSSPropertyWebkitColumnRule:
2939             return getCSSPropertyValuesForShorthandProperties(webkitColumnRuleShorthand());
2940         case CSSPropertyWebkitColumns:
2941             return getCSSPropertyValuesForShorthandProperties(webkitColumnsShorthand());
2942         case CSSPropertyListStyle:
2943             return getCSSPropertyValuesForShorthandProperties(listStyleShorthand());
2944         case CSSPropertyMargin:
2945             return getCSSPropertyValuesForSidesShorthand(marginShorthand());
2946         case CSSPropertyOutline:
2947             return getCSSPropertyValuesForShorthandProperties(outlineShorthand());
2948         case CSSPropertyPadding:
2949             return getCSSPropertyValuesForSidesShorthand(paddingShorthand());
2950         /* Individual properties not part of the spec */
2951         case CSSPropertyBackgroundRepeatX:
2952         case CSSPropertyBackgroundRepeatY:
2953             break;
2954
2955         /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
2956         case CSSPropertyWebkitTextEmphasis:
2957         case CSSPropertyTextLineThrough:
2958         case CSSPropertyTextLineThroughColor:
2959         case CSSPropertyTextLineThroughMode:
2960         case CSSPropertyTextLineThroughStyle:
2961         case CSSPropertyTextLineThroughWidth:
2962         case CSSPropertyTextOverline:
2963         case CSSPropertyTextOverlineColor:
2964         case CSSPropertyTextOverlineMode:
2965         case CSSPropertyTextOverlineStyle:
2966         case CSSPropertyTextOverlineWidth:
2967         case CSSPropertyTextUnderline:
2968         case CSSPropertyTextUnderlineColor:
2969         case CSSPropertyTextUnderlineMode:
2970         case CSSPropertyTextUnderlineStyle:
2971         case CSSPropertyTextUnderlineWidth:
2972             break;
2973
2974         /* Directional properties are resolved by resolveDirectionAwareProperty() before the switch. */
2975         case CSSPropertyWebkitBorderEnd:
2976         case CSSPropertyWebkitBorderEndColor:
2977         case CSSPropertyWebkitBorderEndStyle:
2978         case CSSPropertyWebkitBorderEndWidth:
2979         case CSSPropertyWebkitBorderStart:
2980         case CSSPropertyWebkitBorderStartColor:
2981         case CSSPropertyWebkitBorderStartStyle:
2982         case CSSPropertyWebkitBorderStartWidth:
2983         case CSSPropertyWebkitBorderAfter:
2984         case CSSPropertyWebkitBorderAfterColor:
2985         case CSSPropertyWebkitBorderAfterStyle:
2986         case CSSPropertyWebkitBorderAfterWidth:
2987         case CSSPropertyWebkitBorderBefore:
2988         case CSSPropertyWebkitBorderBeforeColor:
2989         case CSSPropertyWebkitBorderBeforeStyle:
2990         case CSSPropertyWebkitBorderBeforeWidth:
2991         case CSSPropertyWebkitMarginEnd:
2992         case CSSPropertyWebkitMarginStart:
2993         case CSSPropertyWebkitMarginAfter:
2994         case CSSPropertyWebkitMarginBefore:
2995         case CSSPropertyWebkitPaddingEnd:
2996         case CSSPropertyWebkitPaddingStart:
2997         case CSSPropertyWebkitPaddingAfter:
2998         case CSSPropertyWebkitPaddingBefore:
2999         case CSSPropertyWebkitLogicalWidth:
3000         case CSSPropertyWebkitLogicalHeight:
3001         case CSSPropertyWebkitMinLogicalWidth:
3002         case CSSPropertyWebkitMinLogicalHeight:
3003         case CSSPropertyWebkitMaxLogicalWidth:
3004         case CSSPropertyWebkitMaxLogicalHeight:
3005             ASSERT_NOT_REACHED();
3006             break;
3007
3008         /* Unimplemented @font-face properties */
3009         case CSSPropertyFontStretch:
3010         case CSSPropertySrc:
3011         case CSSPropertyUnicodeRange:
3012             break;
3013
3014         /* Other unimplemented properties */
3015 #if ENABLE(CSS_SHADERS)
3016         case CSSPropertyGeometry:
3017 #endif
3018         case CSSPropertyPage: // for @page
3019         case CSSPropertyQuotes: // FIXME: needs implementation
3020         case CSSPropertySize: // for @page
3021             break;
3022
3023         /* Unimplemented -webkit- properties */
3024         case CSSPropertyWebkitAnimation:
3025         case CSSPropertyWebkitBorderRadius:
3026         case CSSPropertyWebkitMarginCollapse:
3027         case CSSPropertyWebkitMarquee:
3028         case CSSPropertyWebkitMarqueeSpeed:
3029         case CSSPropertyWebkitMask:
3030         case CSSPropertyWebkitMaskRepeatX:
3031         case CSSPropertyWebkitMaskRepeatY:
3032         case CSSPropertyWebkitPerspectiveOriginX:
3033         case CSSPropertyWebkitPerspectiveOriginY:
3034         case CSSPropertyWebkitTextStroke:
3035         case CSSPropertyWebkitTransformOriginX:
3036         case CSSPropertyWebkitTransformOriginY:
3037         case CSSPropertyWebkitTransformOriginZ:
3038 #if ENABLE(CSS_SHADERS)
3039         case CSSPropertyMix:
3040         case CSSPropertyParameters:
3041 #endif
3042             break;
3043
3044 #if ENABLE(CSS_DEVICE_ADAPTATION)
3045         case CSSPropertyMaxZoom:
3046         case CSSPropertyMinZoom:
3047         case CSSPropertyOrientation:
3048         case CSSPropertyUserZoom:
3049             break;
3050 #endif
3051
3052 #if ENABLE(SVG)
3053         case CSSPropertyBufferedRendering:
3054         case CSSPropertyClipPath:
3055         case CSSPropertyClipRule:
3056         case CSSPropertyMask:
3057         case CSSPropertyEnableBackground:
3058         case CSSPropertyFilter:
3059         case CSSPropertyFloodColor:
3060         case CSSPropertyFloodOpacity:
3061         case CSSPropertyLightingColor:
3062         case CSSPropertyStopColor:
3063         case CSSPropertyStopOpacity:
3064         case CSSPropertyColorInterpolation:
3065         case CSSPropertyColorInterpolationFilters:
3066         case CSSPropertyColorProfile:
3067         case CSSPropertyColorRendering:
3068         case CSSPropertyFill:
3069         case CSSPropertyFillOpacity:
3070         case CSSPropertyFillRule:
3071         case CSSPropertyMarker:
3072         case CSSPropertyMarkerEnd:
3073         case CSSPropertyMarkerMid:
3074         case CSSPropertyMarkerStart:
3075         case CSSPropertyMaskType:
3076         case CSSPropertyShapeRendering:
3077         case CSSPropertyStroke:
3078         case CSSPropertyStrokeDasharray:
3079         case CSSPropertyStrokeDashoffset:
3080         case CSSPropertyStrokeLinecap:
3081         case CSSPropertyStrokeLinejoin:
3082         case CSSPropertyStrokeMiterlimit:
3083         case CSSPropertyStrokeOpacity:
3084         case CSSPropertyStrokeWidth:
3085         case CSSPropertyAlignmentBaseline:
3086         case CSSPropertyBaselineShift:
3087         case CSSPropertyDominantBaseline:
3088         case CSSPropertyGlyphOrientationHorizontal:
3089         case CSSPropertyGlyphOrientationVertical:
3090         case CSSPropertyKerning:
3091         case CSSPropertyTextAnchor:
3092         case CSSPropertyVectorEffect:
3093         case CSSPropertyWritingMode:
3094         case CSSPropertyWebkitSvgShadow:
3095             return svgPropertyValue(propertyID, DoNotUpdateLayout);
3096 #endif
3097     }
3098
3099     logUnimplementedPropertyID(propertyID);
3100     return 0;
3101 }
3102
3103 String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) const
3104 {
3105     RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
3106     if (value)
3107         return value->cssText();
3108     return "";
3109 }
3110
3111 unsigned CSSComputedStyleDeclaration::length() const
3112 {
3113     Node* node = m_node.get();
3114     if (!node)
3115         return 0;
3116
3117     RenderStyle* style = node->computedStyle(m_pseudoElementSpecifier);
3118     if (!style)
3119         return 0;
3120
3121     return numComputedProperties;
3122 }
3123
3124 String CSSComputedStyleDeclaration::item(unsigned i) const
3125 {
3126     if (i >= length())
3127         return "";
3128
3129     return getPropertyNameString(computedProperties[i]);
3130 }
3131
3132 bool ComputedStyleExtractor::propertyMatches(CSSPropertyID propertyID, const CSSValue* value) const
3133 {
3134     if (propertyID == CSSPropertyFontSize && value->isPrimitiveValue() && m_node) {
3135         m_node->document().updateLayoutIgnorePendingStylesheets();
3136         RenderStyle* style = m_node->computedStyle(m_pseudoElementSpecifier);
3137         if (style && style->fontDescription().keywordSize()) {
3138             CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->fontDescription().keywordSize());
3139             const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
3140             if (primitiveValue->isValueID() && primitiveValue->getValueID() == sizeValue)
3141                 return true;
3142         }
3143     }
3144     RefPtr<CSSValue> computedValue = propertyValue(propertyID);
3145     return computedValue && value && computedValue->equals(*value);
3146 }
3147
3148 PassRefPtr<MutableStylePropertySet> ComputedStyleExtractor::copyProperties() const
3149 {
3150     return copyPropertiesInSet(computedProperties, numComputedProperties);
3151 }
3152
3153 PassRefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties(const StylePropertyShorthand& shorthand) const
3154 {
3155     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
3156     for (size_t i = 0; i < shorthand.length(); ++i) {
3157         RefPtr<CSSValue> value = propertyValue(shorthand.properties()[i], DoNotUpdateLayout);
3158         list->append(value);
3159     }
3160     return list.release();
3161 }
3162
3163 PassRefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForSidesShorthand(const StylePropertyShorthand& shorthand) const
3164 {
3165     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
3166     // Assume the properties are in the usual order top, right, bottom, left.
3167     RefPtr<CSSValue> topValue = propertyValue(shorthand.properties()[0], DoNotUpdateLayout);
3168     RefPtr<CSSValue> rightValue = propertyValue(shorthand.properties()[1], DoNotUpdateLayout);
3169     RefPtr<CSSValue> bottomValue = propertyValue(shorthand.properties()[2], DoNotUpdateLayout);
3170     RefPtr<CSSValue> leftValue = propertyValue(shorthand.properties()[3], DoNotUpdateLayout);
3171
3172     // All 4 properties must be specified.
3173     if (!topValue || !rightValue || !bottomValue || !leftValue)
3174         return 0;
3175
3176     bool showLeft = !compareCSSValuePtr(rightValue, leftValue);
3177     bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft;
3178     bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom;
3179
3180     list->append(topValue.release());
3181     if (showRight)
3182         list->append(rightValue.release());
3183     if (showBottom)
3184         list->append(bottomValue.release());
3185     if (showLeft)
3186         list->append(leftValue.release());
3187
3188     return list.release();
3189 }
3190
3191 PassRefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand(const StylePropertyShorthand& shorthand) const
3192 {
3193     RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3194     for (size_t i = 0; i < shorthand.length(); ++i) {
3195         RefPtr<CSSValue> value = propertyValue(shorthand.properties()[i], DoNotUpdateLayout);
3196         list->append(value.release());
3197     }
3198     return list.release();
3199 }
3200
3201 PassRefPtr<MutableStylePropertySet> ComputedStyleExtractor::copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const
3202 {
3203     Vector<CSSProperty, 256> list;
3204     list.reserveInitialCapacity(length);
3205     for (unsigned i = 0; i < length; ++i) {
3206         RefPtr<CSSValue> value = propertyValue(set[i]);
3207         if (value)
3208             list.append(CSSProperty(set[i], value.release(), false));
3209     }
3210     return MutableStylePropertySet::create(list.data(), list.size());
3211 }
3212
3213 CSSRule* CSSComputedStyleDeclaration::parentRule() const
3214 {
3215     return 0;
3216 }
3217
3218 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(const String& propertyName)
3219 {
3220     CSSPropertyID propertyID = cssPropertyID(propertyName);
3221     if (!propertyID)
3222         return 0;
3223     RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
3224     return value ? value->cloneForCSSOM() : 0;
3225 }
3226
3227 String CSSComputedStyleDeclaration::getPropertyValue(const String &propertyName)
3228 {
3229     CSSPropertyID propertyID = cssPropertyID(propertyName);
3230     if (!propertyID)
3231         return String();
3232     return getPropertyValue(propertyID);
3233 }
3234
3235 String CSSComputedStyleDeclaration::getPropertyPriority(const String&)
3236 {
3237     // All computed styles have a priority of not "important".
3238     return "";
3239 }
3240
3241 String CSSComputedStyleDeclaration::getPropertyShorthand(const String&)
3242 {
3243     return "";
3244 }
3245
3246 bool CSSComputedStyleDeclaration::isPropertyImplicit(const String&)
3247 {
3248     return false;
3249 }
3250
3251 void CSSComputedStyleDeclaration::setProperty(const String&, const String&, const String&, ExceptionCode& ec)
3252 {
3253     ec = NO_MODIFICATION_ALLOWED_ERR;
3254 }
3255
3256 String CSSComputedStyleDeclaration::removeProperty(const String&, ExceptionCode& ec)
3257 {
3258     ec = NO_MODIFICATION_ALLOWED_ERR;
3259     return String();
3260 }
3261     
3262 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID)
3263 {
3264     return getPropertyCSSValue(propertyID);
3265 }
3266
3267 String CSSComputedStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID)
3268 {
3269     return getPropertyValue(propertyID);
3270 }
3271
3272 void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const String&, bool, ExceptionCode& ec)
3273 {
3274     ec = NO_MODIFICATION_ALLOWED_ERR;
3275 }
3276
3277 PassRefPtr<CSSValueList> ComputedStyleExtractor::getBackgroundShorthandValue() const
3278 {
3279     static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSPropertyBackgroundColor, CSSPropertyBackgroundImage,
3280                                                                      CSSPropertyBackgroundRepeat, CSSPropertyBackgroundAttachment,  
3281                                                                      CSSPropertyBackgroundPosition };
3282     static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyBackgroundSize, CSSPropertyBackgroundOrigin, 
3283                                                                     CSSPropertyBackgroundClip };
3284
3285     RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3286     list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperator))));
3287     list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator))));
3288     return list.release();
3289 }
3290
3291 } // namespace WebCore