| OLD | NEW |
| 1 {% from "macros.tmpl" import wrap_with_condition, license -%} | 1 {% from "macros.tmpl" import wrap_with_condition, license -%} |
| 2 {{ license() }} | 2 {{ license() }} |
| 3 | 3 |
| 4 #include "config.h" | 4 #include "config.h" |
| 5 #include "core/css/resolver/StyleBuilder.h" | 5 #include "core/css/resolver/StyleBuilder.h" |
| 6 | 6 |
| 7 #include "StyleBuilderFunctions.h" | 7 #include "StyleBuilderFunctions.h" |
| 8 #include "core/css/CSSPrimitiveValueMappings.h" | 8 #include "core/css/CSSPrimitiveValueMappings.h" |
| 9 #include "core/css/resolver/StyleResolver.h" | 9 #include "core/css/resolver/StyleResolver.h" |
| 10 | 10 |
| 11 // FIXME: currently we're just generating a switch statement, but we should | 11 // FIXME: currently we're just generating a switch statement, but we should |
| 12 // test other variations for performance once we have more properties here. | 12 // test other variations for performance once we have more properties here. |
| 13 | 13 |
| 14 {%- macro set_value(property) -%} | 14 {%- macro set_value(property) -%} |
| 15 styleResolver->style()->{{property.setter}} | 15 styleResolver->style()->{{property.setter}} |
| 16 {%- endmacro %} | 16 {%- endmacro %} |
| 17 | 17 |
| 18 namespace WebCore { | 18 namespace WebCore { |
| 19 | 19 |
| 20 {%- macro apply_value_length(property) -%} | 20 {%- macro apply_value_length(property) -%} |
| 21 if (!value->isPrimitiveValue()) | 21 if (!value->isPrimitiveValue()) |
| 22 return; | 22 return; |
| 23 | 23 |
| 24 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 24 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 25 {% if property.use_none %} | 25 {% if property.use_none %} |
| 26 if (primitiveValue->getIdent() == CSSValueNone) | 26 if (primitiveValue->getValueID() == CSSValueNone) |
| 27 {{ set_value(property) }}(Length(Undefined)); | 27 {{ set_value(property) }}(Length(Undefined)); |
| 28 {% endif %} | 28 {% endif %} |
| 29 | 29 |
| 30 {%- if property.use_intrinsic %} | 30 {%- if property.use_intrinsic %} |
| 31 if (primitiveValue->getIdent() == CSSValueIntrinsic) | 31 if (primitiveValue->getValueID() == CSSValueIntrinsic) |
| 32 {{ set_value(property) }}(Length(Intrinsic)); | 32 {{ set_value(property) }}(Length(Intrinsic)); |
| 33 else if (primitiveValue->getIdent() == CSSValueMinIntrinsic) | 33 else if (primitiveValue->getValueID() == CSSValueMinIntrinsic) |
| 34 {{ set_value(property) }}(Length(MinIntrinsic)); | 34 {{ set_value(property) }}(Length(MinIntrinsic)); |
| 35 else if (primitiveValue->getIdent() == CSSValueWebkitMinContent) | 35 else if (primitiveValue->getValueID() == CSSValueWebkitMinContent) |
| 36 {{ set_value(property) }}(Length(MinContent)); | 36 {{ set_value(property) }}(Length(MinContent)); |
| 37 else if (primitiveValue->getIdent() == CSSValueWebkitMaxContent) | 37 else if (primitiveValue->getValueID() == CSSValueWebkitMaxContent) |
| 38 {{ set_value(property) }}(Length(MaxContent)); | 38 {{ set_value(property) }}(Length(MaxContent)); |
| 39 else if (primitiveValue->getIdent() == CSSValueWebkitFillAvailable) | 39 else if (primitiveValue->getValueID() == CSSValueWebkitFillAvailable) |
| 40 {{ set_value(property) }}(Length(FillAvailable)); | 40 {{ set_value(property) }}(Length(FillAvailable)); |
| 41 else if (primitiveValue->getIdent() == CSSValueWebkitFitContent) | 41 else if (primitiveValue->getValueID() == CSSValueWebkitFitContent) |
| 42 {{ set_value(property) }}(Length(FitContent)); | 42 {{ set_value(property) }}(Length(FitContent)); |
| 43 {% endif %} | 43 {% endif %} |
| 44 | 44 |
| 45 {%- if property.use_auto %} | 45 {%- if property.use_auto %} |
| 46 if (primitiveValue->getIdent() == CSSValueAuto) | 46 if (primitiveValue->getValueID() == CSSValueAuto) |
| 47 {{ set_value(property) }}(Length()); | 47 {{ set_value(property) }}(Length()); |
| 48 {%- endif %} | 48 {%- endif %} |
| 49 | 49 |
| 50 if (primitiveValue->isLength()) { | 50 if (primitiveValue->isLength()) { |
| 51 Length length = primitiveValue->computeLength<Length>(styleResolver->sty
le(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()
); | 51 Length length = primitiveValue->computeLength<Length>(styleResolver->sty
le(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()
); |
| 52 length.setQuirk(primitiveValue->isQuirkValue()); | 52 length.setQuirk(primitiveValue->isQuirkValue()); |
| 53 {{ set_value(property) }}(length); | 53 {{ set_value(property) }}(length); |
| 54 } else if (primitiveValue->isPercentage()) | 54 } else if (primitiveValue->isPercentage()) |
| 55 {{ set_value(property) }}(Length(primitiveValue->getDoubleValue(), Perce
nt)); | 55 {{ set_value(property) }}(Length(primitiveValue->getDoubleValue(), Perce
nt)); |
| 56 else if (primitiveValue->isCalculatedPercentageWithLength()) | 56 else if (primitiveValue->isCalculatedPercentageWithLength()) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 return true; | 105 return true; |
| 106 {%- endcall %} | 106 {%- endcall %} |
| 107 {% endfor %} | 107 {% endfor %} |
| 108 default: | 108 default: |
| 109 return false; | 109 return false; |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace WebCore | 113 } // namespace WebCore |
| 114 | 114 |
| OLD | NEW |