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