| OLD | NEW |
| 1 {% from "macros.tmpl" import lower_first -%} | 1 {% from "macros.tmpl" import lower_first -%} |
| 2 | 2 |
| 3 {# | 3 {# |
| 4 This file is for property handlers which use the templating engine to | 4 This file is for property handlers which use the templating engine to |
| 5 reduce (handwritten) code duplication. | 5 reduce (handwritten) code duplication. |
| 6 | 6 |
| 7 The `properties' dict can be used to access a property's parameters in | 7 The `properties' dict can be used to access a property's parameters in |
| 8 jinja2 templates (i.e. setter, getter, initial, type_name) | 8 jinja2 templates (i.e. setter, getter, initial, type_name) |
| 9 -#} | 9 -#} |
| 10 | 10 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 {%- endmacro %} | 241 {%- endmacro %} |
| 242 | 242 |
| 243 {{ apply_value_border_image_source("CSSPropertyBorderImageSource") }} | 243 {{ apply_value_border_image_source("CSSPropertyBorderImageSource") }} |
| 244 {{ apply_value_border_image_source("CSSPropertyWebkitMaskBoxImageSource") }} | 244 {{ apply_value_border_image_source("CSSPropertyWebkitMaskBoxImageSource") }} |
| 245 | 245 |
| 246 {%- macro apply_color(property_id, default_getter="color", initial_color=none, i
nherit_color=false) %} | 246 {%- macro apply_color(property_id, default_getter="color", initial_color=none, i
nherit_color=false) %} |
| 247 {%- set property = properties[property_id] %} | 247 {%- set property = properties[property_id] %} |
| 248 {%- set visited_link_setter = "setVisitedLink" + property.camel_case_name %} | 248 {%- set visited_link_setter = "setVisitedLink" + property.camel_case_name %} |
| 249 {{ declare_initial_function(property_id) }} | 249 {{ declare_initial_function(property_id) }} |
| 250 { | 250 { |
| 251 StyleColor color = {{ initial_color or "StyleColor" -}}(); | 251 Color color = {{ initial_color or "Color" -}}(); |
| 252 if (state.applyPropertyToRegularStyle()) | 252 if (state.applyPropertyToRegularStyle()) |
| 253 {{ set_value(property) }}(color); | 253 {{ set_value(property) }}(color); |
| 254 if (state.applyPropertyToVisitedLinkStyle()) | 254 if (state.applyPropertyToVisitedLinkStyle()) |
| 255 state.style()->{{visited_link_setter}}(color); | 255 state.style()->{{visited_link_setter}}(color); |
| 256 } | 256 } |
| 257 | 257 |
| 258 {{ declare_inherit_function(property_id) }} | 258 {{ declare_inherit_function(property_id) }} |
| 259 { | 259 { |
| 260 // Visited link style can never explicitly inherit from parent visited link
style so no separate getters are needed. | 260 // Visited link style can never explicitly inherit from parent visited link
style so no separate getters are needed. |
| 261 StyleColor color = state.parentStyle()->{{property.getter}}(); | 261 Color color = state.parentStyle()->{{property.getter}}(); |
| 262 if (!color.isValid()) | 262 if (!color.isValid()) |
| 263 color = state.parentStyle()->{{default_getter}}(); | 263 color = state.parentStyle()->{{default_getter}}(); |
| 264 if (state.applyPropertyToRegularStyle()) | 264 if (state.applyPropertyToRegularStyle()) |
| 265 {{ set_value(property) }}(color); | 265 {{ set_value(property) }}(color); |
| 266 if (state.applyPropertyToVisitedLinkStyle()) | 266 if (state.applyPropertyToVisitedLinkStyle()) |
| 267 state.style()->{{visited_link_setter}}(color); | 267 state.style()->{{visited_link_setter}}(color); |
| 268 } | 268 } |
| 269 | 269 |
| 270 {{ declare_value_function(property_id) }} | 270 {{ declare_value_function(property_id) }} |
| 271 { | 271 { |
| 272 if (!value->isPrimitiveValue()) | 272 if (!value->isPrimitiveValue()) |
| 273 return; | 273 return; |
| 274 | 274 |
| 275 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 275 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 276 | 276 |
| 277 {%- if inherit_color %} | 277 {%- if inherit_color %} |
| 278 if (primitiveValue->getValueID() == CSSValueCurrentcolor) { | 278 if (primitiveValue->getValueID() == CSSValueCurrentcolor) { |
| 279 applyInherit{{property_id}}(state); | 279 applyInherit{{property_id}}(state); |
| 280 return; | 280 return; |
| 281 } | 281 } |
| 282 {%- endif %} | 282 {%- endif %} |
| 283 | 283 |
| 284 if (state.applyPropertyToRegularStyle()) | 284 if (state.applyPropertyToRegularStyle()) |
| 285 {{ set_value(property) }}(state.document().textLinkColors().colorFromPri
mitiveValue(primitiveValue)); | 285 {{ set_value(property) }}(state.document().textLinkColors().colorFromPri
mitiveValue(primitiveValue, state.style()->visitedDependentColor(CSSPropertyColo
r))); |
| 286 if (state.applyPropertyToVisitedLinkStyle()) | 286 if (state.applyPropertyToVisitedLinkStyle()) |
| 287 state.style()->{{visited_link_setter}}(state.document().textLinkColors()
.colorFromPrimitiveValue(primitiveValue, state.element()->isLink() /* forVisited
Link */)); | 287 state.style()->{{visited_link_setter}}(state.document().textLinkColors()
.colorFromPrimitiveValue(primitiveValue, state.style()->visitedDependentColor(CS
SPropertyColor), state.element()->isLink() /* forVisitedLink */)); |
| 288 } | 288 } |
| 289 {%- endmacro %} | 289 {%- endmacro %} |
| 290 | 290 |
| 291 {{ apply_color("CSSPropertyBackgroundColor", default_getter="invalidColor") }} | 291 {{ apply_color("CSSPropertyBackgroundColor", default_getter="invalidColor") }} |
| 292 {{ apply_color("CSSPropertyBorderBottomColor") }} | 292 {{ apply_color("CSSPropertyBorderBottomColor") }} |
| 293 {{ apply_color("CSSPropertyBorderLeftColor") }} | 293 {{ apply_color("CSSPropertyBorderLeftColor") }} |
| 294 {{ apply_color("CSSPropertyBorderRightColor") }} | 294 {{ apply_color("CSSPropertyBorderRightColor") }} |
| 295 {{ apply_color("CSSPropertyBorderTopColor") }} | 295 {{ apply_color("CSSPropertyBorderTopColor") }} |
| 296 {{ apply_color("CSSPropertyColor", inherit_color=true, default_getter="invalidCo
lor", initial_color="RenderStyle::initialColor") }} | 296 {{ apply_color("CSSPropertyColor", inherit_color=true, default_getter="invalidCo
lor", initial_color="RenderStyle::initialColor") }} |
| 297 {{ apply_color("CSSPropertyOutlineColor") }} | 297 {{ apply_color("CSSPropertyOutlineColor") }} |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 } else if (value->isImageValue()) { | 507 } else if (value->isImageValue()) { |
| 508 {{ set_value(property) }}(ShapeValue::createImageValue(state.styleImage(
{{property_id}}, value))); | 508 {{ set_value(property) }}(ShapeValue::createImageValue(state.styleImage(
{{property_id}}, value))); |
| 509 } | 509 } |
| 510 } | 510 } |
| 511 {%- endmacro %} | 511 {%- endmacro %} |
| 512 | 512 |
| 513 {{ apply_value_shape("CSSPropertyWebkitShapeInside") }} | 513 {{ apply_value_shape("CSSPropertyWebkitShapeInside") }} |
| 514 {{ apply_value_shape("CSSPropertyWebkitShapeOutside") }} | 514 {{ apply_value_shape("CSSPropertyWebkitShapeOutside") }} |
| 515 | 515 |
| 516 } // namespace WebCore | 516 } // namespace WebCore |
| OLD | NEW |