Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl

Issue 16415007: Cleanup usage of CSSPropertyID and CSSValueID inside Blink. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/scripts/templates/StyleBuilder.cpp.tmpl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {# 1 {#
2 This file is for property handlers which use the templating engine to 2 This file is for property handlers which use the templating engine to
3 reduce (handwritten) code duplication. 3 reduce (handwritten) code duplication.
4 4
5 The `properties' dict can be used to access a property's parameters in 5 The `properties' dict can be used to access a property's parameters in
6 jinja2 templates (i.e. setter, getter, initial, type_name, condition) 6 jinja2 templates (i.e. setter, getter, initial, type_name, condition)
7 -#} 7 -#}
8 8
9 #include "config.h" 9 #include "config.h"
10 #include "StyleBuilderFunctions.h" 10 #include "StyleBuilderFunctions.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 {{ apply_value_border_image("CSSPropertyWebkitMaskBoxImage") }} 47 {{ apply_value_border_image("CSSPropertyWebkitMaskBoxImage") }}
48 48
49 {%- macro apply_value_number(property_id, id_for_minus_one) %} 49 {%- macro apply_value_number(property_id, id_for_minus_one) %}
50 {{ apply_value(property_id) }} 50 {{ apply_value(property_id) }}
51 { 51 {
52 {%- set property = properties[property_id] %} 52 {%- set property = properties[property_id] %}
53 if (!value->isPrimitiveValue()) 53 if (!value->isPrimitiveValue())
54 return; 54 return;
55 55
56 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 56 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
57 if (primitiveValue->getIdent() == {{id_for_minus_one}}) 57 if (primitiveValue->getValueID() == {{id_for_minus_one}})
58 {{ set_value(property) }}(-1); 58 {{ set_value(property) }}(-1);
59 else 59 else
60 {{ set_value(property) }}(primitiveValue->getValue<{{property.type_name} }>(CSSPrimitiveValue::CSS_NUMBER)); 60 {{ set_value(property) }}(primitiveValue->getValue<{{property.type_name} }>(CSSPrimitiveValue::CSS_NUMBER));
61 } 61 }
62 {%- endmacro %} 62 {%- endmacro %}
63 63
64 {{ apply_value_number("CSSPropertyWebkitHyphenateLimitAfter", "CSSValueAuto") }} 64 {{ apply_value_number("CSSPropertyWebkitHyphenateLimitAfter", "CSSValueAuto") }}
65 {{ apply_value_number("CSSPropertyWebkitHyphenateLimitBefore", "CSSValueAuto") } } 65 {{ apply_value_number("CSSPropertyWebkitHyphenateLimitBefore", "CSSValueAuto") } }
66 {{ apply_value_number("CSSPropertyWebkitHyphenateLimitLines", "CSSValueNoLimit") }} 66 {{ apply_value_number("CSSPropertyWebkitHyphenateLimitLines", "CSSValueNoLimit") }}
67 {{ apply_value_number("CSSPropertyWebkitMarqueeRepetition", "CSSValueInfinite") }} 67 {{ apply_value_number("CSSPropertyWebkitMarqueeRepetition", "CSSValueInfinite") }}
68 68
69 {{ apply_value("CSSPropertyWebkitMarqueeIncrement") }} 69 {{ apply_value("CSSPropertyWebkitMarqueeIncrement") }}
70 { 70 {
71 if (!value->isPrimitiveValue()) 71 if (!value->isPrimitiveValue())
72 return; 72 return;
73 73
74 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 74 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
75 if (primitiveValue->getIdent()) { 75 if (primitiveValue->getValueID()) {
76 switch (primitiveValue->getIdent()) { 76 switch (primitiveValue->getValueID()) {
77 case CSSValueSmall: 77 case CSSValueSmall:
78 styleResolver->style()->setMarqueeIncrement(Length(1, Fixed)); // 1p x. 78 styleResolver->style()->setMarqueeIncrement(Length(1, Fixed)); // 1p x.
79 break; 79 break;
80 case CSSValueNormal: 80 case CSSValueNormal:
81 styleResolver->style()->setMarqueeIncrement(Length(6, Fixed)); // 6p x. The WinIE default. 81 styleResolver->style()->setMarqueeIncrement(Length(6, Fixed)); // 6p x. The WinIE default.
82 break; 82 break;
83 case CSSValueLarge: 83 case CSSValueLarge:
84 styleResolver->style()->setMarqueeIncrement(Length(36, Fixed)); // 3 6px. 84 styleResolver->style()->setMarqueeIncrement(Length(36, Fixed)); // 3 6px.
85 break; 85 break;
86 default:
87 break;
86 } 88 }
87 } else { 89 } else {
88 Length marqueeLength = styleResolver->convertToIntLength(primitiveValue, styleResolver->style(), styleResolver->rootElementStyle()); 90 Length marqueeLength = styleResolver->convertToIntLength(primitiveValue, styleResolver->style(), styleResolver->rootElementStyle());
89 if (!marqueeLength.isUndefined()) 91 if (!marqueeLength.isUndefined())
90 styleResolver->style()->setMarqueeIncrement(marqueeLength); 92 styleResolver->style()->setMarqueeIncrement(marqueeLength);
91 } 93 }
92 } 94 }
93 95
94 } // namespace WebCore 96 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/scripts/templates/StyleBuilder.cpp.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698