flutter_flutter/engine/build/scripts/templates/CSSPropertyMetadata.cpp.tmpl
Eric Seidel 55b5bc485d Sort headers
Fix (most) generated includes to have gen/ in their path.

This makes it easier to tell where files exist on disk.

Unfortunately I had to leave the old include path
in engine/BUILD.gn to support all the v8 includes
which were too many to deal with in this patch.

It's a little nasty to have the raw build directory
in our include path, but it produces nicer paths.

R=abarth@chromium.org
2014-11-19 12:33:42 -08:00

55 lines
1.7 KiB
Cheetah

{% from 'macros.tmpl' import license %}
{{license()}}
#include "config.h"
#include "core/css/CSSPropertyMetadata.h"
#include "gen/sky/platform/RuntimeEnabledFeatures.h"
#include "wtf/BitArray.h"
namespace blink {
{% for flag, function_name in switches %}
bool CSSPropertyMetadata::{{function_name}}(CSSPropertyID property)
{
switch(property) {
case CSSPropertyInvalid:
ASSERT_NOT_REACHED();
return false;
{% for property_id, property in properties.items() if property[flag] %}
case {{property_id}}:
{% endfor %}
return true;
default:
return false;
}
}
{% endfor %}
bool CSSPropertyMetadata::isEnabledProperty(CSSPropertyID property)
{
static BitArray<numCSSProperties>* enabledProperties = 0;
if (!enabledProperties) {
enabledProperties = new BitArray<numCSSProperties>(true); // All bits sets to 1.
{% for property_id, property in properties.items() if property.runtime_flag %}
if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enabled())
enabledProperties->clear({{property_id}} - {{first_enum_value}});
{% endfor %}
{% for property_id, property in properties.items() if property.is_internal %}
enabledProperties->clear({{property_id}} - {{first_enum_value}});
{% endfor %}
}
return enabledProperties->get(property - {{first_enum_value}});
}
void CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector(const CSSPropertyID* properties, size_t propertyCount, Vector<CSSPropertyID>& outVector)
{
for (unsigned i = 0; i < propertyCount; i++) {
CSSPropertyID property = properties[i];
if (isEnabledProperty(property))
outVector.append(property);
}
}
} // namespace blink