| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| {% from 'templates/macros.tmpl' import source_files_for_generated_file %} |
| {{source_files_for_generated_file(template_file, input_files)}} |
| // clang-format off |
| |
| #ifndef CSSPropertyAPI_h |
| #define CSSPropertyAPI_h |
| |
| #include "core/CSSPropertyNames.h" |
| #include "core/css/parser/CSSParserTokenRange.h" |
| |
| namespace blink { |
| |
| class CSSParserContext; |
| class CSSParserLocalContext; |
| class CSSProperty; |
| class CSSValue; |
| class StyleResolverState; |
| |
| class CSSPropertyAPI { |
| public: |
| CORE_EXPORT static const CSSPropertyAPI& Get(CSSPropertyID); |
| |
| #if !defined(OS_WIN) || !defined(COMPILER_MSVC) |
| constexpr CSSPropertyAPI() {} |
| #endif |
| |
| // Parses and consumes a longhand property value from the token range. |
| // Returns nullptr if the input is invalid. |
| virtual const CSSValue* ParseSingleValue(CSSPropertyID, |
| CSSParserTokenRange&, |
| const CSSParserContext&, |
| const CSSParserLocalContext&) const; |
| // Parses and consumes entire shorthand value from the token range and adds |
| // all constituent parsed longhand properties to the 'properties' set. |
| // Returns false if the input is invalid. |
| virtual bool ParseShorthand(CSSPropertyID, |
| bool important, |
| CSSParserTokenRange&, |
| const CSSParserContext&, |
| const CSSParserLocalContext&, |
| HeapVector<CSSProperty, 256>& properties) const; |
| |
| virtual bool IsInterpolable() const { return false; } |
| virtual bool IsInherited() const { return false; } |
| virtual bool IsRepeated() const { return false; } |
| virtual char RepetitionSeparator() const { |
| NOTREACHED(); |
| return 0; |
| } |
| virtual bool IsDescriptor() const { return false; } |
| virtual bool SupportsPercentage() const { return false; } |
| virtual bool IsProperty() const { return true; } |
| virtual bool IsEnabled() const { return true; } |
| virtual void ApplyInitial(StyleResolverState&) const { NOTREACHED(); } |
| virtual void ApplyInherit(StyleResolverState&) const { NOTREACHED(); } |
| virtual void ApplyValue(StyleResolverState&, const CSSValue&) const { |
| NOTREACHED(); |
| } |
| }; |
| |
| {% for api_class_data in api_classes_by_property_id %} |
| const CSSPropertyAPI& Get{{api_class_data.property_id}}API(); |
| {% endfor %} |
| |
| } // namespace blink |
| |
| #endif // CSSPropertyAPI_h |