<rdar://problem/10679035> Implement font-variant-ligatures: {no-}common-ligatures
[WebKit-https.git] / Source / WebCore / css / CSSStyleApplyProperty.cpp
1 /*
2  * Copyright (C) 2011 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1.  Redistributions of source code must retain the above copyright
8  *     notice, this list of conditions and the following disclaimer.
9  * 2.  Redistributions in binary form must reproduce the above copyright
10  *     notice, this list of conditions and the following disclaimer in the
11  *     documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16  * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
17  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  */
24
25 #include "config.h"
26 #include "CSSStyleApplyProperty.h"
27
28 #include "CSSAspectRatioValue.h"
29 #include "CSSCursorImageValue.h"
30 #include "CSSFlexValue.h"
31 #include "CSSPrimitiveValueMappings.h"
32 #include "CSSStyleSelector.h"
33 #include "CSSValueList.h"
34 #include "CursorList.h"
35 #include "Document.h"
36 #include "Element.h"
37 #include "Pair.h"
38 #include "RenderObject.h"
39 #include "RenderStyle.h"
40 #include "Settings.h"
41 #include <wtf/StdLibExtras.h>
42 #include <wtf/UnusedParam.h>
43
44 using namespace std;
45
46 namespace WebCore {
47
48 enum ExpandValueBehavior {SuppressValue = 0, ExpandValue};
49 template <ExpandValueBehavior expandValue, CSSPropertyID one = CSSPropertyInvalid, CSSPropertyID two = CSSPropertyInvalid, CSSPropertyID three = CSSPropertyInvalid, CSSPropertyID four = CSSPropertyInvalid>
50 class ApplyPropertyExpanding {
51 public:
52
53     template <CSSPropertyID id>
54     static inline void applyInheritValue(CSSStyleSelector* selector)
55     {
56         if (id == CSSPropertyInvalid)
57             return;
58
59         const CSSStyleApplyProperty& table = CSSStyleApplyProperty::sharedCSSStyleApplyProperty();
60         const PropertyHandler& handler = table.propertyHandler(id);
61         if (handler.isValid())
62             handler.applyInheritValue(selector);
63     }
64
65     static void applyInheritValue(CSSStyleSelector* selector)
66     {
67         applyInheritValue<one>(selector);
68         applyInheritValue<two>(selector);
69         applyInheritValue<three>(selector);
70         applyInheritValue<four>(selector);
71     }
72
73     template <CSSPropertyID id>
74     static inline void applyInitialValue(CSSStyleSelector* selector)
75     {
76         if (id == CSSPropertyInvalid)
77             return;
78
79         const CSSStyleApplyProperty& table = CSSStyleApplyProperty::sharedCSSStyleApplyProperty();
80         const PropertyHandler& handler = table.propertyHandler(id);
81         if (handler.isValid())
82             handler.applyInitialValue(selector);
83     }
84
85     static void applyInitialValue(CSSStyleSelector* selector)
86     {
87         applyInitialValue<one>(selector);
88         applyInitialValue<two>(selector);
89         applyInitialValue<three>(selector);
90         applyInitialValue<four>(selector);
91     }
92
93     template <CSSPropertyID id>
94     static inline void applyValue(CSSStyleSelector* selector, CSSValue* value)
95     {
96         if (id == CSSPropertyInvalid)
97             return;
98
99         const CSSStyleApplyProperty& table = CSSStyleApplyProperty::sharedCSSStyleApplyProperty();
100         const PropertyHandler& handler = table.propertyHandler(id);
101         if (handler.isValid())
102             handler.applyValue(selector, value);
103     }
104
105     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
106     {
107         if (!expandValue)
108             return;
109
110         applyValue<one>(selector, value);
111         applyValue<two>(selector, value);
112         applyValue<three>(selector, value);
113         applyValue<four>(selector, value);
114     }
115     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
116 };
117
118 template <typename GetterType, GetterType (RenderStyle::*getterFunction)() const, typename SetterType, void (RenderStyle::*setterFunction)(SetterType), typename InitialType, InitialType (*initialFunction)()>
119 class ApplyPropertyDefaultBase {
120 public:
121     static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); }
122     static GetterType value(RenderStyle* style) { return (style->*getterFunction)(); }
123     static InitialType initial() { return (*initialFunction)(); }
124     static void applyInheritValue(CSSStyleSelector* selector) { setValue(selector->style(), value(selector->parentStyle())); }
125     static void applyInitialValue(CSSStyleSelector* selector) { setValue(selector->style(), initial()); }
126     static void applyValue(CSSStyleSelector*, CSSValue*) { }
127     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
128 };
129
130 template <typename GetterType, GetterType (RenderStyle::*getterFunction)() const, typename SetterType, void (RenderStyle::*setterFunction)(SetterType), typename InitialType, InitialType (*initialFunction)()>
131 class ApplyPropertyDefault {
132 public:
133     static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); }
134     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
135     {
136         if (value->isPrimitiveValue())
137             setValue(selector->style(), *static_cast<CSSPrimitiveValue*>(value));
138     }
139     static PropertyHandler createHandler()
140     {
141         PropertyHandler handler = ApplyPropertyDefaultBase<GetterType, getterFunction, SetterType, setterFunction, InitialType, initialFunction>::createHandler();
142         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
143     }
144 };
145
146 template <typename NumberType, NumberType (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(NumberType), NumberType (*initialFunction)(), int idMapsToMinusOne = CSSValueAuto>
147 class ApplyPropertyNumber {
148 public:
149     static void setValue(RenderStyle* style, NumberType value) { (style->*setterFunction)(value); }
150     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
151     {
152         if (!value->isPrimitiveValue())
153             return;
154
155         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
156         if (primitiveValue->getIdent() == idMapsToMinusOne)
157             setValue(selector->style(), -1);
158         else
159             setValue(selector->style(), primitiveValue->getValue<NumberType>(CSSPrimitiveValue::CSS_NUMBER));
160     }
161     static PropertyHandler createHandler()
162     {
163         PropertyHandler handler = ApplyPropertyDefaultBase<NumberType, getterFunction, NumberType, setterFunction, NumberType, initialFunction>::createHandler();
164         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
165     }
166 };
167
168 template <StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)(), CSSPropertyID property>
169 class ApplyPropertyStyleImage {
170 public:
171     static void applyValue(CSSStyleSelector* selector, CSSValue* value) { (selector->style()->*setterFunction)(selector->styleImage(property, value)); }
172     static PropertyHandler createHandler()
173     {
174         PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFunction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::createHandler();
175         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
176     }
177 };
178
179 enum AutoValueType {Number = 0, ComputeLength};
180 template <typename T, T (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(T), bool (RenderStyle::*hasAutoFunction)() const, void (RenderStyle::*setAutoFunction)(), AutoValueType valueType = Number, int autoIdentity = CSSValueAuto>
181 class ApplyPropertyAuto {
182 public:
183     static void setValue(RenderStyle* style, T value) { (style->*setterFunction)(value); }
184     static T value(RenderStyle* style) { return (style->*getterFunction)(); }
185     static bool hasAuto(RenderStyle* style) { return (style->*hasAutoFunction)(); }
186     static void setAuto(RenderStyle* style) { (style->*setAutoFunction)(); }
187
188     static void applyInheritValue(CSSStyleSelector* selector)
189     {
190         if (hasAuto(selector->parentStyle()))
191             setAuto(selector->style());
192         else
193             setValue(selector->style(), value(selector->parentStyle()));
194     }
195
196     static void applyInitialValue(CSSStyleSelector* selector) { setAuto(selector->style()); }
197
198     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
199     {
200         if (!value->isPrimitiveValue())
201             return;
202
203         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
204         if (primitiveValue->getIdent() == autoIdentity)
205             setAuto(selector->style());
206         else if (valueType == Number)
207             setValue(selector->style(), *primitiveValue);
208         else if (valueType == ComputeLength)
209             setValue(selector->style(), primitiveValue->computeLength<T>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()));
210     }
211
212     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
213 };
214
215 enum ColorInherit {NoInheritFromParent = 0, InheritFromParent};
216 Color defaultInitialColor();
217 Color defaultInitialColor() { return Color(); }
218 template <ColorInherit inheritColorFromParent,
219           const Color& (RenderStyle::*getterFunction)() const,
220           void (RenderStyle::*setterFunction)(const Color&),
221           void (RenderStyle::*visitedLinkSetterFunction)(const Color&),
222           const Color& (RenderStyle::*defaultFunction)() const,
223           Color (*initialFunction)() = &defaultInitialColor>
224 class ApplyPropertyColor {
225 public:
226     static void applyInheritValue(CSSStyleSelector* selector)
227     {
228         // Visited link style can never explicitly inherit from parent visited link style so no separate getters are needed.
229         const Color& color = (selector->parentStyle()->*getterFunction)();
230         applyColorValue(selector, color.isValid() ? color : (selector->parentStyle()->*defaultFunction)());
231     }
232
233     static void applyInitialValue(CSSStyleSelector* selector)
234     {
235         applyColorValue(selector, initialFunction());
236     }
237
238     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
239     {
240         if (!value->isPrimitiveValue())
241             return;
242
243         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
244         if (inheritColorFromParent && primitiveValue->getIdent() == CSSValueCurrentcolor)
245             applyInheritValue(selector);
246         else {
247             if (selector->applyPropertyToRegularStyle())
248                 (selector->style()->*setterFunction)(selector->colorFromPrimitiveValue(primitiveValue));
249             if (selector->applyPropertyToVisitedLinkStyle())
250                 (selector->style()->*visitedLinkSetterFunction)(selector->colorFromPrimitiveValue(primitiveValue, /* forVisitedLink */ true));
251         }
252     }
253
254     static void applyColorValue(CSSStyleSelector* selector, const Color& color)
255     {
256         if (selector->applyPropertyToRegularStyle())
257             (selector->style()->*setterFunction)(color);
258         if (selector->applyPropertyToVisitedLinkStyle())
259             (selector->style()->*visitedLinkSetterFunction)(color);
260     }
261
262     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
263 };
264
265 template <TextDirection (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(TextDirection), TextDirection (*initialFunction)()>
266 class ApplyPropertyDirection {
267 public:
268     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
269     {
270         ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::applyValue(selector, value);
271         Element* element = selector->element();
272         if (element && selector->element() == element->document()->documentElement())
273             element->document()->setDirectionSetOnDocumentElement(true);
274     }
275
276     static PropertyHandler createHandler()
277     {
278         PropertyHandler handler = ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::createHandler();
279         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
280     }
281 };
282
283 enum LengthAuto { AutoDisabled = 0, AutoEnabled };
284 enum LengthIntrinsic { IntrinsicDisabled = 0, IntrinsicEnabled };
285 enum LengthMinIntrinsic { MinIntrinsicDisabled = 0, MinIntrinsicEnabled };
286 enum LengthNone { NoneDisabled = 0, NoneEnabled };
287 enum LengthUndefined { UndefinedDisabled = 0, UndefinedEnabled };
288 enum LengthFlexDirection { FlexDirectionDisabled = 0, FlexWidth, FlexHeight };
289 template <Length (RenderStyle::*getterFunction)() const,
290           void (RenderStyle::*setterFunction)(Length),
291           Length (*initialFunction)(),
292           LengthAuto autoEnabled = AutoDisabled,
293           LengthIntrinsic intrinsicEnabled = IntrinsicDisabled,
294           LengthMinIntrinsic minIntrinsicEnabled = MinIntrinsicDisabled,
295           LengthNone noneEnabled = NoneDisabled,
296           LengthUndefined noneUndefined = UndefinedDisabled,
297           LengthFlexDirection flexDirection = FlexDirectionDisabled>
298 class ApplyPropertyLength {
299 public:
300     static void setValue(RenderStyle* style, Length value) { (style->*setterFunction)(value); }
301     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
302     {
303         if (!value->isPrimitiveValue()) {
304             if (!flexDirection || !value->isFlexValue())
305                 return;
306
307             CSSFlexValue* flexValue = static_cast<CSSFlexValue*>(value);
308             value = flexValue->preferredSize();
309
310             if (flexDirection == FlexWidth) {
311                 selector->style()->setFlexboxWidthPositiveFlex(flexValue->positiveFlex());
312                 selector->style()->setFlexboxWidthNegativeFlex(flexValue->negativeFlex());
313             } else if (flexDirection == FlexHeight) {
314                 selector->style()->setFlexboxHeightPositiveFlex(flexValue->positiveFlex());
315                 selector->style()->setFlexboxHeightNegativeFlex(flexValue->negativeFlex());
316             }
317         }
318
319         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
320         if (noneEnabled && primitiveValue->getIdent() == CSSValueNone)
321             if (noneUndefined)
322                 setValue(selector->style(), Length(Undefined));
323             else
324                 setValue(selector->style(), Length());
325         else if (intrinsicEnabled && primitiveValue->getIdent() == CSSValueIntrinsic)
326             setValue(selector->style(), Length(Intrinsic));
327         else if (minIntrinsicEnabled && primitiveValue->getIdent() == CSSValueMinIntrinsic)
328             setValue(selector->style(), Length(MinIntrinsic));
329         else if (autoEnabled && primitiveValue->getIdent() == CSSValueAuto)
330             setValue(selector->style(), Length());
331         else {
332             int type = primitiveValue->primitiveType();
333             if (CSSPrimitiveValue::isUnitTypeLength(type)) {
334                 Length length = primitiveValue->computeLength<Length>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom());
335                 length.setQuirk(primitiveValue->isQuirkValue());
336                 setValue(selector->style(), length);
337             } else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
338                 setValue(selector->style(), Length(primitiveValue->getDoubleValue(), Percent));
339         }
340     }
341
342     static PropertyHandler createHandler()
343     {
344         PropertyHandler handler = ApplyPropertyDefaultBase<Length, getterFunction, Length, setterFunction, Length, initialFunction>::createHandler();
345         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
346     }
347 };
348
349 enum StringIdentBehavior { NothingMapsToNull = 0, MapNoneToNull, MapAutoToNull };
350 template <StringIdentBehavior identBehavior, const AtomicString& (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(const AtomicString&), const AtomicString& (*initialFunction)()>
351 class ApplyPropertyString {
352 public:
353     static void setValue(RenderStyle* style, const AtomicString& value) { (style->*setterFunction)(value); }
354     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
355     {
356         if (!value->isPrimitiveValue())
357             return;
358         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
359         if ((identBehavior == MapNoneToNull && primitiveValue->getIdent() == CSSValueNone)
360             || (identBehavior == MapAutoToNull && primitiveValue->getIdent() == CSSValueAuto))
361             setValue(selector->style(), nullAtom);
362         else
363             setValue(selector->style(), primitiveValue->getStringValue());
364     }
365     static PropertyHandler createHandler()
366     {
367         PropertyHandler handler = ApplyPropertyDefaultBase<const AtomicString&, getterFunction, const AtomicString&, setterFunction, const AtomicString&, initialFunction>::createHandler();
368         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
369     }
370 };
371
372 template <LengthSize (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(LengthSize), LengthSize (*initialFunction)()>
373 class ApplyPropertyBorderRadius {
374 public:
375     static void setValue(RenderStyle* style, LengthSize value) { (style->*setterFunction)(value); }
376     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
377     {
378         if (!value->isPrimitiveValue())
379             return;
380
381         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
382         Pair* pair = primitiveValue->getPairValue();
383         if (!pair || !pair->first() || !pair->second())
384             return;
385
386         Length radiusWidth;
387         Length radiusHeight;
388         if (pair->first()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
389             radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
390         else
391             radiusWidth = Length(max(intMinForLength, min(intMaxForLength, pair->first()->computeLength<int>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()))), Fixed);
392         if (pair->second()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
393             radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
394         else
395             radiusHeight = Length(max(intMinForLength, min(intMaxForLength, pair->second()->computeLength<int>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()))), Fixed);
396         int width = radiusWidth.value();
397         int height = radiusHeight.value();
398         if (width < 0 || height < 0)
399             return;
400         if (!width)
401             radiusHeight = radiusWidth; // Null out the other value.
402         else if (!height)
403             radiusWidth = radiusHeight; // Null out the other value.
404
405         LengthSize size(radiusWidth, radiusHeight);
406         setValue(selector->style(), size);
407     }
408     static PropertyHandler createHandler()
409     {
410         PropertyHandler handler = ApplyPropertyDefaultBase<LengthSize, getterFunction, LengthSize, setterFunction, LengthSize, initialFunction>::createHandler();
411         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
412     }
413 };
414
415 template <typename T>
416 struct FillLayerAccessorTypes {
417     typedef T Setter;
418     typedef T Getter;
419 };
420
421 template <>
422 struct FillLayerAccessorTypes<StyleImage*> {
423     typedef PassRefPtr<StyleImage> Setter;
424     typedef StyleImage* Getter;
425 };
426
427 template <typename T,
428           CSSPropertyID propertyId,
429           EFillLayerType fillLayerType,
430           FillLayer* (RenderStyle::*accessLayersFunction)(),
431           const FillLayer* (RenderStyle::*layersFunction)() const,
432           bool (FillLayer::*testFunction)() const,
433           typename FillLayerAccessorTypes<T>::Getter (FillLayer::*getFunction)() const,
434           void (FillLayer::*setFunction)(typename FillLayerAccessorTypes<T>::Setter),
435           void (FillLayer::*clearFunction)(),
436           typename FillLayerAccessorTypes<T>::Getter (*initialFunction)(EFillLayerType),
437           void (CSSStyleSelector::*mapFillFunction)(CSSPropertyID, FillLayer*, CSSValue*)>
438 class ApplyPropertyFillLayer {
439 public:
440     static void applyInheritValue(CSSStyleSelector* selector)
441     {
442         FillLayer* currChild = (selector->style()->*accessLayersFunction)();
443         FillLayer* prevChild = 0;
444         const FillLayer* currParent = (selector->parentStyle()->*layersFunction)();
445         while (currParent && (currParent->*testFunction)()) {
446             if (!currChild) {
447                 /* Need to make a new layer.*/
448                 currChild = new FillLayer(fillLayerType);
449                 prevChild->setNext(currChild);
450             }
451             (currChild->*setFunction)((currParent->*getFunction)());
452             prevChild = currChild;
453             currChild = prevChild->next();
454             currParent = currParent->next();
455         }
456
457         while (currChild) {
458             /* Reset any remaining layers to not have the property set. */
459             (currChild->*clearFunction)();
460             currChild = currChild->next();
461         }
462     }
463
464     static void applyInitialValue(CSSStyleSelector* selector)
465     {
466         FillLayer* currChild = (selector->style()->*accessLayersFunction)();
467         (currChild->*setFunction)((*initialFunction)(fillLayerType));
468         for (currChild = currChild->next(); currChild; currChild = currChild->next())
469             (currChild->*clearFunction)();
470     }
471
472     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
473     {
474         FillLayer* currChild = (selector->style()->*accessLayersFunction)();
475         FillLayer* prevChild = 0;
476         if (value->isValueList()) {
477             /* Walk each value and put it into a layer, creating new layers as needed. */
478             CSSValueList* valueList = static_cast<CSSValueList*>(value);
479             for (unsigned int i = 0; i < valueList->length(); i++) {
480                 if (!currChild) {
481                     /* Need to make a new layer to hold this value */
482                     currChild = new FillLayer(fillLayerType);
483                     prevChild->setNext(currChild);
484                 }
485                 (selector->*mapFillFunction)(propertyId, currChild, valueList->itemWithoutBoundsCheck(i));
486                 prevChild = currChild;
487                 currChild = currChild->next();
488             }
489         } else {
490             (selector->*mapFillFunction)(propertyId, currChild, value);
491             currChild = currChild->next();
492         }
493         while (currChild) {
494             /* Reset all remaining layers to not have the property set. */
495             (currChild->*clearFunction)();
496             currChild = currChild->next();
497         }
498     }
499
500     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
501 };
502
503 enum ComputeLengthNormal {NormalDisabled = 0, NormalEnabled};
504 enum ComputeLengthThickness {ThicknessDisabled = 0, ThicknessEnabled};
505 enum ComputeLengthSVGZoom {SVGZoomDisabled = 0, SVGZoomEnabled};
506 template <typename T,
507           T (RenderStyle::*getterFunction)() const,
508           void (RenderStyle::*setterFunction)(T),
509           T (*initialFunction)(),
510           ComputeLengthNormal normalEnabled = NormalDisabled,
511           ComputeLengthThickness thicknessEnabled = ThicknessDisabled,
512           ComputeLengthSVGZoom svgZoomEnabled = SVGZoomDisabled>
513 class ApplyPropertyComputeLength {
514 public:
515     static void setValue(RenderStyle* style, T value) { (style->*setterFunction)(value); }
516     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
517     {
518         // note: CSSPropertyLetter/WordSpacing right now sets to zero if it's not a primitive value for some reason...
519         if (!value->isPrimitiveValue())
520             return;
521
522         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
523
524         int ident = primitiveValue->getIdent();
525         T length;
526         if (normalEnabled && ident == CSSValueNormal) {
527             length = 0;
528         } else if (thicknessEnabled && ident == CSSValueThin) {
529             length = 1;
530         } else if (thicknessEnabled && ident == CSSValueMedium) {
531             length = 3;
532         } else if (thicknessEnabled && ident == CSSValueThick) {
533             length = 5;
534         } else if (ident == CSSValueInvalid) {
535             float zoom = (svgZoomEnabled && selector->useSVGZoomRules()) ? 1.0f : selector->style()->effectiveZoom();
536             length = primitiveValue->computeLength<T>(selector->style(), selector->rootElementStyle(), zoom);
537         } else {
538             ASSERT_NOT_REACHED();
539             length = 0;
540         }
541
542         setValue(selector->style(), length);
543     }
544     static PropertyHandler createHandler()
545     {
546         PropertyHandler handler = ApplyPropertyDefaultBase<T, getterFunction, T, setterFunction, T, initialFunction>::createHandler();
547         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
548     }
549 };
550
551 template <typename T, T (FontDescription::*getterFunction)() const, void (FontDescription::*setterFunction)(T), T initialValue>
552 class ApplyPropertyFont {
553 public:
554     static void applyInheritValue(CSSStyleSelector* selector)
555     {
556         FontDescription fontDescription = selector->fontDescription();
557         (fontDescription.*setterFunction)((selector->parentFontDescription().*getterFunction)());
558         selector->setFontDescription(fontDescription);
559     }
560
561     static void applyInitialValue(CSSStyleSelector* selector)
562     {
563         FontDescription fontDescription = selector->fontDescription();
564         (fontDescription.*setterFunction)(initialValue);
565         selector->setFontDescription(fontDescription);
566     }
567
568     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
569     {
570         if (!value->isPrimitiveValue())
571             return;
572         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
573         FontDescription fontDescription = selector->fontDescription();
574         (fontDescription.*setterFunction)(*primitiveValue);
575         selector->setFontDescription(fontDescription);
576     }
577
578     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
579 };
580
581 class ApplyPropertyFontSize {
582 private:
583     // When the CSS keyword "larger" is used, this function will attempt to match within the keyword
584     // table, and failing that, will simply multiply by 1.2.
585     static float largerFontSize(float size)
586     {
587         // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale up to
588         // the next size level.
589         return size * 1.2f;
590     }
591
592     // Like the previous function, but for the keyword "smaller".
593     static float smallerFontSize(float size)
594     {
595         // FIXME: Figure out where we fall in the size ranges (xx-small to xxx-large) and scale down to
596         // the next size level.
597         return size / 1.2f;
598     }
599 public:
600     static void applyInheritValue(CSSStyleSelector* selector)
601     {
602         float size = selector->parentStyle()->fontDescription().specifiedSize();
603
604         if (size < 0)
605             return;
606
607         FontDescription fontDescription = selector->style()->fontDescription();
608         fontDescription.setKeywordSize(selector->parentStyle()->fontDescription().keywordSize());
609         selector->setFontSize(fontDescription, size);
610         selector->setFontDescription(fontDescription);
611         return;
612     }
613
614     static void applyInitialValue(CSSStyleSelector* selector)
615     {
616         FontDescription fontDescription = selector->style()->fontDescription();
617         float size = selector->fontSizeForKeyword(selector->document(), CSSValueMedium, fontDescription.useFixedDefaultSize());
618
619         if (size < 0)
620             return;
621
622         fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
623         selector->setFontSize(fontDescription, size);
624         selector->setFontDescription(fontDescription);
625         return;
626     }
627
628     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
629     {
630         if (!value->isPrimitiveValue())
631             return;
632
633         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
634
635         FontDescription fontDescription = selector->style()->fontDescription();
636         fontDescription.setKeywordSize(0);
637         float parentSize = 0;
638         bool parentIsAbsoluteSize = false;
639         float size = 0;
640
641         if (selector->hasParentNode()) {
642             parentSize = selector->parentStyle()->fontDescription().specifiedSize();
643             parentIsAbsoluteSize = selector->parentStyle()->fontDescription().isAbsoluteSize();
644         }
645
646         if (int ident = primitiveValue->getIdent()) {
647             // Keywords are being used.
648             switch (ident) {
649             case CSSValueXxSmall:
650             case CSSValueXSmall:
651             case CSSValueSmall:
652             case CSSValueMedium:
653             case CSSValueLarge:
654             case CSSValueXLarge:
655             case CSSValueXxLarge:
656             case CSSValueWebkitXxxLarge:
657                 size = selector->fontSizeForKeyword(selector->document(), ident, fontDescription.useFixedDefaultSize());
658                 fontDescription.setKeywordSize(ident - CSSValueXxSmall + 1);
659                 break;
660             case CSSValueLarger:
661                 size = largerFontSize(parentSize);
662                 break;
663             case CSSValueSmaller:
664                 size = smallerFontSize(parentSize);
665                 break;
666             default:
667                 return;
668             }
669
670             fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize && (ident == CSSValueLarger || ident == CSSValueSmaller));
671         } else {
672             int type = primitiveValue->primitiveType();
673             fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize
674                                               || (type != CSSPrimitiveValue::CSS_PERCENTAGE
675                                                   && type != CSSPrimitiveValue::CSS_EMS
676                                                   && type != CSSPrimitiveValue::CSS_EXS
677                                                   && type != CSSPrimitiveValue::CSS_REMS));
678             if (primitiveValue->isLength())
679                 size = primitiveValue->computeLength<float>(selector->parentStyle(), selector->rootElementStyle(), 1.0, true);
680             else if (primitiveValue->isPercentage())
681                 size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
682             else
683                 return;
684         }
685
686         if (size < 0)
687             return;
688
689         selector->setFontSize(fontDescription, size);
690         selector->setFontDescription(fontDescription);
691         return;
692     }
693
694     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
695 };
696
697 class ApplyPropertyFontWeight {
698 public:
699     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
700     {
701         if (!value->isPrimitiveValue())
702             return;
703         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
704         FontDescription fontDescription = selector->fontDescription();
705         switch (primitiveValue->getIdent()) {
706         case CSSValueInvalid:
707             ASSERT_NOT_REACHED();
708             break;
709         case CSSValueBolder:
710             fontDescription.setWeight(fontDescription.bolderWeight());
711             break;
712         case CSSValueLighter:
713             fontDescription.setWeight(fontDescription.lighterWeight());
714             break;
715         default:
716             fontDescription.setWeight(*primitiveValue);
717         }
718         selector->setFontDescription(fontDescription);
719     }
720     static PropertyHandler createHandler()
721     {
722         PropertyHandler handler = ApplyPropertyFont<FontWeight, &FontDescription::weight, &FontDescription::setWeight, FontWeightNormal>::createHandler();
723         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
724     }
725 };
726
727 class ApplyPropertyFontVariantLigatures {
728 public:
729     static void applyInheritValue(CSSStyleSelector* selector)
730     {
731         const FontDescription& parentFontDescription = selector->parentFontDescription();
732         FontDescription fontDescription = selector->fontDescription();
733
734         fontDescription.setCommonLigaturesState(parentFontDescription.commonLigaturesState());
735         fontDescription.setDiscretionaryLigaturesState(parentFontDescription.discretionaryLigaturesState());
736         fontDescription.setHistoricalLigaturesState(parentFontDescription.historicalLigaturesState());
737
738         selector->setFontDescription(fontDescription);
739     }
740
741     static void applyInitialValue(CSSStyleSelector* selector)
742     {
743         FontDescription fontDescription = selector->fontDescription();
744
745         fontDescription.setCommonLigaturesState(FontDescription::NormalLigaturesState);
746         fontDescription.setDiscretionaryLigaturesState(FontDescription::NormalLigaturesState);
747         fontDescription.setHistoricalLigaturesState(FontDescription::NormalLigaturesState);
748
749         selector->setFontDescription(fontDescription);
750     }
751
752     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
753     {
754         FontDescription::LigaturesState commonLigaturesState = FontDescription::NormalLigaturesState;
755         FontDescription::LigaturesState discretionaryLigaturesState = FontDescription::NormalLigaturesState;
756         FontDescription::LigaturesState historicalLigaturesState = FontDescription::NormalLigaturesState;
757
758         if (value->isValueList()) {
759             CSSValueList* valueList = static_cast<CSSValueList*>(value);
760             for (size_t i = 0; i < valueList->length(); ++i) {
761                 CSSValue* item = valueList->itemWithoutBoundsCheck(i);
762                 ASSERT(item->isPrimitiveValue());
763                 if (item->isPrimitiveValue()) {
764                     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
765                     switch (primitiveValue->getIdent()) {
766                     case CSSValueNoCommonLigatures:
767                         commonLigaturesState = FontDescription::DisabledLigaturesState;
768                         break;
769                     case CSSValueCommonLigatures:
770                         commonLigaturesState = FontDescription::EnabledLigaturesState;
771                         break;
772                     case CSSValueNoDiscretionaryLigatures:
773                         discretionaryLigaturesState = FontDescription::DisabledLigaturesState;
774                         break;
775                     case CSSValueDiscretionaryLigatures:
776                         discretionaryLigaturesState = FontDescription::EnabledLigaturesState;
777                         break;
778                     case CSSValueNoHistoricalLigatures:
779                         historicalLigaturesState = FontDescription::DisabledLigaturesState;
780                         break;
781                     case CSSValueHistoricalLigatures:
782                         historicalLigaturesState = FontDescription::EnabledLigaturesState;
783                         break;
784                     default:
785                         ASSERT_NOT_REACHED();
786                         break;
787                     }
788                 }
789             }
790         }
791 #if !ASSERT_DISABLED
792         else {
793             ASSERT(value->isPrimitiveValue());
794             ASSERT(static_cast<CSSPrimitiveValue*>(value)->getIdent() == CSSValueNormal);
795         }
796 #endif
797
798         FontDescription fontDescription = selector->fontDescription();
799         fontDescription.setCommonLigaturesState(commonLigaturesState);
800         fontDescription.setDiscretionaryLigaturesState(discretionaryLigaturesState);
801         fontDescription.setHistoricalLigaturesState(historicalLigaturesState);
802         selector->setFontDescription(fontDescription);
803     }
804
805     static PropertyHandler createHandler()
806     {
807         return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
808     }
809 };
810
811 enum BorderImageType { Image = 0, Mask };
812 template <BorderImageType borderImageType,
813           CSSPropertyID property,
814           const NinePieceImage& (RenderStyle::*getterFunction)() const,
815           void (RenderStyle::*setterFunction)(const NinePieceImage&)>
816 class ApplyPropertyBorderImage {
817 public:
818     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
819     {
820         NinePieceImage image;
821         if (borderImageType == Mask)
822             image.setMaskDefaults();
823         selector->mapNinePieceImage(property, value, image);
824         (selector->style()->*setterFunction)(image);
825     }
826
827     static PropertyHandler createHandler()
828     {
829         PropertyHandler handler = ApplyPropertyDefaultBase<const NinePieceImage&, getterFunction, const NinePieceImage&, setterFunction, NinePieceImage, &RenderStyle::initialNinePieceImage>::createHandler();
830         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
831     }
832 };
833
834 enum BorderImageModifierType { Outset, Repeat, Slice, Width };
835 template <BorderImageType type, BorderImageModifierType modifier>
836 class ApplyPropertyBorderImageModifier {
837 private:
838     static inline const NinePieceImage& getValue(RenderStyle* style) { return type == Image ? style->borderImage() : style->maskBoxImage(); }
839     static inline void setValue(RenderStyle* style, const NinePieceImage& value) { return type == Image ? style->setBorderImage(value) : style->setMaskBoxImage(value); }
840 public:
841     static void applyInheritValue(CSSStyleSelector* selector)
842     {
843         NinePieceImage image(getValue(selector->style()));
844         switch (modifier) {
845         case Outset:
846             image.copyOutsetFrom(getValue(selector->parentStyle()));
847             break;
848         case Repeat:
849             image.copyRepeatFrom(getValue(selector->parentStyle()));
850             break;
851         case Slice:
852             image.copyImageSlicesFrom(getValue(selector->parentStyle()));
853             break;
854         case Width:
855             image.copyBorderSlicesFrom(getValue(selector->parentStyle()));
856             break;
857         }
858         setValue(selector->style(), image);
859     }
860
861     static void applyInitialValue(CSSStyleSelector* selector)
862     {
863         NinePieceImage image(getValue(selector->style()));
864         switch (modifier) {
865         case Outset:
866             image.setOutset(LengthBox());
867             break;
868         case Repeat:
869             image.setHorizontalRule(StretchImageRule);
870             image.setVerticalRule(StretchImageRule);
871             break;
872         case Slice:
873             // Masks have a different initial value for slices. Preserve the value of 0 for backwards compatibility.
874             image.setImageSlices(type == Image ? LengthBox(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent)) : LengthBox());
875             image.setFill(false);
876             break;
877         case Width:
878             // Masks have a different initial value for widths. They use an 'auto' value rather than trying to fit to the border.
879             image.setBorderSlices(type == Image ? LengthBox(Length(1, Relative), Length(1, Relative), Length(1, Relative), Length(1, Relative)) : LengthBox());
880             break;
881         }
882         setValue(selector->style(), image);
883     }
884
885     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
886     {
887         NinePieceImage image(getValue(selector->style()));
888         switch (modifier) {
889         case Outset:
890             image.setOutset(selector->mapNinePieceImageQuad(value));
891             break;
892         case Repeat:
893             selector->mapNinePieceImageRepeat(value, image);
894             break;
895         case Slice:
896             selector->mapNinePieceImageSlice(value, image);
897             break;
898         case Width:
899             image.setBorderSlices(selector->mapNinePieceImageQuad(value));
900             break;
901         }
902         setValue(selector->style(), image);
903     }
904
905     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
906 };
907
908 template <CSSPropertyID id, StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)()>
909 class ApplyPropertyBorderImageSource {
910 public:
911     static void applyValue(CSSStyleSelector* selector, CSSValue* value) { (selector->style()->*setterFunction)(selector->styleImage(id, value)); }
912     static PropertyHandler createHandler()
913     {
914         PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFunction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::createHandler();
915         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
916     }
917 };
918
919 enum CounterBehavior {Increment = 0, Reset};
920 template <CounterBehavior counterBehavior>
921 class ApplyPropertyCounter {
922 public:
923     static void emptyFunction(CSSStyleSelector*) { }
924     static void applyInheritValue(CSSStyleSelector* selector)
925     {
926         CounterDirectiveMap& map = selector->style()->accessCounterDirectives();
927         CounterDirectiveMap& parentMap = selector->parentStyle()->accessCounterDirectives();
928
929         typedef CounterDirectiveMap::iterator Iterator;
930         Iterator end = parentMap.end();
931         for (Iterator it = parentMap.begin(); it != end; ++it) {
932             CounterDirectives& directives = map.add(it->first, CounterDirectives()).first->second;
933             if (counterBehavior == Reset) {
934                 directives.m_reset = it->second.m_reset;
935                 directives.m_resetValue = it->second.m_resetValue;
936             } else {
937                 // Inheriting a counter-increment means taking the parent's current value for the counter
938                 // and adding it to itself.
939                 directives.m_increment = it->second.m_increment;
940                 directives.m_incrementValue = 0;
941                 if (directives.m_increment) {
942                     float incrementValue = directives.m_incrementValue;
943                     directives.m_incrementValue = clampToInteger(incrementValue + it->second.m_incrementValue);
944                 } else {
945                     directives.m_increment = true;
946                     directives.m_incrementValue = it->second.m_incrementValue;
947                 }
948             }
949         }
950     }
951     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
952     {
953         if (!value->isValueList())
954             return;
955
956         CSSValueList* list = static_cast<CSSValueList*>(value);
957
958         CounterDirectiveMap& map = selector->style()->accessCounterDirectives();
959         typedef CounterDirectiveMap::iterator Iterator;
960
961         Iterator end = map.end();
962         for (Iterator it = map.begin(); it != end; ++it)
963             if (counterBehavior == Reset)
964                 it->second.m_reset = false;
965             else
966                 it->second.m_increment = false;
967
968         int length = list ? list->length() : 0;
969         for (int i = 0; i < length; ++i) {
970             CSSValue* currValue = list->itemWithoutBoundsCheck(i);
971             if (!currValue->isPrimitiveValue())
972                 continue;
973
974             Pair* pair = static_cast<CSSPrimitiveValue*>(currValue)->getPairValue();
975             if (!pair || !pair->first() || !pair->second())
976                 continue;
977
978             AtomicString identifier = static_cast<CSSPrimitiveValue*>(pair->first())->getStringValue();
979             int value = static_cast<CSSPrimitiveValue*>(pair->second())->getIntValue();
980             CounterDirectives& directives = map.add(identifier.impl(), CounterDirectives()).first->second;
981             if (counterBehavior == Reset) {
982                 directives.m_reset = true;
983                 directives.m_resetValue = value;
984             } else {
985                 if (directives.m_increment) {
986                     float incrementValue = directives.m_incrementValue;
987                     directives.m_incrementValue = clampToInteger(incrementValue + value);
988                 } else {
989                     directives.m_increment = true;
990                     directives.m_incrementValue = value;
991                 }
992             }
993             
994         }
995     }
996     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &emptyFunction, &applyValue); }
997 };
998
999
1000 class ApplyPropertyCursor {
1001 public:
1002     static void applyInheritValue(CSSStyleSelector* selector)
1003     {
1004         selector->style()->setCursor(selector->parentStyle()->cursor());
1005         selector->style()->setCursorList(selector->parentStyle()->cursors());
1006     }
1007
1008     static void applyInitialValue(CSSStyleSelector* selector)
1009     {
1010         selector->style()->clearCursorList();
1011         selector->style()->setCursor(RenderStyle::initialCursor());
1012     }
1013
1014     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
1015     {
1016         selector->style()->clearCursorList();
1017         if (value->isValueList()) {
1018             CSSValueList* list = static_cast<CSSValueList*>(value);
1019             int len = list->length();
1020             selector->style()->setCursor(CURSOR_AUTO);
1021             for (int i = 0; i < len; i++) {
1022                 CSSValue* item = list->itemWithoutBoundsCheck(i);
1023                 if (!item->isPrimitiveValue())
1024                     continue;
1025                 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
1026                 int type = primitiveValue->primitiveType();
1027                 if (type == CSSPrimitiveValue::CSS_URI) {
1028                     if (primitiveValue->isCursorImageValue()) {
1029                         CSSCursorImageValue* image = static_cast<CSSCursorImageValue*>(primitiveValue);
1030                         if (image->updateIfSVGCursorIsUsed(selector->element())) // Elements with SVG cursors are not allowed to share style.
1031                             selector->style()->setUnique();
1032                         selector->style()->addCursor(selector->cachedOrPendingFromValue(CSSPropertyCursor, image), image->hotSpot());
1033                     }
1034                 } else if (type == CSSPrimitiveValue::CSS_IDENT)
1035                     selector->style()->setCursor(*primitiveValue);
1036             }
1037         } else if (value->isPrimitiveValue()) {
1038             CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1039             int type = primitiveValue->primitiveType();
1040             if (type == CSSPrimitiveValue::CSS_IDENT && selector->style()->cursor() != ECursor(*primitiveValue))
1041                 selector->style()->setCursor(*primitiveValue);
1042         }
1043     }
1044
1045     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1046 };
1047
1048 class ApplyPropertyTextAlign {
1049 public:
1050     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
1051     {
1052         if (!value->isPrimitiveValue())
1053             return;
1054
1055         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1056
1057         if (primitiveValue->getIdent() != CSSValueWebkitMatchParent)
1058             selector->style()->setTextAlign(*primitiveValue);
1059         else if (selector->parentStyle()->textAlign() == TASTART)
1060             selector->style()->setTextAlign(selector->parentStyle()->isLeftToRightDirection() ? LEFT : RIGHT);
1061         else if (selector->parentStyle()->textAlign() == TAEND)
1062             selector->style()->setTextAlign(selector->parentStyle()->isLeftToRightDirection() ? RIGHT : LEFT);
1063         else
1064             selector->style()->setTextAlign(selector->parentStyle()->textAlign());
1065     }
1066     static PropertyHandler createHandler()
1067     {
1068         PropertyHandler handler = ApplyPropertyDefaultBase<ETextAlign, &RenderStyle::textAlign, ETextAlign, &RenderStyle::setTextAlign, ETextAlign, &RenderStyle::initialTextAlign>::createHandler();
1069         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1070     }
1071 };
1072
1073 class ApplyPropertyTextDecoration {
1074 public:
1075     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
1076     {
1077         ETextDecoration t = RenderStyle::initialTextDecoration();
1078         for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
1079             CSSValue* item = i.value();
1080             ASSERT(item->isPrimitiveValue());
1081             t |= *static_cast<CSSPrimitiveValue*>(item);
1082         }
1083         selector->style()->setTextDecoration(t);
1084     }
1085     static PropertyHandler createHandler()
1086     {
1087         PropertyHandler handler = ApplyPropertyDefaultBase<ETextDecoration, &RenderStyle::textDecoration, ETextDecoration, &RenderStyle::setTextDecoration, ETextDecoration, &RenderStyle::initialTextDecoration>::createHandler();
1088         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1089     }
1090 };
1091
1092 class ApplyPropertyLineHeight {
1093 public:
1094     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
1095     {
1096         if (!value->isPrimitiveValue())
1097             return;
1098
1099         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1100         Length lineHeight;
1101
1102         if (primitiveValue->getIdent() == CSSValueNormal)
1103             lineHeight = Length(-100.0, Percent);
1104         else if (primitiveValue->isLength()) {
1105             double multiplier = selector->style()->effectiveZoom();
1106             if (selector->style()->textSizeAdjust()) {
1107                 if (Frame* frame = selector->document()->frame())
1108                     multiplier *= frame->textZoomFactor();
1109             }
1110             lineHeight = primitiveValue->computeLength<Length>(selector->style(), selector->rootElementStyle(), multiplier);
1111         } else if (primitiveValue->isPercentage()) {
1112             // FIXME: percentage should not be restricted to an integer here.
1113             lineHeight = Length((selector->style()->fontSize() * primitiveValue->getIntValue()) / 100, Fixed);
1114         } else if (primitiveValue->isNumber()) {
1115             // FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent).
1116             lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);
1117         } else
1118             return;
1119         selector->style()->setLineHeight(lineHeight);
1120     }
1121     static PropertyHandler createHandler()
1122     {
1123         PropertyHandler handler = ApplyPropertyDefaultBase<Length, &RenderStyle::lineHeight, Length, &RenderStyle::setLineHeight, Length, &RenderStyle::initialLineHeight>::createHandler();
1124         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1125     }
1126 };
1127
1128 class ApplyPropertyPageSize {
1129 private:
1130     static Length mmLength(double mm) { return CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLength<Length>(0, 0); }
1131     static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0); }
1132     static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
1133     {
1134         static const Length a5Width = mmLength(148), a5Height = mmLength(210);
1135         static const Length a4Width = mmLength(210), a4Height = mmLength(297);
1136         static const Length a3Width = mmLength(297), a3Height = mmLength(420);
1137         static const Length b5Width = mmLength(176), b5Height = mmLength(250);
1138         static const Length b4Width = mmLength(250), b4Height = mmLength(353);
1139         static const Length letterWidth = inchLength(8.5), letterHeight = inchLength(11);
1140         static const Length legalWidth = inchLength(8.5), legalHeight = inchLength(14);
1141         static const Length ledgerWidth = inchLength(11), ledgerHeight = inchLength(17);
1142
1143         if (!pageSizeName)
1144             return false;
1145
1146         switch (pageSizeName->getIdent()) {
1147         case CSSValueA5:
1148             width = a5Width;
1149             height = a5Height;
1150             break;
1151         case CSSValueA4:
1152             width = a4Width;
1153             height = a4Height;
1154             break;
1155         case CSSValueA3:
1156             width = a3Width;
1157             height = a3Height;
1158             break;
1159         case CSSValueB5:
1160             width = b5Width;
1161             height = b5Height;
1162             break;
1163         case CSSValueB4:
1164             width = b4Width;
1165             height = b4Height;
1166             break;
1167         case CSSValueLetter:
1168             width = letterWidth;
1169             height = letterHeight;
1170             break;
1171         case CSSValueLegal:
1172             width = legalWidth;
1173             height = legalHeight;
1174             break;
1175         case CSSValueLedger:
1176             width = ledgerWidth;
1177             height = ledgerHeight;
1178             break;
1179         default:
1180             return false;
1181         }
1182
1183         if (pageOrientation) {
1184             switch (pageOrientation->getIdent()) {
1185             case CSSValueLandscape:
1186                 std::swap(width, height);
1187                 break;
1188             case CSSValuePortrait:
1189                 // Nothing to do.
1190                 break;
1191             default:
1192                 return false;
1193             }
1194         }
1195         return true;
1196     }
1197 public:
1198     static void applyInheritValue(CSSStyleSelector*) { }
1199     static void applyInitialValue(CSSStyleSelector*) { }
1200     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
1201     {
1202         selector->style()->resetPageSizeType();
1203         Length width;
1204         Length height;
1205         PageSizeType pageSizeType = PAGE_SIZE_AUTO;
1206         CSSValueListInspector inspector(value);
1207         switch (inspector.length()) {
1208         case 2: {
1209             // <length>{2} | <page-size> <orientation>
1210             if (!inspector.first()->isPrimitiveValue() || !inspector.second()->isPrimitiveValue())
1211                 return;
1212             CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(inspector.first());
1213             CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(inspector.second());
1214             if (first->isLength()) {
1215                 // <length>{2}
1216                 if (!second->isLength())
1217                     return;
1218                 width = first->computeLength<Length>(selector->style(), selector->rootElementStyle());
1219                 height = second->computeLength<Length>(selector->style(), selector->rootElementStyle());
1220             } else {
1221                 // <page-size> <orientation>
1222                 // The value order is guaranteed. See CSSParser::parseSizeParameter.
1223                 if (!getPageSizeFromName(first, second, width, height))
1224                     return;
1225             }
1226             pageSizeType = PAGE_SIZE_RESOLVED;
1227             break;
1228         }
1229         case 1: {
1230             // <length> | auto | <page-size> | [ portrait | landscape]
1231             if (!inspector.first()->isPrimitiveValue())
1232                 return;
1233             CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(inspector.first());
1234             if (primitiveValue->isLength()) {
1235                 // <length>
1236                 pageSizeType = PAGE_SIZE_RESOLVED;
1237                 width = height = primitiveValue->computeLength<Length>(selector->style(), selector->rootElementStyle());
1238             } else {
1239                 if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_IDENT)
1240                     return;
1241                 switch (primitiveValue->getIdent()) {
1242                 case CSSValueAuto:
1243                     pageSizeType = PAGE_SIZE_AUTO;
1244                     break;
1245                 case CSSValuePortrait:
1246                     pageSizeType = PAGE_SIZE_AUTO_PORTRAIT;
1247                     break;
1248                 case CSSValueLandscape:
1249                     pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE;
1250                     break;
1251                 default:
1252                     // <page-size>
1253                     pageSizeType = PAGE_SIZE_RESOLVED;
1254                     if (!getPageSizeFromName(primitiveValue, 0, width, height))
1255                         return;
1256                 }
1257             }
1258             break;
1259         }
1260         default:
1261             return;
1262         }
1263         selector->style()->setPageSizeType(pageSizeType);
1264         selector->style()->setPageSize(LengthSize(width, height));
1265     }
1266     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1267 };
1268
1269 class ApplyPropertyTextEmphasisStyle {
1270 public:
1271     static void applyInheritValue(CSSStyleSelector* selector)
1272     {
1273         selector->style()->setTextEmphasisFill(selector->parentStyle()->textEmphasisFill());
1274         selector->style()->setTextEmphasisMark(selector->parentStyle()->textEmphasisMark());
1275         selector->style()->setTextEmphasisCustomMark(selector->parentStyle()->textEmphasisCustomMark());
1276     }
1277
1278     static void applyInitialValue(CSSStyleSelector* selector)
1279     {
1280         selector->style()->setTextEmphasisFill(RenderStyle::initialTextEmphasisFill());
1281         selector->style()->setTextEmphasisMark(RenderStyle::initialTextEmphasisMark());
1282         selector->style()->setTextEmphasisCustomMark(RenderStyle::initialTextEmphasisCustomMark());
1283     }
1284
1285     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
1286     {
1287         if (value->isValueList()) {
1288             CSSValueList* list = static_cast<CSSValueList*>(value);
1289             ASSERT(list->length() == 2);
1290             if (list->length() != 2)
1291                 return;
1292             for (unsigned i = 0; i < 2; ++i) {
1293                 CSSValue* item = list->itemWithoutBoundsCheck(i);
1294                 if (!item->isPrimitiveValue())
1295                     continue;
1296
1297                 CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(item);
1298                 if (value->getIdent() == CSSValueFilled || value->getIdent() == CSSValueOpen)
1299                     selector->style()->setTextEmphasisFill(*value);
1300                 else
1301                     selector->style()->setTextEmphasisMark(*value);
1302             }
1303             selector->style()->setTextEmphasisCustomMark(nullAtom);
1304             return;
1305         }
1306
1307         if (!value->isPrimitiveValue())
1308             return;
1309         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1310
1311         if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_STRING) {
1312             selector->style()->setTextEmphasisFill(TextEmphasisFillFilled);
1313             selector->style()->setTextEmphasisMark(TextEmphasisMarkCustom);
1314             selector->style()->setTextEmphasisCustomMark(primitiveValue->getStringValue());
1315             return;
1316         }
1317
1318         selector->style()->setTextEmphasisCustomMark(nullAtom);
1319
1320         if (primitiveValue->getIdent() == CSSValueFilled || primitiveValue->getIdent() == CSSValueOpen) {
1321             selector->style()->setTextEmphasisFill(*primitiveValue);
1322             selector->style()->setTextEmphasisMark(TextEmphasisMarkAuto);
1323         } else {
1324             selector->style()->setTextEmphasisFill(TextEmphasisFillFilled);
1325             selector->style()->setTextEmphasisMark(*primitiveValue);
1326         }
1327     }
1328
1329     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1330 };
1331
1332 template <typename T,
1333           T (Animation::*getterFunction)() const,
1334           void (Animation::*setterFunction)(T),
1335           bool (Animation::*testFunction)() const,
1336           void (Animation::*clearFunction)(),
1337           T (*initialFunction)(),
1338           void (CSSStyleSelector::*mapFunction)(Animation*, CSSValue*),
1339           AnimationList* (RenderStyle::*animationGetterFunction)(),
1340           const AnimationList* (RenderStyle::*immutableAnimationGetterFunction)() const>
1341 class ApplyPropertyAnimation {
1342 public:
1343     static void setValue(Animation* animation, T value) { (animation->*setterFunction)(value); }
1344     static T value(const Animation* animation) { return (animation->*getterFunction)(); }
1345     static bool test(const Animation* animation) { return (animation->*testFunction)(); }
1346     static void clear(Animation* animation) { (animation->*clearFunction)(); }
1347     static T initial() { return (*initialFunction)(); }
1348     static void map(CSSStyleSelector* selector, Animation* animation, CSSValue* value) { (selector->*mapFunction)(animation, value); }
1349     static AnimationList* accessAnimations(RenderStyle* style) { return (style->*animationGetterFunction)(); }
1350     static const AnimationList* animations(RenderStyle* style) { return (style->*immutableAnimationGetterFunction)(); }
1351
1352     static void applyInheritValue(CSSStyleSelector* selector)
1353     {
1354         AnimationList* list = accessAnimations(selector->style());
1355         const AnimationList* parentList = animations(selector->parentStyle());
1356         size_t i = 0, parentSize = parentList ? parentList->size() : 0;
1357         for ( ; i < parentSize && test(parentList->animation(i)); ++i) {
1358             if (list->size() <= i)
1359                 list->append(Animation::create());
1360             setValue(list->animation(i), value(parentList->animation(i)));
1361         }
1362
1363         /* Reset any remaining animations to not have the property set. */
1364         for ( ; i < list->size(); ++i)
1365             clear(list->animation(i));
1366     }
1367
1368     static void applyInitialValue(CSSStyleSelector* selector)
1369     {
1370         AnimationList* list = accessAnimations(selector->style());
1371         if (list->isEmpty())
1372             list->append(Animation::create());
1373         setValue(list->animation(0), initial());
1374         for (size_t i = 1; i < list->size(); ++i)
1375             clear(list->animation(i));
1376     }
1377
1378     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
1379     {
1380         AnimationList* list = accessAnimations(selector->style());
1381         size_t childIndex = 0;
1382         if (value->isValueList()) {
1383             /* Walk each value and put it into an animation, creating new animations as needed. */
1384             for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
1385                 if (childIndex <= list->size())
1386                     list->append(Animation::create());
1387                 map(selector, list->animation(childIndex), i.value());
1388                 ++childIndex;
1389             }
1390         } else {
1391             if (list->isEmpty())
1392                 list->append(Animation::create());
1393             map(selector, list->animation(childIndex), value);
1394             childIndex = 1;
1395         }
1396         for ( ; childIndex < list->size(); ++childIndex) {
1397             /* Reset all remaining animations to not have the property set. */
1398             clear(list->animation(childIndex));
1399         }
1400     }
1401
1402     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1403 };
1404
1405 class ApplyPropertyOutlineStyle {
1406 public:
1407     static void applyInheritValue(CSSStyleSelector* selector)
1408     {
1409         ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInheritValue(selector);
1410         ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInheritValue(selector);
1411     }
1412
1413     static void applyInitialValue(CSSStyleSelector* selector)
1414     {
1415         ApplyPropertyDefaultBase<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyInitialValue(selector);
1416         ApplyPropertyDefaultBase<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyInitialValue(selector);
1417     }
1418
1419     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
1420     {
1421         ApplyPropertyDefault<OutlineIsAuto, &RenderStyle::outlineStyleIsAuto, OutlineIsAuto, &RenderStyle::setOutlineStyleIsAuto, OutlineIsAuto, &RenderStyle::initialOutlineStyleIsAuto>::applyValue(selector, value);
1422         ApplyPropertyDefault<EBorderStyle, &RenderStyle::outlineStyle, EBorderStyle, &RenderStyle::setOutlineStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::applyValue(selector, value);
1423     }
1424
1425     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
1426 };
1427
1428 class ApplyPropertyResize {
1429 public:
1430     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
1431     {
1432         if (!value->isPrimitiveValue())
1433             return;
1434
1435         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1436
1437         EResize r = RESIZE_NONE;
1438         switch (primitiveValue->getIdent()) {
1439         case 0:
1440             return;
1441         case CSSValueAuto:
1442             if (Settings* settings = selector->document()->settings())
1443                 r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
1444             break;
1445         default:
1446             r = *primitiveValue;
1447         }
1448         selector->style()->setResize(r);
1449     }
1450
1451     static PropertyHandler createHandler()
1452     {
1453         PropertyHandler handler = ApplyPropertyDefaultBase<EResize, &RenderStyle::resize, EResize, &RenderStyle::setResize, EResize, &RenderStyle::initialResize>::createHandler();
1454         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1455     }
1456 };
1457
1458 class ApplyPropertyVerticalAlign {
1459 public:
1460     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
1461     {
1462         if (!value->isPrimitiveValue())
1463             return;
1464
1465         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1466
1467         if (primitiveValue->getIdent())
1468             return selector->style()->setVerticalAlign(*primitiveValue);
1469
1470         Length length;
1471         if (primitiveValue->isLength())
1472             length = primitiveValue->computeLength<Length>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom());
1473         else if (primitiveValue->isPercentage())
1474             length = Length(primitiveValue->getDoubleValue(), Percent);
1475
1476         selector->style()->setVerticalAlignLength(length);
1477     }
1478
1479     static PropertyHandler createHandler()
1480     {
1481         PropertyHandler handler = ApplyPropertyDefaultBase<EVerticalAlign, &RenderStyle::verticalAlign, EVerticalAlign, &RenderStyle::setVerticalAlign, EVerticalAlign, &RenderStyle::initialVerticalAlign>::createHandler();
1482         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
1483     }
1484 };
1485
1486 class ApplyPropertyAspectRatio {
1487 public:
1488     static void applyInheritValue(CSSStyleSelector* selector)
1489     {
1490         if (!selector->parentStyle()->hasAspectRatio())
1491             return;
1492         selector->style()->setHasAspectRatio(true);
1493         selector->style()->setAspectRatioDenominator(selector->parentStyle()->aspectRatioDenominator());
1494         selector->style()->setAspectRatioNumerator(selector->parentStyle()->aspectRatioNumerator());
1495     }
1496
1497     static void applyInitialValue(CSSStyleSelector* selector)
1498     {
1499         selector->style()->setHasAspectRatio(RenderStyle::initialHasAspectRatio());
1500         selector->style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDenominator());
1501         selector->style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumerator());
1502     }
1503
1504     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
1505     {
1506         if (!value->isAspectRatioValue()) {
1507             selector->style()->setHasAspectRatio(false);
1508             return;
1509         }
1510         CSSAspectRatioValue* aspectRatioValue = static_cast<CSSAspectRatioValue*>(value);
1511         selector->style()->setHasAspectRatio(true);
1512         selector->style()->setAspectRatioDenominator(aspectRatioValue->denominatorValue());
1513         selector->style()->setAspectRatioNumerator(aspectRatioValue->numeratorValue());
1514     }
1515
1516     static PropertyHandler createHandler()
1517     {
1518         return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
1519     }
1520 };
1521
1522 class ApplyPropertyZoom {
1523 private:
1524     static void resetEffectiveZoom(CSSStyleSelector* selector)
1525     {
1526         // Reset the zoom in effect. This allows the setZoom method to accurately compute a new zoom in effect.
1527         selector->setEffectiveZoom(selector->parentStyle() ? selector->parentStyle()->effectiveZoom() : RenderStyle::initialZoom());
1528     }
1529
1530 public:
1531     static void applyInheritValue(CSSStyleSelector* selector)
1532     {
1533         resetEffectiveZoom(selector);
1534         selector->setZoom(selector->parentStyle()->zoom());
1535     }
1536
1537     static void applyInitialValue(CSSStyleSelector* selector)
1538     {
1539         resetEffectiveZoom(selector);
1540         selector->setZoom(RenderStyle::initialZoom());
1541     }
1542
1543     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
1544     {
1545         ASSERT(value->isPrimitiveValue());
1546         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
1547
1548         if (primitiveValue->getIdent() == CSSValueNormal) {
1549             resetEffectiveZoom(selector);
1550             selector->setZoom(RenderStyle::initialZoom());
1551         } else if (primitiveValue->getIdent() == CSSValueReset) {
1552             selector->setEffectiveZoom(RenderStyle::initialZoom());
1553             selector->setZoom(RenderStyle::initialZoom());
1554         } else if (primitiveValue->getIdent() == CSSValueDocument) {
1555             float docZoom = selector->document()->renderer()->style()->zoom();
1556             selector->setEffectiveZoom(docZoom);
1557             selector->setZoom(docZoom);
1558         } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE) {
1559             resetEffectiveZoom(selector);
1560             if (float percent = primitiveValue->getFloatValue())
1561                 selector->setZoom(percent / 100.0f);
1562         } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_NUMBER) {
1563             resetEffectiveZoom(selector);
1564             if (float number = primitiveValue->getFloatValue())
1565                 selector->setZoom(number);
1566         }
1567     }
1568
1569     static PropertyHandler createHandler()
1570     {
1571         return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
1572     }
1573 };
1574
1575 class ApplyPropertyDisplay {
1576 private:
1577     static inline bool isValidDisplayValue(CSSStyleSelector* selector, EDisplay displayPropertyValue)
1578     {
1579 #if ENABLE(SVG)
1580         if (selector->element() && selector->element()->isSVGElement() && selector->style()->styleType() == NOPSEUDO)
1581             return (displayPropertyValue == INLINE || displayPropertyValue == BLOCK || displayPropertyValue == NONE);
1582 #endif
1583         return true;
1584     }
1585 public:
1586     static void applyInheritValue(CSSStyleSelector* selector)
1587     {
1588         EDisplay display = selector->parentStyle()->display();
1589         if (!isValidDisplayValue(selector, display))
1590             return;
1591         selector->style()->setDisplay(display);
1592     }
1593
1594     static void applyInitialValue(CSSStyleSelector* selector)
1595     {
1596         selector->style()->setDisplay(RenderStyle::initialDisplay());
1597     }
1598
1599     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
1600     {
1601         if (!value->isPrimitiveValue())
1602             return;
1603
1604         EDisplay display = *static_cast<CSSPrimitiveValue*>(value);
1605
1606         if (!isValidDisplayValue(selector, display))
1607             return;
1608
1609         selector->style()->setDisplay(display);
1610     }
1611
1612     static PropertyHandler createHandler()
1613     {
1614         return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
1615     }
1616 };
1617
1618 const CSSStyleApplyProperty& CSSStyleApplyProperty::sharedCSSStyleApplyProperty()
1619 {
1620     DEFINE_STATIC_LOCAL(CSSStyleApplyProperty, cssStyleApplyPropertyInstance, ());
1621     return cssStyleApplyPropertyInstance;
1622 }
1623
1624 CSSStyleApplyProperty::CSSStyleApplyProperty()
1625 {
1626     for (int i = 0; i < numCSSProperties; ++i)
1627         m_propertyMap[i] = PropertyHandler();
1628
1629     setPropertyHandler(CSSPropertyWebkitAspectRatio, ApplyPropertyAspectRatio::createHandler());
1630
1631     setPropertyHandler(CSSPropertyColor, ApplyPropertyColor<InheritFromParent, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::setVisitedLinkColor, &RenderStyle::invalidColor, RenderStyle::initialColor>::createHandler());
1632     setPropertyHandler(CSSPropertyDirection, ApplyPropertyDirection<&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection>::createHandler());
1633
1634     setPropertyHandler(CSSPropertyBackgroundAttachment, ApplyPropertyFillLayer<EFillAttachment, CSSPropertyBackgroundAttachment, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
1635                        &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &CSSStyleSelector::mapFillAttachment>::createHandler());
1636     setPropertyHandler(CSSPropertyBackgroundClip, ApplyPropertyFillLayer<EFillBox, CSSPropertyBackgroundClip, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
1637                        &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSStyleSelector::mapFillClip>::createHandler());
1638     setPropertyHandler(CSSPropertyWebkitBackgroundClip, CSSPropertyBackgroundClip);
1639     setPropertyHandler(CSSPropertyWebkitBackgroundComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitBackgroundComposite, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
1640                        &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSStyleSelector::mapFillComposite>::createHandler());
1641
1642     setPropertyHandler(CSSPropertyDisplay, ApplyPropertyDisplay::createHandler());
1643
1644     setPropertyHandler(CSSPropertyBackgroundImage, ApplyPropertyFillLayer<StyleImage*, CSSPropertyBackgroundImage, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
1645                        &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSStyleSelector::mapFillImage>::createHandler());
1646
1647     setPropertyHandler(CSSPropertyBackgroundOrigin, ApplyPropertyFillLayer<EFillBox, CSSPropertyBackgroundOrigin, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
1648                        &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSStyleSelector::mapFillOrigin>::createHandler());
1649     setPropertyHandler(CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundOrigin);
1650
1651     setPropertyHandler(CSSPropertyBackgroundPositionX, ApplyPropertyFillLayer<Length, CSSPropertyBackgroundPositionX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
1652                        &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSStyleSelector::mapFillXPosition>::createHandler());
1653     setPropertyHandler(CSSPropertyBackgroundPositionY, ApplyPropertyFillLayer<Length, CSSPropertyBackgroundPositionY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
1654                        &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSStyleSelector::mapFillYPosition>::createHandler());
1655     setPropertyHandler(CSSPropertyBackgroundPosition, ApplyPropertyExpanding<SuppressValue, CSSPropertyBackgroundPositionX, CSSPropertyBackgroundPositionY>::createHandler());
1656
1657     setPropertyHandler(CSSPropertyBackgroundRepeatX, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyBackgroundRepeatX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
1658                        &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSStyleSelector::mapFillRepeatX>::createHandler());
1659     setPropertyHandler(CSSPropertyBackgroundRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyBackgroundRepeatY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
1660                        &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSStyleSelector::mapFillRepeatY>::createHandler());
1661     setPropertyHandler(CSSPropertyBackgroundRepeat, ApplyPropertyExpanding<SuppressValue, CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeatY>::createHandler());
1662
1663     setPropertyHandler(CSSPropertyBackgroundSize, ApplyPropertyFillLayer<FillSize, CSSPropertyBackgroundSize, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
1664                        &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSStyleSelector::mapFillSize>::createHandler());
1665     setPropertyHandler(CSSPropertyWebkitBackgroundSize, CSSPropertyBackgroundSize);
1666
1667     setPropertyHandler(CSSPropertyWebkitMaskAttachment, ApplyPropertyFillLayer<EFillAttachment, CSSPropertyWebkitMaskAttachment, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
1668                        &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &CSSStyleSelector::mapFillAttachment>::createHandler());
1669     setPropertyHandler(CSSPropertyWebkitMaskClip, ApplyPropertyFillLayer<EFillBox, CSSPropertyWebkitMaskClip, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
1670                        &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSStyleSelector::mapFillClip>::createHandler());
1671     setPropertyHandler(CSSPropertyWebkitMaskComposite, ApplyPropertyFillLayer<CompositeOperator, CSSPropertyWebkitMaskComposite, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
1672                        &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSStyleSelector::mapFillComposite>::createHandler());
1673
1674     setPropertyHandler(CSSPropertyWebkitMaskImage, ApplyPropertyFillLayer<StyleImage*, CSSPropertyWebkitMaskImage, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
1675                        &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSStyleSelector::mapFillImage>::createHandler());
1676
1677     setPropertyHandler(CSSPropertyWebkitMaskOrigin, ApplyPropertyFillLayer<EFillBox, CSSPropertyWebkitMaskOrigin, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
1678                        &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSStyleSelector::mapFillOrigin>::createHandler());
1679     setPropertyHandler(CSSPropertyWebkitMaskSize, ApplyPropertyFillLayer<FillSize, CSSPropertyWebkitMaskSize, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
1680                        &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSStyleSelector::mapFillSize>::createHandler());
1681
1682     setPropertyHandler(CSSPropertyWebkitMaskPositionX, ApplyPropertyFillLayer<Length, CSSPropertyWebkitMaskPositionX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
1683                        &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSStyleSelector::mapFillXPosition>::createHandler());
1684     setPropertyHandler(CSSPropertyWebkitMaskPositionY, ApplyPropertyFillLayer<Length, CSSPropertyWebkitMaskPositionY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
1685                        &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSStyleSelector::mapFillYPosition>::createHandler());
1686     setPropertyHandler(CSSPropertyWebkitMaskPosition, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitMaskPositionX, CSSPropertyWebkitMaskPositionY>::createHandler());
1687
1688     setPropertyHandler(CSSPropertyWebkitMaskRepeatX, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
1689                        &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSStyleSelector::mapFillRepeatX>::createHandler());
1690     setPropertyHandler(CSSPropertyWebkitMaskRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
1691                        &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSStyleSelector::mapFillRepeatY>::createHandler());
1692     setPropertyHandler(CSSPropertyWebkitMaskRepeat, ApplyPropertyExpanding<SuppressValue, CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeatY>::createHandler());
1693
1694     setPropertyHandler(CSSPropertyBackgroundColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, &RenderStyle::setVisitedLinkBackgroundColor, &RenderStyle::invalidColor>::createHandler());
1695     setPropertyHandler(CSSPropertyBorderBottomColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::setVisitedLinkBorderBottomColor, &RenderStyle::color>::createHandler());
1696     setPropertyHandler(CSSPropertyBorderLeftColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::setVisitedLinkBorderLeftColor, &RenderStyle::color>::createHandler());
1697     setPropertyHandler(CSSPropertyBorderRightColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::setVisitedLinkBorderRightColor, &RenderStyle::color>::createHandler());
1698     setPropertyHandler(CSSPropertyBorderTopColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::setVisitedLinkBorderTopColor, &RenderStyle::color>::createHandler());
1699
1700     setPropertyHandler(CSSPropertyBorderTopStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderTopStyle, EBorderStyle, &RenderStyle::setBorderTopStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
1701     setPropertyHandler(CSSPropertyBorderRightStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderRightStyle, EBorderStyle, &RenderStyle::setBorderRightStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
1702     setPropertyHandler(CSSPropertyBorderBottomStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderBottomStyle, EBorderStyle, &RenderStyle::setBorderBottomStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
1703     setPropertyHandler(CSSPropertyBorderLeftStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderLeftStyle, EBorderStyle, &RenderStyle::setBorderLeftStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
1704
1705     setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
1706     setPropertyHandler(CSSPropertyBorderRightWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
1707     setPropertyHandler(CSSPropertyBorderBottomWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
1708     setPropertyHandler(CSSPropertyBorderLeftWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
1709     setPropertyHandler(CSSPropertyOutlineWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
1710     setPropertyHandler(CSSPropertyWebkitColumnRuleWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
1711
1712     setPropertyHandler(CSSPropertyBorderTop, ApplyPropertyExpanding<SuppressValue, CSSPropertyBorderTopColor, CSSPropertyBorderTopStyle, CSSPropertyBorderTopWidth>::createHandler());
1713     setPropertyHandler(CSSPropertyBorderRight, ApplyPropertyExpanding<SuppressValue, CSSPropertyBorderRightColor, CSSPropertyBorderRightStyle, CSSPropertyBorderRightWidth>::createHandler());
1714     setPropertyHandler(CSSPropertyBorderBottom, ApplyPropertyExpanding<SuppressValue, CSSPropertyBorderBottomColor, CSSPropertyBorderBottomStyle, CSSPropertyBorderBottomWidth>::createHandler());
1715     setPropertyHandler(CSSPropertyBorderLeft, ApplyPropertyExpanding<SuppressValue, CSSPropertyBorderLeftColor, CSSPropertyBorderLeftStyle, CSSPropertyBorderLeftWidth>::createHandler());
1716
1717     setPropertyHandler(CSSPropertyBorderStyle, ApplyPropertyExpanding<SuppressValue, CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle>::createHandler());
1718     setPropertyHandler(CSSPropertyBorderWidth, ApplyPropertyExpanding<SuppressValue, CSSPropertyBorderTopWidth, CSSPropertyBorderRightWidth, CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth>::createHandler());
1719     setPropertyHandler(CSSPropertyBorderColor, ApplyPropertyExpanding<SuppressValue, CSSPropertyBorderTopColor, CSSPropertyBorderRightColor, CSSPropertyBorderBottomColor, CSSPropertyBorderLeftColor>::createHandler());
1720     setPropertyHandler(CSSPropertyBorder, ApplyPropertyExpanding<SuppressValue, CSSPropertyBorderStyle, CSSPropertyBorderWidth, CSSPropertyBorderColor>::createHandler());
1721
1722     setPropertyHandler(CSSPropertyBorderImage, ApplyPropertyBorderImage<Image, CSSPropertyBorderImage, &RenderStyle::borderImage, &RenderStyle::setBorderImage>::createHandler());
1723     setPropertyHandler(CSSPropertyWebkitBorderImage, ApplyPropertyBorderImage<Image, CSSPropertyWebkitBorderImage, &RenderStyle::borderImage, &RenderStyle::setBorderImage>::createHandler());
1724     setPropertyHandler(CSSPropertyWebkitMaskBoxImage, ApplyPropertyBorderImage<Mask, CSSPropertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImage>::createHandler());
1725
1726     setPropertyHandler(CSSPropertyBorderImageOutset, ApplyPropertyBorderImageModifier<Image, Outset>::createHandler());
1727     setPropertyHandler(CSSPropertyWebkitMaskBoxImageOutset, ApplyPropertyBorderImageModifier<Mask, Outset>::createHandler());
1728     setPropertyHandler(CSSPropertyBorderImageRepeat, ApplyPropertyBorderImageModifier<Image, Repeat>::createHandler());
1729     setPropertyHandler(CSSPropertyWebkitMaskBoxImageRepeat, ApplyPropertyBorderImageModifier<Mask, Repeat>::createHandler());
1730     setPropertyHandler(CSSPropertyBorderImageSlice, ApplyPropertyBorderImageModifier<Image, Slice>::createHandler());
1731     setPropertyHandler(CSSPropertyWebkitMaskBoxImageSlice, ApplyPropertyBorderImageModifier<Mask, Slice>::createHandler());
1732     setPropertyHandler(CSSPropertyBorderImageWidth, ApplyPropertyBorderImageModifier<Image, Width>::createHandler());
1733     setPropertyHandler(CSSPropertyWebkitMaskBoxImageWidth, ApplyPropertyBorderImageModifier<Mask, Width>::createHandler());
1734
1735     setPropertyHandler(CSSPropertyBorderImageSource, ApplyPropertyBorderImageSource<CSSPropertyBorderImageSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource, &RenderStyle::initialBorderImageSource>::createHandler());
1736     setPropertyHandler(CSSPropertyWebkitMaskBoxImageSource, ApplyPropertyBorderImageSource<CSSPropertyWebkitMaskBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImageSource, &RenderStyle::initialMaskBoxImageSource>::createHandler());
1737
1738     setPropertyHandler(CSSPropertyBorderTopLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
1739     setPropertyHandler(CSSPropertyBorderTopRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
1740     setPropertyHandler(CSSPropertyBorderBottomLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
1741     setPropertyHandler(CSSPropertyBorderBottomRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
1742     setPropertyHandler(CSSPropertyBorderRadius, ApplyPropertyExpanding<ExpandValue, CSSPropertyBorderTopLeftRadius, CSSPropertyBorderTopRightRadius, CSSPropertyBorderBottomLeftRadius, CSSPropertyBorderBottomRightRadius>::createHandler());
1743     setPropertyHandler(CSSPropertyWebkitBorderRadius, CSSPropertyBorderRadius);
1744
1745     setPropertyHandler(CSSPropertyWebkitBorderHorizontalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::horizontalBorderSpacing, &RenderStyle::setHorizontalBorderSpacing, &RenderStyle::initialHorizontalBorderSpacing>::createHandler());
1746     setPropertyHandler(CSSPropertyWebkitBorderVerticalSpacing, ApplyPropertyComputeLength<short, &RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalBorderSpacing, &RenderStyle::initialVerticalBorderSpacing>::createHandler());
1747     setPropertyHandler(CSSPropertyBorderSpacing, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyWebkitBorderVerticalSpacing>::createHandler());
1748
1749     setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<int, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
1750     setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength<int, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
1751
1752     setPropertyHandler(CSSPropertyCursor, ApplyPropertyCursor::createHandler());
1753
1754     setPropertyHandler(CSSPropertyCounterIncrement, ApplyPropertyCounter<Increment>::createHandler());
1755     setPropertyHandler(CSSPropertyCounterReset, ApplyPropertyCounter<Reset>::createHandler());
1756
1757     setPropertyHandler(CSSPropertyWebkitFlexOrder, ApplyPropertyDefault<int, &RenderStyle::flexOrder, int, &RenderStyle::setFlexOrder, int, &RenderStyle::initialFlexOrder>::createHandler());
1758     setPropertyHandler(CSSPropertyWebkitFlexPack, ApplyPropertyDefault<EFlexPack, &RenderStyle::flexPack, EFlexPack, &RenderStyle::setFlexPack, EFlexPack, &RenderStyle::initialFlexPack>::createHandler());
1759     setPropertyHandler(CSSPropertyWebkitFlexItemAlign, ApplyPropertyDefault<EFlexAlign, &RenderStyle::flexItemAlign, EFlexAlign, &RenderStyle::setFlexItemAlign, EFlexAlign, &RenderStyle::initialFlexItemAlign>::createHandler());
1760     setPropertyHandler(CSSPropertyWebkitFlexDirection, ApplyPropertyDefault<EFlexDirection, &RenderStyle::flexDirection, EFlexDirection, &RenderStyle::setFlexDirection, EFlexDirection, &RenderStyle::initialFlexDirection>::createHandler());
1761     setPropertyHandler(CSSPropertyWebkitFlexWrap, ApplyPropertyDefault<EFlexWrap, &RenderStyle::flexWrap, EFlexWrap, &RenderStyle::setFlexWrap, EFlexWrap, &RenderStyle::initialFlexWrap>::createHandler());
1762     setPropertyHandler(CSSPropertyWebkitFlexFlow, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexWrap>::createHandler());
1763
1764     setPropertyHandler(CSSPropertyFontSize, ApplyPropertyFontSize::createHandler());
1765     setPropertyHandler(CSSPropertyFontStyle, ApplyPropertyFont<FontItalic, &FontDescription::italic, &FontDescription::setItalic, FontItalicOff>::createHandler());
1766     setPropertyHandler(CSSPropertyFontVariant, ApplyPropertyFont<FontSmallCaps, &FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff>::createHandler());
1767     setPropertyHandler(CSSPropertyTextRendering, ApplyPropertyFont<TextRenderingMode, &FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering>::createHandler());
1768     setPropertyHandler(CSSPropertyWebkitFontKerning, ApplyPropertyFont<FontDescription::Kerning, &FontDescription::kerning, &FontDescription::setKerning, FontDescription::AutoKerning>::createHandler());
1769     setPropertyHandler(CSSPropertyWebkitFontSmoothing, ApplyPropertyFont<FontSmoothingMode, &FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing>::createHandler());
1770     setPropertyHandler(CSSPropertyWebkitTextOrientation, ApplyPropertyFont<TextOrientation, &FontDescription::textOrientation, &FontDescription::setTextOrientation, TextOrientationVerticalRight>::createHandler());
1771     setPropertyHandler(CSSPropertyWebkitFontVariantLigatures, ApplyPropertyFontVariantLigatures::createHandler());
1772     setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler());
1773
1774     setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler());
1775     setPropertyHandler(CSSPropertyTextDecoration, ApplyPropertyTextDecoration::createHandler());
1776
1777     setPropertyHandler(CSSPropertyOutlineStyle, ApplyPropertyOutlineStyle::createHandler());
1778     setPropertyHandler(CSSPropertyOutlineColor, ApplyPropertyColor<InheritFromParent, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::setVisitedLinkOutlineColor, &RenderStyle::color>::createHandler());
1779     setPropertyHandler(CSSPropertyOutlineOffset, ApplyPropertyComputeLength<int, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset, &RenderStyle::initialOutlineOffset>::createHandler());
1780
1781     setPropertyHandler(CSSPropertyOutline, ApplyPropertyExpanding<SuppressValue, CSSPropertyOutlineWidth, CSSPropertyOutlineColor, CSSPropertyOutlineStyle>::createHandler());
1782
1783     setPropertyHandler(CSSPropertyOverflowX, ApplyPropertyDefault<EOverflow, &RenderStyle::overflowX, EOverflow, &RenderStyle::setOverflowX, EOverflow, &RenderStyle::initialOverflowX>::createHandler());
1784     setPropertyHandler(CSSPropertyOverflowY, ApplyPropertyDefault<EOverflow, &RenderStyle::overflowY, EOverflow, &RenderStyle::setOverflowY, EOverflow, &RenderStyle::initialOverflowY>::createHandler());
1785     setPropertyHandler(CSSPropertyOverflow, ApplyPropertyExpanding<ExpandValue, CSSPropertyOverflowX, CSSPropertyOverflowY>::createHandler());
1786
1787     setPropertyHandler(CSSPropertyWebkitColumnRuleColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor, &RenderStyle::color>::createHandler());
1788     setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color>::createHandler());
1789     setPropertyHandler(CSSPropertyWebkitTextFillColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::setVisitedLinkTextFillColor, &RenderStyle::color>::createHandler());
1790     setPropertyHandler(CSSPropertyWebkitTextStrokeColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor, &RenderStyle::color>::createHandler());
1791
1792     setPropertyHandler(CSSPropertyTop, ApplyPropertyLength<&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
1793     setPropertyHandler(CSSPropertyRight, ApplyPropertyLength<&RenderStyle::right, &RenderStyle::setRight, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
1794     setPropertyHandler(CSSPropertyBottom, ApplyPropertyLength<&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
1795     setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
1796
1797     setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexWidth>::createHandler());
1798     setPropertyHandler(CSSPropertyHeight, ApplyPropertyLength<&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexHeight>::createHandler());
1799
1800     setPropertyHandler(CSSPropertyTextIndent, ApplyPropertyLength<&RenderStyle::textIndent, &RenderStyle::setTextIndent, &RenderStyle::initialTextIndent>::createHandler());
1801
1802     setPropertyHandler(CSSPropertyLineHeight, ApplyPropertyLineHeight::createHandler());
1803
1804     setPropertyHandler(CSSPropertyListStyleImage, ApplyPropertyStyleImage<&RenderStyle::listStyleImage, &RenderStyle::setListStyleImage, &RenderStyle::initialListStyleImage, CSSPropertyListStyleImage>::createHandler());
1805     setPropertyHandler(CSSPropertyListStylePosition, ApplyPropertyDefault<EListStylePosition, &RenderStyle::listStylePosition, EListStylePosition, &RenderStyle::setListStylePosition, EListStylePosition, &RenderStyle::initialListStylePosition>::createHandler());
1806     setPropertyHandler(CSSPropertyListStyleType, ApplyPropertyDefault<EListStyleType, &RenderStyle::listStyleType, EListStyleType, &RenderStyle::setListStyleType, EListStyleType, &RenderStyle::initialListStyleType>::createHandler());
1807     setPropertyHandler(CSSPropertyListStyle, ApplyPropertyExpanding<SuppressValue, CSSPropertyListStyleType, CSSPropertyListStyleImage, CSSPropertyListStylePosition>::createHandler());
1808
1809     setPropertyHandler(CSSPropertyMaxHeight, ApplyPropertyLength<&RenderStyle::maxHeight, &RenderStyle::setMaxHeight, &RenderStyle::initialMaxSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneEnabled, UndefinedEnabled>::createHandler());
1810     setPropertyHandler(CSSPropertyMaxWidth, ApplyPropertyLength<&RenderStyle::maxWidth, &RenderStyle::setMaxWidth, &RenderStyle::initialMaxSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneEnabled, UndefinedEnabled>::createHandler());
1811     setPropertyHandler(CSSPropertyMinHeight, ApplyPropertyLength<&RenderStyle::minHeight, &RenderStyle::setMinHeight, &RenderStyle::initialMinSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>::createHandler());
1812     setPropertyHandler(CSSPropertyMinWidth, ApplyPropertyLength<&RenderStyle::minWidth, &RenderStyle::setMinWidth, &RenderStyle::initialMinSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>::createHandler());
1813
1814     setPropertyHandler(CSSPropertyMarginTop, ApplyPropertyLength<&RenderStyle::marginTop, &RenderStyle::setMarginTop, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
1815     setPropertyHandler(CSSPropertyMarginRight, ApplyPropertyLength<&RenderStyle::marginRight, &RenderStyle::setMarginRight, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
1816     setPropertyHandler(CSSPropertyMarginBottom, ApplyPropertyLength<&RenderStyle::marginBottom, &RenderStyle::setMarginBottom, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
1817     setPropertyHandler(CSSPropertyMarginLeft, ApplyPropertyLength<&RenderStyle::marginLeft, &RenderStyle::setMarginLeft, &RenderStyle::initialMargin, AutoEnabled>::createHandler());
1818     setPropertyHandler(CSSPropertyMargin, ApplyPropertyExpanding<SuppressValue, CSSPropertyMarginTop, CSSPropertyMarginRight, CSSPropertyMarginBottom, CSSPropertyMarginLeft>::createHandler());
1819
1820     setPropertyHandler(CSSPropertyWebkitMarginBeforeCollapse, ApplyPropertyDefault<EMarginCollapse, &RenderStyle::marginBeforeCollapse, EMarginCollapse, &RenderStyle::setMarginBeforeCollapse, EMarginCollapse, &RenderStyle::initialMarginBeforeCollapse>::createHandler());
1821     setPropertyHandler(CSSPropertyWebkitMarginAfterCollapse, ApplyPropertyDefault<EMarginCollapse, &RenderStyle::marginAfterCollapse, EMarginCollapse, &RenderStyle::setMarginAfterCollapse, EMarginCollapse, &RenderStyle::initialMarginAfterCollapse>::createHandler());
1822     setPropertyHandler(CSSPropertyWebkitMarginTopCollapse, CSSPropertyWebkitMarginBeforeCollapse);
1823     setPropertyHandler(CSSPropertyWebkitMarginBottomCollapse, CSSPropertyWebkitMarginAfterCollapse);
1824     setPropertyHandler(CSSPropertyWebkitMarginCollapse, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarginAfterCollapse>::createHandler());
1825
1826     setPropertyHandler(CSSPropertyPaddingTop, ApplyPropertyLength<&RenderStyle::paddingTop, &RenderStyle::setPaddingTop, &RenderStyle::initialPadding>::createHandler());
1827     setPropertyHandler(CSSPropertyPaddingRight, ApplyPropertyLength<&RenderStyle::paddingRight, &RenderStyle::setPaddingRight, &RenderStyle::initialPadding>::createHandler());
1828     setPropertyHandler(CSSPropertyPaddingBottom, ApplyPropertyLength<&RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom, &RenderStyle::initialPadding>::createHandler());
1829     setPropertyHandler(CSSPropertyPaddingLeft, ApplyPropertyLength<&RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft, &RenderStyle::initialPadding>::createHandler());
1830     setPropertyHandler(CSSPropertyPadding, ApplyPropertyExpanding<SuppressValue, CSSPropertyPaddingTop, CSSPropertyPaddingRight, CSSPropertyPaddingBottom, CSSPropertyPaddingLeft>::createHandler());
1831
1832     setPropertyHandler(CSSPropertyResize, ApplyPropertyResize::createHandler());
1833
1834     setPropertyHandler(CSSPropertyVerticalAlign, ApplyPropertyVerticalAlign::createHandler());
1835
1836     setPropertyHandler(CSSPropertySize, ApplyPropertyPageSize::createHandler());
1837
1838     setPropertyHandler(CSSPropertyWebkitPerspectiveOriginX, ApplyPropertyLength<&RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX, &RenderStyle::initialPerspectiveOriginX>::createHandler());
1839     setPropertyHandler(CSSPropertyWebkitPerspectiveOriginY, ApplyPropertyLength<&RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOriginY, &RenderStyle::initialPerspectiveOriginY>::createHandler());
1840     setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitPerspectiveOriginX, CSSPropertyWebkitPerspectiveOriginY>::createHandler());
1841     setPropertyHandler(CSSPropertyWebkitTransformOriginX, ApplyPropertyLength<&RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX, &RenderStyle::initialTransformOriginX>::createHandler());
1842     setPropertyHandler(CSSPropertyWebkitTransformOriginY, ApplyPropertyLength<&RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY, &RenderStyle::initialTransformOriginY>::createHandler());
1843     setPropertyHandler(CSSPropertyWebkitTransformOriginZ, ApplyPropertyComputeLength<float, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ, &RenderStyle::initialTransformOriginZ>::createHandler());
1844     setPropertyHandler(CSSPropertyWebkitTransformOrigin, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitTransformOriginX, CSSPropertyWebkitTransformOriginY, CSSPropertyWebkitTransformOriginZ>::createHandler());
1845
1846     setPropertyHandler(CSSPropertyWebkitAnimationDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSStyleSelector::mapAnimationDelay, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
1847     setPropertyHandler(CSSPropertyWebkitAnimationDirection, ApplyPropertyAnimation<Animation::AnimationDirection, &Animation::direction, &Animation::setDirection, &Animation::isDirectionSet, &Animation::clearDirection, &Animation::initialAnimationDirection, &CSSStyleSelector::mapAnimationDirection, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
1848     setPropertyHandler(CSSPropertyWebkitAnimationDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSStyleSelector::mapAnimationDuration, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
1849     setPropertyHandler(CSSPropertyWebkitAnimationFillMode, ApplyPropertyAnimation<unsigned, &Animation::fillMode, &Animation::setFillMode, &Animation::isFillModeSet, &Animation::clearFillMode, &Animation::initialAnimationFillMode, &CSSStyleSelector::mapAnimationFillMode, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
1850     setPropertyHandler(CSSPropertyWebkitAnimationIterationCount, ApplyPropertyAnimation<int, &Animation::iterationCount, &Animation::setIterationCount, &Animation::isIterationCountSet, &Animation::clearIterationCount, &Animation::initialAnimationIterationCount, &CSSStyleSelector::mapAnimationIterationCount, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
1851     setPropertyHandler(CSSPropertyWebkitAnimationName, ApplyPropertyAnimation<const String&, &Animation::name, &Animation::setName, &Animation::isNameSet, &Animation::clearName, &Animation::initialAnimationName, &CSSStyleSelector::mapAnimationName, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
1852     setPropertyHandler(CSSPropertyWebkitAnimationPlayState, ApplyPropertyAnimation<EAnimPlayState, &Animation::playState, &Animation::setPlayState, &Animation::isPlayStateSet, &Animation::clearPlayState, &Animation::initialAnimationPlayState, &CSSStyleSelector::mapAnimationPlayState, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
1853     setPropertyHandler(CSSPropertyWebkitAnimationTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSStyleSelector::mapAnimationTimingFunction, &RenderStyle::accessAnimations, &RenderStyle::animations>::createHandler());
1854
1855     setPropertyHandler(CSSPropertyWebkitTransitionDelay, ApplyPropertyAnimation<double, &Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSStyleSelector::mapAnimationDelay, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
1856     setPropertyHandler(CSSPropertyWebkitTransitionDuration, ApplyPropertyAnimation<double, &Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSStyleSelector::mapAnimationDuration, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
1857     setPropertyHandler(CSSPropertyWebkitTransitionProperty, ApplyPropertyAnimation<int, &Animation::property, &Animation::setProperty, &Animation::isPropertySet, &Animation::clearProperty, &Animation::initialAnimationProperty, &CSSStyleSelector::mapAnimationProperty, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
1858     setPropertyHandler(CSSPropertyWebkitTransitionTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSStyleSelector::mapAnimationTimingFunction, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
1859
1860     setPropertyHandler(CSSPropertyWebkitColumnCount, ApplyPropertyAuto<unsigned short, &RenderStyle::columnCount, &RenderStyle::setColumnCount, &RenderStyle::hasAutoColumnCount, &RenderStyle::setHasAutoColumnCount>::createHandler());
1861     setPropertyHandler(CSSPropertyWebkitColumnGap, ApplyPropertyAuto<float, &RenderStyle::columnGap, &RenderStyle::setColumnGap, &RenderStyle::hasNormalColumnGap, &RenderStyle::setHasNormalColumnGap, ComputeLength, CSSValueNormal>::createHandler());
1862     setPropertyHandler(CSSPropertyWebkitColumnWidth, ApplyPropertyAuto<float, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth, ComputeLength>::createHandler());
1863     setPropertyHandler(CSSPropertyWebkitColumns, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitColumnWidth, CSSPropertyWebkitColumnCount>::createHandler());
1864
1865     setPropertyHandler(CSSPropertyWebkitFlowInto, ApplyPropertyString<MapAutoToNull, &RenderStyle::flowThread, &RenderStyle::setFlowThread, &RenderStyle::initialFlowThread>::createHandler());
1866     setPropertyHandler(CSSPropertyWebkitFlowFrom, ApplyPropertyString<MapNoneToNull, &RenderStyle::regionThread, &RenderStyle::setRegionThread, &RenderStyle::initialRegionThread>::createHandler());
1867
1868     setPropertyHandler(CSSPropertyWebkitHighlight, ApplyPropertyString<MapNoneToNull, &RenderStyle::highlight, &RenderStyle::setHighlight, &RenderStyle::initialHighlight>::createHandler());
1869     setPropertyHandler(CSSPropertyWebkitHyphenateCharacter, ApplyPropertyString<MapAutoToNull, &RenderStyle::hyphenationString, &RenderStyle::setHyphenationString, &RenderStyle::initialHyphenationString>::createHandler());
1870
1871     setPropertyHandler(CSSPropertyWebkitHyphenateLimitAfter, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitAfter, &RenderStyle::setHyphenationLimitAfter, &RenderStyle::initialHyphenationLimitAfter>::createHandler());
1872     setPropertyHandler(CSSPropertyWebkitHyphenateLimitBefore, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitBefore, &RenderStyle::setHyphenationLimitBefore, &RenderStyle::initialHyphenationLimitBefore>::createHandler());
1873     setPropertyHandler(CSSPropertyWebkitHyphenateLimitLines, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitLines, &RenderStyle::setHyphenationLimitLines, &RenderStyle::initialHyphenationLimitLines, CSSValueNoLimit>::createHandler());
1874
1875     setPropertyHandler(CSSPropertyWebkitLineGrid, ApplyPropertyString<MapNoneToNull, &RenderStyle::lineGrid, &RenderStyle::setLineGrid, &RenderStyle::initialLineGrid>::createHandler());
1876     setPropertyHandler(CSSPropertyWebkitLineGridSnap, ApplyPropertyDefault<LineGridSnap, &RenderStyle::lineGridSnap, LineGridSnap, &RenderStyle::setLineGridSnap, LineGridSnap, &RenderStyle::initialLineGridSnap>::createHandler());
1877
1878     setPropertyHandler(CSSPropertyWebkitTextCombine, ApplyPropertyDefault<TextCombine, &RenderStyle::textCombine, TextCombine, &RenderStyle::setTextCombine, TextCombine, &RenderStyle::initialTextCombine>::createHandler());
1879     setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, ApplyPropertyDefault<TextEmphasisPosition, &RenderStyle::textEmphasisPosition, TextEmphasisPosition, &RenderStyle::setTextEmphasisPosition, TextEmphasisPosition, &RenderStyle::initialTextEmphasisPosition>::createHandler());
1880     setPropertyHandler(CSSPropertyWebkitTextEmphasisStyle, ApplyPropertyTextEmphasisStyle::createHandler());
1881
1882     setPropertyHandler(CSSPropertyWebkitWrapMargin, ApplyPropertyLength<&RenderStyle::wrapMargin, &RenderStyle::setWrapMargin, &RenderStyle::initialWrapMargin>::createHandler());
1883     setPropertyHandler(CSSPropertyWebkitWrapPadding, ApplyPropertyLength<&RenderStyle::wrapPadding, &RenderStyle::setWrapPadding, &RenderStyle::initialWrapPadding>::createHandler());
1884     setPropertyHandler(CSSPropertyWebkitWrapFlow, ApplyPropertyDefault<WrapFlow, &RenderStyle::wrapFlow, WrapFlow, &RenderStyle::setWrapFlow, WrapFlow, &RenderStyle::initialWrapFlow>::createHandler());
1885     setPropertyHandler(CSSPropertyWebkitWrapThrough, ApplyPropertyDefault<WrapThrough, &RenderStyle::wrapThrough, WrapThrough, &RenderStyle::setWrapThrough, WrapThrough, &RenderStyle::initialWrapThrough>::createHandler());
1886     setPropertyHandler(CSSPropertyWebkitWrap, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitWrapFlow, CSSPropertyWebkitWrapMargin, CSSPropertyWebkitWrapPadding>::createHandler());
1887
1888     setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex>::createHandler());
1889     setPropertyHandler(CSSPropertyZoom, ApplyPropertyZoom::createHandler());
1890 }
1891
1892
1893 }