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