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