OLD | NEW |
1 {% from "macros.tmpl" import lower_first -%} | 1 {% from "macros.tmpl" import lower_first %} |
2 | |
3 {# | 2 {# |
4 This file is for property handlers which use the templating engine to | 3 This file is for property handlers which use the templating engine to |
5 reduce (handwritten) code duplication. | 4 reduce (handwritten) code duplication. |
6 | 5 |
7 The `properties' dict can be used to access a property's parameters in | 6 The `properties' dict can be used to access a property's parameters in |
8 jinja2 templates (i.e. setter, getter, initial, type_name) | 7 jinja2 templates (i.e. setter, getter, initial, type_name) |
9 -#} | 8 #} |
10 | |
11 #include "config.h" | 9 #include "config.h" |
12 #include "StyleBuilderFunctions.h" | 10 #include "StyleBuilderFunctions.h" |
13 | 11 |
14 #include "CSSValueKeywords.h" | 12 #include "CSSValueKeywords.h" |
15 #include "core/animation/css/CSSAnimationDataList.h" | 13 #include "core/animation/css/CSSAnimationDataList.h" |
16 #include "core/css/BasicShapeFunctions.h" | 14 #include "core/css/BasicShapeFunctions.h" |
17 #include "core/css/CSSPrimitiveValueMappings.h" | 15 #include "core/css/CSSPrimitiveValueMappings.h" |
18 #include "core/css/Pair.h" | 16 #include "core/css/Pair.h" |
19 #include "core/css/resolver/StyleResolverState.h" | 17 #include "core/css/resolver/StyleResolverState.h" |
20 | 18 |
21 | 19 {# FIXME: factor macros out into a separate library #} |
22 {%- macro declare_initial_function(property_id) -%} | 20 {% macro declare_initial_function(property_id) %} |
23 void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolverState& stat
e) | 21 void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolverState& stat
e) |
24 {%- endmacro %} | 22 {%- endmacro %} |
25 | 23 {% macro declare_inherit_function(property_id) %} |
26 {%- macro declare_inherit_function(property_id) -%} | |
27 void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolverState& stat
e) | 24 void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolverState& stat
e) |
28 {%- endmacro %} | 25 {%- endmacro %} |
29 | 26 {% macro declare_value_function(property_id) %} |
30 {%- macro declare_value_function(property_id) -%} | |
31 void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolverState& state,
CSSValue* value) | 27 void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolverState& state,
CSSValue* value) |
32 {%- endmacro %} | 28 {%- endmacro %} |
33 | |
34 // FIXME: This is duplicated in StyleBuilder.cpp.tmpl, but we'll move the | 29 // FIXME: This is duplicated in StyleBuilder.cpp.tmpl, but we'll move the |
35 // function definitions there over to here later. | 30 // function definitions there over to here later. |
36 {%- macro set_value(property) %} | 31 {% macro set_value(property) %} |
37 {%- if property.svg -%} | 32 {% if property.svg %} |
38 state.style()->accessSVGStyle()->{{property.setter}} | 33 state.style()->accessSVGStyle()->{{property.setter}} |
39 {%- else -%} | 34 {%- else %} |
40 state.style()->{{property.setter}} | 35 state.style()->{{property.setter}} |
41 {%- endif -%} | 36 {%- endif %} |
42 {%- endmacro %} | 37 {% endmacro %} |
43 | 38 |
44 namespace WebCore { | 39 namespace WebCore { |
| 40 {# FIXME: remove excess newline #} |
45 | 41 |
46 {%- macro apply_animation(property_id, attribute, animation) %} | 42 |
47 {{ declare_initial_function(property_id) }} | 43 {% macro apply_animation(property_id, attribute, animation) %} |
| 44 {{declare_initial_function(property_id)}} |
48 { | 45 { |
49 CSSAnimationDataList* list = state.style()->access{{animation}}(); | 46 CSSAnimationDataList* list = state.style()->access{{animation}}(); |
50 if (list->isEmpty()) | 47 if (list->isEmpty()) |
51 list->append(CSSAnimationData::create()); | 48 list->append(CSSAnimationData::create()); |
52 list->animation(0)->set{{attribute}}(CSSAnimationData::initialAnimation{{att
ribute}}()); | 49 list->animation(0)->set{{attribute}}(CSSAnimationData::initialAnimation{{att
ribute}}()); |
53 {%- if property_id == "CSSPropertyWebkitTransitionProperty" %} | 50 {% if property_id == "CSSPropertyWebkitTransitionProperty" %} |
54 list->animation(0)->setAnimationMode(CSSAnimationData::AnimateAll); | 51 list->animation(0)->setAnimationMode(CSSAnimationData::AnimateAll); |
55 {%- endif %} | 52 {% endif %} |
56 for (size_t i = 1; i < list->size(); ++i) | 53 for (size_t i = 1; i < list->size(); ++i) |
57 list->animation(i)->clear{{attribute}}(); | 54 list->animation(i)->clear{{attribute}}(); |
58 } | 55 } |
59 | 56 |
60 {{ declare_inherit_function(property_id) }} | 57 {{declare_inherit_function(property_id)}} |
61 { | 58 { |
62 CSSAnimationDataList* list = state.style()->access{{animation}}(); | 59 CSSAnimationDataList* list = state.style()->access{{animation}}(); |
63 const CSSAnimationDataList* parentList = state.parentStyle()->{{animation|lo
wer}}(); | 60 const CSSAnimationDataList* parentList = state.parentStyle()->{{animation|lo
wer}}(); |
64 size_t i = 0, parentSize = parentList ? parentList->size() : 0; | 61 size_t i = 0, parentSize = parentList ? parentList->size() : 0; |
65 for ( ; i < parentSize && parentList->animation(i)->is{{attribute}}Set(); ++
i) { | 62 for ( ; i < parentSize && parentList->animation(i)->is{{attribute}}Set(); ++
i) { |
66 ASSERT(list->size() >= i); | 63 ASSERT(list->size() >= i); |
67 if (list->size() == i) | 64 if (list->size() == i) |
68 list->append(CSSAnimationData::create()); | 65 list->append(CSSAnimationData::create()); |
69 list->animation(i)->set{{attribute}}(parentList->animation(i)->{{lower_f
irst(attribute)}}()); | 66 list->animation(i)->set{{attribute}}(parentList->animation(i)->{{lower_f
irst(attribute)}}()); |
70 {%- if property_id == "CSSPropertyWebkitTransitionProperty" %} | 67 {% if property_id == "CSSPropertyWebkitTransitionProperty" %} |
71 list->animation(i)->setAnimationMode(parentList->animation(i)->anima
tionMode()); | 68 list->animation(i)->setAnimationMode(parentList->animation(i)->anima
tionMode()); |
72 {%- endif %} | 69 {% endif %} |
73 } | 70 } |
74 | 71 |
75 // Reset any remaining animations to not have the property set. | 72 // Reset any remaining animations to not have the property set. |
76 for ( ; i < list->size(); ++i) | 73 for ( ; i < list->size(); ++i) |
77 list->animation(i)->clear{{attribute}}(); | 74 list->animation(i)->clear{{attribute}}(); |
78 } | 75 } |
79 | 76 |
80 {{ declare_value_function(property_id) }} | 77 {{declare_value_function(property_id)}} |
81 { | 78 { |
82 CSSAnimationDataList* list = state.style()->access{{animation}}(); | 79 CSSAnimationDataList* list = state.style()->access{{animation}}(); |
83 size_t childIndex = 0; | 80 size_t childIndex = 0; |
84 if (value->isValueList()) { | 81 if (value->isValueList()) { |
85 // Walk each value and put it into an animation, creating new animations
as needed. | 82 // Walk each value and put it into an animation, creating new animations
as needed. |
86 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { | 83 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { |
87 ASSERT(list->size() >= childIndex); | 84 ASSERT(list->size() >= childIndex); |
88 if (list->size() == childIndex) | 85 if (list->size() == childIndex) |
89 list->append(CSSAnimationData::create()); | 86 list->append(CSSAnimationData::create()); |
90 state.styleMap().mapAnimation{{attribute}}(list->animation(childInde
x), i.value()); | 87 state.styleMap().mapAnimation{{attribute}}(list->animation(childInde
x), i.value()); |
91 ++childIndex; | 88 ++childIndex; |
92 } | 89 } |
93 } else { | 90 } else { |
94 if (list->isEmpty()) | 91 if (list->isEmpty()) |
95 list->append(CSSAnimationData::create()); | 92 list->append(CSSAnimationData::create()); |
96 state.styleMap().mapAnimation{{attribute}}(list->animation(childIndex),
value); | 93 state.styleMap().mapAnimation{{attribute}}(list->animation(childIndex),
value); |
97 childIndex = 1; | 94 childIndex = 1; |
98 } | 95 } |
99 for ( ; childIndex < list->size(); ++childIndex) { | 96 for ( ; childIndex < list->size(); ++childIndex) { |
100 // Reset all remaining animations to not have the property set. | 97 // Reset all remaining animations to not have the property set. |
101 list->animation(childIndex)->clear{{attribute}}(); | 98 list->animation(childIndex)->clear{{attribute}}(); |
102 } | 99 } |
103 } | 100 } |
104 {%- endmacro %} | 101 {% endmacro %} |
| 102 {{apply_animation('CSSPropertyWebkitAnimationDelay', 'Delay', 'Animations')}} |
| 103 {{apply_animation('CSSPropertyWebkitAnimationDirection', 'Direction', 'Animation
s')}} |
| 104 {{apply_animation('CSSPropertyWebkitAnimationDuration', 'Duration', 'Animations'
)}} |
| 105 {{apply_animation('CSSPropertyWebkitAnimationFillMode', 'FillMode', 'Animations'
)}} |
| 106 {{apply_animation('CSSPropertyWebkitAnimationIterationCount', 'IterationCount',
'Animations')}} |
| 107 {{apply_animation('CSSPropertyWebkitAnimationName', 'Name', 'Animations')}} |
| 108 {{apply_animation('CSSPropertyWebkitAnimationPlayState', 'PlayState', 'Animation
s')}} |
| 109 {{apply_animation('CSSPropertyWebkitAnimationTimingFunction', 'TimingFunction',
'Animations')}} |
| 110 {{apply_animation('CSSPropertyWebkitTransitionDelay', 'Delay', 'Transitions')}} |
| 111 {{apply_animation('CSSPropertyWebkitTransitionDuration', 'Duration', 'Transition
s')}} |
| 112 {{apply_animation('CSSPropertyWebkitTransitionProperty', 'Property', 'Transition
s')}} |
| 113 {{apply_animation('CSSPropertyWebkitTransitionTimingFunction', 'TimingFunction',
'Transitions')}} |
105 | 114 |
106 {{ apply_animation("CSSPropertyWebkitAnimationDelay", "Delay", "Animations") }} | 115 {% macro apply_auto(property_id, auto_getter=none, auto_setter=none, auto_identi
ty='CSSValueAuto', compute_length=false) %} |
107 {{ apply_animation("CSSPropertyWebkitAnimationDirection", "Direction", "Animatio
ns") }} | 116 {% set property = properties[property_id] %} |
108 {{ apply_animation("CSSPropertyWebkitAnimationDuration", "Duration", "Animations
") }} | 117 {% set auto_getter = auto_getter or 'hasAuto' + property.camel_case_name %} |
109 {{ apply_animation("CSSPropertyWebkitAnimationFillMode", "FillMode", "Animations
") }} | 118 {% set auto_setter = auto_setter or 'setHasAuto' + property.camel_case_name %} |
110 {{ apply_animation("CSSPropertyWebkitAnimationIterationCount", "IterationCount",
"Animations") }} | 119 {{declare_initial_function(property_id)}} |
111 {{ apply_animation("CSSPropertyWebkitAnimationName", "Name", "Animations") }} | |
112 {{ apply_animation("CSSPropertyWebkitAnimationPlayState", "PlayState", "Animatio
ns") }} | |
113 {{ apply_animation("CSSPropertyWebkitAnimationTimingFunction", "TimingFunction",
"Animations") }} | |
114 {{ apply_animation("CSSPropertyWebkitTransitionDelay", "Delay", "Transitions") }
} | |
115 {{ apply_animation("CSSPropertyWebkitTransitionDuration", "Duration", "Transitio
ns") }} | |
116 {{ apply_animation("CSSPropertyWebkitTransitionProperty", "Property", "Transitio
ns") }} | |
117 {{ apply_animation("CSSPropertyWebkitTransitionTimingFunction", "TimingFunction"
, "Transitions") }} | |
118 | |
119 {%- macro apply_auto(property_id, auto_getter=none, auto_setter=none, auto_ident
ity="CSSValueAuto", compute_length=false) %} | |
120 {%- set property = properties[property_id] %} | |
121 {%- set auto_getter = auto_getter or "hasAuto" + property.camel_case_name %} | |
122 {%- set auto_setter = auto_setter or "setHasAuto" + property.camel_case_name %} | |
123 {{ declare_initial_function(property_id) }} | |
124 { | 120 { |
125 state.style()->{{auto_setter}}(); | 121 state.style()->{{auto_setter}}(); |
126 } | 122 } |
127 | 123 |
128 {{ declare_inherit_function(property_id) }} | 124 {{declare_inherit_function(property_id)}} |
129 { | 125 { |
130 if (state.parentStyle()->{{auto_getter}}()) | 126 if (state.parentStyle()->{{auto_getter}}()) |
131 state.style()->{{auto_setter}}(); | 127 state.style()->{{auto_setter}}(); |
132 else | 128 else |
133 {{ set_value(property) }}(state.parentStyle()->{{property.getter}}()); | 129 {{set_value(property)}}(state.parentStyle()->{{property.getter}}()); |
134 } | 130 } |
135 | 131 |
136 {{ declare_value_function(property_id) }} | 132 {{declare_value_function(property_id)}} |
137 { | 133 { |
138 if (!value->isPrimitiveValue()) | 134 if (!value->isPrimitiveValue()) |
139 return; | 135 return; |
140 | 136 |
141 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 137 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
142 if (primitiveValue->getValueID() == {{auto_identity}}) | 138 if (primitiveValue->getValueID() == {{auto_identity}}) |
143 state.style()->{{auto_setter}}(); | 139 state.style()->{{auto_setter}}(); |
144 else | 140 else |
145 {%- if compute_length %} | 141 {% if compute_length %} |
146 {{ set_value(property) }}(primitiveValue->computeLength<{{property.type_
name}}>(state.cssToLengthConversionData())); | 142 {{set_value(property)}}(primitiveValue->computeLength<{{property.type_na
me}}>(state.cssToLengthConversionData())); |
147 {%- else %} | 143 {% else %} |
148 {{ set_value(property) }}(*primitiveValue); | 144 {{set_value(property)}}(*primitiveValue); |
149 {%- endif %} | 145 {% endif %} |
150 } | 146 } |
151 {%- endmacro %} | 147 {% endmacro %} |
| 148 {{apply_auto('CSSPropertyOrphans')}} |
| 149 {{apply_auto('CSSPropertyWebkitColumnCount')}} |
| 150 {{apply_auto('CSSPropertyWebkitColumnGap', auto_getter='hasNormalColumnGap', aut
o_setter='setHasNormalColumnGap', auto_identity='CSSValueNormal', compute_length
=true)}} |
| 151 {{apply_auto('CSSPropertyWebkitColumnWidth', compute_length=true)}} |
| 152 {{apply_auto('CSSPropertyWidows')}} |
| 153 {{apply_auto('CSSPropertyZIndex')}} |
152 | 154 |
153 {{ apply_auto("CSSPropertyOrphans") }} | 155 {% macro apply_border_image_modifier(property_id, modifier_type) %} |
154 {{ apply_auto("CSSPropertyWebkitColumnCount") }} | 156 {% set is_mask_box = 'MaskBox' in property_id %} |
155 {{ apply_auto("CSSPropertyWebkitColumnGap", auto_getter="hasNormalColumnGap", au
to_setter="setHasNormalColumnGap", auto_identity="CSSValueNormal", compute_lengt
h=true) }} | 157 {% set getter = 'maskBoxImage' if is_mask_box else 'borderImage' %} |
156 {{ apply_auto("CSSPropertyWebkitColumnWidth", compute_length=true) }} | 158 {% set setter = 'setMaskBoxImage' if is_mask_box else 'setBorderImage' %} |
157 {{ apply_auto("CSSPropertyWidows") }} | |
158 {{ apply_auto("CSSPropertyZIndex") }} | |
159 | |
160 {%- macro apply_border_image_modifier(property_id, modifier_type) %} | |
161 {%- set is_mask_box = "MaskBox" in property_id %} | |
162 {%- set getter = "maskBoxImage" if is_mask_box else "borderImage" %} | |
163 {%- set setter = "setMaskBoxImage" if is_mask_box else "setBorderImage" %} | |
164 {{ declare_initial_function(property_id) }} | 159 {{ declare_initial_function(property_id) }} |
165 { | 160 { |
166 NinePieceImage image(state.style()->{{getter}}()); | 161 NinePieceImage image(state.style()->{{getter}}()); |
167 {%- if modifier_type == "Outset" %} | 162 {% if modifier_type == 'Outset' %} |
168 image.setOutset(Length(0, Fixed)); | 163 image.setOutset(Length(0, Fixed)); |
169 {%- elif modifier_type == "Repeat" %} | 164 {% elif modifier_type == 'Repeat' %} |
170 image.setHorizontalRule(StretchImageRule); | 165 image.setHorizontalRule(StretchImageRule); |
171 image.setVerticalRule(StretchImageRule); | 166 image.setVerticalRule(StretchImageRule); |
172 {%- elif modifier_type == "Slice" and is_mask_box %} | 167 {% elif modifier_type == 'Slice' and is_mask_box %} |
173 // Masks have a different initial value for slices. Preserve the value of 0
for backwards compatibility. | 168 // Masks have a different initial value for slices. Preserve the value of 0
for backwards compatibility. |
174 image.setImageSlices(LengthBox({{ (["Length(0, Fixed)"]*4) | join(", ") }}))
; | 169 image.setImageSlices(LengthBox({{ (['Length(0, Fixed)']*4) | join(', ') }}))
; |
175 image.setFill(true); | 170 image.setFill(true); |
176 {%- elif modifier_type == "Slice" and not is_mask_box %} | 171 {% elif modifier_type == 'Slice' and not is_mask_box %} |
177 image.setImageSlices(LengthBox({{ (["Length(100, Percent)"]*4) | join(", ")
}})); | 172 image.setImageSlices(LengthBox({{ (['Length(100, Percent)']*4) | join(', ')
}})); |
178 image.setFill(false); | 173 image.setFill(false); |
179 {%- elif modifier_type == "Width" %} | 174 {% elif modifier_type == 'Width' %} |
180 // Masks have a different initial value for widths. Preserve the value of 'a
uto' for backwards compatibility. | 175 // Masks have a different initial value for widths. Preserve the value of 'a
uto' for backwards compatibility. |
181 image.setBorderSlices({{ "Length(Auto)" if is_mask_box else "1.0" }}); | 176 image.setBorderSlices({{ 'Length(Auto)' if is_mask_box else '1.0' }}); |
182 {%- endif %} | 177 {% endif %} |
183 state.style()->{{setter}}(image); | 178 state.style()->{{setter}}(image); |
184 } | 179 } |
185 | 180 |
186 {{ declare_inherit_function(property_id) }} | 181 {{declare_inherit_function(property_id)}} |
187 { | 182 { |
188 NinePieceImage image(state.style()->{{getter}}()); | 183 NinePieceImage image(state.style()->{{getter}}()); |
189 {%- if modifier_type == "Outset" %} | 184 {% if modifier_type == 'Outset' %} |
190 image.copyOutsetFrom(state.parentStyle()->{{getter}}()); | 185 image.copyOutsetFrom(state.parentStyle()->{{getter}}()); |
191 {%- elif modifier_type == "Repeat" %} | 186 {% elif modifier_type == 'Repeat' %} |
192 image.copyRepeatFrom(state.parentStyle()->{{getter}}()); | 187 image.copyRepeatFrom(state.parentStyle()->{{getter}}()); |
193 {%- elif modifier_type == "Slice" %} | 188 {% elif modifier_type == 'Slice' %} |
194 image.copyImageSlicesFrom(state.parentStyle()->{{getter}}()); | 189 image.copyImageSlicesFrom(state.parentStyle()->{{getter}}()); |
195 {%- elif modifier_type == "Width" %} | 190 {% elif modifier_type == 'Width' %} |
196 image.copyBorderSlicesFrom(state.parentStyle()->{{getter}}()); | 191 image.copyBorderSlicesFrom(state.parentStyle()->{{getter}}()); |
197 {%- endif %} | 192 {% endif %} |
198 state.style()->{{setter}}(image); | 193 state.style()->{{setter}}(image); |
199 } | 194 } |
200 | 195 |
201 {{ declare_value_function(property_id) }} | 196 {{declare_value_function(property_id)}} |
202 { | 197 { |
203 NinePieceImage image(state.style()->{{getter}}()); | 198 NinePieceImage image(state.style()->{{getter}}()); |
204 {%- if modifier_type == "Outset" %} | 199 {% if modifier_type == 'Outset' %} |
205 image.setOutset(state.styleMap().mapNinePieceImageQuad(value)); | 200 image.setOutset(state.styleMap().mapNinePieceImageQuad(value)); |
206 {%- elif modifier_type == "Repeat" %} | 201 {% elif modifier_type == 'Repeat' %} |
207 state.styleMap().mapNinePieceImageRepeat(value, image); | 202 state.styleMap().mapNinePieceImageRepeat(value, image); |
208 {%- elif modifier_type == "Slice" %} | 203 {% elif modifier_type == 'Slice' %} |
209 state.styleMap().mapNinePieceImageSlice(value, image); | 204 state.styleMap().mapNinePieceImageSlice(value, image); |
210 {%- elif modifier_type == "Width" %} | 205 {% elif modifier_type == 'Width' %} |
211 image.setBorderSlices(state.styleMap().mapNinePieceImageQuad(value)); | 206 image.setBorderSlices(state.styleMap().mapNinePieceImageQuad(value)); |
212 {%- endif %} | 207 {% endif %} |
213 state.style()->{{setter}}(image); | 208 state.style()->{{setter}}(image); |
214 } | 209 } |
215 {%- endmacro %} | 210 {% endmacro %} |
| 211 {{apply_border_image_modifier('CSSPropertyBorderImageOutset', 'Outset')}} |
| 212 {{apply_border_image_modifier('CSSPropertyBorderImageRepeat', 'Repeat')}} |
| 213 {{apply_border_image_modifier('CSSPropertyBorderImageSlice', 'Slice')}} |
| 214 {{apply_border_image_modifier('CSSPropertyBorderImageWidth', 'Width')}} |
| 215 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageOutset', 'Outset')}} |
| 216 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageRepeat', 'Repeat')}} |
| 217 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageSlice', 'Slice')}} |
| 218 {{apply_border_image_modifier('CSSPropertyWebkitMaskBoxImageWidth', 'Width')}} |
216 | 219 |
217 {{ apply_border_image_modifier("CSSPropertyBorderImageOutset", "Outset") }} | 220 {% macro apply_value_border_image_source(property_id) %} |
218 {{ apply_border_image_modifier("CSSPropertyBorderImageRepeat", "Repeat") }} | 221 {{declare_value_function(property_id)}} |
219 {{ apply_border_image_modifier("CSSPropertyBorderImageSlice", "Slice") }} | 222 { |
220 {{ apply_border_image_modifier("CSSPropertyBorderImageWidth", "Width") }} | 223 {% set property = properties[property_id] %} |
221 {{ apply_border_image_modifier("CSSPropertyWebkitMaskBoxImageOutset", "Outset")
}} | 224 {{set_value(property)}}(state.styleImage({{property_id}}, value)); |
222 {{ apply_border_image_modifier("CSSPropertyWebkitMaskBoxImageRepeat", "Repeat")
}} | 225 } |
223 {{ apply_border_image_modifier("CSSPropertyWebkitMaskBoxImageSlice", "Slice") }} | 226 {% endmacro %} |
224 {{ apply_border_image_modifier("CSSPropertyWebkitMaskBoxImageWidth", "Width") }} | 227 {{apply_value_border_image_source('CSSPropertyBorderImageSource')}} |
| 228 {{apply_value_border_image_source('CSSPropertyWebkitMaskBoxImageSource')}} |
225 | 229 |
226 {%- macro apply_value_border_image_source(property_id) %} | 230 {% macro apply_color(property_id, initial_color='StyleColor::currentColor') %} |
227 {{ declare_value_function(property_id) }} | 231 {% set property = properties[property_id] %} |
228 { | 232 {% set visited_link_setter = 'setVisitedLink' + property.camel_case_name %} |
229 {%- set property = properties[property_id] %} | 233 {{declare_initial_function(property_id)}} |
230 {{ set_value(property) }}(state.styleImage({{property_id}}, value)); | |
231 } | |
232 {%- endmacro %} | |
233 | |
234 {{ apply_value_border_image_source("CSSPropertyBorderImageSource") }} | |
235 {{ apply_value_border_image_source("CSSPropertyWebkitMaskBoxImageSource") }} | |
236 | |
237 {%- macro apply_color(property_id, initial_color="StyleColor::currentColor") %} | |
238 {%- set property = properties[property_id] %} | |
239 {%- set visited_link_setter = "setVisitedLink" + property.camel_case_name %} | |
240 {{ declare_initial_function(property_id) }} | |
241 { | 234 { |
242 StyleColor color = {{initial_color}}(); | 235 StyleColor color = {{initial_color}}(); |
243 if (state.applyPropertyToRegularStyle()) | 236 if (state.applyPropertyToRegularStyle()) |
244 {{ set_value(property) }}(color); | 237 {{set_value(property)}}(color); |
245 if (state.applyPropertyToVisitedLinkStyle()) | 238 if (state.applyPropertyToVisitedLinkStyle()) |
246 state.style()->{{visited_link_setter}}(color); | 239 state.style()->{{visited_link_setter}}(color); |
247 } | 240 } |
248 | 241 |
249 {{ declare_inherit_function(property_id) }} | 242 {{declare_inherit_function(property_id)}} |
250 { | 243 { |
251 // Visited link style can never explicitly inherit from parent visited link
style so no separate getters are needed. | 244 // Visited link style can never explicitly inherit from parent visited link
style so no separate getters are needed. |
252 StyleColor color = state.parentStyle()->{{property.getter}}(); | 245 StyleColor color = state.parentStyle()->{{property.getter}}(); |
253 Color resolvedColor = color.resolve(state.parentStyle()->color()); | 246 Color resolvedColor = color.resolve(state.parentStyle()->color()); |
254 if (state.applyPropertyToRegularStyle()) | 247 if (state.applyPropertyToRegularStyle()) |
255 {{ set_value(property) }}(resolvedColor); | 248 {{set_value(property)}}(resolvedColor); |
256 if (state.applyPropertyToVisitedLinkStyle()) | 249 if (state.applyPropertyToVisitedLinkStyle()) |
257 state.style()->{{visited_link_setter}}(resolvedColor); | 250 state.style()->{{visited_link_setter}}(resolvedColor); |
258 } | 251 } |
259 | 252 |
260 {{ declare_value_function(property_id) }} | 253 {{declare_value_function(property_id)}} |
261 { | 254 { |
262 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 255 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
263 | 256 |
264 if (state.applyPropertyToRegularStyle()) | 257 if (state.applyPropertyToRegularStyle()) |
265 {{ set_value(property) }}(state.document().textLinkColors().colorFromPri
mitiveValue(primitiveValue, state.style()->color())); | 258 {{set_value(property)}}(state.document().textLinkColors().colorFromPrimi
tiveValue(primitiveValue, state.style()->color())); |
266 if (state.applyPropertyToVisitedLinkStyle()) | 259 if (state.applyPropertyToVisitedLinkStyle()) |
267 state.style()->{{visited_link_setter}}(state.document().textLinkColors()
.colorFromPrimitiveValue(primitiveValue, state.style()->color(), true)); | 260 state.style()->{{visited_link_setter}}(state.document().textLinkColors()
.colorFromPrimitiveValue(primitiveValue, state.style()->color(), true)); |
268 } | 261 } |
269 {%- endmacro %} | 262 {% endmacro %} |
| 263 {{apply_color('CSSPropertyBackgroundColor', initial_color='RenderStyle::initialB
ackgroundColor') }} |
| 264 {{apply_color('CSSPropertyBorderBottomColor')}} |
| 265 {{apply_color('CSSPropertyBorderLeftColor')}} |
| 266 {{apply_color('CSSPropertyBorderRightColor')}} |
| 267 {{apply_color('CSSPropertyBorderTopColor')}} |
| 268 {{apply_color('CSSPropertyOutlineColor')}} |
| 269 {{apply_color('CSSPropertyTextDecorationColor')}} |
| 270 {{apply_color('CSSPropertyWebkitColumnRuleColor')}} |
| 271 {{apply_color('CSSPropertyWebkitTextEmphasisColor')}} |
| 272 {{apply_color('CSSPropertyWebkitTextFillColor')}} |
| 273 {{apply_color('CSSPropertyWebkitTextStrokeColor')}} |
270 | 274 |
271 {{ apply_color("CSSPropertyBackgroundColor", initial_color="RenderStyle::initial
BackgroundColor") }} | 275 {% macro apply_counter(property_id, action) %} |
272 {{ apply_color("CSSPropertyBorderBottomColor") }} | 276 {% set property = properties[property_id] %} |
273 {{ apply_color("CSSPropertyBorderLeftColor") }} | 277 {{declare_initial_function(property_id)}} { } |
274 {{ apply_color("CSSPropertyBorderRightColor") }} | |
275 {{ apply_color("CSSPropertyBorderTopColor") }} | |
276 {{ apply_color("CSSPropertyOutlineColor") }} | |
277 {{ apply_color("CSSPropertyTextDecorationColor") }} | |
278 {{ apply_color("CSSPropertyWebkitColumnRuleColor") }} | |
279 {{ apply_color("CSSPropertyWebkitTextEmphasisColor") }} | |
280 {{ apply_color("CSSPropertyWebkitTextFillColor") }} | |
281 {{ apply_color("CSSPropertyWebkitTextStrokeColor") }} | |
282 | 278 |
283 {%- macro apply_counter(property_id, action) %} | 279 {{declare_inherit_function(property_id)}} |
284 {%- set property = properties[property_id] %} | |
285 {{ declare_initial_function(property_id) }} { } | |
286 | |
287 {{ declare_inherit_function(property_id) }} | |
288 { | 280 { |
289 CounterDirectiveMap& map = state.style()->accessCounterDirectives(); | 281 CounterDirectiveMap& map = state.style()->accessCounterDirectives(); |
290 CounterDirectiveMap& parentMap = state.parentStyle()->accessCounterDirective
s(); | 282 CounterDirectiveMap& parentMap = state.parentStyle()->accessCounterDirective
s(); |
291 | 283 |
292 typedef CounterDirectiveMap::iterator Iterator; | 284 typedef CounterDirectiveMap::iterator Iterator; |
293 Iterator end = parentMap.end(); | 285 Iterator end = parentMap.end(); |
294 for (Iterator it = parentMap.begin(); it != end; ++it) { | 286 for (Iterator it = parentMap.begin(); it != end; ++it) { |
295 CounterDirectives& directives = map.add(it->key, CounterDirectives()).st
oredValue->value; | 287 CounterDirectives& directives = map.add(it->key, CounterDirectives()).st
oredValue->value; |
296 directives.inherit{{action}}(it->value); | 288 directives.inherit{{action}}(it->value); |
297 } | 289 } |
298 } | 290 } |
299 | 291 |
300 {{ declare_value_function(property_id) }} | 292 {{declare_value_function(property_id)}} |
301 { | 293 { |
302 CounterDirectiveMap& map = state.style()->accessCounterDirectives(); | 294 CounterDirectiveMap& map = state.style()->accessCounterDirectives(); |
303 typedef CounterDirectiveMap::iterator Iterator; | 295 typedef CounterDirectiveMap::iterator Iterator; |
304 | 296 |
305 Iterator end = map.end(); | 297 Iterator end = map.end(); |
306 for (Iterator it = map.begin(); it != end; ++it) | 298 for (Iterator it = map.begin(); it != end; ++it) |
307 it->value.clear{{action}}(); | 299 it->value.clear{{action}}(); |
308 | 300 |
309 if (!value->isValueList()) { | 301 if (!value->isValueList()) { |
310 ASSERT(value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValue
ID() == CSSValueNone); | 302 ASSERT(value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValue
ID() == CSSValueNone); |
311 return; | 303 return; |
312 } | 304 } |
313 | 305 |
314 CSSValueList* list = toCSSValueList(value); | 306 CSSValueList* list = toCSSValueList(value); |
315 | 307 |
316 int length = list ? list->length() : 0; | 308 int length = list ? list->length() : 0; |
317 for (int i = 0; i < length; ++i) { | 309 for (int i = 0; i < length; ++i) { |
318 CSSValue* currValue = list->itemWithoutBoundsCheck(i); | 310 CSSValue* currValue = list->itemWithoutBoundsCheck(i); |
319 if (!currValue->isPrimitiveValue()) | 311 if (!currValue->isPrimitiveValue()) |
320 continue; | 312 continue; |
321 | 313 |
322 Pair* pair = toCSSPrimitiveValue(currValue)->getPairValue(); | 314 Pair* pair = toCSSPrimitiveValue(currValue)->getPairValue(); |
323 if (!pair || !pair->first() || !pair->second()) | 315 if (!pair || !pair->first() || !pair->second()) |
324 continue; | 316 continue; |
325 | 317 |
326 AtomicString identifier(pair->first()->getStringValue()); | 318 AtomicString identifier(pair->first()->getStringValue()); |
327 int value = pair->second()->getIntValue(); | 319 int value = pair->second()->getIntValue(); |
328 CounterDirectives& directives = map.add(identifier, CounterDirectives())
.storedValue->value; | 320 CounterDirectives& directives = map.add(identifier, CounterDirectives())
.storedValue->value; |
329 {%- if action == "Reset" %} | 321 {% if action == 'Reset' %} |
330 directives.setResetValue(value); | 322 directives.setResetValue(value); |
331 {%- else %} | 323 {% else %} |
332 directives.addIncrementValue(value); | 324 directives.addIncrementValue(value); |
333 {%- endif %} | 325 {% endif %} |
334 } | 326 } |
335 } | 327 } |
336 {%- endmacro %} | 328 {% endmacro %} |
| 329 {{apply_counter('CSSPropertyCounterIncrement', 'Increment')}} |
| 330 {{apply_counter('CSSPropertyCounterReset', 'Reset')}} |
337 | 331 |
338 {{ apply_counter("CSSPropertyCounterIncrement", "Increment") }} | 332 {% macro apply_fill_layer(property_id, fill_type) %} |
339 {{ apply_counter("CSSPropertyCounterReset", "Reset") }} | 333 {% set layer_type = 'Background' if 'Background' in property_id else 'Mask' %} |
340 | 334 {% set fill_layer_type = layer_type + 'FillLayer' %} |
341 {%- macro apply_fill_layer(property_id, fill_type) %} | 335 {% set access_layers = 'access' + layer_type + 'Layers' %} |
342 {%- set layer_type = "Background" if "Background" in property_id else "Mask" %} | 336 {% set map_fill = 'mapFill' + fill_type %} |
343 {%- set fill_layer_type = layer_type + "FillLayer" %} | 337 {{declare_initial_function(property_id)}} |
344 {%- set access_layers = "access" + layer_type + "Layers" %} | |
345 {%- set map_fill = "mapFill" + fill_type %} | |
346 {{ declare_initial_function(property_id) }} | |
347 { | 338 { |
348 FillLayer* currChild = state.style()->{{access_layers}}(); | 339 FillLayer* currChild = state.style()->{{access_layers}}(); |
349 currChild->set{{fill_type}}(FillLayer::initialFill{{fill_type}}({{fill_layer
_type}})); | 340 currChild->set{{fill_type}}(FillLayer::initialFill{{fill_type}}({{fill_layer
_type}})); |
350 for (currChild = currChild->next(); currChild; currChild = currChild->next()
) | 341 for (currChild = currChild->next(); currChild; currChild = currChild->next()
) |
351 currChild->clear{{fill_type}}(); | 342 currChild->clear{{fill_type}}(); |
352 } | 343 } |
353 | 344 |
354 {{ declare_inherit_function(property_id) }} | 345 {{declare_inherit_function(property_id)}} |
355 { | 346 { |
356 FillLayer* currChild = state.style()->{{access_layers}}(); | 347 FillLayer* currChild = state.style()->{{access_layers}}(); |
357 FillLayer* prevChild = 0; | 348 FillLayer* prevChild = 0; |
358 const FillLayer* currParent = state.parentStyle()->{{layer_type|lower}}Layer
s(); | 349 const FillLayer* currParent = state.parentStyle()->{{layer_type|lower}}Layer
s(); |
359 while (currParent && currParent->is{{fill_type}}Set()) { | 350 while (currParent && currParent->is{{fill_type}}Set()) { |
360 if (!currChild) { | 351 if (!currChild) { |
361 /* Need to make a new layer.*/ | 352 /* Need to make a new layer.*/ |
362 currChild = new FillLayer({{fill_layer_type}}); | 353 currChild = new FillLayer({{fill_layer_type}}); |
363 prevChild->setNext(currChild); | 354 prevChild->setNext(currChild); |
364 } | 355 } |
365 currChild->set{{fill_type}}(currParent->{{lower_first(fill_type)}}()); | 356 currChild->set{{fill_type}}(currParent->{{lower_first(fill_type)}}()); |
366 prevChild = currChild; | 357 prevChild = currChild; |
367 currChild = prevChild->next(); | 358 currChild = prevChild->next(); |
368 currParent = currParent->next(); | 359 currParent = currParent->next(); |
369 } | 360 } |
370 | 361 |
371 while (currChild) { | 362 while (currChild) { |
372 /* Reset any remaining layers to not have the property set. */ | 363 /* Reset any remaining layers to not have the property set. */ |
373 currChild->clear{{fill_type}}(); | 364 currChild->clear{{fill_type}}(); |
374 currChild = currChild->next(); | 365 currChild = currChild->next(); |
375 } | 366 } |
376 } | 367 } |
377 | 368 |
378 {{ declare_value_function(property_id) }} | 369 {{declare_value_function(property_id)}} |
379 { | 370 { |
380 FillLayer* currChild = state.style()->{{access_layers}}(); | 371 FillLayer* currChild = state.style()->{{access_layers}}(); |
381 FillLayer* prevChild = 0; | 372 FillLayer* prevChild = 0; |
382 if (value->isValueList() && !value->isImageSetValue()) { | 373 if (value->isValueList() && !value->isImageSetValue()) { |
383 /* Walk each value and put it into a layer, creating new layers as neede
d. */ | 374 /* Walk each value and put it into a layer, creating new layers as neede
d. */ |
384 CSSValueList* valueList = toCSSValueList(value); | 375 CSSValueList* valueList = toCSSValueList(value); |
385 for (unsigned int i = 0; i < valueList->length(); i++) { | 376 for (unsigned int i = 0; i < valueList->length(); i++) { |
386 if (!currChild) { | 377 if (!currChild) { |
387 /* Need to make a new layer to hold this value */ | 378 /* Need to make a new layer to hold this value */ |
388 currChild = new FillLayer({{fill_layer_type}}); | 379 currChild = new FillLayer({{fill_layer_type}}); |
389 prevChild->setNext(currChild); | 380 prevChild->setNext(currChild); |
390 } | 381 } |
391 state.styleMap().{{map_fill}}({{property_id}}, currChild, valueList-
>itemWithoutBoundsCheck(i)); | 382 state.styleMap().{{map_fill}}({{property_id}}, currChild, valueList-
>itemWithoutBoundsCheck(i)); |
392 prevChild = currChild; | 383 prevChild = currChild; |
393 currChild = currChild->next(); | 384 currChild = currChild->next(); |
394 } | 385 } |
395 } else { | 386 } else { |
396 state.styleMap().{{map_fill}}({{property_id}}, currChild, value); | 387 state.styleMap().{{map_fill}}({{property_id}}, currChild, value); |
397 currChild = currChild->next(); | 388 currChild = currChild->next(); |
398 } | 389 } |
399 while (currChild) { | 390 while (currChild) { |
400 /* Reset all remaining layers to not have the property set. */ | 391 /* Reset all remaining layers to not have the property set. */ |
401 currChild->clear{{fill_type}}(); | 392 currChild->clear{{fill_type}}(); |
402 currChild = currChild->next(); | 393 currChild = currChild->next(); |
403 } | 394 } |
404 } | 395 } |
405 {%- endmacro %} | 396 {% endmacro %} |
| 397 {{apply_fill_layer('CSSPropertyBackgroundAttachment', 'Attachment')}} |
| 398 {{apply_fill_layer('CSSPropertyBackgroundBlendMode', 'BlendMode')}} |
| 399 {{apply_fill_layer('CSSPropertyBackgroundClip', 'Clip')}} |
| 400 {{apply_fill_layer('CSSPropertyBackgroundImage', 'Image')}} |
| 401 {{apply_fill_layer('CSSPropertyBackgroundOrigin', 'Origin')}} |
| 402 {{apply_fill_layer('CSSPropertyBackgroundPositionX', 'XPosition')}} |
| 403 {{apply_fill_layer('CSSPropertyBackgroundPositionY', 'YPosition')}} |
| 404 {{apply_fill_layer('CSSPropertyBackgroundRepeatX', 'RepeatX')}} |
| 405 {{apply_fill_layer('CSSPropertyBackgroundRepeatY', 'RepeatY')}} |
| 406 {{apply_fill_layer('CSSPropertyBackgroundSize', 'Size')}} |
| 407 {{apply_fill_layer('CSSPropertyMaskSourceType', 'MaskSourceType')}} |
| 408 {{apply_fill_layer('CSSPropertyWebkitBackgroundComposite', 'Composite')}} |
| 409 {{apply_fill_layer('CSSPropertyWebkitMaskClip', 'Clip')}} |
| 410 {{apply_fill_layer('CSSPropertyWebkitMaskComposite', 'Composite')}} |
| 411 {{apply_fill_layer('CSSPropertyWebkitMaskImage', 'Image')}} |
| 412 {{apply_fill_layer('CSSPropertyWebkitMaskOrigin', 'Origin')}} |
| 413 {{apply_fill_layer('CSSPropertyWebkitMaskPositionX', 'XPosition')}} |
| 414 {{apply_fill_layer('CSSPropertyWebkitMaskPositionY', 'YPosition')}} |
| 415 {{apply_fill_layer('CSSPropertyWebkitMaskRepeatX', 'RepeatX')}} |
| 416 {{apply_fill_layer('CSSPropertyWebkitMaskRepeatY', 'RepeatY')}} |
| 417 {{apply_fill_layer('CSSPropertyWebkitMaskSize', 'Size')}} |
406 | 418 |
407 {{ apply_fill_layer("CSSPropertyBackgroundAttachment", "Attachment") }} | 419 {% macro apply_value_number(property_id, id_for_minus_one) %} |
408 {{ apply_fill_layer("CSSPropertyBackgroundBlendMode", "BlendMode") }} | 420 {{declare_value_function(property_id)}} |
409 {{ apply_fill_layer("CSSPropertyBackgroundClip", "Clip") }} | |
410 {{ apply_fill_layer("CSSPropertyBackgroundImage", "Image") }} | |
411 {{ apply_fill_layer("CSSPropertyBackgroundOrigin", "Origin") }} | |
412 {{ apply_fill_layer("CSSPropertyBackgroundPositionX", "XPosition") }} | |
413 {{ apply_fill_layer("CSSPropertyBackgroundPositionY", "YPosition") }} | |
414 {{ apply_fill_layer("CSSPropertyBackgroundRepeatX", "RepeatX") }} | |
415 {{ apply_fill_layer("CSSPropertyBackgroundRepeatY", "RepeatY") }} | |
416 {{ apply_fill_layer("CSSPropertyBackgroundSize", "Size") }} | |
417 {{ apply_fill_layer("CSSPropertyMaskSourceType", "MaskSourceType") }} | |
418 {{ apply_fill_layer("CSSPropertyWebkitBackgroundComposite", "Composite") }} | |
419 {{ apply_fill_layer("CSSPropertyWebkitMaskClip", "Clip") }} | |
420 {{ apply_fill_layer("CSSPropertyWebkitMaskComposite", "Composite") }} | |
421 {{ apply_fill_layer("CSSPropertyWebkitMaskImage", "Image") }} | |
422 {{ apply_fill_layer("CSSPropertyWebkitMaskOrigin", "Origin") }} | |
423 {{ apply_fill_layer("CSSPropertyWebkitMaskPositionX", "XPosition") }} | |
424 {{ apply_fill_layer("CSSPropertyWebkitMaskPositionY", "YPosition") }} | |
425 {{ apply_fill_layer("CSSPropertyWebkitMaskRepeatX", "RepeatX") }} | |
426 {{ apply_fill_layer("CSSPropertyWebkitMaskRepeatY", "RepeatY") }} | |
427 {{ apply_fill_layer("CSSPropertyWebkitMaskSize", "Size") }} | |
428 | |
429 {%- macro apply_value_number(property_id, id_for_minus_one) %} | |
430 {{ declare_value_function(property_id) }} | |
431 { | 421 { |
432 {%- set property = properties[property_id] %} | 422 {% set property = properties[property_id] %} |
433 if (!value->isPrimitiveValue()) | 423 if (!value->isPrimitiveValue()) |
434 return; | 424 return; |
435 | 425 |
436 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 426 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
437 if (primitiveValue->getValueID() == {{id_for_minus_one}}) | 427 if (primitiveValue->getValueID() == {{id_for_minus_one}}) |
438 {{ set_value(property) }}(-1); | 428 {{set_value(property)}}(-1); |
439 else | 429 else |
440 {{ set_value(property) }}(primitiveValue->getValue<{{property.type_name}
}>(CSSPrimitiveValue::CSS_NUMBER)); | 430 {{set_value(property)}}(primitiveValue->getValue<{{property.type_name}}>
(CSSPrimitiveValue::CSS_NUMBER)); |
441 } | 431 } |
442 {%- endmacro %} | 432 {% endmacro %} |
| 433 {{apply_value_number('CSSPropertyInternalMarqueeRepetition', 'CSSValueInfinite')
}} |
443 | 434 |
444 {{ apply_value_number("CSSPropertyInternalMarqueeRepetition", "CSSValueInfinite"
) }} | 435 {% macro apply_value_shape(property_id) %} |
445 | 436 {{declare_value_function(property_id)}} |
446 {%- macro apply_value_shape(property_id) %} | |
447 {{ declare_value_function(property_id) }} | |
448 { | 437 { |
449 {%- set property = properties[property_id] %} | 438 {% set property = properties[property_id] %} |
450 if (value->isPrimitiveValue()) { | 439 if (value->isPrimitiveValue()) { |
451 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 440 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
452 if (primitiveValue->getValueID() == CSSValueAuto) | 441 if (primitiveValue->getValueID() == CSSValueAuto) |
453 {{ set_value(property) }}(nullptr); | 442 {{set_value(property)}}(nullptr); |
454 } else if (value->isImageValue() || value->isImageSetValue()) { | 443 } else if (value->isImageValue() || value->isImageSetValue()) { |
455 {{ set_value(property) }}(ShapeValue::createImageValue(state.styleImage(
{{property_id}}, value))); | 444 {{set_value(property)}}(ShapeValue::createImageValue(state.styleImage({{
property_id}}, value))); |
456 } else if (value->isValueList()) { | 445 } else if (value->isValueList()) { |
457 RefPtr<BasicShape> shape; | 446 RefPtr<BasicShape> shape; |
458 CSSBoxType cssBox = BoxMissing; | 447 CSSBoxType cssBox = BoxMissing; |
459 CSSValueList* valueList = toCSSValueList(value); | 448 CSSValueList* valueList = toCSSValueList(value); |
460 for (unsigned i = 0; i < valueList->length(); ++i) { | 449 for (unsigned i = 0; i < valueList->length(); ++i) { |
461 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->i
temWithoutBoundsCheck(i)); | 450 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->i
temWithoutBoundsCheck(i)); |
462 if (primitiveValue->isShape()) | 451 if (primitiveValue->isShape()) |
463 shape = basicShapeForValue(state, primitiveValue->getShapeValue(
)); | 452 shape = basicShapeForValue(state, primitiveValue->getShapeValue(
)); |
464 else if (primitiveValue->getValueID() == CSSValueContentBox | 453 else if (primitiveValue->getValueID() == CSSValueContentBox |
465 || primitiveValue->getValueID() == CSSValueBorderBox | 454 || primitiveValue->getValueID() == CSSValueBorderBox |
466 || primitiveValue->getValueID() == CSSValuePaddingBox | 455 || primitiveValue->getValueID() == CSSValuePaddingBox |
467 || primitiveValue->getValueID() == CSSValueMarginBox) | 456 || primitiveValue->getValueID() == CSSValueMarginBox) |
468 cssBox = CSSBoxType(*primitiveValue); | 457 cssBox = CSSBoxType(*primitiveValue); |
469 else | 458 else |
470 return; | 459 return; |
471 } | 460 } |
472 | 461 |
473 if (shape) | 462 if (shape) |
474 {{ set_value(property) }}(ShapeValue::createShapeValue(shape.release
(), cssBox)); | 463 {{set_value(property)}}(ShapeValue::createShapeValue(shape.release()
, cssBox)); |
475 else if (cssBox != BoxMissing) | 464 else if (cssBox != BoxMissing) |
476 {{ set_value(property) }}(ShapeValue::createBoxShapeValue(cssBox)); | 465 {{set_value(property)}}(ShapeValue::createBoxShapeValue(cssBox)); |
477 } | 466 } |
478 } | 467 } |
479 {%- endmacro %} | 468 {% endmacro %} |
480 | 469 {{apply_value_shape('CSSPropertyShapeOutside')}} |
481 {{ apply_value_shape("CSSPropertyShapeOutside") }} | |
482 | |
483 } // namespace WebCore | 470 } // namespace WebCore |
OLD | NEW |