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