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