blob: 9e21385da15a9b76f9fd30a1093f44537e7c4d33 [file] [log] [blame]
{% from 'templates/macros.tmpl' import license, source_files_for_generated_file %}
{{license()}}
{{source_files_for_generated_file(template_file, input_files)}}
#include "third_party/blink/renderer/core/css/resolver/style_builder.h"
#include "third_party/blink/renderer/core/css/css_property_value.h"
#include "third_party/blink/renderer/core/css/properties/longhand.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/style_builder_functions.h"
namespace blink {
// TODO(crbug.com/751354): Delete this method and call property class methods
// directly using CSSProperty::Get() once all StyleBuilderFunctions have been
// moved to property classes.
void StyleBuilder::ApplyProperty(const CSSProperty& property,
StyleResolverState& state,
const CSSValue& value,
bool isInitial,
bool isInherit) {
switch (property.PropertyID()) {
{% for input_property in properties if input_property.should_declare_functions %}
{% set property_id = input_property.property_id %}
{% if input_property.use_property_class_in_stylebuilder %}
case {{input_property.property_id}}:
if (isInitial)
ToLonghand(Get{{property_id}}()).ApplyInitial(state);
else if (isInherit)
ToLonghand(Get{{property_id}}()).ApplyInherit(state);
else
ToLonghand(Get{{property_id}}()).ApplyValue(state, value);
return;
{% else %}
case {{input_property.property_id}}:
if (isInitial)
StyleBuilderFunctions::applyInitial{{property_id}}(state);
else if (isInherit)
StyleBuilderFunctions::applyInherit{{property_id}}(state);
else
StyleBuilderFunctions::applyValue{{property_id}}(state, value);
return;
{% endif %}
{% endfor %}
case CSSPropertyVariable:
DCHECK(!isInitial);
DCHECK(!isInherit);
ToLonghand(property).ApplyValue(state, value);
return;
default:
NOTREACHED();
}
}
} // namespace blink