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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 state.style()->{{auto_setter}}(); | 135 state.style()->{{auto_setter}}(); |
136 else | 136 else |
137 {{set_value(property)}}(state.parentStyle()->{{property.getter}}()); | 137 {{set_value(property)}}(state.parentStyle()->{{property.getter}}()); |
138 } | 138 } |
139 | 139 |
140 {{declare_value_function(property_id)}} | 140 {{declare_value_function(property_id)}} |
141 { | 141 { |
142 if (!value.isPrimitiveValue()) | 142 if (!value.isPrimitiveValue()) |
143 return; | 143 return; |
144 | 144 |
145 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 145 CSSPrimitiveValue primitiveValue = toCSSPrimitiveValue(value); |
146 if (primitiveValue.getValueID() == {{auto_identity}}) | 146 if (primitiveValue.getValueID() == {{auto_identity}}) |
147 state.style()->{{auto_setter}}(); | 147 state.style()->{{auto_setter}}(); |
148 else | 148 else |
149 {{convert_and_set_value(property)}} | 149 {{convert_and_set_value(property)}} |
150 } | 150 } |
151 {% endmacro %} | 151 {% endmacro %} |
152 {{apply_auto('CSSPropertyClip')}} | 152 {{apply_auto('CSSPropertyClip')}} |
153 {{apply_auto('CSSPropertyOrphans')}} | 153 {{apply_auto('CSSPropertyOrphans')}} |
154 {{apply_auto('CSSPropertyWebkitColumnCount')}} | 154 {{apply_auto('CSSPropertyWebkitColumnCount')}} |
155 {{apply_auto('CSSPropertyWebkitColumnGap', auto_getter='hasNormalColumnGap', aut
o_setter='setHasNormalColumnGap', auto_identity='CSSValueNormal')}} | 155 {{apply_auto('CSSPropertyWebkitColumnGap', auto_getter='hasNormalColumnGap', aut
o_setter='setHasNormalColumnGap', auto_identity='CSSValueNormal')}} |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 int length = list.length(); | 351 int length = list.length(); |
352 for (int i = 0; i < length; ++i) { | 352 for (int i = 0; i < length; ++i) { |
353 CSSValue currValue = list.item(i); | 353 CSSValue currValue = list.item(i); |
354 if (!currValue.isPrimitiveValue()) | 354 if (!currValue.isPrimitiveValue()) |
355 continue; | 355 continue; |
356 | 356 |
357 Pair* pair = toCSSPrimitiveValue(currValue).getPairValue(); | 357 Pair* pair = toCSSPrimitiveValue(currValue).getPairValue(); |
358 if (!pair || !pair->first() || !pair->second()) | 358 if (!pair || !pair->first() || !pair->second()) |
359 continue; | 359 continue; |
360 | 360 |
361 AtomicString identifier(pair->first()->getStringValue()); | 361 AtomicString identifier(toCSSPrimitiveValue(*pair->first()).getStringVal
ue()); |
362 int value = pair->second()->getIntValue(); | 362 int value = toCSSPrimitiveValue(*pair->second()).getIntValue(); |
363 CounterDirectives& directives = map.add(identifier, CounterDirectives())
.storedValue->value; | 363 CounterDirectives& directives = map.add(identifier, CounterDirectives())
.storedValue->value; |
364 {% if action == 'Reset' %} | 364 {% if action == 'Reset' %} |
365 directives.setResetValue(value); | 365 directives.setResetValue(value); |
366 {% else %} | 366 {% else %} |
367 directives.addIncrementValue(value); | 367 directives.addIncrementValue(value); |
368 {% endif %} | 368 {% endif %} |
369 } | 369 } |
370 ASSERT(!map.isEmpty()); | 370 ASSERT(!map.isEmpty()); |
371 } | 371 } |
372 {% endmacro %} | 372 {% endmacro %} |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 {{declare_value_function(property_id)}} | 513 {{declare_value_function(property_id)}} |
514 { | 514 { |
515 String url; | 515 String url; |
516 if (value.isValueList()) { | 516 if (value.isValueList()) { |
517 CSSValueList& list = toCSSValueList(value); | 517 CSSValueList& list = toCSSValueList(value); |
518 ASSERT(list.length() > 1); | 518 ASSERT(list.length() > 1); |
519 | 519 |
520 if (!list.item(0).isPrimitiveValue()) | 520 if (!list.item(0).isPrimitiveValue()) |
521 return; | 521 return; |
522 | 522 |
523 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(list.item(0)); | 523 CSSPrimitiveValue primitiveValue = toCSSPrimitiveValue(list.item(0)); |
524 if (!primitiveValue.isURI()) | 524 if (!primitiveValue.isURI()) |
525 return; | 525 return; |
526 | 526 |
527 url = primitiveValue.getStringValue(); | 527 url = primitiveValue.getStringValue(); |
528 value = list.item(1); | 528 value = list.item(1); |
529 } | 529 } |
530 if (value.isPrimitiveValue()) { | 530 if (value.isPrimitiveValue()) { |
531 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 531 CSSPrimitiveValue primitiveValue = toCSSPrimitiveValue(value); |
532 Color color; | 532 Color color; |
533 SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR; | 533 SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR; |
534 if (primitiveValue.getValueID() == CSSValueNone) { | 534 if (primitiveValue.getValueID() == CSSValueNone) { |
535 paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_N
ONE; | 535 paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_N
ONE; |
536 } else if (primitiveValue.isURI()) { | 536 } else if (primitiveValue.isURI()) { |
537 paintType = SVG_PAINTTYPE_URI; | 537 paintType = SVG_PAINTTYPE_URI; |
538 url = primitiveValue.getStringValue(); | 538 url = primitiveValue.getStringValue(); |
539 } else if (primitiveValue.getValueID() == CSSValueCurrentcolor) { | 539 } else if (primitiveValue.getValueID() == CSSValueCurrentcolor) { |
540 color = state.style()->color(); | 540 color = state.style()->color(); |
541 paintType = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTY
PE_URI_CURRENTCOLOR; | 541 paintType = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTY
PE_URI_CURRENTCOLOR; |
542 } else { | 542 } else { |
543 color = StyleBuilderConverter::convertColor(state, value); | 543 color = StyleBuilderConverter::convertColor(state, value); |
544 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_U
RI_RGBCOLOR; | 544 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_U
RI_RGBCOLOR; |
545 } | 545 } |
546 {{set_value(property)}}(paintType, color, url, | 546 {{set_value(property)}}(paintType, color, url, |
547 state.applyPropertyToRegularStyle(), | 547 state.applyPropertyToRegularStyle(), |
548 state.applyPropertyToVisitedLinkStyle()); | 548 state.applyPropertyToVisitedLinkStyle()); |
549 } | 549 } |
550 } | 550 } |
551 {% endmacro %} | 551 {% endmacro %} |
552 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 552 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
553 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 553 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
554 } // namespace blink | 554 } // namespace blink |
OLD | NEW |