LLVM Compiler build fix.
[WebKit.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 "CSSPrimitiveValueMappings.h"
29 #include "CSSStyleSelector.h"
30 #include "CSSValueList.h"
31 #include "Document.h"
32 #include "Element.h"
33 #include "Pair.h"
34 #include "RenderStyle.h"
35 #include <wtf/StdLibExtras.h>
36 #include <wtf/UnusedParam.h>
37
38 using namespace std;
39
40 namespace WebCore {
41
42 enum ExpandValueBehavior {SuppressValue = 0, ExpandValue};
43 template <ExpandValueBehavior expandValue>
44 class ApplyPropertyExpanding : public ApplyPropertyBase {
45 public:
46     ApplyPropertyExpanding(ApplyPropertyBase* one = 0, ApplyPropertyBase* two = 0, ApplyPropertyBase *three = 0, ApplyPropertyBase* four = 0)
47     {
48         m_propertyMap[0] = one;
49         m_propertyMap[1] = two;
50         m_propertyMap[2] = three;
51         m_propertyMap[3] = four;
52         m_propertyMap[4] = 0; // always null terminated
53     }
54
55     virtual void applyInheritValue(CSSStyleSelector* selector) const
56     {
57         for (ApplyPropertyBase* const* e = m_propertyMap; *e; e++)
58             (*e)->applyInheritValue(selector);
59     }
60
61     virtual void applyInitialValue(CSSStyleSelector* selector) const
62     {
63         for (ApplyPropertyBase* const* e = m_propertyMap; *e; e++)
64             (*e)->applyInitialValue(selector);
65     }
66
67     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
68     {
69         if (!expandValue)
70             return;
71
72         for (ApplyPropertyBase* const* e = m_propertyMap; *e; e++)
73             (*e)->applyValue(selector, value);
74     }
75 private:
76     ApplyPropertyBase* m_propertyMap[5];
77 };
78
79 template <typename T>
80 class ApplyPropertyDefaultBase : public ApplyPropertyBase {
81 public:
82     typedef T (RenderStyle::*GetterFunction)() const;
83     typedef void (RenderStyle::*SetterFunction)(T);
84     typedef T (*InitialFunction)();
85
86     ApplyPropertyDefaultBase(GetterFunction getter, SetterFunction setter, InitialFunction initial)
87         : m_getter(getter)
88         , m_setter(setter)
89         , m_initial(initial)
90     {
91     }
92
93 private:
94     virtual void applyInheritValue(CSSStyleSelector* selector) const
95     {
96         setValue(selector->style(), value(selector->parentStyle()));
97     }
98
99     virtual void applyInitialValue(CSSStyleSelector* selector) const
100     {
101         setValue(selector->style(), initial());
102     }
103
104 protected:
105     void setValue(RenderStyle* style, T value) const
106     {
107         (style->*m_setter)(value);
108     }
109
110     T value(RenderStyle* style) const
111     {
112         return (style->*m_getter)();
113     }
114
115     T initial() const
116     {
117         return (*m_initial)();
118     }
119
120     GetterFunction m_getter;
121     SetterFunction m_setter;
122     InitialFunction m_initial;
123 };
124
125
126 template <typename T>
127 class ApplyPropertyDefault : public ApplyPropertyDefaultBase<T> {
128 public:
129     ApplyPropertyDefault(typename ApplyPropertyDefaultBase<T>::GetterFunction getter, typename ApplyPropertyDefaultBase<T>::SetterFunction setter, typename ApplyPropertyDefaultBase<T>::InitialFunction initial)
130         : ApplyPropertyDefaultBase<T>(getter, setter, initial)
131     {
132     }
133
134 protected:
135     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
136     {
137         if (value->isPrimitiveValue())
138             ApplyPropertyDefaultBase<T>::setValue(selector->style(), *static_cast<CSSPrimitiveValue*>(value));
139     }
140 };
141
142 enum ColorInherit {NoInheritFromParent = 0, InheritFromParent};
143 template <ColorInherit inheritColorFromParent>
144 class ApplyPropertyColor : public ApplyPropertyBase {
145 public:
146     typedef const Color& (RenderStyle::*GetterFunction)() const;
147     typedef void (RenderStyle::*SetterFunction)(const Color&);
148     typedef const Color& (RenderStyle::*DefaultFunction)() const;
149     typedef Color (*InitialFunction)();
150
151     ApplyPropertyColor(GetterFunction getter, SetterFunction setter, DefaultFunction defaultFunction, InitialFunction initialFunction = 0)
152         : m_getter(getter)
153         , m_setter(setter)
154         , m_default(defaultFunction)
155         , m_initial(initialFunction)
156     {
157     }
158
159 private:
160     virtual void applyInheritValue(CSSStyleSelector* selector) const
161     {
162         const Color& color = (selector->parentStyle()->*m_getter)();
163         if (m_default && !color.isValid())
164             (selector->style()->*m_setter)((selector->parentStyle()->*m_default)());
165         else
166             (selector->style()->*m_setter)(color);
167     }
168
169     virtual void applyInitialValue(CSSStyleSelector* selector) const
170     {
171         (selector->style()->*m_setter)(m_initial ? m_initial() : Color());
172     }
173
174     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
175     {
176         if (!value->isPrimitiveValue())
177             return;
178
179         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
180         if (inheritColorFromParent && primitiveValue->getIdent() == CSSValueCurrentcolor)
181             applyInheritValue(selector);
182         else
183             (selector->style()->*m_setter)(selector->getColorFromPrimitiveValue(primitiveValue));
184     }
185
186     GetterFunction m_getter;
187     SetterFunction m_setter;
188     DefaultFunction m_default;
189     InitialFunction m_initial;
190 };
191
192 class ApplyPropertyDirection : public ApplyPropertyDefault<TextDirection> {
193 public:
194     ApplyPropertyDirection(GetterFunction getter, SetterFunction setter, InitialFunction initial)
195         : ApplyPropertyDefault<TextDirection>(getter, setter, initial)
196     {
197     }
198
199 private:
200     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
201     {
202         ApplyPropertyDefault<TextDirection>::applyValue(selector, value);
203         Element* element = selector->element();
204         if (element && selector->element() == element->document()->documentElement())
205             element->document()->setDirectionSetOnDocumentElement(true);
206     }
207 };
208
209 enum LengthAuto {AutoDisabled = 0, AutoEnabled = 1};
210 enum LengthIntrinsic {IntrinsicDisabled = 0, IntrinsicEnabled = 1};
211 enum LengthMinIntrinsic {MinIntrinsicDisabled = 0, MinIntrinsicEnabled = 1};
212 enum LengthNone {NoneDisabled = 0, NoneEnabled = 1};
213 enum LengthUndefined {UndefinedDisabled = 0, UndefinedEnabled = 1};
214 template <LengthAuto autoEnabled = AutoDisabled,
215           LengthIntrinsic intrinsicEnabled = IntrinsicDisabled,
216           LengthMinIntrinsic minIntrinsicEnabled = MinIntrinsicDisabled,
217           LengthNone noneEnabled = NoneDisabled,
218           LengthUndefined noneUndefined = UndefinedDisabled>
219 class ApplyPropertyLength : public ApplyPropertyDefaultBase<Length> {
220 public:
221     ApplyPropertyLength(GetterFunction getter, SetterFunction setter, InitialFunction initial)
222         : ApplyPropertyDefaultBase<Length>(getter, setter, initial)
223     {
224     }
225
226 private:
227     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
228     {
229         if (!value->isPrimitiveValue())
230             return;
231
232         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
233         if (noneEnabled && primitiveValue->getIdent() == CSSValueNone)
234             if (noneUndefined)
235                 setValue(selector->style(), Length(undefinedLength, Fixed));
236             else
237                 setValue(selector->style(), Length());
238         else if (intrinsicEnabled && primitiveValue->getIdent() == CSSValueIntrinsic)
239             setValue(selector->style(), Length(Intrinsic));
240         else if (minIntrinsicEnabled && primitiveValue->getIdent() == CSSValueMinIntrinsic)
241             setValue(selector->style(), Length(MinIntrinsic));
242         else if (autoEnabled && primitiveValue->getIdent() == CSSValueAuto)
243             setValue(selector->style(), Length());
244         else {
245             int type = primitiveValue->primitiveType();
246             if (CSSPrimitiveValue::isUnitTypeLength(type))
247                 setValue(selector->style(), Length(primitiveValue->computeLengthIntForLength(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()), Fixed, primitiveValue->isQuirkValue()));
248             else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
249                 setValue(selector->style(), Length(primitiveValue->getDoubleValue(), Percent));
250         }
251     }
252 };
253
254 class ApplyPropertyBorderRadius : public ApplyPropertyDefaultBase<LengthSize> {
255 public:
256     ApplyPropertyBorderRadius(GetterFunction getter, SetterFunction setter, InitialFunction initial)
257         : ApplyPropertyDefaultBase<LengthSize>(getter, setter, initial)
258     {
259     }
260 private:
261     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
262     {
263         if (!value->isPrimitiveValue())
264             return;
265
266         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
267         Pair* pair = primitiveValue->getPairValue();
268         if (!pair || !pair->first() || !pair->second())
269             return;
270
271         Length radiusWidth;
272         Length radiusHeight;
273         if (pair->first()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
274             radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
275         else
276             radiusWidth = Length(max(intMinForLength, min(intMaxForLength, pair->first()->computeLength<int>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()))), Fixed);
277         if (pair->second()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
278             radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
279         else
280             radiusHeight = Length(max(intMinForLength, min(intMaxForLength, pair->second()->computeLength<int>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom()))), Fixed);
281         int width = radiusWidth.value();
282         int height = radiusHeight.value();
283         if (width < 0 || height < 0)
284             return;
285         if (!width)
286             radiusHeight = radiusWidth; // Null out the other value.
287         else if (!height)
288             radiusWidth = radiusHeight; // Null out the other value.
289
290         LengthSize size(radiusWidth, radiusHeight);
291         setValue(selector->style(), size);
292     }
293 };
294
295 template <typename T>
296 class ApplyPropertyFillLayer : public ApplyPropertyBase {
297 public:
298     ApplyPropertyFillLayer(CSSPropertyID propertyId, EFillLayerType fillLayerType, FillLayer* (RenderStyle::*accessLayers)(),
299                            const FillLayer* (RenderStyle::*layers)() const, bool (FillLayer::*test)() const, T (FillLayer::*get)() const,
300                            void (FillLayer::*set)(T), void (FillLayer::*clear)(), T (*initial)(EFillLayerType),
301                            void (CSSStyleSelector::*mapFill)(CSSPropertyID, FillLayer*, CSSValue*))
302         : m_propertyId(propertyId)
303         , m_fillLayerType(fillLayerType)
304         , m_accessLayers(accessLayers)
305         , m_layers(layers)
306         , m_test(test)
307         , m_get(get)
308         , m_set(set)
309         , m_clear(clear)
310         , m_initial(initial)
311         , m_mapFill(mapFill)
312     {
313     }
314
315 private:
316     virtual void applyInheritValue(CSSStyleSelector* selector) const
317     {
318         FillLayer* currChild = (selector->style()->*m_accessLayers)();
319         FillLayer* prevChild = 0;
320         const FillLayer* currParent = (selector->parentStyle()->*m_layers)();
321         while (currParent && (currParent->*m_test)()) {
322             if (!currChild) {
323                 /* Need to make a new layer.*/
324                 currChild = new FillLayer(m_fillLayerType);
325                 prevChild->setNext(currChild);
326             }
327             (currChild->*m_set)((currParent->*m_get)());
328             prevChild = currChild;
329             currChild = prevChild->next();
330             currParent = currParent->next();
331         }
332
333         while (currChild) {
334             /* Reset any remaining layers to not have the property set. */
335             (currChild->*m_clear)();
336             currChild = currChild->next();
337         }
338     }
339
340     virtual void applyInitialValue(CSSStyleSelector* selector) const
341     {
342         FillLayer* currChild = (selector->style()->*m_accessLayers)();
343         (currChild->*m_set)((*m_initial)(m_fillLayerType));
344         for (currChild = currChild->next(); currChild; currChild = currChild->next())
345             (currChild->*m_clear)();
346     }
347
348     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
349     {
350         FillLayer* currChild = (selector->style()->*m_accessLayers)();
351         FillLayer* prevChild = 0;
352         if (value->isValueList()) {
353             /* Walk each value and put it into a layer, creating new layers as needed. */
354             CSSValueList* valueList = static_cast<CSSValueList*>(value);
355             for (unsigned int i = 0; i < valueList->length(); i++) {
356                 if (!currChild) {
357                     /* Need to make a new layer to hold this value */
358                     currChild = new FillLayer(m_fillLayerType);
359                     prevChild->setNext(currChild);
360                 }
361                 (selector->*m_mapFill)(m_propertyId, currChild, valueList->itemWithoutBoundsCheck(i));
362                 prevChild = currChild;
363                 currChild = currChild->next();
364             }
365         } else {
366             (selector->*m_mapFill)(m_propertyId, currChild, value);
367             currChild = currChild->next();
368         }
369         while (currChild) {
370             /* Reset all remaining layers to not have the property set. */
371             (currChild->*m_clear)();
372             currChild = currChild->next();
373         }
374     }
375
376 protected:
377     CSSPropertyID m_propertyId;
378     EFillLayerType m_fillLayerType;
379     FillLayer* (RenderStyle::*m_accessLayers)();
380     const FillLayer* (RenderStyle::*m_layers)() const;
381     bool (FillLayer::*m_test)() const;
382     T (FillLayer::*m_get)() const;
383     void (FillLayer::*m_set)(T);
384     void (FillLayer::*m_clear)();
385     T (*m_initial)(EFillLayerType);
386     void (CSSStyleSelector::*m_mapFill)(CSSPropertyID, FillLayer*, CSSValue*);
387 };
388
389 enum ComputeLengthNormal {NormalDisabled = 0, NormalEnabled};
390 enum ComputeLengthThickness {ThicknessDisabled = 0, ThicknessEnabled};
391 enum ComputeLengthSVGZoom {SVGZoomDisabled = 0, SVGZoomEnabled};
392 template <typename T,
393           ComputeLengthNormal normalEnabled = NormalDisabled,
394           ComputeLengthThickness thicknessEnabled = ThicknessDisabled,
395           ComputeLengthSVGZoom svgZoomEnabled = SVGZoomDisabled>
396 class ApplyPropertyComputeLength : public ApplyPropertyDefaultBase<T> {
397 public:
398     ApplyPropertyComputeLength(typename ApplyPropertyDefaultBase<T>::GetterFunction getter, typename ApplyPropertyDefaultBase<T>::SetterFunction setter, typename ApplyPropertyDefaultBase<T>::InitialFunction initial)
399         : ApplyPropertyDefaultBase<T>(getter, setter, initial)
400     {
401     }
402
403 private:
404     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
405     {
406         // note: CSSPropertyLetter/WordSpacing right now sets to zero if it's not a primitive value for some reason...
407         if (!value->isPrimitiveValue())
408             return;
409
410         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
411
412         int ident = primitiveValue->getIdent();
413         T length;
414         if (normalEnabled && ident == CSSValueNormal) {
415             length = 0;
416         } else if (thicknessEnabled && ident == CSSValueThin) {
417             length = 1;
418         } else if (thicknessEnabled && ident == CSSValueMedium) {
419             length = 3;
420         } else if (thicknessEnabled && ident == CSSValueThick) {
421             length = 5;
422         } else if (ident == CSSValueInvalid) {
423             float zoom = (svgZoomEnabled && selector->useSVGZoomRules()) ? 1.0f : selector->style()->effectiveZoom();
424             length = primitiveValue->computeLength<T>(selector->style(), selector->rootElementStyle(), zoom);
425         } else {
426             ASSERT_NOT_REACHED();
427             length = 0;
428         }
429
430         this->setValue(selector->style(), length);
431     }
432 };
433
434 template <typename T>
435 class ApplyPropertyFont : public ApplyPropertyBase {
436 public:
437     typedef T (FontDescription::*GetterFunction)() const;
438     typedef void (FontDescription::*SetterFunction)(T);
439
440     ApplyPropertyFont(GetterFunction getter, SetterFunction setter, T initial)
441         : m_getter(getter)
442         , m_setter(setter)
443         , m_initial(initial)
444     {
445     }
446
447 private:
448     virtual void applyInheritValue(CSSStyleSelector* selector) const
449     {
450         FontDescription fontDescription = selector->fontDescription();
451         (fontDescription.*m_setter)((selector->parentFontDescription().*m_getter)());
452         selector->setFontDescription(fontDescription);
453     }
454
455     virtual void applyInitialValue(CSSStyleSelector* selector) const
456     {
457         FontDescription fontDescription = selector->fontDescription();
458         (fontDescription.*m_setter)(m_initial);
459         selector->setFontDescription(fontDescription);
460     }
461
462     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
463     {
464         if (!value->isPrimitiveValue())
465             return;
466         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
467         FontDescription fontDescription = selector->fontDescription();
468         (fontDescription.*m_setter)(*primitiveValue);
469         selector->setFontDescription(fontDescription);
470     }
471
472     GetterFunction m_getter;
473     SetterFunction m_setter;
474     T m_initial;
475 };
476
477 class ApplyPropertyFontWeight : public ApplyPropertyFont<FontWeight> {
478 public:
479     ApplyPropertyFontWeight()
480         : ApplyPropertyFont<FontWeight>(&FontDescription::weight, &FontDescription::setWeight, FontWeightNormal)
481     {
482     }
483
484     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
485     {
486         if (!value->isPrimitiveValue())
487             return;
488         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
489         FontDescription fontDescription = selector->fontDescription();
490         switch (primitiveValue->getIdent()) {
491         case CSSValueInvalid:
492             ASSERT_NOT_REACHED();
493             break;
494         case CSSValueBolder:
495             fontDescription.setWeight(fontDescription.bolderWeight());
496             break;
497         case CSSValueLighter:
498             fontDescription.setWeight(fontDescription.lighterWeight());
499             break;
500         default:
501             fontDescription.setWeight(*primitiveValue);
502         }
503         selector->setFontDescription(fontDescription);
504     }
505 };
506
507 const CSSStyleApplyProperty& CSSStyleApplyProperty::sharedCSSStyleApplyProperty()
508 {
509     DEFINE_STATIC_LOCAL(CSSStyleApplyProperty, cssStyleApplyPropertyInstance, ());
510     return cssStyleApplyPropertyInstance;
511 }
512
513 CSSStyleApplyProperty::CSSStyleApplyProperty()
514 {
515     for (int i = 0; i < numCSSProperties; ++i)
516        m_propertyMap[i] = 0;
517
518     setPropertyHandler(CSSPropertyColor, new ApplyPropertyColor<InheritFromParent>(&RenderStyle::color, &RenderStyle::setColor, 0, RenderStyle::initialColor));
519     setPropertyHandler(CSSPropertyDirection, new ApplyPropertyDirection(&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection));
520
521     setPropertyHandler(CSSPropertyBackgroundAttachment, new ApplyPropertyFillLayer<EFillAttachment>(CSSPropertyBackgroundAttachment, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
522             &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &CSSStyleSelector::mapFillAttachment));
523     setPropertyHandler(CSSPropertyBackgroundClip, new ApplyPropertyFillLayer<EFillBox>(CSSPropertyBackgroundClip, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
524             &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSStyleSelector::mapFillClip));
525     setPropertyHandler(CSSPropertyWebkitBackgroundClip, CSSPropertyBackgroundClip);
526     setPropertyHandler(CSSPropertyWebkitBackgroundComposite, new ApplyPropertyFillLayer<CompositeOperator>(CSSPropertyWebkitBackgroundComposite, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
527             &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSStyleSelector::mapFillComposite));
528
529     setPropertyHandler(CSSPropertyBackgroundImage, new ApplyPropertyFillLayer<StyleImage*>(CSSPropertyBackgroundImage, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
530                 &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSStyleSelector::mapFillImage));
531
532     setPropertyHandler(CSSPropertyBackgroundOrigin, new ApplyPropertyFillLayer<EFillBox>(CSSPropertyBackgroundOrigin, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
533             &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSStyleSelector::mapFillOrigin));
534     setPropertyHandler(CSSPropertyWebkitBackgroundOrigin, CSSPropertyBackgroundOrigin);
535
536     setPropertyHandler(CSSPropertyBackgroundPositionX, new ApplyPropertyFillLayer<Length>(CSSPropertyBackgroundPositionX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
537                 &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSStyleSelector::mapFillXPosition));
538     setPropertyHandler(CSSPropertyBackgroundPositionY, new ApplyPropertyFillLayer<Length>(CSSPropertyBackgroundPositionY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
539                     &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSStyleSelector::mapFillYPosition));
540     setPropertyHandler(CSSPropertyBackgroundPosition, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBackgroundPositionX), propertyHandler(CSSPropertyBackgroundPositionY)));
541
542     setPropertyHandler(CSSPropertyBackgroundRepeatX, new ApplyPropertyFillLayer<EFillRepeat>(CSSPropertyBackgroundRepeatX, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
543                 &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSStyleSelector::mapFillRepeatX));
544     setPropertyHandler(CSSPropertyBackgroundRepeatY, new ApplyPropertyFillLayer<EFillRepeat>(CSSPropertyBackgroundRepeatY, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
545                     &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSStyleSelector::mapFillRepeatY));
546     setPropertyHandler(CSSPropertyBackgroundRepeat, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBackgroundRepeatX), propertyHandler(CSSPropertyBackgroundRepeatY)));
547
548     setPropertyHandler(CSSPropertyBackgroundSize, new ApplyPropertyFillLayer<FillSize>(CSSPropertyBackgroundSize, BackgroundFillLayer, &RenderStyle::accessBackgroundLayers, &RenderStyle::backgroundLayers,
549             &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSStyleSelector::mapFillSize));
550     setPropertyHandler(CSSPropertyWebkitBackgroundSize, CSSPropertyBackgroundSize);
551
552     setPropertyHandler(CSSPropertyWebkitMaskAttachment, new ApplyPropertyFillLayer<EFillAttachment>(CSSPropertyWebkitMaskAttachment, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
553             &FillLayer::isAttachmentSet, &FillLayer::attachment, &FillLayer::setAttachment, &FillLayer::clearAttachment, &FillLayer::initialFillAttachment, &CSSStyleSelector::mapFillAttachment));
554     setPropertyHandler(CSSPropertyWebkitMaskClip, new ApplyPropertyFillLayer<EFillBox>(CSSPropertyWebkitMaskClip, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
555             &FillLayer::isClipSet, &FillLayer::clip, &FillLayer::setClip, &FillLayer::clearClip, &FillLayer::initialFillClip, &CSSStyleSelector::mapFillClip));
556     setPropertyHandler(CSSPropertyWebkitMaskComposite, new ApplyPropertyFillLayer<CompositeOperator>(CSSPropertyWebkitMaskComposite, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
557             &FillLayer::isCompositeSet, &FillLayer::composite, &FillLayer::setComposite, &FillLayer::clearComposite, &FillLayer::initialFillComposite, &CSSStyleSelector::mapFillComposite));
558
559     setPropertyHandler(CSSPropertyWebkitMaskImage, new ApplyPropertyFillLayer<StyleImage*>(CSSPropertyWebkitMaskImage, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
560                 &FillLayer::isImageSet, &FillLayer::image, &FillLayer::setImage, &FillLayer::clearImage, &FillLayer::initialFillImage, &CSSStyleSelector::mapFillImage));
561
562     setPropertyHandler(CSSPropertyWebkitMaskOrigin, new ApplyPropertyFillLayer<EFillBox>(CSSPropertyWebkitMaskOrigin, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
563             &FillLayer::isOriginSet, &FillLayer::origin, &FillLayer::setOrigin, &FillLayer::clearOrigin, &FillLayer::initialFillOrigin, &CSSStyleSelector::mapFillOrigin));
564     setPropertyHandler(CSSPropertyWebkitMaskSize, new ApplyPropertyFillLayer<FillSize>(CSSPropertyWebkitMaskSize, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
565             &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSStyleSelector::mapFillSize));
566
567     setPropertyHandler(CSSPropertyWebkitMaskPositionX, new ApplyPropertyFillLayer<Length>(CSSPropertyWebkitMaskPositionX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
568                 &FillLayer::isXPositionSet, &FillLayer::xPosition, &FillLayer::setXPosition, &FillLayer::clearXPosition, &FillLayer::initialFillXPosition, &CSSStyleSelector::mapFillXPosition));
569     setPropertyHandler(CSSPropertyWebkitMaskPositionY, new ApplyPropertyFillLayer<Length>(CSSPropertyWebkitMaskPositionY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
570                     &FillLayer::isYPositionSet, &FillLayer::yPosition, &FillLayer::setYPosition, &FillLayer::clearYPosition, &FillLayer::initialFillYPosition, &CSSStyleSelector::mapFillYPosition));
571     setPropertyHandler(CSSPropertyWebkitMaskPosition, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyWebkitMaskPositionX), propertyHandler(CSSPropertyWebkitMaskPositionY)));
572
573     setPropertyHandler(CSSPropertyWebkitMaskRepeatX, new ApplyPropertyFillLayer<EFillRepeat>(CSSPropertyWebkitMaskRepeatX, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
574                 &FillLayer::isRepeatXSet, &FillLayer::repeatX, &FillLayer::setRepeatX, &FillLayer::clearRepeatX, &FillLayer::initialFillRepeatX, &CSSStyleSelector::mapFillRepeatX));
575     setPropertyHandler(CSSPropertyWebkitMaskRepeatY, new ApplyPropertyFillLayer<EFillRepeat>(CSSPropertyWebkitMaskRepeatY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers,
576                     &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSStyleSelector::mapFillRepeatY));
577     setPropertyHandler(CSSPropertyWebkitMaskRepeat, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBackgroundRepeatX), propertyHandler(CSSPropertyBackgroundRepeatY)));
578
579     setPropertyHandler(CSSPropertyBackgroundColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, 0));
580     setPropertyHandler(CSSPropertyBorderBottomColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::color));
581     setPropertyHandler(CSSPropertyBorderLeftColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::color));
582     setPropertyHandler(CSSPropertyBorderRightColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::color));
583     setPropertyHandler(CSSPropertyBorderTopColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::color));
584
585     setPropertyHandler(CSSPropertyBorderTopStyle, new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::borderTopStyle, &RenderStyle::setBorderTopStyle, &RenderStyle::initialBorderStyle));
586     setPropertyHandler(CSSPropertyBorderRightStyle, new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::borderRightStyle, &RenderStyle::setBorderRightStyle, &RenderStyle::initialBorderStyle));
587     setPropertyHandler(CSSPropertyBorderBottomStyle, new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::borderBottomStyle, &RenderStyle::setBorderBottomStyle, &RenderStyle::initialBorderStyle));
588     setPropertyHandler(CSSPropertyBorderLeftStyle, new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::borderLeftStyle, &RenderStyle::setBorderLeftStyle, &RenderStyle::initialBorderStyle));
589
590     setPropertyHandler(CSSPropertyBorderTopWidth, new ApplyPropertyComputeLength<unsigned short, NormalDisabled, ThicknessEnabled>(&RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth));
591     setPropertyHandler(CSSPropertyBorderRightWidth, new ApplyPropertyComputeLength<unsigned short, NormalDisabled, ThicknessEnabled>(&RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth));
592     setPropertyHandler(CSSPropertyBorderBottomWidth, new ApplyPropertyComputeLength<unsigned short, NormalDisabled, ThicknessEnabled>(&RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth));
593     setPropertyHandler(CSSPropertyBorderLeftWidth, new ApplyPropertyComputeLength<unsigned short, NormalDisabled, ThicknessEnabled>(&RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth));
594     setPropertyHandler(CSSPropertyOutlineWidth, new ApplyPropertyComputeLength<unsigned short, NormalDisabled, ThicknessEnabled>(&RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth, &RenderStyle::initialBorderWidth));
595     setPropertyHandler(CSSPropertyWebkitColumnRuleWidth, new ApplyPropertyComputeLength<unsigned short, NormalDisabled, ThicknessEnabled>(&RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth, &RenderStyle::initialBorderWidth));
596
597     setPropertyHandler(CSSPropertyBorderTop, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderTopColor), propertyHandler(CSSPropertyBorderTopStyle), propertyHandler(CSSPropertyBorderTopWidth)));
598     setPropertyHandler(CSSPropertyBorderRight, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderRightColor), propertyHandler(CSSPropertyBorderRightStyle), propertyHandler(CSSPropertyBorderRightWidth)));
599     setPropertyHandler(CSSPropertyBorderBottom, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderBottomColor), propertyHandler(CSSPropertyBorderBottomStyle), propertyHandler(CSSPropertyBorderBottomWidth)));
600     setPropertyHandler(CSSPropertyBorderLeft, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderLeftColor), propertyHandler(CSSPropertyBorderLeftStyle), propertyHandler(CSSPropertyBorderLeftWidth)));
601
602     setPropertyHandler(CSSPropertyBorderStyle, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderTopStyle), propertyHandler(CSSPropertyBorderRightStyle), propertyHandler(CSSPropertyBorderBottomStyle), propertyHandler(CSSPropertyBorderLeftStyle)));
603     setPropertyHandler(CSSPropertyBorderWidth, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderTopWidth), propertyHandler(CSSPropertyBorderRightWidth), propertyHandler(CSSPropertyBorderBottomWidth), propertyHandler(CSSPropertyBorderLeftWidth)));
604     setPropertyHandler(CSSPropertyBorderColor, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderTopColor), propertyHandler(CSSPropertyBorderRightColor), propertyHandler(CSSPropertyBorderBottomColor), propertyHandler(CSSPropertyBorderLeftColor)));
605     setPropertyHandler(CSSPropertyBorder, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyBorderStyle), propertyHandler(CSSPropertyBorderWidth), propertyHandler(CSSPropertyBorderColor)));
606
607     setPropertyHandler(CSSPropertyBorderTopLeftRadius, new ApplyPropertyBorderRadius(&RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius, &RenderStyle::initialBorderRadius));
608     setPropertyHandler(CSSPropertyBorderTopRightRadius, new ApplyPropertyBorderRadius(&RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius, &RenderStyle::initialBorderRadius));
609     setPropertyHandler(CSSPropertyBorderBottomLeftRadius, new ApplyPropertyBorderRadius(&RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius, &RenderStyle::initialBorderRadius));
610     setPropertyHandler(CSSPropertyBorderBottomRightRadius, new ApplyPropertyBorderRadius(&RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius, &RenderStyle::initialBorderRadius));
611     setPropertyHandler(CSSPropertyBorderRadius, new ApplyPropertyExpanding<ExpandValue>(propertyHandler(CSSPropertyBorderTopLeftRadius), propertyHandler(CSSPropertyBorderTopRightRadius), propertyHandler(CSSPropertyBorderBottomLeftRadius), propertyHandler(CSSPropertyBorderBottomRightRadius)));
612     setPropertyHandler(CSSPropertyWebkitBorderRadius, CSSPropertyBorderRadius);
613
614     setPropertyHandler(CSSPropertyWebkitBorderHorizontalSpacing, new ApplyPropertyComputeLength<short>(&RenderStyle::horizontalBorderSpacing, &RenderStyle::setHorizontalBorderSpacing, &RenderStyle::initialHorizontalBorderSpacing));
615     setPropertyHandler(CSSPropertyWebkitBorderVerticalSpacing, new ApplyPropertyComputeLength<short>(&RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalBorderSpacing, &RenderStyle::initialVerticalBorderSpacing));
616     setPropertyHandler(CSSPropertyBorderSpacing, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyWebkitBorderHorizontalSpacing), propertyHandler(CSSPropertyWebkitBorderVerticalSpacing)));
617
618     setPropertyHandler(CSSPropertyLetterSpacing, new ApplyPropertyComputeLength<int, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>(&RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterWordSpacing));
619     setPropertyHandler(CSSPropertyWordSpacing, new ApplyPropertyComputeLength<int, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>(&RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLetterWordSpacing));
620
621     setPropertyHandler(CSSPropertyFontStyle, new ApplyPropertyFont<FontItalic>(&FontDescription::italic, &FontDescription::setItalic, FontItalicOff));
622     setPropertyHandler(CSSPropertyFontVariant, new ApplyPropertyFont<FontSmallCaps>(&FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff));
623     setPropertyHandler(CSSPropertyTextRendering, new ApplyPropertyFont<TextRenderingMode>(&FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering));
624     setPropertyHandler(CSSPropertyWebkitFontSmoothing, new ApplyPropertyFont<FontSmoothingMode>(&FontDescription::fontSmoothing, &FontDescription::setFontSmoothing, AutoSmoothing));
625     setPropertyHandler(CSSPropertyWebkitTextOrientation, new ApplyPropertyFont<TextOrientation>(&FontDescription::textOrientation, &FontDescription::setTextOrientation, RenderStyle::initialTextOrientation()));
626     setPropertyHandler(CSSPropertyFontWeight, new ApplyPropertyFontWeight());
627
628     setPropertyHandler(CSSPropertyOutlineStyle, new ApplyPropertyExpanding<ExpandValue>(new ApplyPropertyDefault<OutlineIsAuto>(&RenderStyle::outlineStyleIsAuto, &RenderStyle::setOutlineStyleIsAuto, &RenderStyle::initialOutlineStyleIsAuto), new ApplyPropertyDefault<EBorderStyle>(&RenderStyle::outlineStyle, &RenderStyle::setOutlineStyle, &RenderStyle::initialBorderStyle)));
629     setPropertyHandler(CSSPropertyOutlineColor, new ApplyPropertyColor<InheritFromParent>(&RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::color));
630
631     setPropertyHandler(CSSPropertyOverflowX, new ApplyPropertyDefault<EOverflow>(&RenderStyle::overflowX, &RenderStyle::setOverflowX, &RenderStyle::initialOverflowX));
632     setPropertyHandler(CSSPropertyOverflowY, new ApplyPropertyDefault<EOverflow>(&RenderStyle::overflowY, &RenderStyle::setOverflowY, &RenderStyle::initialOverflowY));
633     setPropertyHandler(CSSPropertyOverflow, new ApplyPropertyExpanding<ExpandValue>(propertyHandler(CSSPropertyOverflowX), propertyHandler(CSSPropertyOverflowY)));
634
635     setPropertyHandler(CSSPropertyWebkitColumnRuleColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::color));
636     setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::color));
637     setPropertyHandler(CSSPropertyWebkitTextFillColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::color));
638     setPropertyHandler(CSSPropertyWebkitTextStrokeColor, new ApplyPropertyColor<NoInheritFromParent>(&RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::color));
639
640     setPropertyHandler(CSSPropertyTop, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::top, &RenderStyle::setTop, &RenderStyle::initialOffset));
641     setPropertyHandler(CSSPropertyRight, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::right, &RenderStyle::setRight, &RenderStyle::initialOffset));
642     setPropertyHandler(CSSPropertyBottom, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset));
643     setPropertyHandler(CSSPropertyLeft, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset));
644
645     setPropertyHandler(CSSPropertyWidth, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>(&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize));
646     setPropertyHandler(CSSPropertyHeight, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>(&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize));
647
648     setPropertyHandler(CSSPropertyTextIndent, new ApplyPropertyLength<>(&RenderStyle::textIndent, &RenderStyle::setTextIndent, &RenderStyle::initialTextIndent));
649
650     setPropertyHandler(CSSPropertyMaxHeight, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneEnabled, UndefinedEnabled>(&RenderStyle::maxHeight, &RenderStyle::setMaxHeight, &RenderStyle::initialMaxSize));
651     setPropertyHandler(CSSPropertyMaxWidth, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneEnabled, UndefinedEnabled>(&RenderStyle::maxWidth, &RenderStyle::setMaxWidth, &RenderStyle::initialMaxSize));
652     setPropertyHandler(CSSPropertyMinHeight, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>(&RenderStyle::minHeight, &RenderStyle::setMinHeight, &RenderStyle::initialMinSize));
653     setPropertyHandler(CSSPropertyMinWidth, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>(&RenderStyle::minWidth, &RenderStyle::setMinWidth, &RenderStyle::initialMinSize));
654
655     setPropertyHandler(CSSPropertyMarginTop, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::marginTop, &RenderStyle::setMarginTop, &RenderStyle::initialMargin));
656     setPropertyHandler(CSSPropertyMarginRight, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::marginRight, &RenderStyle::setMarginRight, &RenderStyle::initialMargin));
657     setPropertyHandler(CSSPropertyMarginBottom, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::marginBottom, &RenderStyle::setMarginBottom, &RenderStyle::initialMargin));
658     setPropertyHandler(CSSPropertyMarginLeft, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::marginLeft, &RenderStyle::setMarginLeft, &RenderStyle::initialMargin));
659     setPropertyHandler(CSSPropertyMargin, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyMarginTop), propertyHandler(CSSPropertyMarginRight), propertyHandler(CSSPropertyMarginBottom), propertyHandler(CSSPropertyMarginLeft)));
660
661     setPropertyHandler(CSSPropertyWebkitMarginBeforeCollapse, new ApplyPropertyDefault<EMarginCollapse>(&RenderStyle::marginBeforeCollapse, &RenderStyle::setMarginBeforeCollapse, &RenderStyle::initialMarginBeforeCollapse));
662     setPropertyHandler(CSSPropertyWebkitMarginAfterCollapse, new ApplyPropertyDefault<EMarginCollapse>(&RenderStyle::marginAfterCollapse, &RenderStyle::setMarginAfterCollapse, &RenderStyle::initialMarginAfterCollapse));
663     setPropertyHandler(CSSPropertyWebkitMarginTopCollapse, CSSPropertyWebkitMarginBeforeCollapse);
664     setPropertyHandler(CSSPropertyWebkitMarginBottomCollapse, CSSPropertyWebkitMarginAfterCollapse);
665     setPropertyHandler(CSSPropertyWebkitMarginCollapse, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyWebkitMarginBeforeCollapse), propertyHandler(CSSPropertyWebkitMarginAfterCollapse)));
666
667     setPropertyHandler(CSSPropertyPaddingTop, new ApplyPropertyLength<>(&RenderStyle::paddingTop, &RenderStyle::setPaddingTop, &RenderStyle::initialPadding));
668     setPropertyHandler(CSSPropertyPaddingRight, new ApplyPropertyLength<>(&RenderStyle::paddingRight, &RenderStyle::setPaddingRight, &RenderStyle::initialPadding));
669     setPropertyHandler(CSSPropertyPaddingBottom, new ApplyPropertyLength<>(&RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom, &RenderStyle::initialPadding));
670     setPropertyHandler(CSSPropertyPaddingLeft, new ApplyPropertyLength<>(&RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft, &RenderStyle::initialPadding));
671     setPropertyHandler(CSSPropertyPadding, new ApplyPropertyExpanding<SuppressValue>(propertyHandler(CSSPropertyPaddingTop), propertyHandler(CSSPropertyPaddingRight), propertyHandler(CSSPropertyPaddingBottom), propertyHandler(CSSPropertyPaddingLeft)));
672
673     setPropertyHandler(CSSPropertyWebkitPerspectiveOriginX, new ApplyPropertyLength<>(&RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX, &RenderStyle::initialPerspectiveOriginX));
674     setPropertyHandler(CSSPropertyWebkitPerspectiveOriginY, new ApplyPropertyLength<>(&RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOriginY, &RenderStyle::initialPerspectiveOriginY));
675     setPropertyHandler(CSSPropertyWebkitTransformOriginX, new ApplyPropertyLength<>(&RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX, &RenderStyle::initialTransformOriginX));
676     setPropertyHandler(CSSPropertyWebkitTransformOriginY, new ApplyPropertyLength<>(&RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY, &RenderStyle::initialTransformOriginY));
677 }
678
679
680 }