11317dca7a8d0ca30f5863a1071af6e5f8b75ded
[WebKit-https.git] / Source / WebCore / css / CSSStyleApplyProperty.cpp
1 /*
2  * Copyright (C) 2011 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1.  Redistributions of source code must retain the above copyright
8  *     notice, this list of conditions and the following disclaimer.
9  * 2.  Redistributions in binary form must reproduce the above copyright
10  *     notice, this list of conditions and the following disclaimer in the
11  *     documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16  * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
17  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  */
24
25 #include "config.h"
26 #include "CSSStyleApplyProperty.h"
27
28 #include "CSSCursorImageValue.h"
29 #include "CSSFlexValue.h"
30 #include "CSSPrimitiveValueMappings.h"
31 #include "CSSStyleSelector.h"
32 #include "CSSValueList.h"
33 #include "CursorList.h"
34 #include "Document.h"
35 #include "Element.h"
36 #include "Pair.h"
37 #include "RenderStyle.h"
38 #include <wtf/StdLibExtras.h>
39 #include <wtf/UnusedParam.h>
40
41 using namespace std;
42
43 namespace WebCore {
44
45 enum ExpandValueBehavior {SuppressValue = 0, ExpandValue};
46 template <ExpandValueBehavior expandValue>
47 class ApplyPropertyExpanding : public ApplyPropertyBase {
48 public:
49     ApplyPropertyExpanding(ApplyPropertyBase* one = 0, ApplyPropertyBase* two = 0, ApplyPropertyBase *three = 0, ApplyPropertyBase* four = 0)
50     {
51         m_propertyMap[0] = one;
52         m_propertyMap[1] = two;
53         m_propertyMap[2] = three;
54         m_propertyMap[3] = four;
55         m_propertyMap[4] = 0; // always null terminated
56     }
57
58     virtual void applyInheritValue(CSSStyleSelector* selector) const
59     {
60         for (ApplyPropertyBase* const* e = m_propertyMap; *e; e++)
61             (*e)->applyInheritValue(selector);
62     }
63
64     virtual void applyInitialValue(CSSStyleSelector* selector) const
65     {
66         for (ApplyPropertyBase* const* e = m_propertyMap; *e; e++)
67             (*e)->applyInitialValue(selector);
68     }
69
70     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
71     {
72         if (!expandValue)
73             return;
74
75         for (ApplyPropertyBase* const* e = m_propertyMap; *e; e++)
76             (*e)->applyValue(selector, value);
77     }
78 private:
79     ApplyPropertyBase* m_propertyMap[5];
80 };
81
82 template <typename T>
83 class ApplyPropertyDefaultBase : public ApplyPropertyBase {
84 public:
85     typedef T (RenderStyle::*GetterFunction)() const;
86     typedef void (RenderStyle::*SetterFunction)(T);
87     typedef T (*InitialFunction)();
88
89     ApplyPropertyDefaultBase(GetterFunction getter, SetterFunction setter, InitialFunction initial)
90         : m_getter(getter)
91         , m_setter(setter)
92         , m_initial(initial)
93     {
94     }
95
96 private:
97     virtual void applyInheritValue(CSSStyleSelector* selector) const
98     {
99         setValue(selector->style(), value(selector->parentStyle()));
100     }
101
102     virtual void applyInitialValue(CSSStyleSelector* selector) const
103     {
104         setValue(selector->style(), initial());
105     }
106
107 protected:
108     void setValue(RenderStyle* style, T value) const
109     {
110         (style->*m_setter)(value);
111     }
112
113     T value(RenderStyle* style) const
114     {
115         return (style->*m_getter)();
116     }
117
118     T initial() const
119     {
120         return (*m_initial)();
121     }
122
123     GetterFunction m_getter;
124     SetterFunction m_setter;
125     InitialFunction m_initial;
126 };
127
128
129 template <typename T>
130 class ApplyPropertyDefault : public ApplyPropertyDefaultBase<T> {
131 public:
132     ApplyPropertyDefault(typename ApplyPropertyDefaultBase<T>::GetterFunction getter, typename ApplyPropertyDefaultBase<T>::SetterFunction setter, typename ApplyPropertyDefaultBase<T>::InitialFunction initial)
133         : ApplyPropertyDefaultBase<T>(getter, setter, initial)
134     {
135     }
136
137 protected:
138     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
139     {
140         if (value->isPrimitiveValue())
141             ApplyPropertyDefaultBase<T>::setValue(selector->style(), *static_cast<CSSPrimitiveValue*>(value));
142     }
143 };
144
145 enum AutoValueType {Number = 0, ComputeLength};
146 template <typename T, AutoValueType valueType = Number, int autoIdentity = CSSValueAuto>
147 class ApplyPropertyAuto : public ApplyPropertyDefaultBase<T> {
148 public:
149     typedef bool (RenderStyle::*HasAutoFunction)() const;
150     typedef void (RenderStyle::*SetAutoFunction)();
151
152     ApplyPropertyAuto(typename ApplyPropertyDefaultBase<T>::GetterFunction getter, typename ApplyPropertyDefaultBase<T>::SetterFunction setter, HasAutoFunction hasAuto, SetAutoFunction setAuto)
153         : ApplyPropertyDefaultBase<T>(getter, setter, 0)
154         , m_hasAuto(hasAuto)
155         , m_setAuto(setAuto)
156     {
157     }
158
159 protected:
160     virtual void applyInheritValue(CSSStyleSelector* selector) const
161     {
162         if (hasAuto(selector->parentStyle()))
163             setAuto(selector->style());
164         else
165             ApplyPropertyDefaultBase<T>::setValue(selector->style(), ApplyPropertyDefaultBase<T>::value(selector->parentStyle()));
166     }
167
168     virtual void applyInitialValue(CSSStyleSelector* selector) const
169     {
170         setAuto(selector->style());
171     }
172
173     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
174     {
175         if (!value->isPrimitiveValue())
176             return;
177
178         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
179         if (primitiveValue->getIdent() == autoIdentity)
180             setAuto(selector->style());
181         else if (valueType == Number)
182             ApplyPropertyDefaultBase<T>::setValue(selector->style(), *primitiveValue);
183         else if (valueType == ComputeLength)
184             ApplyPropertyDefaultBase<T>::setValue(selector->style(), primitiveValue->computeLength<T>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()));
185     }
186
187     bool hasAuto(RenderStyle* style) const
188     {
189         return (style->*m_hasAuto)();
190     }
191
192     void setAuto(RenderStyle* style) const
193     {
194         (style->*m_setAuto)();
195     }
196
197     HasAutoFunction m_hasAuto;
198     SetAutoFunction m_setAuto;
199 };
200
201 enum ColorInherit {NoInheritFromParent = 0, InheritFromParent};
202 template <ColorInherit inheritColorFromParent>
203 class ApplyPropertyColor : public ApplyPropertyBase {
204 public:
205     typedef const Color& (RenderStyle::*GetterFunction)() const;
206     typedef void (RenderStyle::*SetterFunction)(const Color&);
207     typedef const Color& (RenderStyle::*DefaultFunction)() const;
208     typedef Color (*InitialFunction)();
209
210     ApplyPropertyColor(GetterFunction getter, SetterFunction setter, DefaultFunction defaultFunction, InitialFunction initialFunction = 0)
211         : m_getter(getter)
212         , m_setter(setter)
213         , m_default(defaultFunction)
214         , m_initial(initialFunction)
215     {
216     }
217
218 private:
219     virtual void applyInheritValue(CSSStyleSelector* selector) const
220     {
221         const Color& color = (selector->parentStyle()->*m_getter)();
222         if (m_default && !color.isValid())
223             (selector->style()->*m_setter)((selector->parentStyle()->*m_default)());
224         else
225             (selector->style()->*m_setter)(color);
226     }
227
228     virtual void applyInitialValue(CSSStyleSelector* selector) const
229     {
230         (selector->style()->*m_setter)(m_initial ? m_initial() : Color());
231     }
232
233     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
234     {
235         if (!value->isPrimitiveValue())
236             return;
237
238         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
239         if (inheritColorFromParent && primitiveValue->getIdent() == CSSValueCurrentcolor)
240             applyInheritValue(selector);
241         else
242             (selector->style()->*m_setter)(selector->getColorFromPrimitiveValue(primitiveValue));
243     }
244
245     GetterFunction m_getter;
246     SetterFunction m_setter;
247     DefaultFunction m_default;
248     InitialFunction m_initial;
249 };
250
251 class ApplyPropertyDirection : public ApplyPropertyDefault<TextDirection> {
252 public:
253     ApplyPropertyDirection(GetterFunction getter, SetterFunction setter, InitialFunction initial)
254         : ApplyPropertyDefault<TextDirection>(getter, setter, initial)
255     {
256     }
257
258 private:
259     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
260     {
261         ApplyPropertyDefault<TextDirection>::applyValue(selector, value);
262         Element* element = selector->element();
263         if (element && selector->element() == element->document()->documentElement())
264             element->document()->setDirectionSetOnDocumentElement(true);
265     }
266 };
267
268 enum LengthAuto { AutoDisabled = 0, AutoEnabled };
269 enum LengthIntrinsic { IntrinsicDisabled = 0, IntrinsicEnabled };
270 enum LengthMinIntrinsic { MinIntrinsicDisabled = 0, MinIntrinsicEnabled };
271 enum LengthNone { NoneDisabled = 0, NoneEnabled };
272 enum LengthUndefined { UndefinedDisabled = 0, UndefinedEnabled };
273 enum LengthFlexDirection { FlexDirectionDisabled = 0, FlexWidth, FlexHeight };
274 template <LengthAuto autoEnabled = AutoDisabled,
275           LengthIntrinsic intrinsicEnabled = IntrinsicDisabled,
276           LengthMinIntrinsic minIntrinsicEnabled = MinIntrinsicDisabled,
277           LengthNone noneEnabled = NoneDisabled,
278           LengthUndefined noneUndefined = UndefinedDisabled,
279           LengthFlexDirection flexDirection = FlexDirectionDisabled>
280 class ApplyPropertyLength : public ApplyPropertyDefaultBase<Length> {
281 public:
282     ApplyPropertyLength(GetterFunction getter, SetterFunction setter, InitialFunction initial)
283         : ApplyPropertyDefaultBase<Length>(getter, setter, initial)
284     {
285     }
286
287 private:
288     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
289     {
290 #if ENABLE(CSS3_FLEXBOX)
291         if (!value->isPrimitiveValue()) {
292             if (!flexDirection || !value->isFlexValue())
293                 return;
294
295             CSSFlexValue* flexValue = static_cast<CSSFlexValue*>(value);
296             value = flexValue->preferredSize();
297
298             if (flexDirection == FlexWidth) {
299                 selector->style()->setFlexboxWidthPositiveFlex(flexValue->positiveFlex());
300                 selector->style()->setFlexboxWidthNegativeFlex(flexValue->negativeFlex());
301             } else if (flexDirection == FlexHeight) {
302                 selector->style()->setFlexboxHeightPositiveFlex(flexValue->positiveFlex());
303                 selector->style()->setFlexboxHeightNegativeFlex(flexValue->negativeFlex());
304             }
305         }
306 #else
307         if (!value->isPrimitiveValue())
308             return;
309 #endif
310
311         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
312         if (noneEnabled && primitiveValue->getIdent() == CSSValueNone)
313             if (noneUndefined)
314                 setValue(selector->style(), Length(undefinedLength, Fixed));
315             else
316                 setValue(selector->style(), Length());
317         else if (intrinsicEnabled && primitiveValue->getIdent() == CSSValueIntrinsic)
318             setValue(selector->style(), Length(Intrinsic));
319         else if (minIntrinsicEnabled && primitiveValue->getIdent() == CSSValueMinIntrinsic)
320             setValue(selector->style(), Length(MinIntrinsic));
321         else if (autoEnabled && primitiveValue->getIdent() == CSSValueAuto)
322             setValue(selector->style(), Length());
323         else {
324             int type = primitiveValue->primitiveType();
325             if (CSSPrimitiveValue::isUnitTypeLength(type)) {
326                 Length length = primitiveValue->computeLength<Length>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom());
327                 length.setQuirk(primitiveValue->isQuirkValue());
328                 setValue(selector->style(), length);
329             } else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
330                 setValue(selector->style(), Length(primitiveValue->getDoubleValue(), Percent));
331         }
332     }
333 };
334
335 enum StringIdentBehavior { NothingMapsToNull = 0, MapNoneToNull, MapAutoToNull };
336 template <StringIdentBehavior identBehavior = NothingMapsToNull>
337 class ApplyPropertyString : public ApplyPropertyDefaultBase<const AtomicString&> {
338 public:
339     ApplyPropertyString(GetterFunction getter, SetterFunction setter, InitialFunction initial)
340         : ApplyPropertyDefaultBase<const AtomicString&>(getter, setter, initial)
341     {
342     }
343
344 private:
345     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
346     {
347         if (!value->isPrimitiveValue())
348             return;
349         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
350         if ((identBehavior == MapNoneToNull && primitiveValue->getIdent() == CSSValueNone)
351             || (identBehavior == MapAutoToNull && primitiveValue->getIdent() == CSSValueAuto))
352             setValue(selector->style(), nullAtom);
353         else
354             setValue(selector->style(), primitiveValue->getStringValue());
355     }
356 };
357
358 class ApplyPropertyBorderRadius : public ApplyPropertyDefaultBase<LengthSize> {
359 public:
360     ApplyPropertyBorderRadius(GetterFunction getter, SetterFunction setter, InitialFunction initial)
361         : ApplyPropertyDefaultBase<LengthSize>(getter, setter, initial)
362     {
363     }
364 private:
365     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
366     {
367         if (!value->isPrimitiveValue())
368             return;
369
370         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
371         Pair* pair = primitiveValue->getPairValue();
372         if (!pair || !pair->first() || !pair->second())
373             return;
374
375         Length radiusWidth;
376         Length radiusHeight;
377         if (pair->first()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
378             radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
379         else
380             radiusWidth = Length(max(intMinForLength, min(intMaxForLength, pair->first()->computeLength<int>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()))), Fixed);
381         if (pair->second()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
382             radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
383         else
384             radiusHeight = Length(max(intMinForLength, min(intMaxForLength, pair->second()->computeLength<int>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()))), Fixed);
385         int width = radiusWidth.value();
386         int height = radiusHeight.value();
387         if (width < 0 || height < 0)
388             return;
389         if (!width)
390             radiusHeight = radiusWidth; // Null out the other value.
391         else if (!height)
392             radiusWidth = radiusHeight; // Null out the other value.
393
394         LengthSize size(radiusWidth, radiusHeight);
395         setValue(selector->style(), size);
396     }
397 };
398
399 template <typename T>
400 class ApplyPropertyFillLayer : public ApplyPropertyBase {
401 public:
402     ApplyPropertyFillLayer(CSSPropertyID propertyId, EFillLayerType fillLayerType, FillLayer* (RenderStyle::*accessLayers)(),
403                            const FillLayer* (RenderStyle::*layers)() const, bool (FillLayer::*test)() const, T (FillLayer::*get)() const,
404                            void (FillLayer::*set)(T), void (FillLayer::*clear)(), T (*initial)(EFillLayerType),
405                            void (CSSStyleSelector::*mapFill)(CSSPropertyID, FillLayer*, CSSValue*))
406         : m_propertyId(propertyId)
407         , m_fillLayerType(fillLayerType)
408         , m_accessLayers(accessLayers)
409         , m_layers(layers)
410         , m_test(test)
411         , m_get(get)
412         , m_set(set)
413         , m_clear(clear)
414         , m_initial(initial)
415         , m_mapFill(mapFill)
416     {
417     }
418
419 private:
420     virtual void applyInheritValue(CSSStyleSelector* selector) const
421     {
422         FillLayer* currChild = (selector->style()->*m_accessLayers)();
423         FillLayer* prevChild = 0;
424         const FillLayer* currParent = (selector->parentStyle()->*m_layers)();
425         while (currParent && (currParent->*m_test)()) {
426             if (!currChild) {
427                 /* Need to make a new layer.*/
428                 currChild = new FillLayer(m_fillLayerType);
429                 prevChild->setNext(currChild);
430             }
431             (currChild->*m_set)((currParent->*m_get)());
432             prevChild = currChild;
433             currChild = prevChild->next();
434             currParent = currParent->next();
435         }
436
437         while (currChild) {
438             /* Reset any remaining layers to not have the property set. */
439             (currChild->*m_clear)();
440             currChild = currChild->next();
441         }
442     }
443
444     virtual void applyInitialValue(CSSStyleSelector* selector) const
445     {
446         FillLayer* currChild = (selector->style()->*m_accessLayers)();
447         (currChild->*m_set)((*m_initial)(m_fillLayerType));
448         for (currChild = currChild->next(); currChild; currChild = currChild->next())
449             (currChild->*m_clear)();
450     }
451
452     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
453     {
454         FillLayer* currChild = (selector->style()->*m_accessLayers)();
455         FillLayer* prevChild = 0;
456         if (value->isValueList()) {
457             /* Walk each value and put it into a layer, creating new layers as needed. */
458             CSSValueList* valueList = static_cast<CSSValueList*>(value);
459             for (unsigned int i = 0; i < valueList->length(); i++) {
460                 if (!currChild) {
461                     /* Need to make a new layer to hold this value */
462                     currChild = new FillLayer(m_fillLayerType);
463                     prevChild->setNext(currChild);
464                 }
465                 (selector->*m_mapFill)(m_propertyId, currChild, valueList->itemWithoutBoundsCheck(i));
466                 prevChild = currChild;
467                 currChild = currChild->next();
468             }
469         } else {
470             (selector->*m_mapFill)(m_propertyId, currChild, value);
471             currChild = currChild->next();
472         }
473         while (currChild) {
474             /* Reset all remaining layers to not have the property set. */
475             (currChild->*m_clear)();
476             currChild = currChild->next();
477         }
478     }
479
480 protected:
481     CSSPropertyID m_propertyId;
482     EFillLayerType m_fillLayerType;
483     FillLayer* (RenderStyle::*m_accessLayers)();
484     const FillLayer* (RenderStyle::*m_layers)() const;
485     bool (FillLayer::*m_test)() const;
486     T (FillLayer::*m_get)() const;
487     void (FillLayer::*m_set)(T);
488     void (FillLayer::*m_clear)();
489     T (*m_initial)(EFillLayerType);
490     void (CSSStyleSelector::*m_mapFill)(CSSPropertyID, FillLayer*, CSSValue*);
491 };
492
493 enum ComputeLengthNormal {NormalDisabled = 0, NormalEnabled};
494 enum ComputeLengthThickness {ThicknessDisabled = 0, ThicknessEnabled};
495 enum ComputeLengthSVGZoom {SVGZoomDisabled = 0, SVGZoomEnabled};
496 template <typename T,
497           ComputeLengthNormal normalEnabled = NormalDisabled,
498           ComputeLengthThickness thicknessEnabled = ThicknessDisabled,
499           ComputeLengthSVGZoom svgZoomEnabled = SVGZoomDisabled>
500 class ApplyPropertyComputeLength : public ApplyPropertyDefaultBase<T> {
501 public:
502     ApplyPropertyComputeLength(typename ApplyPropertyDefaultBase<T>::GetterFunction getter, typename ApplyPropertyDefaultBase<T>::SetterFunction setter, typename ApplyPropertyDefaultBase<T>::InitialFunction initial)
503         : ApplyPropertyDefaultBase<T>(getter, setter, initial)
504     {
505     }
506
507 private:
508     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
509     {
510         // note: CSSPropertyLetter/WordSpacing right now sets to zero if it's not a primitive value for some reason...
511         if (!value->isPrimitiveValue())
512             return;
513
514         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
515
516         int ident = primitiveValue->getIdent();
517         T length;
518         if (normalEnabled && ident == CSSValueNormal) {
519             length = 0;
520         } else if (thicknessEnabled && ident == CSSValueThin) {
521             length = 1;
522         } else if (thicknessEnabled && ident == CSSValueMedium) {
523             length = 3;
524         } else if (thicknessEnabled && ident == CSSValueThick) {
525             length = 5;
526         } else if (ident == CSSValueInvalid) {
527             float zoom = (svgZoomEnabled && selector->useSVGZoomRules()) ? 1.0f : selector->style()->effectiveZoom();
528             length = primitiveValue->computeLength<T>(selector->style(), selector->rootElementStyle(), zoom);
529         } else {
530             ASSERT_NOT_REACHED();
531             length = 0;
532         }
533
534         this->setValue(selector->style(), length);
535     }
536 };
537
538 template <typename T>
539 class ApplyPropertyFont : public ApplyPropertyBase {
540 public:
541     typedef T (FontDescription::*GetterFunction)() const;
542     typedef void (FontDescription::*SetterFunction)(T);
543
544     ApplyPropertyFont(GetterFunction getter, SetterFunction setter, T initial)
545         : m_getter(getter)
546         , m_setter(setter)
547         , m_initial(initial)
548     {
549     }
550
551 private:
552     virtual void applyInheritValue(CSSStyleSelector* selector) const
553     {
554         FontDescription fontDescription = selector->fontDescription();
555         (fontDescription.*m_setter)((selector->parentFontDescription().*m_getter)());
556         selector->setFontDescription(fontDescription);
557     }
558
559     virtual void applyInitialValue(CSSStyleSelector* selector) const
560     {
561         FontDescription fontDescription = selector->fontDescription();
562         (fontDescription.*m_setter)(m_initial);
563         selector->setFontDescription(fontDescription);
564     }
565
566     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
567     {
568         if (!value->isPrimitiveValue())
569             return;
570         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
571         FontDescription fontDescription = selector->fontDescription();
572         (fontDescription.*m_setter)(*primitiveValue);
573         selector->setFontDescription(fontDescription);
574     }
575
576     GetterFunction m_getter;
577     SetterFunction m_setter;
578     T m_initial;
579 };
580
581 class ApplyPropertyFontWeight : public ApplyPropertyFont<FontWeight> {
582 public:
583     ApplyPropertyFontWeight()
584         : ApplyPropertyFont<FontWeight>(&FontDescription::weight, &FontDescription::setWeight, FontWeightNormal)
585     {
586     }
587
588     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
589     {
590         if (!value->isPrimitiveValue())
591             return;
592         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
593         FontDescription fontDescription = selector->fontDescription();
594         switch (primitiveValue->getIdent()) {
595         case CSSValueInvalid:
596             ASSERT_NOT_REACHED();
597             break;
598         case CSSValueBolder:
599             fontDescription.setWeight(fontDescription.bolderWeight());
600             break;
601         case CSSValueLighter:
602             fontDescription.setWeight(fontDescription.lighterWeight());
603             break;
604         default:
605             fontDescription.setWeight(*primitiveValue);
606         }
607         selector->setFontDescription(fontDescription);
608     }
609 };
610
611 enum CounterBehavior {Increment = 0, Reset};
612 template <CounterBehavior counterBehavior>
613 class ApplyPropertyCounter : public ApplyPropertyBase {
614 private:
615     virtual void applyInheritValue(CSSStyleSelector*) const { }
616     virtual void applyInitialValue(CSSStyleSelector*) const { }
617
618     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
619     {
620         if (!value->isValueList())
621             return;
622
623         CSSValueList* list = static_cast<CSSValueList*>(value);
624
625         CounterDirectiveMap& map = selector->style()->accessCounterDirectives();
626         typedef CounterDirectiveMap::iterator Iterator;
627
628         Iterator end = map.end();
629         for (Iterator it = map.begin(); it != end; ++it)
630             if (counterBehavior)
631                 it->second.m_reset = false;
632             else
633                 it->second.m_increment = false;
634
635         int length = list ? list->length() : 0;
636         for (int i = 0; i < length; ++i) {
637             CSSValue* currValue = list->itemWithoutBoundsCheck(i);
638             if (!currValue->isPrimitiveValue())
639                 continue;
640
641             Pair* pair = static_cast<CSSPrimitiveValue*>(currValue)->getPairValue();
642             if (!pair || !pair->first() || !pair->second())
643                 continue;
644
645             AtomicString identifier = static_cast<CSSPrimitiveValue*>(pair->first())->getStringValue();
646             // FIXME: What about overflow?
647             int value = static_cast<CSSPrimitiveValue*>(pair->second())->getIntValue();
648             CounterDirectives& directives = map.add(identifier.impl(), CounterDirectives()).first->second;
649             if (counterBehavior) {
650                 directives.m_reset = true;
651                 directives.m_resetValue = value;
652             } else {
653                 if (directives.m_increment)
654                     directives.m_incrementValue += value;
655                 else {
656                     directives.m_increment = true;
657                     directives.m_incrementValue = value;
658                 }
659             }
660         }
661     }
662 };
663
664
665 class ApplyPropertyCursor : public ApplyPropertyBase {
666 private:
667     virtual void applyInheritValue(CSSStyleSelector* selector) const
668     {
669         selector->style()->setCursor(selector->parentStyle()->cursor());
670         selector->style()->setCursorList(selector->parentStyle()->cursors());
671     }
672
673     virtual void applyInitialValue(CSSStyleSelector* selector) const
674     {
675         selector->style()->clearCursorList();
676         selector->style()->setCursor(RenderStyle::initialCursor());
677     }
678
679     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
680     {
681         selector->style()->clearCursorList();
682         if (value->isValueList()) {
683             CSSValueList* list = static_cast<CSSValueList*>(value);
684             int len = list->length();
685             selector->style()->setCursor(CURSOR_AUTO);
686             for (int i = 0; i < len; i++) {
687                 CSSValue* item = list->itemWithoutBoundsCheck(i);
688                 if (!item->isPrimitiveValue())
689                     continue;
690                 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
691                 int type = primitiveValue->primitiveType();
692                 if (type == CSSPrimitiveValue::CSS_URI) {
693                     if (primitiveValue->isCursorImageValue()) {
694                         CSSCursorImageValue* image = static_cast<CSSCursorImageValue*>(primitiveValue);
695                         if (image->updateIfSVGCursorIsUsed(selector->element())) // Elements with SVG cursors are not allowed to share style.
696                             selector->style()->setUnique();
697                         selector->style()->addCursor(selector->cachedOrPendingFromValue(CSSPropertyCursor, image), image->hotSpot());
698                     }
699                 } else if (type == CSSPrimitiveValue::CSS_IDENT)
700                     selector->style()->setCursor(*primitiveValue);
701             }
702         } else if (value->isPrimitiveValue()) {
703             CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
704             int type = primitiveValue->primitiveType();
705             if (type == CSSPrimitiveValue::CSS_IDENT && selector->style()->cursor() != ECursor(*primitiveValue))
706                 selector->style()->setCursor(*primitiveValue);
707         }
708     }
709 };
710
711 class ApplyPropertyTextEmphasisStyle : public ApplyPropertyBase {
712 private:
713     virtual void applyInheritValue(CSSStyleSelector* selector) const
714     {
715         selector->style()->setTextEmphasisFill(selector->parentStyle()->textEmphasisFill());
716         selector->style()->setTextEmphasisMark(selector->parentStyle()->textEmphasisMark());
717         selector->style()->setTextEmphasisCustomMark(selector->parentStyle()->textEmphasisCustomMark());
718     }
719
720     virtual void applyInitialValue(CSSStyleSelector* selector) const
721     {
722         selector->style()->setTextEmphasisFill(RenderStyle::initialTextEmphasisFill());
723         selector->style()->setTextEmphasisMark(RenderStyle::initialTextEmphasisMark());
724         selector->style()->setTextEmphasisCustomMark(RenderStyle::initialTextEmphasisCustomMark());
725     }
726
727     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
728     {
729         if (value->isValueList()) {
730             CSSValueList* list = static_cast<CSSValueList*>(value);
731             ASSERT(list->length() == 2);
732             if (list->length() != 2)
733                 return;
734             for (unsigned i = 0; i < 2; ++i) {
735                 CSSValue* item = list->itemWithoutBoundsCheck(i);
736                 if (!item->isPrimitiveValue())
737                     continue;
738
739                 CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(item);
740                 if (value->getIdent() == CSSValueFilled || value->getIdent() == CSSValueOpen)
741                     selector->style()->setTextEmphasisFill(*value);
742                 else
743                     selector->style()->setTextEmphasisMark(*value);
744             }
745             selector->style()->setTextEmphasisCustomMark(nullAtom);
746             return;
747         }
748
749         if (!value->isPrimitiveValue())
750             return;
751         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
752
753         if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_STRING) {
754             selector->style()->setTextEmphasisFill(TextEmphasisFillFilled);
755             selector->style()->setTextEmphasisMark(TextEmphasisMarkCustom);
756             selector->style()->setTextEmphasisCustomMark(primitiveValue->getStringValue());
757             return;
758         }
759
760         selector->style()->setTextEmphasisCustomMark(nullAtom);
761
762         if (primitiveValue->getIdent() == CSSValueFilled || primitiveValue->getIdent() == CSSValueOpen) {
763             selector->style()->setTextEmphasisFill(*primitiveValue);
764             selector->style()->setTextEmphasisMark(TextEmphasisMarkAuto);
765         } else {
766             selector->style()->setTextEmphasisFill(TextEmphasisFillFilled);
767             selector->style()->setTextEmphasisMark(*primitiveValue);
768         }
769
770     }
771 };
772
773 template <typename T>
774 class ApplyPropertyAnimation : public ApplyPropertyBase {
775 public:
776     typedef T (Animation::*GetterFunction)() const;
777     typedef void (Animation::*SetterFunction)(T);
778     typedef bool (Animation::*TestFunction)() const;
779     typedef void (Animation::*ClearFunction)();
780     typedef T (*InitialFunction)();
781     typedef void (CSSStyleSelector::*MapFunction)(Animation*, CSSValue*);
782     typedef AnimationList* (RenderStyle::*AnimationGetter)();
783     typedef const AnimationList* (RenderStyle::*ImmutableAnimationGetter)() const;
784
785     ApplyPropertyAnimation(GetterFunction getter, SetterFunction setter, TestFunction test, ClearFunction clear, InitialFunction initial, MapFunction map,
786                            AnimationGetter animationGetter, ImmutableAnimationGetter immutableAnimationGetter)
787         : m_getter(getter)
788         , m_setter(setter)
789         , m_test(test)
790         , m_clear(clear)
791         , m_initial(initial)
792         , m_map(map)
793         , m_animationGetter(animationGetter)
794         , m_immutableAnimationGetter(immutableAnimationGetter)
795     {
796     }
797
798 private:
799     virtual void applyInheritValue(CSSStyleSelector* selector) const
800     {
801         AnimationList* list = accessAnimations(selector->style());
802         const AnimationList* parentList = animations(selector->parentStyle());
803         size_t i = 0, parentSize = parentList ? parentList->size() : 0;
804         for ( ; i < parentSize && test(parentList->animation(i)); ++i) {
805             if (list->size() <= i)
806                 list->append(Animation::create());
807             setValue(list->animation(i), value(parentList->animation(i)));
808         }
809
810         /* Reset any remaining animations to not have the property set. */
811         for ( ; i < list->size(); ++i)
812             clear(list->animation(i));
813     }
814
815     virtual void applyInitialValue(CSSStyleSelector* selector) const
816     {
817         AnimationList* list = accessAnimations(selector->style());
818         if (list->isEmpty())
819             list->append(Animation::create());
820         setValue(list->animation(0), initial());
821         for (size_t i = 1; i < list->size(); ++i)
822             clear(list->animation(i));
823     }
824
825     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
826     {
827         AnimationList* list = accessAnimations(selector->style());
828         size_t childIndex = 0;
829         if (value->isValueList()) {
830             /* Walk each value and put it into an animation, creating new animations as needed. */
831             for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
832                 if (childIndex <= list->size())
833                     list->append(Animation::create());
834                 map(selector, list->animation(childIndex), i.value());
835                 ++childIndex;
836             }
837         } else {
838             if (list->isEmpty())
839                 list->append(Animation::create());
840             map(selector, list->animation(childIndex), value);
841             childIndex = 1;
842         }
843         for ( ; childIndex < list->size(); ++childIndex) {
844             /* Reset all remaining animations to not have the property set. */
845             clear(list->animation(childIndex));
846         }
847     }
848
849     void setValue(Animation* animation, T value) const { (animation->*m_setter)(value); }
850     T value(const Animation* animation) const { return (animation->*m_getter)(); }
851     bool test(const Animation* animation) const { return (animation->*m_test)(); }
852     void clear(Animation* animation) const { (animation->*m_clear)(); }
853     T initial() const { return (*m_initial)(); }
854     void map(CSSStyleSelector* selector, Animation* animation, CSSValue* value) const { (selector->*m_map)(animation, value); }
855     AnimationList* accessAnimations(RenderStyle* style) const { return (style->*m_animationGetter)(); }
856     const AnimationList* animations(RenderStyle* style) const { return (style->*m_immutableAnimationGetter)(); }
857
858     GetterFunction m_getter;
859     SetterFunction m_setter;
860     TestFunction m_test;
861     ClearFunction m_clear;
862     InitialFunction m_initial;
863     MapFunction m_map;
864     AnimationGetter m_animationGetter;
865     ImmutableAnimationGetter m_immutableAnimationGetter;
866 };
867
868 const CSSStyleApplyProperty& CSSStyleApplyProperty::sharedCSSStyleApplyProperty()
869 {
870     DEFINE_STATIC_LOCAL(CSSStyleApplyProperty, cssStyleApplyPropertyInstance, ());
871     return cssStyleApplyPropertyInstance;
872 }
873
874 CSSStyleApplyProperty::CSSStyleApplyProperty()
875 {
876     for (int i = 0; i < numCSSProperties; ++i)
877        m_propertyMap[i] = 0;
878
879     setPropertyHandler(CSSPropertyColor, new ApplyPropertyColor<InheritFromParent>(&RenderStyle::color, &RenderStyle::setColor, 0, RenderStyle::initialColor));
880     setPropertyHandler(CSSPropertyDirection, new ApplyPropertyDirection(&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection));
881
882     setPropertyHandler(CSSPropertyBackgroundAttachment, new ApplyPropertyFillLayer<EFillAttachment>(CSSPropertyBackgroundAttachment, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
883             &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &CSSStyleSelector::mapFillAttachment));
884     setPropertyHandler(CSSPropertyBackgroundClip, new ApplyPropertyFillLayer<EFillBox>(CSSPropertyBackgroundClip, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
885             &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSStyleSelector::mapFillClip));
886     setPropertyHandler(CSSPropertyWebkitBackgroundClip, CSSPropertyBackgroundClip);
887     setPropertyHandler(CSSPropertyWebkitBackgroundComposite, new ApplyPropertyFillLayer<CompositeOperator>(CSSPropertyWebkitBackgroundComposite, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
888             &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSStyleSelector::mapFillComposite));
889
890     setPropertyHandler(CSSPropertyBackgroundImage, new ApplyPropertyFillLayer<StyleImage*>(CSSPropertyBackgroundImage, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
891                 &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSStyleSelector::mapFillImage));
892
893     setPropertyHandler(CSSPropertyBackgroundOrigin, new ApplyPropertyFillLayer<EFillBox>(CSSPropertyBackgroundOrigin, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
894             &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSStyleSelector::mapFillOrigin));
895     setPropertyHandler(CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundOrigin);
896
897     setPropertyHandler(CSSPropertyBackgroundPositionX, new ApplyPropertyFillLayer<Length>(CSSPropertyBackgroundPositionX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
898                 &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSStyleSelector::mapFillXPosition));
899     setPropertyHandler(CSSPropertyBackgroundPositionY, new ApplyPropertyFillLayer<Length>(CSSPropertyBackgroundPositionY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
900                     &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSStyleSelector::mapFillYPosition));
901     setPropertyHandler(CSSPropertyBackgroundPosition, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBackgroundPositionX), propertyHandler(CSSPropertyBackgroundPositionY)));
902
903     setPropertyHandler(CSSPropertyBackgroundRepeatX, new ApplyPropertyFillLayer<EFillRepeat>(CSSPropertyBackgroundRepeatX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
904                 &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSStyleSelector::mapFillRepeatX));
905     setPropertyHandler(CSSPropertyBackgroundRepeatY, new ApplyPropertyFillLayer<EFillRepeat>(CSSPropertyBackgroundRepeatY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
906                     &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSStyleSelector::mapFillRepeatY));
907     setPropertyHandler(CSSPropertyBackgroundRepeat, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBackgroundRepeatX), propertyHandler(CSSPropertyBackgroundRepeatY)));
908
909     setPropertyHandler(CSSPropertyBackgroundSize, new ApplyPropertyFillLayer<FillSize>(CSSPropertyBackgroundSize, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
910             &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSStyleSelector::mapFillSize));
911     setPropertyHandler(CSSPropertyWebkitBackgroundSize, CSSPropertyBackgroundSize);
912
913     setPropertyHandler(CSSPropertyWebkitMaskAttachment, new ApplyPropertyFillLayer<EFillAttachment>(CSSPropertyWebkitMaskAttachment, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
914             &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &CSSStyleSelector::mapFillAttachment));
915     setPropertyHandler(CSSPropertyWebkitMaskClip, new ApplyPropertyFillLayer<EFillBox>(CSSPropertyWebkitMaskClip, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
916             &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSStyleSelector::mapFillClip));
917     setPropertyHandler(CSSPropertyWebkitMaskComposite, new ApplyPropertyFillLayer<CompositeOperator>(CSSPropertyWebkitMaskComposite, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
918             &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSStyleSelector::mapFillComposite));
919
920     setPropertyHandler(CSSPropertyWebkitMaskImage, new ApplyPropertyFillLayer<StyleImage*>(CSSPropertyWebkitMaskImage, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
921                 &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSStyleSelector::mapFillImage));
922
923     setPropertyHandler(CSSPropertyWebkitMaskOrigin, new ApplyPropertyFillLayer<EFillBox>(CSSPropertyWebkitMaskOrigin, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
924             &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSStyleSelector::mapFillOrigin));
925     setPropertyHandler(CSSPropertyWebkitMaskSize, new ApplyPropertyFillLayer<FillSize>(CSSPropertyWebkitMaskSize, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
926             &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSStyleSelector::mapFillSize));
927
928     setPropertyHandler(CSSPropertyWebkitMaskPositionX, new ApplyPropertyFillLayer<Length>(CSSPropertyWebkitMaskPositionX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
929                 &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSStyleSelector::mapFillXPosition));
930     setPropertyHandler(CSSPropertyWebkitMaskPositionY, new ApplyPropertyFillLayer<Length>(CSSPropertyWebkitMaskPositionY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
931                     &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSStyleSelector::mapFillYPosition));
932     setPropertyHandler(CSSPropertyWebkitMaskPosition, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyWebkitMaskPositionX), propertyHandler(CSSPropertyWebkitMaskPositionY)));
933
934     setPropertyHandler(CSSPropertyWebkitMaskRepeatX, new ApplyPropertyFillLayer<EFillRepeat>(CSSPropertyWebkitMaskRepeatX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
935                 &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSStyleSelector::mapFillRepeatX));
936     setPropertyHandler(CSSPropertyWebkitMaskRepeatY, new ApplyPropertyFillLayer<EFillRepeat>(CSSPropertyWebkitMaskRepeatY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
937                     &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSStyleSelector::mapFillRepeatY));
938     setPropertyHandler(CSSPropertyWebkitMaskRepeat, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBackgroundRepeatX), propertyHandler(CSSPropertyBackgroundRepeatY)));
939
940     setPropertyHandler(CSSPropertyBackgroundColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, 0));
941     setPropertyHandler(CSSPropertyBorderBottomColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::color));
942     setPropertyHandler(CSSPropertyBorderLeftColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::color));
943     setPropertyHandler(CSSPropertyBorderRightColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::color));
944     setPropertyHandler(CSSPropertyBorderTopColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::color));
945
946     setPropertyHandler(CSSPropertyBorderTopStyle, new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::borderTopStyle, &RenderStyle::setBorderTopStyle, &RenderStyle::initialBorderStyle));
947     setPropertyHandler(CSSPropertyBorderRightStyle, new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::borderRightStyle, &RenderStyle::setBorderRightStyle, &RenderStyle::initialBorderStyle));
948     setPropertyHandler(CSSPropertyBorderBottomStyle, new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::borderBottomStyle, &RenderStyle::setBorderBottomStyle, &RenderStyle::initialBorderStyle));
949     setPropertyHandler(CSSPropertyBorderLeftStyle, new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::borderLeftStyle, &RenderStyle::setBorderLeftStyle, &RenderStyle::initialBorderStyle));
950
951     setPropertyHandler(CSSPropertyBorderTopWidth, new ApplyPropertyComputeLength<unsigned short, NormalDisabled, ThicknessEnabled>(&RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth));
952     setPropertyHandler(CSSPropertyBorderRightWidth, new ApplyPropertyComputeLength<unsigned short, NormalDisabled, ThicknessEnabled>(&RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth));
953     setPropertyHandler(CSSPropertyBorderBottomWidth, new ApplyPropertyComputeLength<unsigned short, NormalDisabled, ThicknessEnabled>(&RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth));
954     setPropertyHandler(CSSPropertyBorderLeftWidth, new ApplyPropertyComputeLength<unsigned short, NormalDisabled, ThicknessEnabled>(&RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth));
955     setPropertyHandler(CSSPropertyOutlineWidth, new ApplyPropertyComputeLength<unsigned short, NormalDisabled, ThicknessEnabled>(&RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth, &RenderStyle::initialBorderWidth));
956     setPropertyHandler(CSSPropertyWebkitColumnRuleWidth, new ApplyPropertyComputeLength<unsigned short, NormalDisabled, ThicknessEnabled>(&RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth, &RenderStyle::initialBorderWidth));
957
958     setPropertyHandler(CSSPropertyBorderTop, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderTopColor), propertyHandler(CSSPropertyBorderTopStyle), propertyHandler(CSSPropertyBorderTopWidth)));
959     setPropertyHandler(CSSPropertyBorderRight, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderRightColor), propertyHandler(CSSPropertyBorderRightStyle), propertyHandler(CSSPropertyBorderRightWidth)));
960     setPropertyHandler(CSSPropertyBorderBottom, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderBottomColor), propertyHandler(CSSPropertyBorderBottomStyle), propertyHandler(CSSPropertyBorderBottomWidth)));
961     setPropertyHandler(CSSPropertyBorderLeft, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderLeftColor), propertyHandler(CSSPropertyBorderLeftStyle), propertyHandler(CSSPropertyBorderLeftWidth)));
962
963     setPropertyHandler(CSSPropertyBorderStyle, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderTopStyle), propertyHandler(CSSPropertyBorderRightStyle), propertyHandler(CSSPropertyBorderBottomStyle), propertyHandler(CSSPropertyBorderLeftStyle)));
964     setPropertyHandler(CSSPropertyBorderWidth, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderTopWidth), propertyHandler(CSSPropertyBorderRightWidth), propertyHandler(CSSPropertyBorderBottomWidth), propertyHandler(CSSPropertyBorderLeftWidth)));
965     setPropertyHandler(CSSPropertyBorderColor, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderTopColor), propertyHandler(CSSPropertyBorderRightColor), propertyHandler(CSSPropertyBorderBottomColor), propertyHandler(CSSPropertyBorderLeftColor)));
966     setPropertyHandler(CSSPropertyBorder, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderStyle), propertyHandler(CSSPropertyBorderWidth), propertyHandler(CSSPropertyBorderColor)));
967
968     setPropertyHandler(CSSPropertyBorderTopLeftRadius, new ApplyPropertyBorderRadius(&RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius, &RenderStyle::initialBorderRadius));
969     setPropertyHandler(CSSPropertyBorderTopRightRadius, new ApplyPropertyBorderRadius(&RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius, &RenderStyle::initialBorderRadius));
970     setPropertyHandler(CSSPropertyBorderBottomLeftRadius, new ApplyPropertyBorderRadius(&RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius, &RenderStyle::initialBorderRadius));
971     setPropertyHandler(CSSPropertyBorderBottomRightRadius, new ApplyPropertyBorderRadius(&RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius, &RenderStyle::initialBorderRadius));
972     setPropertyHandler(CSSPropertyBorderRadius, new ApplyPropertyExpanding<ExpandValue>(propertyHandler(CSSPropertyBorderTopLeftRadius), propertyHandler(CSSPropertyBorderTopRightRadius), propertyHandler(CSSPropertyBorderBottomLeftRadius), propertyHandler(CSSPropertyBorderBottomRightRadius)));
973     setPropertyHandler(CSSPropertyWebkitBorderRadius, CSSPropertyBorderRadius);
974
975     setPropertyHandler(CSSPropertyWebkitBorderHorizontalSpacing, new ApplyPropertyComputeLength<short>(&RenderStyle::horizontalBorderSpacing, &RenderStyle::setHorizontalBorderSpacing, &RenderStyle::initialHorizontalBorderSpacing));
976     setPropertyHandler(CSSPropertyWebkitBorderVerticalSpacing, new ApplyPropertyComputeLength<short>(&RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalBorderSpacing, &RenderStyle::initialVerticalBorderSpacing));
977     setPropertyHandler(CSSPropertyBorderSpacing, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyWebkitBorderHorizontalSpacing), propertyHandler(CSSPropertyWebkitBorderVerticalSpacing)));
978
979     setPropertyHandler(CSSPropertyLetterSpacing, new ApplyPropertyComputeLength<int, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>(&RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterWordSpacing));
980     setPropertyHandler(CSSPropertyWordSpacing, new ApplyPropertyComputeLength<int, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>(&RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLetterWordSpacing));
981
982     setPropertyHandler(CSSPropertyCursor, new ApplyPropertyCursor());
983
984     setPropertyHandler(CSSPropertyCounterIncrement, new ApplyPropertyCounter<Increment>());
985     setPropertyHandler(CSSPropertyCounterReset, new ApplyPropertyCounter<Reset>());
986
987 #if ENABLE(CSS3_FLEXBOX)
988     setPropertyHandler(CSSPropertyWebkitFlexOrder, new ApplyPropertyDefault<int>(&RenderStyle::flexOrder, &RenderStyle::setFlexOrder, &RenderStyle::initialFlexOrder));
989     setPropertyHandler(CSSPropertyWebkitFlexPack, new ApplyPropertyDefault<EFlexPack>(&RenderStyle::flexPack, &RenderStyle::setFlexPack, &RenderStyle::initialFlexPack));
990     setPropertyHandler(CSSPropertyWebkitFlexAlign, new ApplyPropertyDefault<EFlexAlign>(&RenderStyle::flexAlign, &RenderStyle::setFlexAlign, &RenderStyle::initialFlexAlign));
991 #endif
992
993     setPropertyHandler(CSSPropertyFontStyle, new ApplyPropertyFont<FontItalic>(&FontDescription::italic, &FontDescription::setItalic, FontItalicOff));
994     setPropertyHandler(CSSPropertyFontVariant, new ApplyPropertyFont<FontSmallCaps>(&FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff));
995     setPropertyHandler(CSSPropertyTextRendering, new ApplyPropertyFont<TextRenderingMode>(&FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering));
996     setPropertyHandler(CSSPropertyWebkitFontSmoothing, new ApplyPropertyFont<FontSmoothingMode>(&FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing));
997     setPropertyHandler(CSSPropertyWebkitTextOrientation, new ApplyPropertyFont<TextOrientation>(&FontDescription::textOrientation, &FontDescription::setTextOrientation, RenderStyle::initialTextOrientation()));
998     setPropertyHandler(CSSPropertyFontWeight, new ApplyPropertyFontWeight());
999
1000     setPropertyHandler(CSSPropertyOutlineStyle, new ApplyPropertyExpanding<ExpandValue>(new ApplyPropertyDefault<OutlineIsAuto>(&RenderStyle::outlineStyleIsAuto, &RenderStyle::setOutlineStyleIsAuto, &RenderStyle::initialOutlineStyleIsAuto), new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::outlineStyle, &RenderStyle::setOutlineStyle, &RenderStyle::initialBorderStyle)));
1001     setPropertyHandler(CSSPropertyOutlineColor, new ApplyPropertyColor<InheritFromParent>(&RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::color));
1002     setPropertyHandler(CSSPropertyOutlineOffset, new ApplyPropertyComputeLength<int>(&RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset, &RenderStyle::initialOutlineOffset));
1003
1004     setPropertyHandler(CSSPropertyOverflowX, new ApplyPropertyDefault<EOverflow>(&RenderStyle::overflowX, &RenderStyle::setOverflowX, &RenderStyle::initialOverflowX));
1005     setPropertyHandler(CSSPropertyOverflowY, new ApplyPropertyDefault<EOverflow>(&RenderStyle::overflowY, &RenderStyle::setOverflowY, &RenderStyle::initialOverflowY));
1006     setPropertyHandler(CSSPropertyOverflow, new ApplyPropertyExpanding<ExpandValue>(propertyHandler(CSSPropertyOverflowX), propertyHandler(CSSPropertyOverflowY)));
1007
1008     setPropertyHandler(CSSPropertyWebkitColumnRuleColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::color));
1009     setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::color));
1010     setPropertyHandler(CSSPropertyWebkitTextFillColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::color));
1011     setPropertyHandler(CSSPropertyWebkitTextStrokeColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::color));
1012
1013     setPropertyHandler(CSSPropertyTop, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset));
1014     setPropertyHandler(CSSPropertyRight, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::right, &RenderStyle::setRight, &RenderStyle::initialOffset));
1015     setPropertyHandler(CSSPropertyBottom, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset));
1016     setPropertyHandler(CSSPropertyLeft, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset));
1017
1018     setPropertyHandler(CSSPropertyWidth, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexWidth>(&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize));
1019     setPropertyHandler(CSSPropertyHeight, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexHeight>(&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize));
1020
1021     setPropertyHandler(CSSPropertyTextIndent, new ApplyPropertyLength<>(&RenderStyle::textIndent, &RenderStyle::setTextIndent, &RenderStyle::initialTextIndent));
1022
1023     setPropertyHandler(CSSPropertyMaxHeight, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneEnabled, UndefinedEnabled>(&RenderStyle::maxHeight, &RenderStyle::setMaxHeight, &RenderStyle::initialMaxSize));
1024     setPropertyHandler(CSSPropertyMaxWidth, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneEnabled, UndefinedEnabled>(&RenderStyle::maxWidth, &RenderStyle::setMaxWidth, &RenderStyle::initialMaxSize));
1025     setPropertyHandler(CSSPropertyMinHeight, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>(&RenderStyle::minHeight, &RenderStyle::setMinHeight, &RenderStyle::initialMinSize));
1026     setPropertyHandler(CSSPropertyMinWidth, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>(&RenderStyle::minWidth, &RenderStyle::setMinWidth, &RenderStyle::initialMinSize));
1027
1028     setPropertyHandler(CSSPropertyMarginTop, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::marginTop, &RenderStyle::setMarginTop, &RenderStyle::initialMargin));
1029     setPropertyHandler(CSSPropertyMarginRight, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::marginRight, &RenderStyle::setMarginRight, &RenderStyle::initialMargin));
1030     setPropertyHandler(CSSPropertyMarginBottom, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::marginBottom, &RenderStyle::setMarginBottom, &RenderStyle::initialMargin));
1031     setPropertyHandler(CSSPropertyMarginLeft, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::marginLeft, &RenderStyle::setMarginLeft, &RenderStyle::initialMargin));
1032     setPropertyHandler(CSSPropertyMargin, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyMarginTop), propertyHandler(CSSPropertyMarginRight), propertyHandler(CSSPropertyMarginBottom), propertyHandler(CSSPropertyMarginLeft)));
1033
1034     setPropertyHandler(CSSPropertyWebkitMarginBeforeCollapse, new ApplyPropertyDefault<EMarginCollapse>(&RenderStyle::marginBeforeCollapse, &RenderStyle::setMarginBeforeCollapse, &RenderStyle::initialMarginBeforeCollapse));
1035     setPropertyHandler(CSSPropertyWebkitMarginAfterCollapse, new ApplyPropertyDefault<EMarginCollapse>(&RenderStyle::marginAfterCollapse, &RenderStyle::setMarginAfterCollapse, &RenderStyle::initialMarginAfterCollapse));
1036     setPropertyHandler(CSSPropertyWebkitMarginTopCollapse, CSSPropertyWebkitMarginBeforeCollapse);
1037     setPropertyHandler(CSSPropertyWebkitMarginBottomCollapse, CSSPropertyWebkitMarginAfterCollapse);
1038     setPropertyHandler(CSSPropertyWebkitMarginCollapse, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyWebkitMarginBeforeCollapse), propertyHandler(CSSPropertyWebkitMarginAfterCollapse)));
1039
1040     setPropertyHandler(CSSPropertyPaddingTop, new ApplyPropertyLength<>(&RenderStyle::paddingTop, &RenderStyle::setPaddingTop, &RenderStyle::initialPadding));
1041     setPropertyHandler(CSSPropertyPaddingRight, new ApplyPropertyLength<>(&RenderStyle::paddingRight, &RenderStyle::setPaddingRight, &RenderStyle::initialPadding));
1042     setPropertyHandler(CSSPropertyPaddingBottom, new ApplyPropertyLength<>(&RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom, &RenderStyle::initialPadding));
1043     setPropertyHandler(CSSPropertyPaddingLeft, new ApplyPropertyLength<>(&RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft, &RenderStyle::initialPadding));
1044     setPropertyHandler(CSSPropertyPadding, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyPaddingTop), propertyHandler(CSSPropertyPaddingRight), propertyHandler(CSSPropertyPaddingBottom), propertyHandler(CSSPropertyPaddingLeft)));
1045
1046     setPropertyHandler(CSSPropertyWebkitPerspectiveOriginX, new ApplyPropertyLength<>(&RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX, &RenderStyle::initialPerspectiveOriginX));
1047     setPropertyHandler(CSSPropertyWebkitPerspectiveOriginY, new ApplyPropertyLength<>(&RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOriginY, &RenderStyle::initialPerspectiveOriginY));
1048     setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyWebkitPerspectiveOriginX), propertyHandler(CSSPropertyWebkitPerspectiveOriginY)));
1049     setPropertyHandler(CSSPropertyWebkitTransformOriginX, new ApplyPropertyLength<>(&RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX, &RenderStyle::initialTransformOriginX));
1050     setPropertyHandler(CSSPropertyWebkitTransformOriginY, new ApplyPropertyLength<>(&RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY, &RenderStyle::initialTransformOriginY));
1051     setPropertyHandler(CSSPropertyWebkitTransformOriginZ, new ApplyPropertyComputeLength<float>(&RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ, &RenderStyle::initialTransformOriginZ));
1052     setPropertyHandler(CSSPropertyWebkitTransformOrigin, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyWebkitTransformOriginX), propertyHandler(CSSPropertyWebkitTransformOriginY), propertyHandler(CSSPropertyWebkitTransformOriginZ)));
1053
1054     setPropertyHandler(CSSPropertyWebkitAnimationDelay, new ApplyPropertyAnimation<double>(&Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSStyleSelector::mapAnimationDelay, &RenderStyle::accessAnimations, &RenderStyle::animations));
1055     setPropertyHandler(CSSPropertyWebkitAnimationDirection, new ApplyPropertyAnimation<Animation::AnimationDirection>(&Animation::direction, &Animation::setDirection, &Animation::isDirectionSet, &Animation::clearDirection, &Animation::initialAnimationDirection, &CSSStyleSelector::mapAnimationDirection, &RenderStyle::accessAnimations, &RenderStyle::animations));
1056     setPropertyHandler(CSSPropertyWebkitAnimationDuration, new ApplyPropertyAnimation<double>(&Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSStyleSelector::mapAnimationDuration, &RenderStyle::accessAnimations, &RenderStyle::animations));
1057     setPropertyHandler(CSSPropertyWebkitAnimationFillMode, new ApplyPropertyAnimation<unsigned>(&Animation::fillMode, &Animation::setFillMode, &Animation::isFillModeSet, &Animation::clearFillMode, &Animation::initialAnimationFillMode, &CSSStyleSelector::mapAnimationFillMode, &RenderStyle::accessAnimations, &RenderStyle::animations));
1058     setPropertyHandler(CSSPropertyWebkitAnimationIterationCount, new ApplyPropertyAnimation<int>(&Animation::iterationCount, &Animation::setIterationCount, &Animation::isIterationCountSet, &Animation::clearIterationCount, &Animation::initialAnimationIterationCount, &CSSStyleSelector::mapAnimationIterationCount, &RenderStyle::accessAnimations, &RenderStyle::animations));
1059     setPropertyHandler(CSSPropertyWebkitAnimationName, new ApplyPropertyAnimation<const String&>(&Animation::name, &Animation::setName, &Animation::isNameSet, &Animation::clearName, &Animation::initialAnimationName, &CSSStyleSelector::mapAnimationName, &RenderStyle::accessAnimations, &RenderStyle::animations));
1060     setPropertyHandler(CSSPropertyWebkitAnimationPlayState, new ApplyPropertyAnimation<EAnimPlayState>(&Animation::playState, &Animation::setPlayState, &Animation::isPlayStateSet, &Animation::clearPlayState, &Animation::initialAnimationPlayState, &CSSStyleSelector::mapAnimationPlayState, &RenderStyle::accessAnimations, &RenderStyle::animations));
1061     setPropertyHandler(CSSPropertyWebkitAnimationTimingFunction, new ApplyPropertyAnimation<const PassRefPtr<TimingFunction> >(&Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSStyleSelector::mapAnimationTimingFunction, &RenderStyle::accessAnimations, &RenderStyle::animations));
1062
1063     setPropertyHandler(CSSPropertyWebkitTransitionDelay, new ApplyPropertyAnimation<double>(&Animation::delay, &Animation::setDelay, &Animation::isDelaySet, &Animation::clearDelay, &Animation::initialAnimationDelay, &CSSStyleSelector::mapAnimationDelay, &RenderStyle::accessTransitions, &RenderStyle::transitions));
1064     setPropertyHandler(CSSPropertyWebkitTransitionDuration, new ApplyPropertyAnimation<double>(&Animation::duration, &Animation::setDuration, &Animation::isDurationSet, &Animation::clearDuration, &Animation::initialAnimationDuration, &CSSStyleSelector::mapAnimationDuration, &RenderStyle::accessTransitions, &RenderStyle::transitions));
1065     setPropertyHandler(CSSPropertyWebkitTransitionProperty, new ApplyPropertyAnimation<int>(&Animation::property, &Animation::setProperty, &Animation::isPropertySet, &Animation::clearProperty, &Animation::initialAnimationProperty, &CSSStyleSelector::mapAnimationProperty, &RenderStyle::accessTransitions, &RenderStyle::transitions));
1066     setPropertyHandler(CSSPropertyWebkitTransitionTimingFunction, new ApplyPropertyAnimation<const PassRefPtr<TimingFunction> >(&Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSStyleSelector::mapAnimationTimingFunction, &RenderStyle::accessTransitions, &RenderStyle::transitions));
1067
1068
1069     setPropertyHandler(CSSPropertyWebkitColumnCount, new ApplyPropertyAuto<unsigned short>(&RenderStyle::columnCount, &RenderStyle::setColumnCount, &RenderStyle::hasAutoColumnCount, &RenderStyle::setHasAutoColumnCount));
1070     setPropertyHandler(CSSPropertyWebkitColumnGap, new ApplyPropertyAuto<float, ComputeLength, CSSValueNormal>(&RenderStyle::columnGap, &RenderStyle::setColumnGap, &RenderStyle::hasNormalColumnGap, &RenderStyle::setHasNormalColumnGap));
1071     setPropertyHandler(CSSPropertyWebkitColumnWidth, new ApplyPropertyAuto<float, ComputeLength>(&RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth));
1072     setPropertyHandler(CSSPropertyWebkitColumns, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyWebkitColumnWidth), propertyHandler(CSSPropertyWebkitColumnCount)));
1073
1074     setPropertyHandler(CSSPropertyWebkitHighlight, new ApplyPropertyString<MapNoneToNull>(&RenderStyle::highlight, &RenderStyle::setHighlight, &RenderStyle::initialHighlight));
1075     setPropertyHandler(CSSPropertyWebkitHyphenateCharacter, new ApplyPropertyString<MapAutoToNull>(&RenderStyle::hyphenationString, &RenderStyle::setHyphenationString, &RenderStyle::initialHyphenationString));
1076
1077     setPropertyHandler(CSSPropertyWebkitTextCombine, new ApplyPropertyDefault<TextCombine>(&RenderStyle::textCombine, &RenderStyle::setTextCombine, &RenderStyle::initialTextCombine));
1078     setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, new ApplyPropertyDefault<TextEmphasisPosition>(&RenderStyle::textEmphasisPosition, &RenderStyle::setTextEmphasisPosition, &RenderStyle::initialTextEmphasisPosition));
1079     setPropertyHandler(CSSPropertyWebkitTextEmphasisStyle, new ApplyPropertyTextEmphasisStyle());
1080
1081     setPropertyHandler(CSSPropertyZIndex, new ApplyPropertyAuto<int>(&RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex));
1082 }
1083
1084
1085 }