| // 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. |
| |
| #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_COMPUTED_STYLE_INITIAL_VALUES_H_ |
| #define THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_COMPUTED_STYLE_INITIAL_VALUES_H_ |
| |
| #include "third_party/blink/renderer/core/layout/layout_theme.h" |
| #include "third_party/blink/renderer/core/scroll/scroll_types.h" |
| #include "third_party/blink/renderer/core/style/computed_style_constants.h" |
| #include "third_party/blink/renderer/core/style/filter_operations.h" |
| #include "third_party/blink/renderer/platform/theme_types.h" |
| {% for include in includes %} |
| #include "{{include}}" |
| {% endfor %} |
| |
| namespace blink { |
| |
| class ShapeValue; |
| class StyleImage; |
| class StyleInheritedVariables; |
| class StyleNonInheritedVariables; |
| {% for forward_declaration in forward_declarations %} |
| class {{forward_declaration}}; |
| {% endfor %} |
| |
| /** |
| * A set of functions that return the initial value for each field on ComputedStyle. |
| * This includes both properties defined in css_properties.json5 and the extra |
| * fields defined in computed_style_extra_fields.json5. |
| */ |
| class ComputedStyleInitialValues{ |
| STATIC_ONLY(ComputedStyleInitialValues); |
| public: |
| // Hand-written methods. |
| |
| static StyleContentAlignmentData InitialContentAlignment() { |
| return StyleContentAlignmentData(ContentPosition::kNormal, |
| ContentDistributionType::kDefault, |
| OverflowAlignment::kDefault); |
| } |
| static StyleSelfAlignmentData InitialDefaultAlignment() { |
| return StyleSelfAlignmentData(ItemPosition::kNormal, |
| OverflowAlignment::kDefault); |
| } |
| static StyleImage* InitialBorderImageSource() { return nullptr; } |
| static float InitialBorderWidth() { return 3; } |
| static uint16_t InitialColumnRuleWidth() { |
| return 3; |
| } |
| |
| // Grid properties. |
| static size_t InitialGridAutoRepeatInsertionPoint() { return 0; } |
| static AutoRepeatType InitialGridAutoRepeatType() { |
| return AutoRepeatType::kNoAutoRepeat; |
| } |
| |
| // FIXME: Remove letter-spacing/word-spacing and replace them with respective |
| // FontBuilder calls. |
| static float InitialWordSpacing() { return 0.0f; } |
| static float InitialLetterSpacing() { return 0.0f; } |
| |
| static EVerticalAlign InitialVerticalAlign() { |
| return EVerticalAlign::kBaseline; |
| } |
| |
| // -webkit-perspective-origin-x |
| static Length InitialPerspectiveOriginX() { return Length::Percent(50.0); } |
| |
| // -webkit-perspective-origin-y |
| static Length InitialPerspectiveOriginY() { return Length::Percent(50.0); } |
| |
| // -webkit-transform-origin-x |
| static Length InitialTransformOriginX() { return Length::Percent(50.0); } |
| // -webkit-transform-origin-y |
| static Length InitialTransformOriginY() { return Length::Percent(50.0); } |
| // -webkit-transform-origin-z |
| static float InitialTransformOriginZ() { return 0; } |
| |
| // -webkit-mask-box-image-source |
| static StyleImage* InitialMaskBoxImageSource() { return nullptr; } |
| |
| static const FilterOperations& InitialFilter() { |
| return InitialFilterInternal(); |
| } |
| static const FilterOperations& InitialBackdropFilter() { |
| return InitialFilterInternal(); |
| } |
| |
| // Generated methods below. |
| {% for property in properties if |
| 'initial' not in property.computed_style_custom_functions %} |
| {% if property.field_template == "pointer" %} |
| |
| static {{property.type_name}}* {{property.initial}}() { |
| return {{property.default_value}}; |
| } |
| {% elif property.field_template == "external" %} |
| |
| {% if property.wrapper_pointer_name %} |
| static {{property.unwrapped_type_name}}* {{property.initial}}() { |
| return {{property.default_value}}; |
| } |
| {% else %} |
| static {{property.type_name}} {{property.initial}}() { |
| return {{property.default_value}}; |
| } |
| {% endif %} |
| {% elif property.field_template == "keyword" or |
| property.field_template == "multi_keyword" or |
| property.field_template == "primitive" %} |
| |
| static {{property.type_name}} {{property.initial}}() { |
| return {{property.default_value}}; |
| } |
| {% endif %} |
| {% endfor %} |
| |
| private: |
| static const FilterOperations& InitialFilterInternal() { |
| DEFINE_STATIC_LOCAL(const Persistent<FilterOperationsWrapper>, ops, |
| (MakeGarbageCollected<FilterOperationsWrapper>())); |
| return ops->Operations(); |
| } |
| }; |
| |
| } // namespace blink |
| |
| #endif // THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_COMPUTED_STYLE_INITIAL_VALUES_H_ |