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