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" |
11 | 11 |
12 #include "CSSValueKeywords.h" | 12 #include "CSSValueKeywords.h" |
13 #include "core/css/BasicShapeFunctions.h" | 13 #include "core/css/BasicShapeFunctions.h" |
14 #include "core/css/CSSContentDistributionValue.h" | 14 #include "core/css/CSSContentDistributionValue.h" |
15 #include "core/css/CSSPrimitiveValueMappings.h" | 15 #include "core/css/CSSPrimitiveValueMappings.h" |
16 #include "core/css/Pair.h" | 16 #include "core/css/CSSValuePair.h" |
17 #include "core/css/resolver/StyleResolverState.h" | 17 #include "core/css/resolver/StyleResolverState.h" |
18 | 18 |
19 {% macro declare_initial_function(property_id) %} | 19 {% macro declare_initial_function(property_id) %} |
20 void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolverState& stat
e) | 20 void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolverState& stat
e) |
21 {%- endmacro %} | 21 {%- endmacro %} |
22 {% macro declare_inherit_function(property_id) %} | 22 {% macro declare_inherit_function(property_id) %} |
23 void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolverState& stat
e) | 23 void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolverState& stat
e) |
24 {%- endmacro %} | 24 {%- endmacro %} |
25 {% macro declare_value_function(property_id) %} | 25 {% macro declare_value_function(property_id) %} |
26 void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolverState& state,
CSSValue* value) | 26 void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolverState& state,
CSSValue* value) |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 ASSERT(value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValue
ID() == CSSValueNone); | 339 ASSERT(value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValue
ID() == CSSValueNone); |
340 return; | 340 return; |
341 } | 341 } |
342 | 342 |
343 CounterDirectiveMap& map = state.style()->accessCounterDirectives(); | 343 CounterDirectiveMap& map = state.style()->accessCounterDirectives(); |
344 | 344 |
345 CSSValueList* list = toCSSValueList(value); | 345 CSSValueList* list = toCSSValueList(value); |
346 | 346 |
347 int length = list ? list->length() : 0; | 347 int length = list ? list->length() : 0; |
348 for (int i = 0; i < length; ++i) { | 348 for (int i = 0; i < length; ++i) { |
349 CSSValue* currValue = list->item(i); | 349 const CSSValuePair* pair = toCSSValuePair(list->item(i)); |
350 Pair* pair = toCSSPrimitiveValue(currValue)->getPairValue(); | 350 AtomicString identifier(toCSSPrimitiveValue(pair->first())->getStringVal
ue()); |
351 AtomicString identifier(pair->first()->getStringValue()); | 351 int value = toCSSPrimitiveValue(pair->second())->getIntValue(); |
352 int value = pair->second()->getIntValue(); | |
353 CounterDirectives& directives = map.add(identifier, CounterDirectives())
.storedValue->value; | 352 CounterDirectives& directives = map.add(identifier, CounterDirectives())
.storedValue->value; |
354 {% if action == 'Reset' %} | 353 {% if action == 'Reset' %} |
355 directives.setResetValue(value); | 354 directives.setResetValue(value); |
356 {% else %} | 355 {% else %} |
357 directives.addIncrementValue(value); | 356 directives.addIncrementValue(value); |
358 {% endif %} | 357 {% endif %} |
359 } | 358 } |
360 ASSERT(!map.isEmpty()); | 359 ASSERT(!map.isEmpty()); |
361 } | 360 } |
362 {% endmacro %} | 361 {% endmacro %} |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_R
GBCOLOR; | 524 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_R
GBCOLOR; |
526 } | 525 } |
527 {{set_value(property)}}(paintType, color, url, | 526 {{set_value(property)}}(paintType, color, url, |
528 state.applyPropertyToRegularStyle(), | 527 state.applyPropertyToRegularStyle(), |
529 state.applyPropertyToVisitedLinkStyle()); | 528 state.applyPropertyToVisitedLinkStyle()); |
530 } | 529 } |
531 {% endmacro %} | 530 {% endmacro %} |
532 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 531 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
533 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 532 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
534 } // namespace blink | 533 } // namespace blink |
OLD | NEW |