[CSS Blending] Parse and implement the -webkit-isolation CSS property.
[WebKit-https.git] / Source / WebCore / css / DeprecatedStyleBuilder.cpp
1 /*
2  * Copyright (C) 2011 Google Inc. All rights reserved.
3  * Copyright (C) 2013 Apple Inc. All rights reserved.
4  * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1.  Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
11  * 2.  Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
16  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18  * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
19  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  */
26
27 #include "config.h"
28 #include "DeprecatedStyleBuilder.h"
29
30 #include "BasicShapeFunctions.h"
31 #include "BasicShapes.h"
32 #include "CSSAspectRatioValue.h"
33 #include "CSSCalculationValue.h"
34 #include "CSSCursorImageValue.h"
35 #include "CSSPrimitiveValue.h"
36 #include "CSSPrimitiveValueMappings.h"
37 #include "CSSToStyleMap.h"
38 #include "CSSValueList.h"
39 #include "ClipPathOperation.h"
40 #include "CursorList.h"
41 #include "Document.h"
42 #include "Element.h"
43 #include "Frame.h"
44 #include "Pair.h"
45 #include "Rect.h"
46 #include "RenderStyle.h"
47 #include "RenderView.h"
48 #include "Settings.h"
49 #include "StyleFontSizeFunctions.h"
50 #include "StyleResolver.h"
51 #include <wtf/StdLibExtras.h>
52
53 #if ENABLE(CSS_SHAPES)
54 #include "ShapeValue.h"
55 #endif
56
57 namespace WebCore {
58
59 enum ExpandValueBehavior {SuppressValue = 0, ExpandValue};
60 template <ExpandValueBehavior expandValue, CSSPropertyID one = CSSPropertyInvalid, CSSPropertyID two = CSSPropertyInvalid, CSSPropertyID three = CSSPropertyInvalid, CSSPropertyID four = CSSPropertyInvalid, CSSPropertyID five = CSSPropertyInvalid>
61 class ApplyPropertyExpanding {
62 public:
63
64     template <CSSPropertyID id>
65     static inline void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
66     {
67         if (id == CSSPropertyInvalid)
68             return;
69
70         const DeprecatedStyleBuilder& table = DeprecatedStyleBuilder::sharedStyleBuilder();
71         const PropertyHandler& handler = table.propertyHandler(id);
72         if (handler.isValid())
73             handler.applyInheritValue(propertyID, styleResolver);
74     }
75
76     static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
77     {
78         applyInheritValue<one>(propertyID, styleResolver);
79         applyInheritValue<two>(propertyID, styleResolver);
80         applyInheritValue<three>(propertyID, styleResolver);
81         applyInheritValue<four>(propertyID, styleResolver);
82         applyInheritValue<five>(propertyID, styleResolver);
83     }
84
85     template <CSSPropertyID id>
86     static inline void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
87     {
88         if (id == CSSPropertyInvalid)
89             return;
90
91         const DeprecatedStyleBuilder& table = DeprecatedStyleBuilder::sharedStyleBuilder();
92         const PropertyHandler& handler = table.propertyHandler(id);
93         if (handler.isValid())
94             handler.applyInitialValue(propertyID, styleResolver);
95     }
96
97     static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
98     {
99         applyInitialValue<one>(propertyID, styleResolver);
100         applyInitialValue<two>(propertyID, styleResolver);
101         applyInitialValue<three>(propertyID, styleResolver);
102         applyInitialValue<four>(propertyID, styleResolver);
103         applyInitialValue<five>(propertyID, styleResolver);
104     }
105
106     template <CSSPropertyID id>
107     static inline void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
108     {
109         if (id == CSSPropertyInvalid)
110             return;
111
112         const DeprecatedStyleBuilder& table = DeprecatedStyleBuilder::sharedStyleBuilder();
113         const PropertyHandler& handler = table.propertyHandler(id);
114         if (handler.isValid())
115             handler.applyValue(propertyID, styleResolver, value);
116     }
117
118     static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
119     {
120         if (!expandValue)
121             return;
122
123         applyValue<one>(propertyID, styleResolver, value);
124         applyValue<two>(propertyID, styleResolver, value);
125         applyValue<three>(propertyID, styleResolver, value);
126         applyValue<four>(propertyID, styleResolver, value);
127         applyValue<five>(propertyID, styleResolver, value);
128     }
129     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
130 };
131
132 template <typename GetterType, GetterType (RenderStyle::*getterFunction)() const, typename SetterType, void (RenderStyle::*setterFunction)(SetterType), typename InitialType, InitialType (*initialFunction)()>
133 class ApplyPropertyDefaultBase {
134 public:
135     static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); }
136     static GetterType value(RenderStyle* style) { return (style->*getterFunction)(); }
137     static InitialType initial() { return (*initialFunction)(); }
138     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { setValue(styleResolver->style(), value(styleResolver->parentStyle())); }
139     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { setValue(styleResolver->style(), initial()); }
140     static void applyValue(CSSPropertyID, StyleResolver*, CSSValue*) { }
141     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
142 };
143
144 template <typename GetterType, GetterType (RenderStyle::*getterFunction)() const, typename SetterType, void (RenderStyle::*setterFunction)(SetterType), typename InitialType, InitialType (*initialFunction)()>
145 class ApplyPropertyDefault {
146 public:
147     static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); }
148     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
149     {
150         if (value->isPrimitiveValue())
151             setValue(styleResolver->style(), *toCSSPrimitiveValue(value));
152     }
153     static PropertyHandler createHandler()
154     {
155         PropertyHandler handler = ApplyPropertyDefaultBase<GetterType, getterFunction, SetterType, setterFunction, InitialType, initialFunction>::createHandler();
156         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
157     }
158 };
159
160 template <typename NumberType, NumberType (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(NumberType), NumberType (*initialFunction)(), int idMapsToMinusOne = CSSValueAuto>
161 class ApplyPropertyNumber {
162 public:
163     static void setValue(RenderStyle* style, NumberType value) { (style->*setterFunction)(value); }
164     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
165     {
166         if (!value->isPrimitiveValue())
167             return;
168
169         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
170         if (primitiveValue->getValueID() == idMapsToMinusOne)
171             setValue(styleResolver->style(), -1);
172         else
173             setValue(styleResolver->style(), primitiveValue->getValue<NumberType>(CSSPrimitiveValue::CSS_NUMBER));
174     }
175     static PropertyHandler createHandler()
176     {
177         PropertyHandler handler = ApplyPropertyDefaultBase<NumberType, getterFunction, NumberType, setterFunction, NumberType, initialFunction>::createHandler();
178         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
179     }
180 };
181
182 template <StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)(), CSSPropertyID property>
183 class ApplyPropertyStyleImage {
184 public:
185     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(property, value)); }
186     static PropertyHandler createHandler()
187     {
188         PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFunction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::createHandler();
189         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
190     }
191 };
192
193 enum AutoValueType {Number = 0, ComputeLength};
194 template <typename T, T (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(T), bool (RenderStyle::*hasAutoFunction)() const, void (RenderStyle::*setAutoFunction)(), AutoValueType valueType = Number, int autoIdentity = CSSValueAuto>
195 class ApplyPropertyAuto {
196 public:
197     static void setValue(RenderStyle* style, T value) { (style->*setterFunction)(value); }
198     static T value(RenderStyle* style) { return (style->*getterFunction)(); }
199     static bool hasAuto(RenderStyle* style) { return (style->*hasAutoFunction)(); }
200     static void setAuto(RenderStyle* style) { (style->*setAutoFunction)(); }
201
202     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
203     {
204         if (hasAuto(styleResolver->parentStyle()))
205             setAuto(styleResolver->style());
206         else
207             setValue(styleResolver->style(), value(styleResolver->parentStyle()));
208     }
209
210     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { setAuto(styleResolver->style()); }
211
212     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
213     {
214         if (!value->isPrimitiveValue())
215             return;
216
217         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
218         if (primitiveValue->getValueID() == autoIdentity)
219             setAuto(styleResolver->style());
220         else if (valueType == Number)
221             setValue(styleResolver->style(), *primitiveValue);
222         else if (valueType == ComputeLength)
223             setValue(styleResolver->style(), primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
224     }
225
226     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
227 };
228
229 class ApplyPropertyClip {
230 private:
231     static Length convertToLength(StyleResolver* styleResolver, CSSPrimitiveValue* value)
232     {
233         return value->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | AutoConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
234     }
235 public:
236     static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
237     {
238         RenderStyle* parentStyle = styleResolver->parentStyle();
239         if (!parentStyle->hasClip())
240             return applyInitialValue(propertyID, styleResolver);
241         styleResolver->style()->setClip(parentStyle->clipTop(), parentStyle->clipRight(), parentStyle->clipBottom(), parentStyle->clipLeft());
242         styleResolver->style()->setHasClip(true);
243     }
244
245     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
246     {
247         styleResolver->style()->setClip(Length(), Length(), Length(), Length());
248         styleResolver->style()->setHasClip(false);
249     }
250
251     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
252     {
253         if (!value->isPrimitiveValue())
254             return;
255
256         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
257
258         if (Rect* rect = primitiveValue->getRectValue()) {
259             Length top = convertToLength(styleResolver, rect->top());
260             Length right = convertToLength(styleResolver, rect->right());
261             Length bottom = convertToLength(styleResolver, rect->bottom());
262             Length left = convertToLength(styleResolver, rect->left());
263             styleResolver->style()->setClip(top, right, bottom, left);
264             styleResolver->style()->setHasClip(true);
265         } else if (primitiveValue->getValueID() == CSSValueAuto) {
266             styleResolver->style()->setClip(Length(), Length(), Length(), Length());
267             styleResolver->style()->setHasClip(false);
268         }
269     }
270
271     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
272 };
273
274 enum ColorInherit {NoInheritFromParent = 0, InheritFromParent};
275 Color defaultInitialColor();
276 Color defaultInitialColor() { return Color(); }
277 template <ColorInherit inheritColorFromParent,
278           Color (RenderStyle::*getterFunction)() const,
279           void (RenderStyle::*setterFunction)(const Color&),
280           void (RenderStyle::*visitedLinkSetterFunction)(const Color&),
281           Color (RenderStyle::*defaultFunction)() const,
282           Color (*initialFunction)() = &defaultInitialColor>
283 class ApplyPropertyColor {
284 public:
285     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
286     {
287         // Visited link style can never explicitly inherit from parent visited link style so no separate getters are needed.
288         Color color = (styleResolver->parentStyle()->*getterFunction)();
289         applyColorValue(styleResolver, color.isValid() ? color : (styleResolver->parentStyle()->*defaultFunction)());
290     }
291
292     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
293     {
294         applyColorValue(styleResolver, initialFunction());
295     }
296
297     static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
298     {
299         if (!value->isPrimitiveValue())
300             return;
301
302         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
303         if (inheritColorFromParent && primitiveValue->getValueID() == CSSValueCurrentcolor)
304             applyInheritValue(propertyID, styleResolver);
305         else {
306             if (styleResolver->applyPropertyToRegularStyle())
307                 (styleResolver->style()->*setterFunction)(styleResolver->colorFromPrimitiveValue(primitiveValue));
308             if (styleResolver->applyPropertyToVisitedLinkStyle())
309                 (styleResolver->style()->*visitedLinkSetterFunction)(styleResolver->colorFromPrimitiveValue(primitiveValue, /* forVisitedLink */ true));
310         }
311     }
312
313     static void applyColorValue(StyleResolver* styleResolver, const Color& color)
314     {
315         if (styleResolver->applyPropertyToRegularStyle())
316             (styleResolver->style()->*setterFunction)(color);
317         if (styleResolver->applyPropertyToVisitedLinkStyle())
318             (styleResolver->style()->*visitedLinkSetterFunction)(color);
319     }
320
321     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
322 };
323
324 template <TextDirection (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(TextDirection), TextDirection (*initialFunction)()>
325 class ApplyPropertyDirection {
326 public:
327     static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
328     {
329         ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::applyValue(propertyID, styleResolver, value);
330         Element* element = styleResolver->element();
331         if (element && styleResolver->element() == element->document().documentElement())
332             element->document().setDirectionSetOnDocumentElement(true);
333     }
334
335     static PropertyHandler createHandler()
336     {
337         PropertyHandler handler = ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::createHandler();
338         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
339     }
340 };
341
342 enum LengthAuto { AutoDisabled = 0, AutoEnabled };
343 enum LengthLegacyIntrinsic { LegacyIntrinsicDisabled = 0, LegacyIntrinsicEnabled };
344 enum LengthIntrinsic { IntrinsicDisabled = 0, IntrinsicEnabled };
345 enum LengthNone { NoneDisabled = 0, NoneEnabled };
346 enum LengthUndefined { UndefinedDisabled = 0, UndefinedEnabled };
347 template <const Length& (RenderStyle::*getterFunction)() const,
348           void (RenderStyle::*setterFunction)(Length),
349           Length (*initialFunction)(),
350           LengthAuto autoEnabled = AutoDisabled,
351           LengthLegacyIntrinsic legacyIntrinsicEnabled = LegacyIntrinsicDisabled,
352           LengthIntrinsic intrinsicEnabled = IntrinsicDisabled,
353           LengthNone noneEnabled = NoneDisabled,
354           LengthUndefined noneUndefined = UndefinedDisabled>
355 class ApplyPropertyLength {
356 public:
357     static void setValue(RenderStyle* style, Length value) { (style->*setterFunction)(std::move(value)); }
358     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
359     {
360         if (!value->isPrimitiveValue())
361             return;
362
363         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
364         if (noneEnabled && primitiveValue->getValueID() == CSSValueNone) {
365             if (noneUndefined)
366                 setValue(styleResolver->style(), Length(Undefined));
367             else
368                 setValue(styleResolver->style(), Length());
369         }
370         if (legacyIntrinsicEnabled) {
371             if (primitiveValue->getValueID() == CSSValueIntrinsic)
372                 setValue(styleResolver->style(), Length(Intrinsic));
373             else if (primitiveValue->getValueID() == CSSValueMinIntrinsic)
374                 setValue(styleResolver->style(), Length(MinIntrinsic));
375         }
376         if (intrinsicEnabled) {
377             if (primitiveValue->getValueID() == CSSValueWebkitMinContent)
378                 setValue(styleResolver->style(), Length(MinContent));
379             else if (primitiveValue->getValueID() == CSSValueWebkitMaxContent)
380                 setValue(styleResolver->style(), Length(MaxContent));
381             else if (primitiveValue->getValueID() == CSSValueWebkitFillAvailable)
382                 setValue(styleResolver->style(), Length(FillAvailable));
383             else if (primitiveValue->getValueID() == CSSValueWebkitFitContent)
384                 setValue(styleResolver->style(), Length(FitContent));
385         }
386
387         if (autoEnabled && primitiveValue->getValueID() == CSSValueAuto)
388             setValue(styleResolver->style(), Length());
389         else if (primitiveValue->isLength()) {
390             Length length = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
391             length.setQuirk(primitiveValue->isQuirkValue());
392             setValue(styleResolver->style(), length);
393         } else if (primitiveValue->isPercentage())
394             setValue(styleResolver->style(), Length(primitiveValue->getDoubleValue(), Percent));
395         else if (primitiveValue->isCalculatedPercentageWithLength())
396             setValue(styleResolver->style(), Length(primitiveValue->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
397         else if (primitiveValue->isViewportPercentageLength())
398             setValue(styleResolver->style(), primitiveValue->viewportPercentageLength());
399     }
400
401     static PropertyHandler createHandler()
402     {
403         PropertyHandler handler = ApplyPropertyDefaultBase<const Length&, getterFunction, Length, setterFunction, Length, initialFunction>::createHandler();
404         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
405     }
406 };
407
408 enum StringIdentBehavior { NothingMapsToNull = 0, MapNoneToNull, MapAutoToNull };
409 template <StringIdentBehavior identBehavior, const AtomicString& (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(const AtomicString&), const AtomicString& (*initialFunction)()>
410 class ApplyPropertyString {
411 public:
412     static void setValue(RenderStyle* style, const AtomicString& value) { (style->*setterFunction)(value); }
413     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
414     {
415         if (!value->isPrimitiveValue())
416             return;
417         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
418         if ((identBehavior == MapNoneToNull && primitiveValue->getValueID() == CSSValueNone)
419             || (identBehavior == MapAutoToNull && primitiveValue->getValueID() == CSSValueAuto))
420             setValue(styleResolver->style(), nullAtom);
421         else
422             setValue(styleResolver->style(), primitiveValue->getStringValue());
423     }
424     static PropertyHandler createHandler()
425     {
426         PropertyHandler handler = ApplyPropertyDefaultBase<const AtomicString&, getterFunction, const AtomicString&, setterFunction, const AtomicString&, initialFunction>::createHandler();
427         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
428     }
429 };
430
431 template <const LengthSize& (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(LengthSize), LengthSize (*initialFunction)()>
432 class ApplyPropertyBorderRadius {
433 public:
434     static void setValue(RenderStyle* style, LengthSize value) { (style->*setterFunction)(std::move(value)); }
435     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
436     {
437         if (!value->isPrimitiveValue())
438             return;
439
440         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
441         Pair* pair = primitiveValue->getPairValue();
442         if (!pair || !pair->first() || !pair->second())
443             return;
444
445         Length radiusWidth;
446         Length radiusHeight;
447         if (pair->first()->isPercentage())
448             radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
449         else if (pair->first()->isViewportPercentageLength())
450             radiusWidth = Length(styleResolver->viewportPercentageValue(*pair->first(), pair->first()->getIntValue()), Fixed);
451         else if (pair->first()->isCalculatedPercentageWithLength())
452             radiusWidth = Length((pair->first()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
453         else
454             radiusWidth = pair->first()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
455         if (pair->second()->isPercentage())
456             radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
457         else if (pair->second()->isViewportPercentageLength())
458             radiusHeight = Length(styleResolver->viewportPercentageValue(*pair->second(), pair->second()->getIntValue()), Fixed);
459         else if (pair->second()->isCalculatedPercentageWithLength())
460             radiusHeight = Length((pair->second()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
461         else
462             radiusHeight = pair->second()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
463         int width = radiusWidth.value();
464         int height = radiusHeight.value();
465         if (width < 0 || height < 0)
466             return;
467         if (!width)
468             radiusHeight = radiusWidth; // Null out the other value.
469         else if (!height)
470             radiusWidth = radiusHeight; // Null out the other value.
471
472         LengthSize size(radiusWidth, radiusHeight);
473         setValue(styleResolver->style(), size);
474     }
475     static PropertyHandler createHandler()
476     {
477         PropertyHandler handler = ApplyPropertyDefaultBase<const LengthSize&, getterFunction, LengthSize, setterFunction, LengthSize, initialFunction>::createHandler();
478         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
479     }
480 };
481
482 template <typename T>
483 struct FillLayerAccessorTypes {
484     typedef T Setter;
485     typedef T Getter;
486     typedef T InitialGetter;
487 };
488
489 template <>
490 struct FillLayerAccessorTypes<StyleImage*> {
491     typedef PassRefPtr<StyleImage> Setter;
492     typedef StyleImage* Getter;
493     typedef StyleImage* InitialGetter;
494 };
495
496 template<>
497 struct FillLayerAccessorTypes<Length>
498 {
499     typedef Length Setter;
500     typedef const Length& Getter;
501     typedef Length InitialGetter;
502 };
503
504 template <typename T,
505           CSSPropertyID propertyId,
506           EFillLayerType fillLayerType,
507           FillLayer* (RenderStyle::*accessLayersFunction)(),
508           const FillLayer* (RenderStyle::*layersFunction)() const,
509           bool (FillLayer::*testFunction)() const,
510           typename FillLayerAccessorTypes<T>::Getter (FillLayer::*getFunction)() const,
511           void (FillLayer::*setFunction)(typename FillLayerAccessorTypes<T>::Setter),
512           void (FillLayer::*clearFunction)(),
513           typename FillLayerAccessorTypes<T>::InitialGetter (*initialFunction)(EFillLayerType),
514           void (CSSToStyleMap::*mapFillFunction)(CSSPropertyID, FillLayer*, CSSValue*)>
515 class ApplyPropertyFillLayer {
516 public:
517     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
518     {
519         // Check for no-op before copying anything.
520         if (*(styleResolver->parentStyle()->*layersFunction)() == *(styleResolver->style()->*layersFunction)())
521             return;
522
523         FillLayer* currChild = (styleResolver->style()->*accessLayersFunction)();
524         FillLayer* prevChild = 0;
525         const FillLayer* currParent = (styleResolver->parentStyle()->*layersFunction)();
526         while (currParent && (currParent->*testFunction)()) {
527             if (!currChild) {
528                 /* Need to make a new layer.*/
529                 currChild = new FillLayer(fillLayerType);
530                 prevChild->setNext(currChild);
531             }
532             (currChild->*setFunction)((currParent->*getFunction)());
533             prevChild = currChild;
534             currChild = prevChild->next();
535             currParent = currParent->next();
536         }
537
538         while (currChild) {
539             /* Reset any remaining layers to not have the property set. */
540             (currChild->*clearFunction)();
541             currChild = currChild->next();
542         }
543     }
544
545     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
546     {
547         // Check for (single-layer) no-op before clearing anything.
548         const FillLayer& layers = *(styleResolver->style()->*layersFunction)();
549         bool firstLayerHasValue = (layers.*testFunction)();
550         if (!layers.next() && (!firstLayerHasValue || (layers.*getFunction)() == (*initialFunction)(fillLayerType)))
551             return;
552
553         FillLayer* currChild = (styleResolver->style()->*accessLayersFunction)();
554         (currChild->*setFunction)((*initialFunction)(fillLayerType));
555         for (currChild = currChild->next(); currChild; currChild = currChild->next())
556             (currChild->*clearFunction)();
557     }
558
559     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
560     {
561         FillLayer* currChild = (styleResolver->style()->*accessLayersFunction)();
562         FillLayer* prevChild = 0;
563         if (value->isValueList()
564 #if ENABLE(CSS_IMAGE_SET)
565         && !value->isImageSetValue()
566 #endif
567         ) {
568             /* Walk each value and put it into a layer, creating new layers as needed. */
569             CSSValueList* valueList = toCSSValueList(value);
570             for (unsigned int i = 0; i < valueList->length(); i++) {
571                 if (!currChild) {
572                     /* Need to make a new layer to hold this value */
573                     currChild = new FillLayer(fillLayerType);
574                     prevChild->setNext(currChild);
575                 }
576                 (styleResolver->styleMap()->*mapFillFunction)(propertyId, currChild, valueList->itemWithoutBoundsCheck(i));
577                 prevChild = currChild;
578                 currChild = currChild->next();
579             }
580         } else {
581             (styleResolver->styleMap()->*mapFillFunction)(propertyId, currChild, value);
582             currChild = currChild->next();
583         }
584         while (currChild) {
585             /* Reset all remaining layers to not have the property set. */
586             (currChild->*clearFunction)();
587             currChild = currChild->next();
588         }
589     }
590
591     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
592 };
593
594 enum ComputeLengthNormal {NormalDisabled = 0, NormalEnabled};
595 enum ComputeLengthThickness {ThicknessDisabled = 0, ThicknessEnabled};
596 enum ComputeLengthSVGZoom {SVGZoomDisabled = 0, SVGZoomEnabled};
597 template <typename T,
598           T (RenderStyle::*getterFunction)() const,
599           void (RenderStyle::*setterFunction)(T),
600           T (*initialFunction)(),
601           ComputeLengthNormal normalEnabled = NormalDisabled,
602           ComputeLengthThickness thicknessEnabled = ThicknessDisabled,
603           ComputeLengthSVGZoom svgZoomEnabled = SVGZoomDisabled>
604 class ApplyPropertyComputeLength {
605 public:
606     static void setValue(RenderStyle* style, T value) { (style->*setterFunction)(value); }
607     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
608     {
609         // note: CSSPropertyLetter/WordSpacing right now sets to zero if it's not a primitive value for some reason...
610         if (!value->isPrimitiveValue())
611             return;
612
613         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
614
615         CSSValueID ident = primitiveValue->getValueID();
616         T length;
617         if (normalEnabled && ident == CSSValueNormal) {
618             length = 0;
619         } else if (thicknessEnabled && ident == CSSValueThin) {
620             length = 1;
621         } else if (thicknessEnabled && ident == CSSValueMedium) {
622             length = 3;
623         } else if (thicknessEnabled && ident == CSSValueThick) {
624             length = 5;
625         } else if (ident == CSSValueInvalid) {
626             float zoom = (svgZoomEnabled && styleResolver->useSVGZoomRules()) ? 1.0f : styleResolver->style()->effectiveZoom();
627
628             // Any original result that was >= 1 should not be allowed to fall below 1.
629             // This keeps border lines from vanishing.
630             length = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), zoom);
631             if (zoom < 1.0f && length < 1.0) {
632                 T originalLength = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), 1.0);
633                 if (originalLength >= 1.0)
634                     length = 1.0;
635             }
636             if (primitiveValue->isViewportPercentageLength())
637                 length = styleResolver->viewportPercentageValue(*primitiveValue, length);
638         } else {
639             ASSERT_NOT_REACHED();
640             length = 0;
641         }
642
643         setValue(styleResolver->style(), length);
644     }
645     static PropertyHandler createHandler()
646     {
647         PropertyHandler handler = ApplyPropertyDefaultBase<T, getterFunction, T, setterFunction, T, initialFunction>::createHandler();
648         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
649     }
650 };
651
652 template <typename T, T (FontDescription::*getterFunction)() const, void (FontDescription::*setterFunction)(T), T initialValue>
653 class ApplyPropertyFont {
654 public:
655     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
656     {
657         FontDescription fontDescription = styleResolver->fontDescription();
658         (fontDescription.*setterFunction)((styleResolver->parentFontDescription().*getterFunction)());
659         styleResolver->setFontDescription(fontDescription);
660     }
661
662     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
663     {
664         FontDescription fontDescription = styleResolver->fontDescription();
665         (fontDescription.*setterFunction)(initialValue);
666         styleResolver->setFontDescription(fontDescription);
667     }
668
669     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
670     {
671         if (!value->isPrimitiveValue())
672             return;
673         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
674         FontDescription fontDescription = styleResolver->fontDescription();
675         (fontDescription.*setterFunction)(*primitiveValue);
676         styleResolver->setFontDescription(fontDescription);
677     }
678
679     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
680 };
681
682 class ApplyPropertyFontFamily {
683 public:
684     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
685     {
686         FontDescription fontDescription = styleResolver->style()->fontDescription();
687         FontDescription parentFontDescription = styleResolver->parentStyle()->fontDescription();
688         
689         fontDescription.setGenericFamily(parentFontDescription.genericFamily());
690         fontDescription.setFamilies(parentFontDescription.families());
691         fontDescription.setIsSpecifiedFont(parentFontDescription.isSpecifiedFont());
692         styleResolver->setFontDescription(fontDescription);
693         return;
694     }
695
696     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
697     {
698         FontDescription fontDescription = styleResolver->style()->fontDescription();
699         FontDescription initialDesc = FontDescription();
700         
701         // We need to adjust the size to account for the generic family change from monospace to non-monospace.
702         if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize())
703             styleResolver->setFontSize(fontDescription, Style::fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, false, styleResolver->document()));
704         fontDescription.setGenericFamily(initialDesc.genericFamily());
705         if (!initialDesc.firstFamily().isEmpty())
706             fontDescription.setFamilies(initialDesc.families());
707
708         styleResolver->setFontDescription(fontDescription);
709         return;
710     }
711
712     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
713     {
714         if (!value->isValueList())
715             return;
716
717         auto& valueList = toCSSValueList(*value);
718
719         FontDescription fontDescription = styleResolver->style()->fontDescription();
720         // Before mapping in a new font-family property, we should reset the generic family.
721         bool oldFamilyUsedFixedDefaultSize = fontDescription.useFixedDefaultSize();
722         fontDescription.setGenericFamily(FontDescription::NoFamily);
723
724         Vector<AtomicString> families;
725         families.reserveInitialCapacity(valueList.length());
726
727         for (unsigned i = 0; i < valueList.length(); ++i) {
728             CSSValue* item = valueList.item(i);
729             if (!item->isPrimitiveValue())
730                 continue;
731             CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item);
732             AtomicString face;
733             if (contentValue->isString())
734                 face = contentValue->getStringValue();
735             else if (Settings* settings = styleResolver->document().settings()) {
736                 switch (contentValue->getValueID()) {
737                 case CSSValueWebkitBody:
738                     face = settings->standardFontFamily();
739                     break;
740                 case CSSValueSerif:
741                     face = serifFamily;
742                     fontDescription.setGenericFamily(FontDescription::SerifFamily);
743                     break;
744                 case CSSValueSansSerif:
745                     face = sansSerifFamily;
746                     fontDescription.setGenericFamily(FontDescription::SansSerifFamily);
747                     break;
748                 case CSSValueCursive:
749                     face = cursiveFamily;
750                     fontDescription.setGenericFamily(FontDescription::CursiveFamily);
751                     break;
752                 case CSSValueFantasy:
753                     face = fantasyFamily;
754                     fontDescription.setGenericFamily(FontDescription::FantasyFamily);
755                     break;
756                 case CSSValueMonospace:
757                     face = monospaceFamily;
758                     fontDescription.setGenericFamily(FontDescription::MonospaceFamily);
759                     break;
760                 case CSSValueWebkitPictograph:
761                     face = pictographFamily;
762                     fontDescription.setGenericFamily(FontDescription::PictographFamily);
763                     break;
764                 default:
765                     break;
766                 }
767             }
768
769             if (face.isEmpty())
770                 continue;
771             if (families.isEmpty())
772                 fontDescription.setIsSpecifiedFont(fontDescription.genericFamily() == FontDescription::NoFamily);
773             families.uncheckedAppend(face);
774         }
775
776         if (families.isEmpty())
777             return;
778         fontDescription.setFamilies(families);
779
780         if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize)
781             styleResolver->setFontSize(fontDescription, Style::fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, !oldFamilyUsedFixedDefaultSize, styleResolver->document()));
782
783         styleResolver->setFontDescription(fontDescription);
784     }
785
786     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
787 };
788
789 class ApplyPropertyFontSize {
790 private:
791     // When the CSS keyword "larger" is used, this function will attempt to match within the keyword
792     // table, and failing that, will simply multiply by 1.2.
793     static float largerFontSize(float size)
794     {
795         // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale up to
796         // the next size level.
797         return size * 1.2f;
798     }
799
800     // Like the previous function, but for the keyword "smaller".
801     static float smallerFontSize(float size)
802     {
803         // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale down to
804         // the next size level.
805         return size / 1.2f;
806     }
807 public:
808     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
809     {
810         float size = styleResolver->parentStyle()->fontDescription().specifiedSize();
811
812         if (size < 0)
813             return;
814
815         FontDescription fontDescription = styleResolver->style()->fontDescription();
816         fontDescription.setKeywordSize(styleResolver->parentStyle()->fontDescription().keywordSize());
817         styleResolver->setFontSize(fontDescription, size);
818         styleResolver->setFontDescription(fontDescription);
819         return;
820     }
821
822     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
823     {
824         FontDescription fontDescription = styleResolver->style()->fontDescription();
825         float size = Style::fontSizeForKeyword(CSSValueMedium, fontDescription.useFixedDefaultSize(), styleResolver->document());
826
827         if (size < 0)
828             return;
829
830         fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
831         styleResolver->setFontSize(fontDescription, size);
832         styleResolver->setFontDescription(fontDescription);
833         return;
834     }
835
836     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
837     {
838         if (!value->isPrimitiveValue())
839             return;
840
841         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
842
843         FontDescription fontDescription = styleResolver->style()->fontDescription();
844         fontDescription.setKeywordSize(0);
845         float parentSize = 0;
846         bool parentIsAbsoluteSize = false;
847         float size = 0;
848
849         if (styleResolver->parentStyle()) {
850             parentSize = styleResolver->parentStyle()->fontDescription().specifiedSize();
851             parentIsAbsoluteSize = styleResolver->parentStyle()->fontDescription().isAbsoluteSize();
852         }
853
854         if (CSSValueID ident = primitiveValue->getValueID()) {
855             // Keywords are being used.
856             switch (ident) {
857             case CSSValueXxSmall:
858             case CSSValueXSmall:
859             case CSSValueSmall:
860             case CSSValueMedium:
861             case CSSValueLarge:
862             case CSSValueXLarge:
863             case CSSValueXxLarge:
864             case CSSValueWebkitXxxLarge:
865                 size = Style::fontSizeForKeyword(ident, fontDescription.useFixedDefaultSize(), styleResolver->document());
866                 fontDescription.setKeywordSize(ident - CSSValueXxSmall + 1);
867                 break;
868             case CSSValueLarger:
869                 size = largerFontSize(parentSize);
870                 break;
871             case CSSValueSmaller:
872                 size = smallerFontSize(parentSize);
873                 break;
874             default:
875                 return;
876             }
877
878             fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize && (ident == CSSValueLarger || ident == CSSValueSmaller));
879         } else {
880             fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize
881                                               || !(primitiveValue->isPercentage() || primitiveValue->isFontRelativeLength()));
882             if (primitiveValue->isLength())
883                 size = primitiveValue->computeLength<float>(styleResolver->parentStyle(), styleResolver->rootElementStyle(), 1.0, true);
884             else if (primitiveValue->isPercentage())
885                 size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
886             else if (primitiveValue->isCalculatedPercentageWithLength())
887                 size = primitiveValue->cssCalcValue()->toCalcValue(styleResolver->parentStyle(), styleResolver->rootElementStyle())->evaluate(parentSize);
888             else if (primitiveValue->isViewportPercentageLength())
889                 size = valueForLength(primitiveValue->viewportPercentageLength(), 0, styleResolver->document().renderView());
890             else
891                 return;
892         }
893
894         if (size < 0)
895             return;
896
897         // Overly large font sizes will cause crashes on some platforms (such as Windows).
898         // Cap font size here to make sure that doesn't happen.
899         size = std::min(maximumAllowedFontSize, size);
900
901         styleResolver->setFontSize(fontDescription, size);
902         styleResolver->setFontDescription(fontDescription);
903         return;
904     }
905
906     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
907 };
908
909 class ApplyPropertyFontWeight {
910 public:
911     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
912     {
913         if (!value->isPrimitiveValue())
914             return;
915         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
916         FontDescription fontDescription = styleResolver->fontDescription();
917         switch (primitiveValue->getValueID()) {
918         case CSSValueInvalid:
919             ASSERT_NOT_REACHED();
920             break;
921         case CSSValueBolder:
922             fontDescription.setWeight(fontDescription.bolderWeight());
923             break;
924         case CSSValueLighter:
925             fontDescription.setWeight(fontDescription.lighterWeight());
926             break;
927         default:
928             fontDescription.setWeight(*primitiveValue);
929         }
930         styleResolver->setFontDescription(fontDescription);
931     }
932     static PropertyHandler createHandler()
933     {
934         PropertyHandler handler = ApplyPropertyFont<FontWeight, &FontDescription::weight, &FontDescription::setWeight, FontWeightNormal>::createHandler();
935         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
936     }
937 };
938
939 class ApplyPropertyFontVariantLigatures {
940 public:
941     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
942     {
943         const FontDescription& parentFontDescription = styleResolver->parentFontDescription();
944         FontDescription fontDescription = styleResolver->fontDescription();
945
946         fontDescription.setCommonLigaturesState(parentFontDescription.commonLigaturesState());
947         fontDescription.setDiscretionaryLigaturesState(parentFontDescription.discretionaryLigaturesState());
948         fontDescription.setHistoricalLigaturesState(parentFontDescription.historicalLigaturesState());
949
950         styleResolver->setFontDescription(fontDescription);
951     }
952
953     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
954     {
955         FontDescription fontDescription = styleResolver->fontDescription();
956
957         fontDescription.setCommonLigaturesState(FontDescription::NormalLigaturesState);
958         fontDescription.setDiscretionaryLigaturesState(FontDescription::NormalLigaturesState);
959         fontDescription.setHistoricalLigaturesState(FontDescription::NormalLigaturesState);
960
961         styleResolver->setFontDescription(fontDescription);
962     }
963
964     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
965     {
966         FontDescription::LigaturesState commonLigaturesState = FontDescription::NormalLigaturesState;
967         FontDescription::LigaturesState discretionaryLigaturesState = FontDescription::NormalLigaturesState;
968         FontDescription::LigaturesState historicalLigaturesState = FontDescription::NormalLigaturesState;
969
970         if (value->isValueList()) {
971             CSSValueList* valueList = toCSSValueList(value);
972             for (size_t i = 0; i < valueList->length(); ++i) {
973                 CSSValue* item = valueList->itemWithoutBoundsCheck(i);
974                 ASSERT(item->isPrimitiveValue());
975                 if (item->isPrimitiveValue()) {
976                     switch (toCSSPrimitiveValue(item)->getValueID()) {
977                     case CSSValueNoCommonLigatures:
978                         commonLigaturesState = FontDescription::DisabledLigaturesState;
979                         break;
980                     case CSSValueCommonLigatures:
981                         commonLigaturesState = FontDescription::EnabledLigaturesState;
982                         break;
983                     case CSSValueNoDiscretionaryLigatures:
984                         discretionaryLigaturesState = FontDescription::DisabledLigaturesState;
985                         break;
986                     case CSSValueDiscretionaryLigatures:
987                         discretionaryLigaturesState = FontDescription::EnabledLigaturesState;
988                         break;
989                     case CSSValueNoHistoricalLigatures:
990                         historicalLigaturesState = FontDescription::DisabledLigaturesState;
991                         break;
992                     case CSSValueHistoricalLigatures:
993                         historicalLigaturesState = FontDescription::EnabledLigaturesState;
994                         break;
995                     default:
996                         ASSERT_NOT_REACHED();
997                         break;
998                     }
999                 }
1000             }
1001         }
1002 #if !ASSERT_DISABLED
1003         else {
1004             ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue());
1005             ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNormal);
1006         }
1007 #endif
1008
1009         FontDescription fontDescription = styleResolver->fontDescription();
1010         fontDescription.setCommonLigaturesState(commonLigaturesState);
1011         fontDescription.setDiscretionaryLigaturesState(discretionaryLigaturesState);
1012         fontDescription.setHistoricalLigaturesState(historicalLigaturesState);
1013         styleResolver->setFontDescription(fontDescription);
1014     }
1015
1016     static PropertyHandler createHandler()
1017     {
1018         return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
1019     }
1020 };
1021
1022 enum BorderImageType { BorderImage = 0, BorderMask };
1023 template <BorderImageType borderImageType,
1024           CSSPropertyID property,
1025           const NinePieceImage& (RenderStyle::*getterFunction)() const,
1026           void (RenderStyle::*setterFunction)(const NinePieceImage&)>
1027 class ApplyPropertyBorderImage {
1028 public:
1029     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1030     {
1031         NinePieceImage image;
1032         if (borderImageType == BorderMask)
1033             image.setMaskDefaults();
1034         styleResolver->styleMap()->mapNinePieceImage(property, value, image);
1035         (styleResolver->style()->*setterFunction)(image);
1036     }
1037
1038     static PropertyHandler createHandler()
1039     {
1040         PropertyHandler handler = ApplyPropertyDefaultBase<const NinePieceImage&, getterFunction, const NinePieceImage&, setterFunction, NinePieceImage, &RenderStyle::initialNinePieceImage>::createHandler();
1041         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1042     }
1043 };
1044
1045 enum BorderImageModifierType { Outset, Repeat, Slice, Width };
1046 template <BorderImageType type, BorderImageModifierType modifier>
1047 class ApplyPropertyBorderImageModifier {
1048 private:
1049     static inline const NinePieceImage& getValue(RenderStyle* style) { return type == BorderImage ? style->borderImage() : style->maskBoxImage(); }
1050     static inline void setValue(RenderStyle* style, const NinePieceImage& value) { return type == BorderImage ? style->setBorderImage(value) : style->setMaskBoxImage(value); }
1051 public:
1052     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1053     {
1054         NinePieceImage image(getValue(styleResolver->style()));
1055         switch (modifier) {
1056         case Outset:
1057             image.copyOutsetFrom(getValue(styleResolver->parentStyle()));
1058             break;
1059         case Repeat:
1060             image.copyRepeatFrom(getValue(styleResolver->parentStyle()));
1061             break;
1062         case Slice:
1063             image.copyImageSlicesFrom(getValue(styleResolver->parentStyle()));
1064             break;
1065         case Width:
1066             image.copyBorderSlicesFrom(getValue(styleResolver->parentStyle()));
1067             break;
1068         }
1069         setValue(styleResolver->style(), image);
1070     }
1071
1072     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
1073     {
1074         NinePieceImage image(getValue(styleResolver->style()));
1075         switch (modifier) {
1076         case Outset:
1077             image.setOutset(LengthBox(0));
1078             break;
1079         case Repeat:
1080             image.setHorizontalRule(StretchImageRule);
1081             image.setVerticalRule(StretchImageRule);
1082             break;
1083         case Slice:
1084             // Masks have a different initial value for slices. Preserve the value of 0 for backwards compatibility.
1085             image.setImageSlices(type == BorderImage ? LengthBox(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent)) : LengthBox());
1086             image.setFill(false);
1087             break;
1088         case Width:
1089             // Masks have a different initial value for widths. They use an 'auto' value rather than trying to fit to the border.
1090             image.setBorderSlices(type == BorderImage ? LengthBox(Length(1, Relative), Length(1, Relative), Length(1, Relative), Length(1, Relative)) : LengthBox());
1091             break;
1092         }
1093         setValue(styleResolver->style(), image);
1094     }
1095
1096     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1097     {
1098         NinePieceImage image(getValue(styleResolver->style()));
1099         switch (modifier) {
1100         case Outset:
1101             image.setOutset(styleResolver->styleMap()->mapNinePieceImageQuad(value));
1102             break;
1103         case Repeat:
1104             styleResolver->styleMap()->mapNinePieceImageRepeat(value, image);
1105             break;
1106         case Slice:
1107             styleResolver->styleMap()->mapNinePieceImageSlice(value, image);
1108             break;
1109         case Width:
1110             image.setBorderSlices(styleResolver->styleMap()->mapNinePieceImageQuad(value));
1111             break;
1112         }
1113         setValue(styleResolver->style(), image);
1114     }
1115
1116     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1117 };
1118
1119 template <CSSPropertyID id, StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)()>
1120 class ApplyPropertyBorderImageSource {
1121 public:
1122     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(id, value)); }
1123     static PropertyHandler createHandler()
1124     {
1125         PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFunction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::createHandler();
1126         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1127     }
1128 };
1129
1130 enum CounterBehavior {Increment = 0, Reset};
1131 template <CounterBehavior counterBehavior>
1132 class ApplyPropertyCounter {
1133 public:
1134     static void emptyFunction(CSSPropertyID, StyleResolver*) { }
1135     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1136     {
1137         CounterDirectiveMap& map = styleResolver->style()->accessCounterDirectives();
1138         CounterDirectiveMap& parentMap = styleResolver->parentStyle()->accessCounterDirectives();
1139
1140         typedef CounterDirectiveMap::iterator Iterator;
1141         Iterator end = parentMap.end();
1142         for (Iterator it = parentMap.begin(); it != end; ++it) {
1143             CounterDirectives& directives = map.add(it->key, CounterDirectives()).iterator->value;
1144             if (counterBehavior == Reset) {
1145                 directives.inheritReset(it->value);
1146             } else {
1147                 directives.inheritIncrement(it->value);
1148             }
1149         }
1150     }
1151     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1152     {
1153         bool setCounterIncrementToNone = counterBehavior == Increment && value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() == CSSValueNone;
1154
1155         if (!value->isValueList() && !setCounterIncrementToNone)
1156             return;
1157
1158         CounterDirectiveMap& map = styleResolver->style()->accessCounterDirectives();
1159         typedef CounterDirectiveMap::iterator Iterator;
1160
1161         Iterator end = map.end();
1162         for (Iterator it = map.begin(); it != end; ++it)
1163             if (counterBehavior == Reset)
1164                 it->value.clearReset();
1165             else
1166                 it->value.clearIncrement();
1167         
1168         if (setCounterIncrementToNone)
1169             return;
1170         
1171         CSSValueList* list = toCSSValueList(value);
1172         int length = list ? list->length() : 0;
1173         for (int i = 0; i < length; ++i) {
1174             CSSValue* currValue = list->itemWithoutBoundsCheck(i);
1175             if (!currValue->isPrimitiveValue())
1176                 continue;
1177
1178             Pair* pair = toCSSPrimitiveValue(currValue)->getPairValue();
1179             if (!pair || !pair->first() || !pair->second())
1180                 continue;
1181
1182             AtomicString identifier = static_cast<CSSPrimitiveValue*>(pair->first())->getStringValue();
1183             int value = static_cast<CSSPrimitiveValue*>(pair->second())->getIntValue();
1184             CounterDirectives& directives = map.add(identifier, CounterDirectives()).iterator->value;
1185             if (counterBehavior == Reset) {
1186                 directives.setResetValue(value);
1187             } else {
1188                 directives.addIncrementValue(value);
1189             }
1190         }
1191     }
1192     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &emptyFunction, &applyValue); }
1193 };
1194
1195
1196 class ApplyPropertyCursor {
1197 public:
1198     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1199     {
1200         styleResolver->style()->setCursor(styleResolver->parentStyle()->cursor());
1201         styleResolver->style()->setCursorList(styleResolver->parentStyle()->cursors());
1202     }
1203
1204     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
1205     {
1206         styleResolver->style()->clearCursorList();
1207         styleResolver->style()->setCursor(RenderStyle::initialCursor());
1208     }
1209
1210     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1211     {
1212         styleResolver->style()->clearCursorList();
1213         if (value->isValueList()) {
1214             CSSValueList* list = toCSSValueList(value);
1215             int len = list->length();
1216             styleResolver->style()->setCursor(CURSOR_AUTO);
1217             for (int i = 0; i < len; i++) {
1218                 CSSValue* item = list->itemWithoutBoundsCheck(i);
1219                 if (item->isCursorImageValue()) {
1220                     CSSCursorImageValue* image = toCSSCursorImageValue(item);
1221                     if (image->updateIfSVGCursorIsUsed(styleResolver->element())) // Elements with SVG cursors are not allowed to share style.
1222                         styleResolver->style()->setUnique();
1223                     styleResolver->style()->addCursor(styleResolver->styleImage(CSSPropertyCursor, image), image->hotSpot());
1224                 } else if (item->isPrimitiveValue()) {
1225                     CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
1226                     if (primitiveValue->isValueID())
1227                         styleResolver->style()->setCursor(*primitiveValue);
1228                 }
1229             }
1230         } else if (value->isPrimitiveValue()) {
1231             CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1232             if (primitiveValue->isValueID() && styleResolver->style()->cursor() != ECursor(*primitiveValue))
1233                 styleResolver->style()->setCursor(*primitiveValue);
1234         }
1235     }
1236
1237     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1238 };
1239
1240 class ApplyPropertyTextAlign {
1241 public:
1242     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1243     {
1244         if (!value->isPrimitiveValue())
1245             return;
1246
1247         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1248         ASSERT(primitiveValue->isValueID());
1249
1250         if (primitiveValue->getValueID() != CSSValueWebkitMatchParent)
1251             styleResolver->style()->setTextAlign(*primitiveValue);
1252         else if (styleResolver->parentStyle()->textAlign() == TASTART)
1253             styleResolver->style()->setTextAlign(styleResolver->parentStyle()->isLeftToRightDirection() ? LEFT : RIGHT);
1254         else if (styleResolver->parentStyle()->textAlign() == TAEND)
1255             styleResolver->style()->setTextAlign(styleResolver->parentStyle()->isLeftToRightDirection() ? RIGHT : LEFT);
1256         else
1257             styleResolver->style()->setTextAlign(styleResolver->parentStyle()->textAlign());
1258     }
1259     static PropertyHandler createHandler()
1260     {
1261         PropertyHandler handler = ApplyPropertyDefaultBase<ETextAlign, &RenderStyle::textAlign, ETextAlign, &RenderStyle::setTextAlign, ETextAlign, &RenderStyle::initialTextAlign>::createHandler();
1262         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1263     }
1264 };
1265
1266 class ApplyPropertyTextDecoration {
1267 public:
1268     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1269     {
1270         TextDecoration t = RenderStyle::initialTextDecoration();
1271         for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
1272             CSSValue* item = i.value();
1273             ASSERT_WITH_SECURITY_IMPLICATION(item->isPrimitiveValue());
1274             t |= *toCSSPrimitiveValue(item);
1275         }
1276         styleResolver->style()->setTextDecoration(t);
1277     }
1278     static PropertyHandler createHandler()
1279     {
1280         PropertyHandler handler = ApplyPropertyDefaultBase<TextDecoration, &RenderStyle::textDecoration, TextDecoration, &RenderStyle::setTextDecoration, TextDecoration, &RenderStyle::initialTextDecoration>::createHandler();
1281         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1282     }
1283 };
1284
1285 static TextDecorationSkip valueToDecorationSkip(CSSPrimitiveValue& primitiveValue)
1286 {
1287     ASSERT(primitiveValue.isValueID());
1288
1289     switch (primitiveValue.getValueID()) {
1290     case CSSValueAuto:
1291         return TextDecorationSkipAuto;
1292     case CSSValueNone:
1293         return TextDecorationSkipNone;
1294     case CSSValueInk:
1295         return TextDecorationSkipInk;
1296     case CSSValueObjects:
1297         return TextDecorationSkipObjects;
1298     default:
1299         break;
1300     }
1301
1302     ASSERT_NOT_REACHED();
1303     return TextDecorationSkipNone;
1304 }
1305
1306 class ApplyPropertyTextDecorationSkip {
1307 public:
1308     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1309     {
1310         if (value->isPrimitiveValue()) {
1311             styleResolver->style()->setTextDecorationSkip(valueToDecorationSkip(*toCSSPrimitiveValue(value)));
1312             return;
1313         }
1314
1315         TextDecorationSkip skip = RenderStyle::initialTextDecorationSkip();
1316         for (CSSValueListIterator i(value); i.hasMore(); i.advance())
1317             skip |= valueToDecorationSkip(*toCSSPrimitiveValue(i.value()));
1318         styleResolver->style()->setTextDecorationSkip(skip);
1319     }
1320     static PropertyHandler createHandler()
1321     {
1322         PropertyHandler handler = ApplyPropertyDefaultBase<TextDecorationSkip, &RenderStyle::textDecorationSkip, TextDecorationSkip, &RenderStyle::setTextDecorationSkip, TextDecorationSkip, &RenderStyle::initialTextDecorationSkip>::createHandler();
1323         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1324     }
1325 };
1326
1327 class ApplyPropertyMarqueeIncrement {
1328 public:
1329     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1330     {
1331         if (!value->isPrimitiveValue())
1332             return;
1333
1334         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1335         if (primitiveValue->getValueID()) {
1336             switch (primitiveValue->getValueID()) {
1337             case CSSValueSmall:
1338                 styleResolver->style()->setMarqueeIncrement(Length(1, Fixed)); // 1px.
1339                 break;
1340             case CSSValueNormal:
1341                 styleResolver->style()->setMarqueeIncrement(Length(6, Fixed)); // 6px. The WinIE default.
1342                 break;
1343             case CSSValueLarge:
1344                 styleResolver->style()->setMarqueeIncrement(Length(36, Fixed)); // 36px.
1345                 break;
1346             default:
1347                 break;
1348             }
1349         } else {
1350             Length marqueeLength = styleResolver->convertToIntLength(primitiveValue, styleResolver->style(), styleResolver->rootElementStyle());
1351             if (!marqueeLength.isUndefined())
1352                 styleResolver->style()->setMarqueeIncrement(marqueeLength);
1353         }
1354     }
1355     static PropertyHandler createHandler()
1356     {
1357         PropertyHandler handler = ApplyPropertyLength<&RenderStyle::marqueeIncrement, &RenderStyle::setMarqueeIncrement, &RenderStyle::initialMarqueeIncrement>::createHandler();
1358         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1359     }
1360 };
1361
1362 class ApplyPropertyMarqueeRepetition {
1363 public:
1364     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1365     {
1366         if (!value->isPrimitiveValue())
1367             return;
1368
1369         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1370         if (primitiveValue->getValueID() == CSSValueInfinite)
1371             styleResolver->style()->setMarqueeLoopCount(-1); // -1 means repeat forever.
1372         else if (primitiveValue->isNumber())
1373             styleResolver->style()->setMarqueeLoopCount(primitiveValue->getIntValue());
1374     }
1375     static PropertyHandler createHandler()
1376     {
1377         PropertyHandler handler = ApplyPropertyDefault<int, &RenderStyle::marqueeLoopCount, int, &RenderStyle::setMarqueeLoopCount, int, &RenderStyle::initialMarqueeLoopCount>::createHandler();
1378         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1379     }
1380 };
1381
1382 class ApplyPropertyMarqueeSpeed {
1383 public:
1384     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1385     {
1386         if (!value->isPrimitiveValue())
1387             return;
1388
1389         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1390         if (CSSValueID ident = primitiveValue->getValueID()) {
1391             switch (ident) {
1392             case CSSValueSlow:
1393                 styleResolver->style()->setMarqueeSpeed(500); // 500 msec.
1394                 break;
1395             case CSSValueNormal:
1396                 styleResolver->style()->setMarqueeSpeed(85); // 85msec. The WinIE default.
1397                 break;
1398             case CSSValueFast:
1399                 styleResolver->style()->setMarqueeSpeed(10); // 10msec. Super fast.
1400                 break;
1401             default:
1402                 break;
1403             }
1404         } else if (primitiveValue->isTime())
1405             styleResolver->style()->setMarqueeSpeed(primitiveValue->computeTime<int, CSSPrimitiveValue::Milliseconds>());
1406         else if (primitiveValue->isNumber()) // For scrollamount support.
1407             styleResolver->style()->setMarqueeSpeed(primitiveValue->getIntValue());
1408     }
1409     static PropertyHandler createHandler()
1410     {
1411         PropertyHandler handler = ApplyPropertyDefault<int, &RenderStyle::marqueeSpeed, int, &RenderStyle::setMarqueeSpeed, int, &RenderStyle::initialMarqueeSpeed>::createHandler();
1412         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1413     }
1414 };
1415
1416 class ApplyPropertyTextUnderlinePosition {
1417 public:
1418     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1419     {
1420         // This is true if value is 'auto' or 'alphabetic'.
1421         if (value->isPrimitiveValue()) {
1422             TextUnderlinePosition t = *toCSSPrimitiveValue(value);
1423             styleResolver->style()->setTextUnderlinePosition(t);
1424             return;
1425         }
1426
1427         unsigned t = 0;
1428         for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
1429             CSSValue* item = i.value();
1430             ASSERT_WITH_SECURITY_IMPLICATION(item->isPrimitiveValue());
1431             TextUnderlinePosition t2 = *toCSSPrimitiveValue(item);
1432             t |= t2;
1433         }
1434         styleResolver->style()->setTextUnderlinePosition(static_cast<TextUnderlinePosition>(t));
1435     }
1436     static PropertyHandler createHandler()
1437     {
1438         PropertyHandler handler = ApplyPropertyDefaultBase<TextUnderlinePosition, &RenderStyle::textUnderlinePosition, TextUnderlinePosition, &RenderStyle::setTextUnderlinePosition, TextUnderlinePosition, &RenderStyle::initialTextUnderlinePosition>::createHandler();
1439         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1440     }
1441 };
1442
1443 class ApplyPropertyLineHeight {
1444 public:
1445     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1446     {
1447         if (!value->isPrimitiveValue())
1448             return;
1449
1450         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1451         Length lineHeight;
1452
1453         if (primitiveValue->getValueID() == CSSValueNormal)
1454             lineHeight = RenderStyle::initialLineHeight();
1455         else if (primitiveValue->isLength()) {
1456             double multiplier = styleResolver->style()->effectiveZoom();
1457             if (Frame* frame = styleResolver->document().frame())
1458                 multiplier *= frame->textZoomFactor();
1459             lineHeight = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), multiplier);
1460         } else if (primitiveValue->isPercentage()) {
1461             // FIXME: percentage should not be restricted to an integer here.
1462             lineHeight = Length((styleResolver->style()->computedFontSize() * primitiveValue->getIntValue()) / 100, Fixed);
1463         } else if (primitiveValue->isNumber()) {
1464             // FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent).
1465             lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);
1466         } else if (primitiveValue->isViewportPercentageLength())
1467             lineHeight = primitiveValue->viewportPercentageLength();
1468         else
1469             return;
1470         styleResolver->style()->setLineHeight(lineHeight);
1471     }
1472     static PropertyHandler createHandler()
1473     {
1474         PropertyHandler handler = ApplyPropertyDefaultBase<const Length&, &RenderStyle::specifiedLineHeight, Length, &RenderStyle::setLineHeight, Length, &RenderStyle::initialLineHeight>::createHandler();
1475         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1476     }
1477 };
1478
1479 #if ENABLE(IOS_TEXT_AUTOSIZING)
1480 // FIXME: Share more code with class ApplyPropertyLineHeight.
1481 class ApplyPropertyLineHeightForIOSTextAutosizing {
1482 public:
1483     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1484     {
1485         if (!value->isPrimitiveValue())
1486             return;
1487
1488         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1489         Length lineHeight;
1490
1491         if (primitiveValue->getValueID() == CSSValueNormal)
1492             lineHeight = RenderStyle::initialLineHeight();
1493         else if (primitiveValue->isLength()) {
1494             double multiplier = styleResolver->style()->effectiveZoom();
1495             if (styleResolver->style()->textSizeAdjust().isNone()) {
1496                 if (Frame* frame = styleResolver->document().frame())
1497                     multiplier *= frame->textZoomFactor();
1498             }
1499             lineHeight = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), multiplier);
1500             if (styleResolver->style()->textSizeAdjust().isPercentage())
1501                 lineHeight = Length(lineHeight.value() * styleResolver->style()->textSizeAdjust().multiplier(), Fixed);
1502         } else if (primitiveValue->isPercentage()) {
1503             // FIXME: percentage should not be restricted to an integer here.
1504             lineHeight = Length((styleResolver->style()->fontSize() * primitiveValue->getIntValue()) / 100, Fixed);
1505         } else if (primitiveValue->isNumber()) {
1506             // FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent).
1507             if (styleResolver->style()->textSizeAdjust().isPercentage())
1508                 lineHeight = Length(primitiveValue->getDoubleValue() * styleResolver->style()->textSizeAdjust().multiplier() * 100.0, Percent);
1509             else
1510                 lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);
1511         } else if (primitiveValue->isViewportPercentageLength())
1512             lineHeight = primitiveValue->viewportPercentageLength();
1513         else
1514             return;
1515         styleResolver->style()->setLineHeight(lineHeight);
1516         styleResolver->style()->setSpecifiedLineHeight(lineHeight);
1517     }
1518
1519     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
1520     {
1521         styleResolver->style()->setLineHeight(RenderStyle::initialLineHeight());
1522         styleResolver->style()->setSpecifiedLineHeight(RenderStyle::initialSpecifiedLineHeight());
1523     }
1524
1525     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1526     {
1527         styleResolver->style()->setLineHeight(styleResolver->parentStyle()->lineHeight());
1528         styleResolver->style()->setSpecifiedLineHeight(styleResolver->parentStyle()->specifiedLineHeight());
1529     }
1530
1531     static PropertyHandler createHandler()
1532     {
1533         return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
1534     }
1535 };
1536 #endif
1537
1538 class ApplyPropertyWordSpacing {
1539 public:
1540     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1541     {
1542         if (!value->isPrimitiveValue())
1543             return;
1544
1545         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1546         Length wordSpacing;
1547
1548         if (primitiveValue->getValueID() == CSSValueNormal)
1549             wordSpacing = RenderStyle::initialWordSpacing();
1550         else if (primitiveValue->isLength()) {
1551             double multiplier = styleResolver->style()->effectiveZoom();
1552             if (Frame* frame = styleResolver->document().frame())
1553                 multiplier *= frame->textZoomFactor();
1554             wordSpacing = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), multiplier);
1555         } else if (primitiveValue->isPercentage())
1556             wordSpacing = Length(primitiveValue->getDoubleValue(), Percent);
1557         else if (primitiveValue->isNumber())
1558             wordSpacing = Length(primitiveValue->getDoubleValue(), Fixed);
1559         else if (primitiveValue->isViewportPercentageLength())
1560             wordSpacing = Length(styleResolver->viewportPercentageValue(*primitiveValue, primitiveValue->getDoubleValue()), Fixed);
1561         else
1562             return;
1563         styleResolver->style()->setWordSpacing(wordSpacing);
1564     }
1565     static PropertyHandler createHandler()
1566     {
1567         PropertyHandler handler = ApplyPropertyDefaultBase<const Length&, &RenderStyle::wordSpacing, Length, &RenderStyle::setWordSpacing, Length, &RenderStyle::initialWordSpacing>::createHandler();
1568         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1569     }
1570 };
1571
1572 class ApplyPropertyPageSize {
1573 private:
1574     static Length mmLength(double mm)
1575     {
1576         Ref<CSSPrimitiveValue> value(CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM));
1577         return value.get().computeLength<Length>(0, 0);
1578     }
1579     static Length inchLength(double inch)
1580     {
1581         Ref<CSSPrimitiveValue> value(CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN));
1582         return value.get().computeLength<Length>(0, 0);
1583     }
1584     static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
1585     {
1586         DEFINE_STATIC_LOCAL(Length, a5Width, (mmLength(148)));
1587         DEFINE_STATIC_LOCAL(Length, a5Height, (mmLength(210)));
1588         DEFINE_STATIC_LOCAL(Length, a4Width, (mmLength(210)));
1589         DEFINE_STATIC_LOCAL(Length, a4Height, (mmLength(297)));
1590         DEFINE_STATIC_LOCAL(Length, a3Width, (mmLength(297)));
1591         DEFINE_STATIC_LOCAL(Length, a3Height, (mmLength(420)));
1592         DEFINE_STATIC_LOCAL(Length, b5Width, (mmLength(176)));
1593         DEFINE_STATIC_LOCAL(Length, b5Height, (mmLength(250)));
1594         DEFINE_STATIC_LOCAL(Length, b4Width, (mmLength(250)));
1595         DEFINE_STATIC_LOCAL(Length, b4Height, (mmLength(353)));
1596         DEFINE_STATIC_LOCAL(Length, letterWidth, (inchLength(8.5)));
1597         DEFINE_STATIC_LOCAL(Length, letterHeight, (inchLength(11)));
1598         DEFINE_STATIC_LOCAL(Length, legalWidth, (inchLength(8.5)));
1599         DEFINE_STATIC_LOCAL(Length, legalHeight, (inchLength(14)));
1600         DEFINE_STATIC_LOCAL(Length, ledgerWidth, (inchLength(11)));
1601         DEFINE_STATIC_LOCAL(Length, ledgerHeight, (inchLength(17)));
1602
1603         if (!pageSizeName)
1604             return false;
1605
1606         switch (pageSizeName->getValueID()) {
1607         case CSSValueA5:
1608             width = a5Width;
1609             height = a5Height;
1610             break;
1611         case CSSValueA4:
1612             width = a4Width;
1613             height = a4Height;
1614             break;
1615         case CSSValueA3:
1616             width = a3Width;
1617             height = a3Height;
1618             break;
1619         case CSSValueB5:
1620             width = b5Width;
1621             height = b5Height;
1622             break;
1623         case CSSValueB4:
1624             width = b4Width;
1625             height = b4Height;
1626             break;
1627         case CSSValueLetter:
1628             width = letterWidth;
1629             height = letterHeight;
1630             break;
1631         case CSSValueLegal:
1632             width = legalWidth;
1633             height = legalHeight;
1634             break;
1635         case CSSValueLedger:
1636             width = ledgerWidth;
1637             height = ledgerHeight;
1638             break;
1639         default:
1640             return false;
1641         }
1642
1643         if (pageOrientation) {
1644             switch (pageOrientation->getValueID()) {
1645             case CSSValueLandscape:
1646                 std::swap(width, height);
1647                 break;
1648             case CSSValuePortrait:
1649                 // Nothing to do.
1650                 break;
1651             default:
1652                 return false;
1653             }
1654         }
1655         return true;
1656     }
1657 public:
1658     static void applyInheritValue(CSSPropertyID, StyleResolver*) { }
1659     static void applyInitialValue(CSSPropertyID, StyleResolver*) { }
1660     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1661     {
1662         styleResolver->style()->resetPageSizeType();
1663         Length width;
1664         Length height;
1665         PageSizeType pageSizeType = PAGE_SIZE_AUTO;
1666         CSSValueListInspector inspector(value);
1667         switch (inspector.length()) {
1668         case 2: {
1669             // <length>{2} | <page-size> <orientation>
1670             if (!inspector.first()->isPrimitiveValue() || !inspector.second()->isPrimitiveValue())
1671                 return;
1672             CSSPrimitiveValue* first = toCSSPrimitiveValue(inspector.first());
1673             CSSPrimitiveValue* second = toCSSPrimitiveValue(inspector.second());
1674             if (first->isLength()) {
1675                 // <length>{2}
1676                 if (!second->isLength())
1677                     return;
1678                 width = first->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
1679                 height = second->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
1680             } else {
1681                 // <page-size> <orientation>
1682                 // The value order is guaranteed. See CSSParser::parseSizeParameter.
1683                 if (!getPageSizeFromName(first, second, width, height))
1684                     return;
1685             }
1686             pageSizeType = PAGE_SIZE_RESOLVED;
1687             break;
1688         }
1689         case 1: {
1690             // <length> | auto | <page-size> | [ portrait | landscape]
1691             if (!inspector.first()->isPrimitiveValue())
1692                 return;
1693             CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(inspector.first());
1694             if (primitiveValue->isLength()) {
1695                 // <length>
1696                 pageSizeType = PAGE_SIZE_RESOLVED;
1697                 width = height = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
1698             } else {
1699                 switch (primitiveValue->getValueID()) {
1700                 case 0:
1701                     return;
1702                 case CSSValueAuto:
1703                     pageSizeType = PAGE_SIZE_AUTO;
1704                     break;
1705                 case CSSValuePortrait:
1706                     pageSizeType = PAGE_SIZE_AUTO_PORTRAIT;
1707                     break;
1708                 case CSSValueLandscape:
1709                     pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE;
1710                     break;
1711                 default:
1712                     // <page-size>
1713                     pageSizeType = PAGE_SIZE_RESOLVED;
1714                     if (!getPageSizeFromName(primitiveValue, 0, width, height))
1715                         return;
1716                 }
1717             }
1718             break;
1719         }
1720         default:
1721             return;
1722         }
1723         styleResolver->style()->setPageSizeType(pageSizeType);
1724         styleResolver->style()->setPageSize(LengthSize(width, height));
1725     }
1726     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1727 };
1728
1729 class ApplyPropertyTextEmphasisStyle {
1730 public:
1731     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1732     {
1733         styleResolver->style()->setTextEmphasisFill(styleResolver->parentStyle()->textEmphasisFill());
1734         styleResolver->style()->setTextEmphasisMark(styleResolver->parentStyle()->textEmphasisMark());
1735         styleResolver->style()->setTextEmphasisCustomMark(styleResolver->parentStyle()->textEmphasisCustomMark());
1736     }
1737
1738     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
1739     {
1740         styleResolver->style()->setTextEmphasisFill(RenderStyle::initialTextEmphasisFill());
1741         styleResolver->style()->setTextEmphasisMark(RenderStyle::initialTextEmphasisMark());
1742         styleResolver->style()->setTextEmphasisCustomMark(RenderStyle::initialTextEmphasisCustomMark());
1743     }
1744
1745     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1746     {
1747         if (value->isValueList()) {
1748             CSSValueList* list = toCSSValueList(value);
1749             ASSERT(list->length() == 2);
1750             if (list->length() != 2)
1751                 return;
1752             for (unsigned i = 0; i < 2; ++i) {
1753                 CSSValue* item = list->itemWithoutBoundsCheck(i);
1754                 if (!item->isPrimitiveValue())
1755                     continue;
1756
1757                 CSSPrimitiveValue* value = toCSSPrimitiveValue(item);
1758                 if (value->getValueID() == CSSValueFilled || value->getValueID() == CSSValueOpen)
1759                     styleResolver->style()->setTextEmphasisFill(*value);
1760                 else
1761                     styleResolver->style()->setTextEmphasisMark(*value);
1762             }
1763             styleResolver->style()->setTextEmphasisCustomMark(nullAtom);
1764             return;
1765         }
1766
1767         if (!value->isPrimitiveValue())
1768             return;
1769         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1770
1771         if (primitiveValue->isString()) {
1772             styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled);
1773             styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkCustom);
1774             styleResolver->style()->setTextEmphasisCustomMark(primitiveValue->getStringValue());
1775             return;
1776         }
1777
1778         styleResolver->style()->setTextEmphasisCustomMark(nullAtom);
1779
1780         if (primitiveValue->getValueID() == CSSValueFilled || primitiveValue->getValueID() == CSSValueOpen) {
1781             styleResolver->style()->setTextEmphasisFill(*primitiveValue);
1782             styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkAuto);
1783         } else {
1784             styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled);
1785             styleResolver->style()->setTextEmphasisMark(*primitiveValue);
1786         }
1787     }
1788
1789     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1790 };
1791
1792 static TextEmphasisPosition valueToEmphasisPosition(CSSPrimitiveValue& primitiveValue)
1793 {
1794     ASSERT(primitiveValue.isValueID());
1795
1796     switch (primitiveValue.getValueID()) {
1797     case CSSValueOver:
1798         return TextEmphasisPositionOver;
1799     case CSSValueUnder:
1800         return TextEmphasisPositionUnder;
1801     case CSSValueLeft:
1802         return TextEmphasisPositionLeft;
1803     case CSSValueRight:
1804         return TextEmphasisPositionRight;
1805     default:
1806         break;
1807     }
1808
1809     ASSERT_NOT_REACHED();
1810     return RenderStyle::initialTextEmphasisPosition();
1811 }
1812
1813 class ApplyPropertyTextEmphasisPosition {
1814 public:
1815     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1816     {
1817         if (value->isPrimitiveValue()) {
1818             styleResolver->style()->setTextEmphasisPosition(valueToEmphasisPosition(*toCSSPrimitiveValue(value)));
1819             return;
1820         }
1821
1822         TextEmphasisPosition position = 0;
1823         for (CSSValueListIterator i(value); i.hasMore(); i.advance())
1824             position |= valueToEmphasisPosition(*toCSSPrimitiveValue(i.value()));
1825         styleResolver->style()->setTextEmphasisPosition(position);
1826     }
1827     static PropertyHandler createHandler()
1828     {
1829         PropertyHandler handler = ApplyPropertyDefaultBase<TextEmphasisPosition, &RenderStyle::textEmphasisPosition, TextEmphasisPosition, &RenderStyle::setTextEmphasisPosition, TextEmphasisPosition, &RenderStyle::initialTextEmphasisPosition>::createHandler();
1830         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1831     }
1832 };
1833
1834 template <typename T,
1835           T (Animation::*getterFunction)() const,
1836           void (Animation::*setterFunction)(T),
1837           bool (Animation::*testFunction)() const,
1838           void (Animation::*clearFunction)(),
1839           T (*initialFunction)(),
1840           void (CSSToStyleMap::*mapFunction)(Animation*, CSSValue*),
1841           AnimationList* (RenderStyle::*animationGetterFunction)(),
1842           const AnimationList* (RenderStyle::*immutableAnimationGetterFunction)() const>
1843 class ApplyPropertyAnimation {
1844 public:
1845     static void setValue(Animation& animation, T value) { (animation.*setterFunction)(value); }
1846     static T value(const Animation& animation) { return (animation.*getterFunction)(); }
1847     static bool test(const Animation& animation) { return (animation.*testFunction)(); }
1848     static void clear(Animation& animation) { (animation.*clearFunction)(); }
1849     static T initial() { return (*initialFunction)(); }
1850     static void map(StyleResolver* styleResolver, Animation& animation, CSSValue* value) { (styleResolver->styleMap()->*mapFunction)(&animation, value); }
1851     static AnimationList* accessAnimations(RenderStyle* style) { return (style->*animationGetterFunction)(); }
1852     static const AnimationList* animations(RenderStyle* style) { return (style->*immutableAnimationGetterFunction)(); }
1853
1854     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1855     {
1856         AnimationList* list = accessAnimations(styleResolver->style());
1857         const AnimationList* parentList = animations(styleResolver->parentStyle());
1858         size_t i = 0, parentSize = parentList ? parentList->size() : 0;
1859         for ( ; i < parentSize && test(parentList->animation(i)); ++i) {
1860             if (list->size() <= i)
1861                 list->append(Animation::create());
1862             setValue(list->animation(i), value(parentList->animation(i)));
1863             list->animation(i).setAnimationMode(parentList->animation(i).animationMode());
1864         }
1865
1866         /* Reset any remaining animations to not have the property set. */
1867         for ( ; i < list->size(); ++i)
1868             clear(list->animation(i));
1869     }
1870
1871     static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
1872     {
1873         AnimationList* list = accessAnimations(styleResolver->style());
1874         if (list->isEmpty())
1875             list->append(Animation::create());
1876         setValue(list->animation(0), initial());
1877         if (propertyID == CSSPropertyWebkitTransitionProperty)
1878             list->animation(0).setAnimationMode(Animation::AnimateAll);
1879         for (size_t i = 1; i < list->size(); ++i)
1880             clear(list->animation(i));
1881     }
1882
1883     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1884     {
1885         AnimationList* list = accessAnimations(styleResolver->style());
1886         size_t childIndex = 0;
1887         if (value->isValueList()) {
1888             /* Walk each value and put it into an animation, creating new animations as needed. */
1889             for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
1890                 if (childIndex <= list->size())
1891                     list->append(Animation::create());
1892                 map(styleResolver, list->animation(childIndex), i.value());
1893                 ++childIndex;
1894             }
1895         } else {
1896             if (list->isEmpty())
1897                 list->append(Animation::create());
1898             map(styleResolver, list->animation(childIndex), value);
1899             childIndex = 1;
1900         }
1901         for ( ; childIndex < list->size(); ++childIndex) {
1902             /* Reset all remaining animations to not have the property set. */
1903             clear(list->animation(childIndex));
1904         }
1905     }
1906
1907     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1908 };
1909
1910 class ApplyPropertyOutlineStyle {
1911 public:
1912     static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
1913     {
1914         ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInheritValue(propertyID, styleResolver);
1915         ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInheritValue(propertyID, styleResolver);
1916     }
1917
1918     static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
1919     {
1920         ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInitialValue(propertyID, styleResolver);
1921         ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInitialValue(propertyID, styleResolver);
1922     }
1923
1924     static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
1925     {
1926         ApplyPropertyDefault<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyValue(propertyID, styleResolver, value);
1927         ApplyPropertyDefault<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyValue(propertyID, styleResolver, value);
1928     }
1929
1930     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1931 };
1932
1933 class ApplyPropertyResize {
1934 public:
1935     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1936     {
1937         if (!value->isPrimitiveValue())
1938             return;
1939
1940         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1941
1942         EResize r = RESIZE_NONE;
1943         switch (primitiveValue->getValueID()) {
1944         case 0:
1945             return;
1946         case CSSValueAuto:
1947             if (Settings* settings = styleResolver->document().settings())
1948                 r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
1949             break;
1950         default:
1951             r = *primitiveValue;
1952         }
1953         styleResolver->style()->setResize(r);
1954     }
1955
1956     static PropertyHandler createHandler()
1957     {
1958         PropertyHandler handler = ApplyPropertyDefaultBase<EResize, &RenderStyle::resize, EResize, &RenderStyle::setResize, EResize, &RenderStyle::initialResize>::createHandler();
1959         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1960     }
1961 };
1962
1963 class ApplyPropertyVerticalAlign {
1964 public:
1965     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
1966     {
1967         if (!value->isPrimitiveValue())
1968             return;
1969
1970         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1971
1972         if (primitiveValue->getValueID())
1973             return styleResolver->style()->setVerticalAlign(*primitiveValue);
1974
1975         styleResolver->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
1976     }
1977
1978     static PropertyHandler createHandler()
1979     {
1980         PropertyHandler handler = ApplyPropertyDefaultBase<EVerticalAlign, &RenderStyle::verticalAlign, EVerticalAlign, &RenderStyle::setVerticalAlign, EVerticalAlign, &RenderStyle::initialVerticalAlign>::createHandler();
1981         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1982     }
1983 };
1984
1985 class ApplyPropertyAspectRatio {
1986 public:
1987     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
1988     {
1989         if (styleResolver->parentStyle()->aspectRatioType() == AspectRatioAuto)
1990             return;
1991         styleResolver->style()->setAspectRatioType(styleResolver->parentStyle()->aspectRatioType());
1992         styleResolver->style()->setAspectRatioDenominator(styleResolver->parentStyle()->aspectRatioDenominator());
1993         styleResolver->style()->setAspectRatioNumerator(styleResolver->parentStyle()->aspectRatioNumerator());
1994     }
1995
1996     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
1997     {
1998         styleResolver->style()->setAspectRatioType(RenderStyle::initialAspectRatioType());
1999         styleResolver->style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDenominator());
2000         styleResolver->style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumerator());
2001     }
2002
2003     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
2004     {
2005         if (value->isPrimitiveValue()) {
2006             CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
2007
2008             if (primitiveValue->getValueID() == CSSValueAuto)
2009                 return styleResolver->style()->setAspectRatioType(AspectRatioAuto);
2010             if (primitiveValue->getValueID() == CSSValueFromDimensions)
2011                 return styleResolver->style()->setAspectRatioType(AspectRatioFromDimensions);
2012             if (primitiveValue->getValueID() == CSSValueFromIntrinsic)
2013                 return styleResolver->style()->setAspectRatioType(AspectRatioFromIntrinsic);
2014         }
2015
2016         if (!value->isAspectRatioValue()) {
2017             styleResolver->style()->setAspectRatioType(AspectRatioAuto);
2018             return;
2019         }
2020
2021         CSSAspectRatioValue* aspectRatioValue = toCSSAspectRatioValue(value);
2022         styleResolver->style()->setAspectRatioType(AspectRatioSpecified);
2023         styleResolver->style()->setAspectRatioDenominator(aspectRatioValue->denominatorValue());
2024         styleResolver->style()->setAspectRatioNumerator(aspectRatioValue->numeratorValue());
2025     }
2026
2027     static PropertyHandler createHandler()
2028     {
2029         return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
2030     }
2031 };
2032
2033 class ApplyPropertyZoom {
2034 private:
2035     static void resetEffectiveZoom(StyleResolver* styleResolver)
2036     {
2037         // Reset the zoom in effect. This allows the setZoom method to accurately compute a new zoom in effect.
2038         styleResolver->setEffectiveZoom(styleResolver->parentStyle() ? styleResolver->parentStyle()->effectiveZoom() : RenderStyle::initialZoom());
2039     }
2040
2041 public:
2042     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
2043     {
2044         resetEffectiveZoom(styleResolver);
2045         styleResolver->setZoom(styleResolver->parentStyle()->zoom());
2046     }
2047
2048     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
2049     {
2050         resetEffectiveZoom(styleResolver);
2051         styleResolver->setZoom(RenderStyle::initialZoom());
2052     }
2053
2054     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
2055     {
2056         ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue());
2057         CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
2058
2059         if (primitiveValue->getValueID() == CSSValueNormal) {
2060             resetEffectiveZoom(styleResolver);
2061             styleResolver->setZoom(RenderStyle::initialZoom());
2062         } else if (primitiveValue->getValueID() == CSSValueReset) {
2063             styleResolver->setEffectiveZoom(RenderStyle::initialZoom());
2064             styleResolver->setZoom(RenderStyle::initialZoom());
2065         } else if (primitiveValue->getValueID() == CSSValueDocument) {
2066             float docZoom = styleResolver->rootElementStyle() ? styleResolver->rootElementStyle()->zoom() : RenderStyle::initialZoom();
2067             styleResolver->setEffectiveZoom(docZoom);
2068             styleResolver->setZoom(docZoom);
2069         } else if (primitiveValue->isPercentage()) {
2070             resetEffectiveZoom(styleResolver);
2071             if (float percent = primitiveValue->getFloatValue())
2072                 styleResolver->setZoom(percent / 100.0f);
2073         } else if (primitiveValue->isNumber()) {
2074             resetEffectiveZoom(styleResolver);
2075             if (float number = primitiveValue->getFloatValue())
2076                 styleResolver->setZoom(number);
2077         }
2078     }
2079
2080     static PropertyHandler createHandler()
2081     {
2082         return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
2083     }
2084 };
2085
2086 class ApplyPropertyDisplay {
2087 private:
2088     static inline bool isValidDisplayValue(StyleResolver* styleResolver, EDisplay displayPropertyValue)
2089     {
2090         if (styleResolver->element() && styleResolver->element()->isSVGElement() && styleResolver->style()->styleType() == NOPSEUDO)
2091             return (displayPropertyValue == INLINE || displayPropertyValue == BLOCK || displayPropertyValue == NONE);
2092         return true;
2093     }
2094 public:
2095     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
2096     {
2097         EDisplay display = styleResolver->parentStyle()->display();
2098         if (!isValidDisplayValue(styleResolver, display))
2099             return;
2100         styleResolver->style()->setDisplay(display);
2101     }
2102
2103     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
2104     {
2105         styleResolver->style()->setDisplay(RenderStyle::initialDisplay());
2106     }
2107
2108     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
2109     {
2110         if (!value->isPrimitiveValue())
2111             return;
2112
2113         EDisplay display = *toCSSPrimitiveValue(value);
2114
2115         if (!isValidDisplayValue(styleResolver, display))
2116             return;
2117
2118         styleResolver->style()->setDisplay(display);
2119     }
2120
2121     static PropertyHandler createHandler()
2122     {
2123         return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
2124     }
2125 };
2126
2127 template <ClipPathOperation* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<ClipPathOperation>), ClipPathOperation* (*initialFunction)()>
2128 class ApplyPropertyClipPath {
2129 public:
2130     static void setValue(RenderStyle* style, PassRefPtr<ClipPathOperation> value) { (style->*setterFunction)(value); }
2131     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
2132     {
2133         if (value->isPrimitiveValue()) {
2134             auto& primitiveValue = toCSSPrimitiveValue(*value);
2135             if (primitiveValue.getValueID() == CSSValueNone)
2136                 setValue(styleResolver->style(), 0);
2137             else if (primitiveValue.primitiveType() == CSSPrimitiveValue::CSS_URI) {
2138                 String cssURLValue = primitiveValue.getStringValue();
2139                 URL url = styleResolver->document().completeURL(cssURLValue);
2140                 // FIXME: It doesn't work with external SVG references (see https://bugs.webkit.org/show_bug.cgi?id=126133)
2141                 setValue(styleResolver->style(), ReferenceClipPathOperation::create(cssURLValue, url.fragmentIdentifier()));
2142             }
2143             return;
2144         }
2145         if (!value->isValueList())
2146             return;
2147         LayoutBox referenceBox = BoxMissing;
2148         RefPtr<ClipPathOperation> operation;
2149         auto& valueList = toCSSValueList(*value);
2150         for (unsigned i = 0; i < valueList.length(); ++i) {
2151             auto& primitiveValue = toCSSPrimitiveValue(*valueList.itemWithoutBoundsCheck(i));
2152             if (primitiveValue.isShape() && !operation)
2153                 operation = ShapeClipPathOperation::create(basicShapeForValue(styleResolver->style(), styleResolver->rootElementStyle(), primitiveValue.getShapeValue()));
2154             else if ((primitiveValue.getValueID() == CSSValueContentBox
2155                 || primitiveValue.getValueID() == CSSValueBorderBox
2156                 || primitiveValue.getValueID() == CSSValuePaddingBox
2157                 || primitiveValue.getValueID() == CSSValueMarginBox
2158                 || primitiveValue.getValueID() == CSSValueFill
2159                 || primitiveValue.getValueID() == CSSValueStroke
2160                 || primitiveValue.getValueID() == CSSValueViewBox)
2161                 && referenceBox == BoxMissing)
2162                 referenceBox = LayoutBox(primitiveValue);
2163             else
2164                 return;
2165         }
2166         if (!operation) {
2167             if (referenceBox == BoxMissing)
2168                 return;
2169             operation = BoxClipPathOperation::create(referenceBox);
2170         } else
2171             toShapeClipPathOperation(operation.get())->setReferenceBox(referenceBox);
2172         setValue(styleResolver->style(), operation.release());
2173     }
2174     static PropertyHandler createHandler()
2175     {
2176         PropertyHandler handler = ApplyPropertyDefaultBase<ClipPathOperation*, getterFunction, PassRefPtr<ClipPathOperation>, setterFunction, ClipPathOperation*, initialFunction>::createHandler();
2177         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
2178     }
2179 };
2180
2181 #if ENABLE(CSS_SHAPES)
2182 template <ShapeValue* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<ShapeValue>), ShapeValue* (*initialFunction)()>
2183 class ApplyPropertyShape {
2184 public:
2185     static void setValue(RenderStyle* style, PassRefPtr<ShapeValue> value) { (style->*setterFunction)(value); }
2186     static void applyValue(CSSPropertyID property, StyleResolver* styleResolver, CSSValue* value)
2187     {
2188         if (value->isPrimitiveValue()) {
2189             CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
2190             if (primitiveValue->getValueID() == CSSValueAuto)
2191                 setValue(styleResolver->style(), 0);
2192             else if (primitiveValue->getValueID() == CSSValueOutsideShape)
2193                 setValue(styleResolver->style(), ShapeValue::createOutsideValue());
2194         } else if (value->isImageValue() || value->isImageSetValue()) {
2195             RefPtr<ShapeValue> shape = ShapeValue::createImageValue(styleResolver->styleImage(property, value));
2196             setValue(styleResolver->style(), shape.release());
2197         } else if (value->isValueList()) {
2198             RefPtr<BasicShape> shape;
2199             LayoutBox layoutBox = BoxMissing;
2200             CSSValueList* valueList = toCSSValueList(value);
2201             for (unsigned i = 0; i < valueList->length(); ++i) {
2202                 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->itemWithoutBoundsCheck(i));
2203                 if (primitiveValue->isShape())
2204                     shape = basicShapeForValue(styleResolver->style(), styleResolver->rootElementStyle(), primitiveValue->getShapeValue());
2205                 else if (primitiveValue->getValueID() == CSSValueContentBox
2206                     || primitiveValue->getValueID() == CSSValueBorderBox
2207                     || primitiveValue->getValueID() == CSSValuePaddingBox
2208                     || primitiveValue->getValueID() == CSSValueMarginBox)
2209                     layoutBox = LayoutBox(*primitiveValue);
2210                 else
2211                     return;
2212             }
2213
2214             if (shape)
2215                 setValue(styleResolver->style(), ShapeValue::createShapeValue(shape.release(), layoutBox));
2216             else if (layoutBox != BoxMissing)
2217                 setValue(styleResolver->style(), ShapeValue::createLayoutBoxValue(layoutBox));
2218
2219         }
2220     }
2221
2222     static PropertyHandler createHandler()
2223     {
2224         PropertyHandler handler = ApplyPropertyDefaultBase<ShapeValue*, getterFunction, PassRefPtr<ShapeValue>, setterFunction, ShapeValue*, initialFunction>::createHandler();
2225         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
2226     }
2227 };
2228 #endif
2229
2230 #if ENABLE(CSS_IMAGE_RESOLUTION)
2231 class ApplyPropertyImageResolution {
2232 public:
2233     static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
2234     {
2235         ApplyPropertyDefaultBase<ImageResolutionSource, &RenderStyle::imageResolutionSource, ImageResolutionSource, &RenderStyle::setImageResolutionSource, ImageResolutionSource, &RenderStyle::initialImageResolutionSource>::applyInheritValue(propertyID, styleResolver);
2236         ApplyPropertyDefaultBase<ImageResolutionSnap, &RenderStyle::imageResolutionSnap, ImageResolutionSnap, &RenderStyle::setImageResolutionSnap, ImageResolutionSnap, &RenderStyle::initialImageResolutionSnap>::applyInheritValue(propertyID, styleResolver);
2237         ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInheritValue(propertyID, styleResolver);
2238     }
2239
2240     static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
2241     {
2242         ApplyPropertyDefaultBase<ImageResolutionSource, &RenderStyle::imageResolutionSource, ImageResolutionSource, &RenderStyle::setImageResolutionSource, ImageResolutionSource, &RenderStyle::initialImageResolutionSource>::applyInitialValue(propertyID, styleResolver);
2243         ApplyPropertyDefaultBase<ImageResolutionSnap, &RenderStyle::imageResolutionSnap, ImageResolutionSnap, &RenderStyle::setImageResolutionSnap, ImageResolutionSnap, &RenderStyle::initialImageResolutionSnap>::applyInitialValue(propertyID, styleResolver);
2244         ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInitialValue(propertyID, styleResolver);
2245     }
2246
2247     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
2248     {
2249         if (!value->isValueList())
2250             return;
2251         CSSValueList* valueList = toCSSValueList(value);
2252         ImageResolutionSource source = RenderStyle::initialImageResolutionSource();
2253         ImageResolutionSnap snap = RenderStyle::initialImageResolutionSnap();
2254         double resolution = RenderStyle::initialImageResolution();
2255         for (size_t i = 0; i < valueList->length(); i++) {
2256             CSSValue* item = valueList->itemWithoutBoundsCheck(i);
2257             if (!item->isPrimitiveValue())
2258                 continue;
2259             CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
2260             if (primitiveValue->getValueID() == CSSValueFromImage)
2261                 source = ImageResolutionFromImage;
2262             else if (primitiveValue->getValueID() == CSSValueSnap)
2263                 snap = ImageResolutionSnapPixels;
2264             else
2265                 resolution = primitiveValue->getDoubleValue(CSSPrimitiveValue::CSS_DPPX);
2266         }
2267         styleResolver->style()->setImageResolutionSource(source);
2268         styleResolver->style()->setImageResolutionSnap(snap);
2269         styleResolver->style()->setImageResolution(resolution);
2270     }
2271
2272     static PropertyHandler createHandler()
2273     {
2274         return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
2275     }
2276 };
2277 #endif
2278
2279 class ApplyPropertyTextIndent {
2280 public:
2281     static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
2282     {
2283         styleResolver->style()->setTextIndent(styleResolver->parentStyle()->textIndent());
2284 #if ENABLE(CSS3_TEXT)
2285         styleResolver->style()->setTextIndentLine(styleResolver->parentStyle()->textIndentLine());
2286         styleResolver->style()->setTextIndentType(styleResolver->parentStyle()->textIndentType());
2287 #endif
2288     }
2289
2290     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
2291     {
2292         styleResolver->style()->setTextIndent(RenderStyle::initialTextIndent());
2293 #if ENABLE(CSS3_TEXT)
2294         styleResolver->style()->setTextIndentLine(RenderStyle::initialTextIndentLine());
2295         styleResolver->style()->setTextIndentType(RenderStyle::initialTextIndentType());
2296 #endif
2297     }
2298
2299     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
2300     {
2301         if (!value->isValueList())
2302             return;
2303
2304         Length lengthOrPercentageValue;
2305 #if ENABLE(CSS3_TEXT)
2306         TextIndentLine textIndentLineValue = RenderStyle::initialTextIndentLine();
2307         TextIndentType textIndentTypeValue = RenderStyle::initialTextIndentType();
2308 #endif
2309         CSSValueList* valueList = toCSSValueList(value);
2310         for (size_t i = 0; i < valueList->length(); ++i) {
2311             CSSValue* item = valueList->itemWithoutBoundsCheck(i);
2312             if (!item->isPrimitiveValue())
2313                 continue;
2314
2315             CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
2316             if (!primitiveValue->getValueID())
2317                 lengthOrPercentageValue = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
2318 #if ENABLE(CSS3_TEXT)
2319             else if (primitiveValue->getValueID() == CSSValueWebkitEachLine)
2320                 textIndentLineValue = TextIndentEachLine;
2321             else if (primitiveValue->getValueID() == CSSValueWebkitHanging)
2322                 textIndentTypeValue = TextIndentHanging;
2323 #endif
2324         }
2325
2326         ASSERT(!lengthOrPercentageValue.isUndefined());
2327         styleResolver->style()->setTextIndent(lengthOrPercentageValue);
2328 #if ENABLE(CSS3_TEXT)
2329         styleResolver->style()->setTextIndentLine(textIndentLineValue);
2330         styleResolver->style()->setTextIndentType(textIndentTypeValue);
2331 #endif
2332     }
2333
2334     static PropertyHandler createHandler()
2335     {
2336         return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
2337     }
2338 };
2339
2340 const DeprecatedStyleBuilder& DeprecatedStyleBuilder::sharedStyleBuilder()
2341 {
2342     DEFINE_STATIC_LOCAL(DeprecatedStyleBuilder, styleBuilderInstance, ());
2343     return styleBuilderInstance;
2344 }
2345
2346 DeprecatedStyleBuilder::DeprecatedStyleBuilder()
2347 {
2348     for (int i = 0; i < numCSSProperties; ++i)
2349         m_propertyMap[i] = PropertyHandler();
2350
2351     // Please keep CSS property list in alphabetical order.
2352     setPropertyHandler(CSSPropertyBackgroundAttachment, ApplyPropertyFillLayer<EFillAttachment, CSSPropertyBackgroundAttachment, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &CSSToStyleMap::mapFillAttachment>::createHandler());
2353     setPropertyHandler(CSSPropertyBackgroundBlendMode, ApplyPropertyFillLayer<BlendMode, CSSPropertyBackgroundBlendMode, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isBlendModeSet, &FillLayer::blendMode, &FillLayer::setBlendMode, &FillLayer::clearBlendMode, &FillLayer::initialFillBlendMode, &CSSToStyleMap::mapFillBlendMode>::createHandler());
2354     setPropertyHandler(CSSPropertyBackgroundClip, ApplyPropertyFillLayer<EFillBox, CSSPropertyBackgroundClip, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSToStyleMap::mapFillClip>::createHandler());
2355     setPropertyHandler(CSSPropertyBackgroundColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, &RenderStyle::setVisitedLinkBackgroundColor, &RenderStyle::invalidColor>::createHandler());
2356     setPropertyHandler(CSSPropertyBackgroundImage, ApplyPropertyFillLayer<StyleImage*, CSSPropertyBackgroundImage, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSToStyleMap::mapFillImage>::createHandler());
2357     setPropertyHandler(CSSPropertyBackgroundOrigin, ApplyPropertyFillLayer<EFillBox, CSSPropertyBackgroundOrigin, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSToStyleMap::mapFillOrigin>::createHandler());
2358     setPropertyHandler(CSSPropertyBackgroundPositionX, ApplyPropertyFillLayer<Length, CSSPropertyBackgroundPositionX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSToStyleMap::mapFillXPosition>::createHandler());
2359     setPropertyHandler(CSSPropertyBackgroundPositionY, ApplyPropertyFillLayer<Length, CSSPropertyBackgroundPositionY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSToStyleMap::mapFillYPosition>::createHandler());
2360     setPropertyHandler(CSSPropertyBackgroundRepeatX, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyBackgroundRepeatX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSToStyleMap::mapFillRepeatX>::createHandler());
2361     setPropertyHandler(CSSPropertyBackgroundRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyBackgroundRepeatY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSToStyleMap::mapFillRepeatY>::createHandler());
2362     setPropertyHandler(CSSPropertyBackgroundSize, ApplyPropertyFillLayer<FillSize, CSSPropertyBackgroundSize, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSToStyleMap::mapFillSize>::createHandler());
2363     setPropertyHandler(CSSPropertyBorderBottomColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::setVisitedLinkBorderBottomColor, &RenderStyle::color>::createHandler());
2364     setPropertyHandler(CSSPropertyBorderBottomLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
2365     setPropertyHandler(CSSPropertyBorderBottomRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
2366     setPropertyHandler(CSSPropertyBorderBottomStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderBottomStyle, EBorderStyle, &RenderStyle::setBorderBottomStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
2367     setPropertyHandler(CSSPropertyBorderBottomWidth, ApplyPropertyComputeLength<float, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
2368     setPropertyHandler(CSSPropertyBorderCollapse, ApplyPropertyDefault<EBorderCollapse, &RenderStyle::borderCollapse, EBorderCollapse, &RenderStyle::setBorderCollapse, EBorderCollapse, &RenderStyle::initialBorderCollapse>::createHandler());
2369     setPropertyHandler(CSSPropertyBorderImageOutset, ApplyPropertyBorderImageModifier<BorderImage, Outset>::createHandler());
2370     setPropertyHandler(CSSPropertyBorderImageRepeat, ApplyPropertyBorderImageModifier<BorderImage, Repeat>::createHandler());
2371     setPropertyHandler(CSSPropertyBorderImageSlice, ApplyPropertyBorderImageModifier<BorderImage, Slice>::createHandler());
2372     setPropertyHandler(CSSPropertyBorderImageSource, ApplyPropertyBorderImageSource<CSSPropertyBorderImageSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource, &RenderStyle::initialBorderImageSource>::createHandler());
2373     setPropertyHandler(CSSPropertyBorderImageWidth, ApplyPropertyBorderImageModifier<BorderImage, Width>::createHandler());
2374     setPropertyHandler(CSSPropertyBorderLeftColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::setVisitedLinkBorderLeftColor, &RenderStyle::color>::createHandler());
2375     setPropertyHandler(CSSPropertyBorderLeftStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderLeftStyle, EBorderStyle, &RenderStyle::setBorderLeftStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
2376     setPropertyHandler(CSSPropertyBorderLeftWidth, ApplyPropertyComputeLength<float, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
2377     setPropertyHandler(CSSPropertyBorderRightColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::setVisitedLinkBorderRightColor, &RenderStyle::color>::createHandler());
2378     setPropertyHandler(CSSPropertyBorderRightStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderRightStyle, EBorderStyle, &RenderStyle::setBorderRightStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
2379     setPropertyHandler(CSSPropertyBorderRightWidth, ApplyPropertyComputeLength<float, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
2380     setPropertyHandler(CSSPropertyBorderTopColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::setVisitedLinkBorderTopColor, &RenderStyle::color>::createHandler());
2381     setPropertyHandler(CSSPropertyBorderTopLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
2382     setPropertyHandler(CSSPropertyBorderTopRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
2383     setPropertyHandler(CSSPropertyBorderTopStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderTopStyle, EBorderStyle, &RenderStyle::setBorderTopStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
2384     setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength<float, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
2385     setPropertyHandler(CSSPropertyBottom, ApplyPropertyLength<&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
2386     setPropertyHandler(CSSPropertyBoxSizing, ApplyPropertyDefault<EBoxSizing, &RenderStyle::boxSizing, EBoxSizing, &RenderStyle::setBoxSizing, EBoxSizing, &RenderStyle::initialBoxSizing>::createHandler());
2387     setPropertyHandler(CSSPropertyCaptionSide, ApplyPropertyDefault<ECaptionSide, &RenderStyle::captionSide, ECaptionSide, &RenderStyle::setCaptionSide, ECaptionSide, &RenderStyle::initialCaptionSide>::createHandler());
2388     setPropertyHandler(CSSPropertyClear, ApplyPropertyDefault<EClear, &RenderStyle::clear, EClear, &RenderStyle::setClear, EClear, &RenderStyle::initialClear>::createHandler());
2389     setPropertyHandler(CSSPropertyClip, ApplyPropertyClip::createHandler());
2390     setPropertyHandler(CSSPropertyColor, ApplyPropertyColor<InheritFromParent, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::setVisitedLinkColor, &RenderStyle::invalidColor, RenderStyle::initialColor>::createHandler());
2391     setPropertyHandler(CSSPropertyCounterIncrement, ApplyPropertyCounter<Increment>::createHandler());
2392     setPropertyHandler(CSSPropertyCounterReset, ApplyPropertyCounter<Reset>::createHandler());
2393     setPropertyHandler(CSSPropertyCursor, ApplyPropertyCursor::createHandler());
2394     setPropertyHandler(CSSPropertyDirection, ApplyPropertyDirection<&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection>::createHandler());
2395     setPropertyHandler(CSSPropertyDisplay, ApplyPropertyDisplay::createHandler());
2396     setPropertyHandler(CSSPropertyEmptyCells, ApplyPropertyDefault<EEmptyCell, &RenderStyle::emptyCells, EEmptyCell, &RenderStyle::setEmptyCells, EEmptyCell, &RenderStyle::initialEmptyCells>::createHandler());
2397     setPropertyHandler(CSSPropertyFloat, ApplyPropertyDefault<EFloat, &RenderStyle::floating, EFloat, &RenderStyle::setFloating, EFloat, &RenderStyle::initialFloating>::createHandler());
2398     setPropertyHandler(CSSPropertyFontFamily, ApplyPropertyFontFamily::createHandler());
2399     setPropertyHandler(CSSPropertyFontSize, ApplyPropertyFontSize::createHandler());
2400     setPropertyHandler(CSSPropertyFontStyle, ApplyPropertyFont<FontItalic, &FontDescription::italic, &FontDescription::setItalic, FontItalicOff>::createHandler());
2401     setPropertyHandler(CSSPropertyFontVariant, ApplyPropertyFont<FontSmallCaps, &FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff>::createHandler());
2402     setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler());
2403     setPropertyHandler(CSSPropertyHeight, ApplyPropertyLength<&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicDisabled, NoneDisabled, UndefinedDisabled>::createHandler());
2404 #if ENABLE(CSS_IMAGE_ORIENTATION)
2405     setPropertyHandler(CSSPropertyImageOrientation, ApplyPropertyDefault<ImageOrientationEnum, &RenderStyle::imageOrientation, ImageOrientationEnum, &RenderStyle::setImageOrientation, ImageOrientationEnum, &RenderStyle::initialImageOrientation>::createHandler());
2406 #endif
2407     setPropertyHandler(CSSPropertyImageRendering, ApplyPropertyDefault<EImageRendering, &RenderStyle::imageRendering, EImageRendering, &RenderStyle::setImageRendering, EImageRendering, &RenderStyle::initialImageRendering>::createHandler());
2408 #if ENABLE(CSS_IMAGE_RESOLUTION)
2409     setPropertyHandler(CSSPropertyImageResolution, ApplyPropertyImageResolution::createHandler());
2410 #endif
2411     setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
2412     setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<float, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
2413
2414 #if ENABLE(IOS_TEXT_AUTOSIZING)
2415     setPropertyHandler(CSSPropertyLineHeight, ApplyPropertyLineHeightForIOSTextAutosizing::createHandler());
2416 #else
2417     setPropertyHandler(CSSPropertyLineHeight, ApplyPropertyLineHeight::createHandler());
2418 #endif
2419     setPropertyHandler(CSSPropertyListStyleImage, ApplyPropertyStyleImage<&RenderStyle::listStyleImage, &RenderStyle::setListStyleImage, &RenderStyle::initialListStyleImage, CSSPropertyListStyleImage>::createHandler());
2420     setPropertyHandler(CSSPropertyListStylePosition, ApplyPropertyDefault<EListStylePosition, &RenderStyle::listStylePosition, EListStylePosition, &RenderStyle::setListStylePosition, EListStylePosition, &RenderStyle::initialListStylePosition>::createHandler());
2421     setPropertyHandler(CSSPropertyListStyleType, ApplyPropertyDefault<EListStyleType, &RenderStyle::listStyleType, EListStyleType, &RenderStyle::setListStyleType, EListStyleType, &RenderStyle::initialListStyleType>::createHandler());
2422     setPropertyHandler(CSSPropertyMarginBottom, ApplyPropertyLength<&RenderStyle::marginBottom, &RenderStyle::setMarginBottom, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
2423     setPropertyHandler(CSSPropertyMarginLeft, ApplyPropertyLength<&RenderStyle::marginLeft, &RenderStyle::setMarginLeft, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
2424     setPropertyHandler(CSSPropertyMarginRight, ApplyPropertyLength<&RenderStyle::marginRight, &RenderStyle::setMarginRight, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
2425     setPropertyHandler(CSSPropertyMarginTop, ApplyPropertyLength<&RenderStyle::marginTop, &RenderStyle::setMarginTop, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
2426     setPropertyHandler(CSSPropertyMaxHeight, ApplyPropertyLength<&RenderStyle::maxHeight, &RenderStyle::setMaxHeight, &RenderStyle::initialMaxSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicDisabled, NoneEnabled, UndefinedEnabled>::createHandler());
2427     setPropertyHandler(CSSPropertyMaxWidth, ApplyPropertyLength<&RenderStyle::maxWidth, &RenderStyle::setMaxWidth, &RenderStyle::initialMaxSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneEnabled, UndefinedEnabled>::createHandler());
2428     setPropertyHandler(CSSPropertyMinHeight, ApplyPropertyLength<&RenderStyle::minHeight, &RenderStyle::setMinHeight, &RenderStyle::initialMinSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicDisabled>::createHandler());
2429     setPropertyHandler(CSSPropertyMinWidth, ApplyPropertyLength<&RenderStyle::minWidth, &RenderStyle::setMinWidth, &RenderStyle::initialMinSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled>::createHandler());
2430     setPropertyHandler(CSSPropertyObjectFit, ApplyPropertyDefault<ObjectFit, &RenderStyle::objectFit, ObjectFit, &RenderStyle::setObjectFit, ObjectFit, &RenderStyle::initialObjectFit>::createHandler());
2431     setPropertyHandler(CSSPropertyOpacity, ApplyPropertyDefault<float, &RenderStyle::opacity, float, &RenderStyle::setOpacity, float, &RenderStyle::initialOpacity>::createHandler());
2432     setPropertyHandler(CSSPropertyOrphans, ApplyPropertyAuto<short, &RenderStyle::orphans, &RenderStyle::setOrphans, &RenderStyle::hasAutoOrphans, &RenderStyle::setHasAutoOrphans>::createHandler());
2433     setPropertyHandler(CSSPropertyOutlineColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::setVisitedLinkOutlineColor, &RenderStyle::color>::createHandler());
2434     setPropertyHandler(CSSPropertyOutlineOffset, ApplyPropertyComputeLength<int, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset, &RenderStyle::initialOutlineOffset>::createHandler());
2435     setPropertyHandler(CSSPropertyOutlineStyle, ApplyPropertyOutlineStyle::createHandler());
2436     setPropertyHandler(CSSPropertyOutlineWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth, &RenderStyle::initialOutlineWidth, NormalDisabled, ThicknessEnabled>::createHandler());
2437     setPropertyHandler(CSSPropertyOverflowWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler());
2438     setPropertyHandler(CSSPropertyOverflowX, ApplyPropertyDefault<EOverflow, &RenderStyle::overflowX, EOverflow, &RenderStyle::setOverflowX, EOverflow, &RenderStyle::initialOverflowX>::createHandler());
2439     setPropertyHandler(CSSPropertyOverflowY, ApplyPropertyDefault<EOverflow, &RenderStyle::overflowY, EOverflow, &RenderStyle::setOverflowY, EOverflow, &RenderStyle::initialOverflowY>::createHandler());
2440     setPropertyHandler(CSSPropertyPaddingBottom, ApplyPropertyLength<&RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom, &RenderStyle::initialPadding>::createHandler());
2441     setPropertyHandler(CSSPropertyPaddingLeft, ApplyPropertyLength<&RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft, &RenderStyle::initialPadding>::createHandler());
2442     setPropertyHandler(CSSPropertyPaddingRight, ApplyPropertyLength<&RenderStyle::paddingRight, &RenderStyle::setPaddingRight, &RenderStyle::initialPadding>::createHandler());
2443     setPropertyHandler(CSSPropertyPaddingTop, ApplyPropertyLength<&RenderStyle::paddingTop, &RenderStyle::setPaddingTop, &RenderStyle::initialPadding>::createHandler());
2444     setPropertyHandler(CSSPropertyPageBreakAfter, ApplyPropertyDefault<EPageBreak, &RenderStyle::pageBreakAfter, EPageBreak, &RenderStyle::setPageBreakAfter, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2445     setPropertyHandler(CSSPropertyPageBreakBefore, ApplyPropertyDefault<EPageBreak, &RenderStyle::pageBreakBefore, EPageBreak, &RenderStyle::setPageBreakBefore, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2446     setPropertyHandler(CSSPropertyPageBreakInside, ApplyPropertyDefault<EPageBreak, &RenderStyle::pageBreakInside, EPageBreak, &RenderStyle::setPageBreakInside, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2447     setPropertyHandler(CSSPropertyPointerEvents, ApplyPropertyDefault<EPointerEvents, &RenderStyle::pointerEvents, EPointerEvents, &RenderStyle::setPointerEvents, EPointerEvents, &RenderStyle::initialPointerEvents>::createHandler());
2448     setPropertyHandler(CSSPropertyPosition, ApplyPropertyDefault<EPosition, &RenderStyle::position, EPosition, &RenderStyle::setPosition, EPosition, &RenderStyle::initialPosition>::createHandler());
2449     setPropertyHandler(CSSPropertyResize, ApplyPropertyResize::createHandler());
2450     setPropertyHandler(CSSPropertyRight, ApplyPropertyLength<&RenderStyle::right, &RenderStyle::setRight, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
2451     setPropertyHandler(CSSPropertySize, ApplyPropertyPageSize::createHandler());
2452     setPropertyHandler(CSSPropertySpeak, ApplyPropertyDefault<ESpeak, &RenderStyle::speak, ESpeak, &RenderStyle::setSpeak, ESpeak, &RenderStyle::initialSpeak>::createHandler());
2453     setPropertyHandler(CSSPropertyTableLayout, ApplyPropertyDefault<ETableLayout, &RenderStyle::tableLayout, ETableLayout, &RenderStyle::setTableLayout, ETableLayout, &RenderStyle::initialTableLayout>::createHandler());
2454     setPropertyHandler(CSSPropertyTabSize, ApplyPropertyDefault<unsigned, &RenderStyle::tabSize, unsigned, &RenderStyle::setTabSize, unsigned, &RenderStyle::initialTabSize>::createHandler());
2455     setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler());
2456     setPropertyHandler(CSSPropertyTextDecoration, ApplyPropertyTextDecoration::createHandler());
2457 #if ENABLE(CSS3_TEXT)
2458     setPropertyHandler(CSSPropertyWebkitTextAlignLast, ApplyPropertyDefault<TextAlignLast, &RenderStyle::textAlignLast, TextAlignLast, &RenderStyle::setTextAlignLast, TextAlignLast, &RenderStyle::initialTextAlignLast>::createHandler());
2459     setPropertyHandler(CSSPropertyWebkitTextJustify, ApplyPropertyDefault<TextJustify, &RenderStyle::textJustify, TextJustify, &RenderStyle::setTextJustify, TextJustify, &RenderStyle::initialTextJustify>::createHandler());
2460 #endif // CSS3_TEXT
2461     setPropertyHandler(CSSPropertyWebkitTextDecorationLine, ApplyPropertyTextDecoration::createHandler());
2462     setPropertyHandler(CSSPropertyWebkitTextDecorationStyle, ApplyPropertyDefault<TextDecorationStyle, &RenderStyle::textDecorationStyle, TextDecorationStyle, &RenderStyle::setTextDecorationStyle, TextDecorationStyle, &RenderStyle::initialTextDecorationStyle>::createHandler());
2463     setPropertyHandler(CSSPropertyWebkitTextDecorationColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textDecorationColor, &RenderStyle::setTextDecorationColor, &RenderStyle::setVisitedLinkTextDecorationColor, &RenderStyle::color>::createHandler());
2464     setPropertyHandler(CSSPropertyWebkitTextDecorationSkip, ApplyPropertyTextDecorationSkip::createHandler());
2465     setPropertyHandler(CSSPropertyWebkitTextUnderlinePosition, ApplyPropertyTextUnderlinePosition::createHandler());
2466     setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyTextIndent::createHandler());
2467     setPropertyHandler(CSSPropertyTextOverflow, ApplyPropertyDefault<TextOverflow, &RenderStyle::textOverflow, TextOverflow, &RenderStyle::setTextOverflow, TextOverflow, &RenderStyle::initialTextOverflow>::createHandler());
2468     setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont<TextRenderingMode, &FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering>::createHandler());
2469     setPropertyHandler(CSSPropertyTextTransform, ApplyPropertyDefault<ETextTransform, &RenderStyle::textTransform, ETextTransform, &RenderStyle::setTextTransform, ETextTransform, &RenderStyle::initialTextTransform>::createHandler());
2470     setPropertyHandler(CSSPropertyTop, ApplyPropertyLength<&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
2471     setPropertyHandler(CSSPropertyUnicodeBidi, ApplyPropertyDefault<EUnicodeBidi, &RenderStyle::unicodeBidi, EUnicodeBidi, &RenderStyle::setUnicodeBidi, EUnicodeBidi, &RenderStyle::initialUnicodeBidi>::createHandler());
2472     setPropertyHandler(CSSPropertyVerticalAlign, ApplyPropertyVerticalAlign::createHandler());
2473     setPropertyHandler(CSSPropertyVisibility, ApplyPropertyDefault<EVisibility, &RenderStyle::visibility, EVisibility, &RenderStyle::setVisibility, EVisibility, &RenderStyle::initialVisibility>::createHandler());
2474     setPropertyHandler(CSSPropertyWebkitAnimationDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2475     setPropertyHandler(CSSPropertyWebkitAnimationDirection, ApplyPropertyAnimation<Animation::AnimationDirection, &Animation::direction, &Animation::setDirection, &Animation::isDirectionSet, &Animation::clearDirection, &Animation::initialAnimationDirection, &CSSToStyleMap::mapAnimationDirection, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2476     setPropertyHandler(CSSPropertyWebkitAnimationDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSToStyleMap::mapAnimationDuration, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2477     setPropertyHandler(CSSPropertyWebkitAnimationFillMode, ApplyPropertyAnimation<unsigned, &Animation::fillMode, &Animation::setFillMode, &Animation::isFillModeSet, &Animation::clearFillMode, &Animation::initialAnimationFillMode, &CSSToStyleMap::mapAnimationFillMode, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2478     setPropertyHandler(CSSPropertyWebkitAnimationIterationCount, ApplyPropertyAnimation<double, &Animation::iterationCount, &Animation::setIterationCount, &Animation::isIterationCountSet, &Animation::clearIterationCount, &Animation::initialAnimationIterationCount, &CSSToStyleMap::mapAnimationIterationCount, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2479     setPropertyHandler(CSSPropertyWebkitAnimationName, ApplyPropertyAnimation<const String&, &Animation::name, &Animation::setName, &Animation::isNameSet, &Animation::clearName, &Animation::initialAnimationName, &CSSToStyleMap::mapAnimationName, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2480     setPropertyHandler(CSSPropertyWebkitAnimationPlayState, ApplyPropertyAnimation<EAnimPlayState, &Animation::playState, &Animation::setPlayState, &Animation::isPlayStateSet, &Animation::clearPlayState, &Animation::initialAnimationPlayState, &CSSToStyleMap::mapAnimationPlayState, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2481     setPropertyHandler(CSSPropertyWebkitAnimationTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
2482     setPropertyHandler(CSSPropertyWebkitAppearance, ApplyPropertyDefault<ControlPart, &RenderStyle::appearance, ControlPart, &RenderStyle::setAppearance, ControlPart, &RenderStyle::initialAppearance>::createHandler());
2483     setPropertyHandler(CSSPropertyWebkitAspectRatio, ApplyPropertyAspectRatio::createHandler());
2484     setPropertyHandler(CSSPropertyWebkitBackfaceVisibility, ApplyPropertyDefault<EBackfaceVisibility, &RenderStyle::backfaceVisibility, EBackfaceVisibility, &RenderStyle::setBackfaceVisibility, EBackfaceVisibility, &RenderStyle::initialBackfaceVisibility>::createHandler());
2485     setPropertyHandler(CSSPropertyWebkitBackgroundClip, CSSPropertyBackgroundClip);
2486     setPropertyHandler(CSSPropertyWebkitBackgroundComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitBackgroundComposite, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers, &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSToStyleMap::mapFillComposite>::createHandler());
2487     setPropertyHandler(CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundOrigin);
2488     setPropertyHandler(CSSPropertyWebkitBackgroundSize, CSSPropertyBackgroundSize);
2489 #if ENABLE(CSS_COMPOSITING)
2490     setPropertyHandler(CSSPropertyWebkitMixBlendMode, ApplyPropertyDefault<BlendMode, &RenderStyle::blendMode, BlendMode, &RenderStyle::setBlendMode, BlendMode, &RenderStyle::initialBlendMode>::createHandler());
2491     setPropertyHandler(CSSPropertyWebkitIsolation, ApplyPropertyDefault<Isolation, &RenderStyle::isolation, Isolation, &RenderStyle::setIsolation, Isolation, &RenderStyle::initialIsolation>::createHandler());
2492 #endif
2493     setPropertyHandler(CSSPropertyWebkitBorderFit, ApplyPropertyDefault<EBorderFit, &RenderStyle::borderFit, EBorderFit, &RenderStyle::setBorderFit, EBorderFit, &RenderStyle::initialBorderFit>::createHandler());
2494     setPropertyHandler(CSSPropertyWebkitBorderHorizontalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::horizontalBorderSpacing, &RenderStyle::setHorizontalBorderSpacing, &RenderStyle::initialHorizontalBorderSpacing>::createHandler());
2495     setPropertyHandler(CSSPropertyWebkitBorderImage, ApplyPropertyBorderImage<BorderImage, CSSPropertyWebkitBorderImage, &RenderStyle::borderImage, &RenderStyle::setBorderImage>::createHandler());
2496     setPropertyHandler(CSSPropertyWebkitBorderVerticalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalBorderSpacing, &RenderStyle::initialVerticalBorderSpacing>::createHandler());
2497     setPropertyHandler(CSSPropertyWebkitBoxAlign, ApplyPropertyDefault<EBoxAlignment, &RenderStyle::boxAlign, EBoxAlignment, &RenderStyle::setBoxAlign, EBoxAlignment, &RenderStyle::initialBoxAlign>::createHandler());
2498 #if ENABLE(CSS_BOX_DECORATION_BREAK)
2499     setPropertyHandler(CSSPropertyWebkitBoxDecorationBreak, ApplyPropertyDefault<EBoxDecorationBreak, &RenderStyle::boxDecorationBreak, EBoxDecorationBreak, &RenderStyle::setBoxDecorationBreak, EBoxDecorationBreak, &RenderStyle::initialBoxDecorationBreak>::createHandler());
2500 #endif
2501     setPropertyHandler(CSSPropertyWebkitBoxDirection, ApplyPropertyDefault<EBoxDirection, &RenderStyle::boxDirection, EBoxDirection, &RenderStyle::setBoxDirection, EBoxDirection, &RenderStyle::initialBoxDirection>::createHandler());
2502     setPropertyHandler(CSSPropertyWebkitBoxFlex, ApplyPropertyDefault<float, &RenderStyle::boxFlex, float, &RenderStyle::setBoxFlex, float, &RenderStyle::initialBoxFlex>::createHandler());
2503     setPropertyHandler(CSSPropertyWebkitBoxFlexGroup, ApplyPropertyDefault<unsigned int, &RenderStyle::boxFlexGroup, unsigned int, &RenderStyle::setBoxFlexGroup, unsigned int, &RenderStyle::initialBoxFlexGroup>::createHandler());
2504     setPropertyHandler(CSSPropertyWebkitBoxLines, ApplyPropertyDefault<EBoxLines, &RenderStyle::boxLines, EBoxLines, &RenderStyle::setBoxLines, EBoxLines, &RenderStyle::initialBoxLines>::createHandler());
2505     setPropertyHandler(CSSPropertyWebkitBoxOrdinalGroup, ApplyPropertyDefault<unsigned int, &RenderStyle::boxOrdinalGroup, unsigned int, &RenderStyle::setBoxOrdinalGroup, unsigned int, &RenderStyle::initialBoxOrdinalGroup>::createHandler());
2506     setPropertyHandler(CSSPropertyWebkitBoxOrient, ApplyPropertyDefault<EBoxOrient, &RenderStyle::boxOrient, EBoxOrient, &RenderStyle::setBoxOrient, EBoxOrient, &RenderStyle::initialBoxOrient>::createHandler());
2507     setPropertyHandler(CSSPropertyWebkitBoxPack, ApplyPropertyDefault<EBoxPack, &RenderStyle::boxPack, EBoxPack, &RenderStyle::setBoxPack, EBoxPack, &RenderStyle::initialBoxPack>::createHandler());
2508     setPropertyHandler(CSSPropertyWebkitColorCorrection, ApplyPropertyDefault<ColorSpace, &RenderStyle::colorSpace, ColorSpace, &RenderStyle::setColorSpace, ColorSpace, &RenderStyle::initialColorSpace>::createHandler());
2509     setPropertyHandler(CSSPropertyWebkitColumnAxis, ApplyPropertyDefault<ColumnAxis, &RenderStyle::columnAxis, ColumnAxis, &RenderStyle::setColumnAxis, ColumnAxis, &RenderStyle::initialColumnAxis>::createHandler());
2510     setPropertyHandler(CSSPropertyWebkitColumnBreakAfter, ApplyPropertyDefault<EPageBreak, &RenderStyle::columnBreakAfter, EPageBreak, &RenderStyle::setColumnBreakAfter, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2511     setPropertyHandler(CSSPropertyWebkitColumnBreakBefore, ApplyPropertyDefault<EPageBreak, &RenderStyle::columnBreakBefore, EPageBreak, &RenderStyle::setColumnBreakBefore, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2512     setPropertyHandler(CSSPropertyWebkitColumnBreakInside, ApplyPropertyDefault<EPageBreak, &RenderStyle::columnBreakInside, EPageBreak, &RenderStyle::setColumnBreakInside, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2513     setPropertyHandler(CSSPropertyWebkitColumnCount, ApplyPropertyAuto<unsigned short, &RenderStyle::columnCount, &RenderStyle::setColumnCount, &RenderStyle::hasAutoColumnCount, &RenderStyle::setHasAutoColumnCount>::createHandler());
2514     setPropertyHandler(CSSPropertyWebkitColumnFill, ApplyPropertyDefault<ColumnFill, &RenderStyle::columnFill, ColumnFill, &RenderStyle::setColumnFill, ColumnFill, &RenderStyle::initialColumnFill>::createHandler());
2515     setPropertyHandler(CSSPropertyWebkitColumnGap, ApplyPropertyAuto<float, &RenderStyle::columnGap, &RenderStyle::setColumnGap, &RenderStyle::hasNormalColumnGap, &RenderStyle::setHasNormalColumnGap, ComputeLength, CSSValueNormal>::createHandler());
2516     setPropertyHandler(CSSPropertyWebkitColumnProgression, ApplyPropertyDefault<ColumnProgression, &RenderStyle::columnProgression, ColumnProgression, &RenderStyle::setColumnProgression, ColumnProgression, &RenderStyle::initialColumnProgression>::createHandler());
2517     setPropertyHandler(CSSPropertyWebkitColumnRuleColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor, &RenderStyle::color>::createHandler());
2518     setPropertyHandler(CSSPropertyWebkitColumnRuleWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth, &RenderStyle::initialColumnRuleWidth, NormalDisabled, ThicknessEnabled>::createHandler());
2519     setPropertyHandler(CSSPropertyWebkitColumnSpan, ApplyPropertyDefault<ColumnSpan, &RenderStyle::columnSpan, ColumnSpan, &RenderStyle::setColumnSpan, ColumnSpan, &RenderStyle::initialColumnSpan>::createHandler());
2520     setPropertyHandler(CSSPropertyWebkitColumnRuleStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::columnRuleStyle, EBorderStyle, &RenderStyle::setColumnRuleStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
2521     setPropertyHandler(CSSPropertyWebkitColumnWidth, ApplyPropertyAuto<float, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth, ComputeLength>::createHandler());
2522 #if ENABLE(CURSOR_VISIBILITY)
2523     setPropertyHandler(CSSPropertyWebkitCursorVisibility, ApplyPropertyDefault<CursorVisibility, &RenderStyle::cursorVisibility, CursorVisibility, &RenderStyle::setCursorVisibility, CursorVisibility, &RenderStyle::initialCursorVisibility>::createHandler());
2524 #endif
2525     setPropertyHandler(CSSPropertyWebkitAlignContent, ApplyPropertyDefault<EAlignContent, &RenderStyle::alignContent, EAlignContent, &RenderStyle::setAlignContent, EAlignContent, &RenderStyle::initialAlignContent>::createHandler());
2526     setPropertyHandler(CSSPropertyWebkitAlignItems, ApplyPropertyDefault<EAlignItems, &RenderStyle::alignItems, EAlignItems, &RenderStyle::setAlignItems, EAlignItems, &RenderStyle::initialAlignItems>::createHandler());
2527     setPropertyHandler(CSSPropertyWebkitAlignSelf, ApplyPropertyDefault<EAlignItems, &RenderStyle::alignSelf, EAlignItems, &RenderStyle::setAlignSelf, EAlignItems, &RenderStyle::initialAlignSelf>::createHandler());
2528     setPropertyHandler(CSSPropertyWebkitFlexBasis, ApplyPropertyLength<&RenderStyle::flexBasis, &RenderStyle::setFlexBasis, &RenderStyle::initialFlexBasis, AutoEnabled>::createHandler());
2529     setPropertyHandler(CSSPropertyWebkitFlexDirection, ApplyPropertyDefault<EFlexDirection, &RenderStyle::flexDirection, EFlexDirection, &RenderStyle::setFlexDirection, EFlexDirection, &RenderStyle::initialFlexDirection>::createHandler());
2530     setPropertyHandler(CSSPropertyWebkitFlexGrow, ApplyPropertyDefault<float, &RenderStyle::flexGrow, float, &RenderStyle::setFlexGrow, float, &RenderStyle::initialFlexGrow>::createHandler());
2531     setPropertyHandler(CSSPropertyWebkitFlexShrink, ApplyPropertyDefault<float, &RenderStyle::flexShrink, float, &RenderStyle::setFlexShrink, float, &RenderStyle::initialFlexShrink>::createHandler());
2532     setPropertyHandler(CSSPropertyWebkitFlexWrap, ApplyPropertyDefault<EFlexWrap, &RenderStyle::flexWrap, EFlexWrap, &RenderStyle::setFlexWrap, EFlexWrap, &RenderStyle::initialFlexWrap>::createHandler());
2533 #if ENABLE(CSS_GRID_LAYOUT)
2534     setPropertyHandler(CSSPropertyWebkitGridAutoFlow, ApplyPropertyDefault<GridAutoFlow, &RenderStyle::gridAutoFlow, GridAutoFlow, &RenderStyle::setGridAutoFlow, GridAutoFlow, &RenderStyle::initialGridAutoFlow>::createHandler());
2535 #endif
2536     setPropertyHandler(CSSPropertyWebkitJustifyContent, ApplyPropertyDefault<EJustifyContent, &RenderStyle::justifyContent, EJustifyContent, &RenderStyle::setJustifyContent, EJustifyContent, &RenderStyle::initialJustifyContent>::createHandler());
2537     setPropertyHandler(CSSPropertyWebkitOrder, ApplyPropertyDefault<int, &RenderStyle::order, int, &RenderStyle::setOrder, int, &RenderStyle::initialOrder>::createHandler());
2538 #if ENABLE(CSS_REGIONS)
2539     setPropertyHandler(CSSPropertyWebkitFlowFrom, ApplyPropertyString<MapNoneToNull, &RenderStyle::regionThread, &RenderStyle::setRegionThread, &RenderStyle::initialRegionThread>::createHandler());
2540     setPropertyHandler(CSSPropertyWebkitFlowInto, ApplyPropertyString<MapNoneToNull, &RenderStyle::flowThread, &RenderStyle::setFlowThread, &RenderStyle::initialFlowThread>::createHandler());
2541 #endif
2542     setPropertyHandler(CSSPropertyWebkitFontKerning, ApplyPropertyFont<FontDescription::Kerning, &FontDescription::kerning, &FontDescription::setKerning, FontDescription::AutoKerning>::createHandler());
2543     setPropertyHandler(CSSPropertyWebkitFontSmoothing, ApplyPropertyFont<FontSmoothingMode, &FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing>::createHandler());
2544     setPropertyHandler(CSSPropertyWebkitFontVariantLigatures, ApplyPropertyFontVariantLigatures::createHandler());
2545     setPropertyHandler(CSSPropertyWebkitHyphenateCharacter, ApplyPropertyString<MapAutoToNull, &RenderStyle::hyphenationString, &RenderStyle::setHyphenationString, &RenderStyle::initialHyphenationString>::createHandler());
2546     setPropertyHandler(CSSPropertyWebkitHyphenateLimitAfter, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitAfter, &RenderStyle::setHyphenationLimitAfter, &RenderStyle::initialHyphenationLimitAfter>::createHandler());
2547     setPropertyHandler(CSSPropertyWebkitHyphenateLimitBefore, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitBefore, &RenderStyle::setHyphenationLimitBefore, &RenderStyle::initialHyphenationLimitBefore>::createHandler());
2548     setPropertyHandler(CSSPropertyWebkitHyphenateLimitLines, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitLines, &RenderStyle::setHyphenationLimitLines, &RenderStyle::initialHyphenationLimitLines, CSSValueNoLimit>::createHandler());
2549     setPropertyHandler(CSSPropertyWebkitHyphens, ApplyPropertyDefault<Hyphens, &RenderStyle::hyphens, Hyphens, &RenderStyle::setHyphens, Hyphens, &RenderStyle::initialHyphens>::createHandler());
2550     setPropertyHandler(CSSPropertyWebkitLineAlign, ApplyPropertyDefault<LineAlign, &RenderStyle::lineAlign, LineAlign, &RenderStyle::setLineAlign, LineAlign, &RenderStyle::initialLineAlign>::createHandler());
2551     setPropertyHandler(CSSPropertyWebkitLineBreak, ApplyPropertyDefault<LineBreak, &RenderStyle::lineBreak, LineBreak, &RenderStyle::setLineBreak, LineBreak, &RenderStyle::initialLineBreak>::createHandler());
2552     setPropertyHandler(CSSPropertyWebkitLineClamp, ApplyPropertyDefault<const LineClampValue&, &RenderStyle::lineClamp, LineClampValue, &RenderStyle::setLineClamp, LineClampValue, &RenderStyle::initialLineClamp>::createHandler());
2553     setPropertyHandler(CSSPropertyWebkitLineGrid, ApplyPropertyString<MapNoneToNull, &RenderStyle::lineGrid, &RenderStyle::setLineGrid, &RenderStyle::initialLineGrid>::createHandler());
2554     setPropertyHandler(CSSPropertyWebkitLineSnap, ApplyPropertyDefault<LineSnap, &RenderStyle::lineSnap, LineSnap, &RenderStyle::setLineSnap, LineSnap, &RenderStyle::initialLineSnap>::createHandler());
2555     setPropertyHandler(CSSPropertyWebkitMarginAfterCollapse, ApplyPropertyDefault<EMarginCollapse, &RenderStyle::marginAfterCollapse, EMarginCollapse, &RenderStyle::setMarginAfterCollapse, EMarginCollapse, &RenderStyle::initialMarginAfterCollapse>::createHandler());
2556     setPropertyHandler(CSSPropertyWebkitMarginBeforeCollapse, ApplyPropertyDefault<EMarginCollapse, &RenderStyle::marginBeforeCollapse, EMarginCollapse, &RenderStyle::setMarginBeforeCollapse, EMarginCollapse, &RenderStyle::initialMarginBeforeCollapse>::createHandler());
2557     setPropertyHandler(CSSPropertyWebkitMarginBottomCollapse, CSSPropertyWebkitMarginAfterCollapse);
2558     setPropertyHandler(CSSPropertyWebkitMarginTopCollapse, CSSPropertyWebkitMarginBeforeCollapse);
2559     setPropertyHandler(CSSPropertyWebkitMarqueeDirection, ApplyPropertyDefault<EMarqueeDirection, &RenderStyle::marqueeDirection, EMarqueeDirection, &RenderStyle::setMarqueeDirection, EMarqueeDirection, &RenderStyle::initialMarqueeDirection>::createHandler());
2560     setPropertyHandler(CSSPropertyWebkitMarqueeIncrement, ApplyPropertyMarqueeIncrement::createHandler());
2561     setPropertyHandler(CSSPropertyWebkitMarqueeRepetition, ApplyPropertyMarqueeRepetition::createHandler());
2562     setPropertyHandler(CSSPropertyWebkitMarqueeSpeed, ApplyPropertyMarqueeSpeed::createHandler());
2563     setPropertyHandler(CSSPropertyWebkitMarqueeStyle, ApplyPropertyDefault<EMarqueeBehavior, &RenderStyle::marqueeBehavior, EMarqueeBehavior, &RenderStyle::setMarqueeBehavior, EMarqueeBehavior, &RenderStyle::initialMarqueeBehavior>::createHandler());
2564     setPropertyHandler(CSSPropertyWebkitMaskBoxImage, ApplyPropertyBorderImage<BorderMask, CSSPropertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImage>::createHandler());
2565     setPropertyHandler(CSSPropertyWebkitMaskBoxImageOutset, ApplyPropertyBorderImageModifier<BorderMask, Outset>::createHandler());
2566     setPropertyHandler(CSSPropertyWebkitMaskBoxImageRepeat, ApplyPropertyBorderImageModifier<BorderMask, Repeat>::createHandler());
2567     setPropertyHandler(CSSPropertyWebkitMaskBoxImageSlice, ApplyPropertyBorderImageModifier<BorderMask, Slice>::createHandler());
2568     setPropertyHandler(CSSPropertyWebkitMaskBoxImageSource, ApplyPropertyBorderImageSource<CSSPropertyWebkitMaskBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImageSource, &RenderStyle::initialMaskBoxImageSource>::createHandler());
2569     setPropertyHandler(CSSPropertyWebkitMaskBoxImageWidth, ApplyPropertyBorderImageModifier<BorderMask, Width>::createHandler());
2570     setPropertyHandler(CSSPropertyWebkitMaskClip, ApplyPropertyFillLayer<EFillBox, CSSPropertyWebkitMaskClip, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSToStyleMap::mapFillClip>::createHandler());
2571     setPropertyHandler(CSSPropertyWebkitMaskComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitMaskComposite, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSToStyleMap::mapFillComposite>::createHandler());
2572     setPropertyHandler(CSSPropertyWebkitMaskImage, ApplyPropertyFillLayer<StyleImage*, CSSPropertyWebkitMaskImage, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSToStyleMap::mapFillImage>::createHandler());
2573     setPropertyHandler(CSSPropertyWebkitMaskOrigin, ApplyPropertyFillLayer<EFillBox, CSSPropertyWebkitMaskOrigin, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSToStyleMap::mapFillOrigin>::createHandler());
2574     setPropertyHandler(CSSPropertyWebkitMaskPositionX, ApplyPropertyFillLayer<Length, CSSPropertyWebkitMaskPositionX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSToStyleMap::mapFillXPosition>::createHandler());
2575     setPropertyHandler(CSSPropertyWebkitMaskPositionY, ApplyPropertyFillLayer<Length, CSSPropertyWebkitMaskPositionY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSToStyleMap::mapFillYPosition>::createHandler());
2576     setPropertyHandler(CSSPropertyWebkitMaskRepeatX, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSToStyleMap::mapFillRepeatX>::createHandler());
2577     setPropertyHandler(CSSPropertyWebkitMaskRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSToStyleMap::mapFillRepeatY>::createHandler());
2578     setPropertyHandler(CSSPropertyWebkitMaskSize, ApplyPropertyFillLayer<FillSize, CSSPropertyWebkitMaskSize, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSToStyleMap::mapFillSize>::createHandler());
2579     setPropertyHandler(CSSPropertyWebkitMaskSourceType, ApplyPropertyFillLayer<EMaskSourceType, CSSPropertyWebkitMaskSourceType, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isMaskSourceTypeSet, &FillLayer::maskSourceType, &FillLayer::setMaskSourceType, &FillLayer::clearMaskSourceType, &FillLayer::initialMaskSourceType, &CSSToStyleMap::mapFillMaskSourceType>::createHandler());
2580     setPropertyHandler(CSSPropertyWebkitNbspMode, ApplyPropertyDefault<ENBSPMode, &RenderStyle::nbspMode, ENBSPMode, &RenderStyle::setNBSPMode, ENBSPMode, &RenderStyle::initialNBSPMode>::createHandler());
2581     setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitPerspectiveOriginX, CSSPropertyWebkitPerspectiveOriginY>::createHandler());
2582     setPropertyHandler(CSSPropertyWebkitPerspectiveOriginX, ApplyPropertyLength<&RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX, &RenderStyle::initialPerspectiveOriginX>::createHandler());
2583     setPropertyHandler(CSSPropertyWebkitPerspectiveOriginY, ApplyPropertyLength<&RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOriginY, &RenderStyle::initialPerspectiveOriginY>::createHandler());
2584     setPropertyHandler(CSSPropertyWebkitPrintColorAdjust, ApplyPropertyDefault<PrintColorAdjust, &RenderStyle::printColorAdjust, PrintColorAdjust, &RenderStyle::setPrintColorAdjust, PrintColorAdjust, &RenderStyle::initialPrintColorAdjust>::createHandler());
2585 #if ENABLE(CSS_REGIONS)
2586     setPropertyHandler(CSSPropertyWebkitRegionBreakAfter, ApplyPropertyDefault<EPageBreak, &RenderStyle::regionBreakAfter, EPageBreak, &RenderStyle::setRegionBreakAfter, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2587     setPropertyHandler(CSSPropertyWebkitRegionBreakBefore, ApplyPropertyDefault<EPageBreak, &RenderStyle::regionBreakBefore, EPageBreak, &RenderStyle::setRegionBreakBefore, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2588     setPropertyHandler(CSSPropertyWebkitRegionBreakInside, ApplyPropertyDefault<EPageBreak, &RenderStyle::regionBreakInside, EPageBreak, &RenderStyle::setRegionBreakInside, EPageBreak, &RenderStyle::initialPageBreak>::createHandler());
2589     setPropertyHandler(CSSPropertyWebkitRegionFragment, ApplyPropertyDefault<RegionFragment, &RenderStyle::regionFragment, RegionFragment, &RenderStyle::setRegionFragment, RegionFragment, &RenderStyle::initialRegionFragment>::createHandler());
2590 #endif
2591     setPropertyHandler(CSSPropertyWebkitRtlOrdering, ApplyPropertyDefault<Order, &RenderStyle::rtlOrdering, Order, &RenderStyle::setRTLOrdering, Order, &RenderStyle::initialRTLOrdering>::createHandler());
2592     setPropertyHandler(CSSPropertyWebkitRubyPosition, ApplyPropertyDefault<RubyPosition, &RenderStyle::rubyPosition, RubyPosition, &RenderStyle::setRubyPosition, RubyPosition, &RenderStyle::initialRubyPosition>::createHandler());
2593     setPropertyHandler(CSSPropertyWebkitTextCombine, ApplyPropertyDefault<TextCombine, &RenderStyle::textCombine, TextCombine, &RenderStyle::setTextCombine, TextCombine, &RenderStyle::initialTextCombine>::createHandler());
2594     setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color>::createHandler());
2595     setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, ApplyPropertyTextEmphasisPosition::createHandler());
2596     setPropertyHandler(CSSPropertyWebkitTextEmphasisStyle, ApplyPropertyTextEmphasisStyle::createHandler());
2597     setPropertyHandler(CSSPropertyWebkitTextFillColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::setVisitedLinkTextFillColor, &RenderStyle::color>::createHandler());
2598     setPropertyHandler(CSSPropertyWebkitTextSecurity, ApplyPropertyDefault<ETextSecurity, &RenderStyle::textSecurity, ETextSecurity, &RenderStyle::setTextSecurity, ETextSecurity, &RenderStyle::initialTextSecurity>::createHandler());
2599     setPropertyHandler(CSSPropertyWebkitTextStrokeColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor, &RenderStyle::color>::createHandler());
2600     setPropertyHandler(CSSPropertyWebkitTransformOriginX, ApplyPropertyLength<&RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX, &RenderStyle::initialTransformOriginX>::createHandler());
2601     setPropertyHandler(CSSPropertyWebkitTransformOriginY, ApplyPropertyLength<&RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY, &RenderStyle::initialTransformOriginY>::createHandler());
2602     setPropertyHandler(CSSPropertyWebkitTransformOriginZ, ApplyPropertyComputeLength<float, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ, &RenderStyle::initialTransformOriginZ>::createHandler());
2603     setPropertyHandler(CSSPropertyWebkitTransformStyle, ApplyPropertyDefault<ETransformStyle3D, &RenderStyle::transformStyle3D, ETransformStyle3D, &RenderStyle::setTransformStyle3D, ETransformStyle3D, &RenderStyle::initialTransformStyle3D>::createHandler());
2604     setPropertyHandler(CSSPropertyWebkitTransitionDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSToStyleMap::mapAnimationDelay, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
2605     setPropertyHandler(CSSPropertyWebkitTransitionDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSToStyleMap::mapAnimationDuration, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
2606     setPropertyHandler(CSSPropertyWebkitTransitionProperty, ApplyPropertyAnimation<CSSPropertyID, &Animation::property, &Animation::setProperty, &Animation::isPropertySet, &Animation::clearProperty, &Animation::initialAnimationProperty, &CSSToStyleMap::mapAnimationProperty, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
2607     setPropertyHandler(CSSPropertyWebkitTransitionTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
2608     setPropertyHandler(CSSPropertyWebkitUserDrag, ApplyPropertyDefault<EUserDrag, &RenderStyle::userDrag, EUserDrag, &RenderStyle::setUserDrag, EUserDrag, &RenderStyle::initialUserDrag>::createHandler());
2609     setPropertyHandler(CSSPropertyWebkitUserModify, ApplyPropertyDefault<EUserModify, &RenderStyle::userModify, EUserModify, &RenderStyle::setUserModify, EUserModify, &RenderStyle::initialUserModify>::createHandler());
2610     setPropertyHandler(CSSPropertyWebkitUserSelect, ApplyPropertyDefault<EUserSelect, &RenderStyle::userSelect, EUserSelect, &RenderStyle::setUserSelect, EUserSelect, &RenderStyle::initialUserSelect>::createHandler());
2611     setPropertyHandler(CSSPropertyWebkitClipPath, ApplyPropertyClipPath<&RenderStyle::clipPath, &RenderStyle::setClipPath, &RenderStyle::initialClipPath>::createHandler());
2612
2613 #if ENABLE(CSS_EXCLUSIONS)
2614     setPropertyHandler(CSSPropertyWebkitWrapFlow, ApplyPropertyDefault<WrapFlow, &RenderStyle::wrapFlow, WrapFlow, &RenderStyle::setWrapFlow, WrapFlow, &RenderStyle::initialWrapFlow>::createHandler());
2615     setPropertyHandler(CSSPropertyWebkitWrapThrough, ApplyPropertyDefault<WrapThrough, &RenderStyle::wrapThrough, WrapThrough, &RenderStyle::setWrapThrough, WrapThrough, &RenderStyle::initialWrapThrough>::createHandler());
2616 #endif
2617 #if ENABLE(CSS_SHAPES) && ENABLE(CSS_SHAPE_INSIDE)
2618     setPropertyHandler(CSSPropertyWebkitShapeInside, ApplyPropertyShape<&RenderStyle::shapeInside, &RenderStyle::setShapeInside, &RenderStyle::initialShapeInside>::createHandler());
2619     setPropertyHandler(CSSPropertyWebkitShapePadding, ApplyPropertyLength<&RenderStyle::shapePadding, &RenderStyle::setShapePadding, &RenderStyle::initialShapePadding>::createHandler());
2620 #endif
2621 #if ENABLE(CSS_SHAPES)
2622     setPropertyHandler(CSSPropertyWebkitShapeMargin, ApplyPropertyLength<&RenderStyle::shapeMargin, &RenderStyle::setShapeMargin, &RenderStyle::initialShapeMargin>::createHandler());
2623     setPropertyHandler(CSSPropertyWebkitShapeImageThreshold, ApplyPropertyDefault<float, &RenderStyle::shapeImageThreshold, float, &RenderStyle::setShapeImageThreshold, float, &RenderStyle::initialShapeImageThreshold>::createHandler());
2624     setPropertyHandler(CSSPropertyWebkitShapeOutside, ApplyPropertyShape<&RenderStyle::shapeOutside, &RenderStyle::setShapeOutside, &RenderStyle::initialShapeOutside>::createHandler());
2625 #endif
2626     setPropertyHandler(CSSPropertyWhiteSpace, ApplyPropertyDefault<EWhiteSpace, &RenderStyle::whiteSpace, EWhiteSpace, &RenderStyle::setWhiteSpace, EWhiteSpace, &RenderStyle::initialWhiteSpace>::createHandler());
2627     setPropertyHandler(CSSPropertyWidows, ApplyPropertyAuto<short, &RenderStyle::widows, &RenderStyle::setWidows, &RenderStyle::hasAutoWidows, &RenderStyle::setHasAutoWidows>::createHandler());
2628     setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneDisabled, UndefinedDisabled>::createHandler());
2629     setPropertyHandler(CSSPropertyWordBreak, ApplyPropertyDefault<EWordBreak, &RenderStyle::wordBreak, EWordBreak, &RenderStyle::setWordBreak, EWordBreak, &RenderStyle::initialWordBreak>::createHandler());
2630     setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyWordSpacing::createHandler());
2631
2632     // UAs must treat 'word-wrap' as an alternate name for the 'overflow-wrap' property. So using the same handlers.
2633     setPropertyHandler(CSSPropertyWordWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler());
2634     setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex>::createHandler());
2635     setPropertyHandler(CSSPropertyZoom, ApplyPropertyZoom::createHandler());
2636 }
2637
2638
2639 }