| OLD | NEW |
| 1 {% from 'macros.tmpl' import license %} | 1 {% from 'macros.tmpl' import license %} |
| 2 {# | 2 {# |
| 3 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 |
| 4 reduce (handwritten) code duplication. | 4 reduce (handwritten) code duplication. |
| 5 | 5 |
| 6 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 |
| 7 jinja2 templates (i.e. setter, getter, initial, type_name) | 7 jinja2 templates (i.e. setter, getter, initial, type_name) |
| 8 #} | 8 #} |
| 9 #include "config.h" | 9 #include "config.h" |
| 10 #include "StyleBuilderFunctions.h" | 10 #include "StyleBuilderFunctions.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 {{apply_counter('CSSPropertyCounterIncrement', 'Increment')}} | 381 {{apply_counter('CSSPropertyCounterIncrement', 'Increment')}} |
| 382 {{apply_counter('CSSPropertyCounterReset', 'Reset')}} | 382 {{apply_counter('CSSPropertyCounterReset', 'Reset')}} |
| 383 | 383 |
| 384 {% macro apply_fill_layer(property_id, fill_type) %} | 384 {% macro apply_fill_layer(property_id, fill_type) %} |
| 385 {% set layer_type = 'Background' if 'Background' in property_id else 'Mask' %} | 385 {% set layer_type = 'Background' if 'Background' in property_id else 'Mask' %} |
| 386 {% set fill_layer_type = layer_type + 'FillLayer' %} | 386 {% set fill_layer_type = layer_type + 'FillLayer' %} |
| 387 {% set access_layers = 'access' + layer_type + 'Layers' %} | 387 {% set access_layers = 'access' + layer_type + 'Layers' %} |
| 388 {% set map_fill = 'mapFill' + fill_type %} | 388 {% set map_fill = 'mapFill' + fill_type %} |
| 389 {{declare_initial_function(property_id)}} | 389 {{declare_initial_function(property_id)}} |
| 390 { | 390 { |
| 391 FillLayer* currChild = state.style()->{{access_layers}}(); | 391 FillLayer* currChild = &state.style()->{{access_layers}}(); |
| 392 currChild->set{{fill_type}}(FillLayer::initialFill{{fill_type}}({{fill_layer
_type}})); | 392 currChild->set{{fill_type}}(FillLayer::initialFill{{fill_type}}({{fill_layer
_type}})); |
| 393 for (currChild = currChild->next(); currChild; currChild = currChild->next()
) | 393 for (currChild = currChild->next(); currChild; currChild = currChild->next()
) |
| 394 currChild->clear{{fill_type}}(); | 394 currChild->clear{{fill_type}}(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 {{declare_inherit_function(property_id)}} | 397 {{declare_inherit_function(property_id)}} |
| 398 { | 398 { |
| 399 FillLayer* currChild = state.style()->{{access_layers}}(); | 399 FillLayer* currChild = &state.style()->{{access_layers}}(); |
| 400 FillLayer* prevChild = 0; | 400 FillLayer* prevChild = 0; |
| 401 const FillLayer* currParent = state.parentStyle()->{{layer_type|lower}}Layer
s(); | 401 const FillLayer* currParent = &state.parentStyle()->{{layer_type|lower}}Laye
rs(); |
| 402 while (currParent && currParent->is{{fill_type}}Set()) { | 402 while (currParent && currParent->is{{fill_type}}Set()) { |
| 403 if (!currChild) { | 403 if (!currChild) { |
| 404 /* Need to make a new layer.*/ | 404 /* Need to make a new layer.*/ |
| 405 currChild = new FillLayer({{fill_layer_type}}); | 405 currChild = new FillLayer({{fill_layer_type}}); |
| 406 prevChild->setNext(currChild); | 406 prevChild->setNext(currChild); |
| 407 } | 407 } |
| 408 currChild->set{{fill_type}}(currParent->{{fill_type|lower_first}}()); | 408 currChild->set{{fill_type}}(currParent->{{fill_type|lower_first}}()); |
| 409 prevChild = currChild; | 409 prevChild = currChild; |
| 410 currChild = prevChild->next(); | 410 currChild = prevChild->next(); |
| 411 currParent = currParent->next(); | 411 currParent = currParent->next(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 while (currChild) { | 414 while (currChild) { |
| 415 /* Reset any remaining layers to not have the property set. */ | 415 /* Reset any remaining layers to not have the property set. */ |
| 416 currChild->clear{{fill_type}}(); | 416 currChild->clear{{fill_type}}(); |
| 417 currChild = currChild->next(); | 417 currChild = currChild->next(); |
| 418 } | 418 } |
| 419 } | 419 } |
| 420 | 420 |
| 421 {{declare_value_function(property_id)}} | 421 {{declare_value_function(property_id)}} |
| 422 { | 422 { |
| 423 FillLayer* currChild = state.style()->{{access_layers}}(); | 423 FillLayer* currChild = &state.style()->{{access_layers}}(); |
| 424 FillLayer* prevChild = 0; | 424 FillLayer* prevChild = 0; |
| 425 if (value->isValueList() && !value->isImageSetValue()) { | 425 if (value->isValueList() && !value->isImageSetValue()) { |
| 426 /* Walk each value and put it into a layer, creating new layers as neede
d. */ | 426 /* Walk each value and put it into a layer, creating new layers as neede
d. */ |
| 427 CSSValueList* valueList = toCSSValueList(value); | 427 CSSValueList* valueList = toCSSValueList(value); |
| 428 for (unsigned int i = 0; i < valueList->length(); i++) { | 428 for (unsigned int i = 0; i < valueList->length(); i++) { |
| 429 if (!currChild) { | 429 if (!currChild) { |
| 430 /* Need to make a new layer to hold this value */ | 430 /* Need to make a new layer to hold this value */ |
| 431 currChild = new FillLayer({{fill_layer_type}}); | 431 currChild = new FillLayer({{fill_layer_type}}); |
| 432 prevChild->setNext(currChild); | 432 prevChild->setNext(currChild); |
| 433 } | 433 } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 } | 642 } |
| 643 {{set_value(property)}}(ptype, c, url, | 643 {{set_value(property)}}(ptype, c, url, |
| 644 state.applyPropertyToRegularStyle(), | 644 state.applyPropertyToRegularStyle(), |
| 645 state.applyPropertyToVisitedLinkStyle()); | 645 state.applyPropertyToVisitedLinkStyle()); |
| 646 } | 646 } |
| 647 } | 647 } |
| 648 {% endmacro %} | 648 {% endmacro %} |
| 649 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 649 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
| 650 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 650 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
| 651 } // namespace WebCore | 651 } // namespace WebCore |
| OLD | NEW |