summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/build/scripts/core
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-28 15:28:34 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-28 13:54:51 +0000
commit2a19c63448c84c1805fb1a585c3651318bb86ca7 (patch)
treeeb17888e8531aa6ee5e85721bd553b832a7e5156 /chromium/third_party/blink/renderer/build/scripts/core
parentb014812705fc80bff0a5c120dfcef88f349816dc (diff)
downloadqtwebengine-chromium-2a19c63448c84c1805fb1a585c3651318bb86ca7.tar.gz
BASELINE: Update Chromium to 69.0.3497.70
Change-Id: I2b7b56e4e7a8b26656930def0d4575dc32b900a0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/build/scripts/core')
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/css_properties.py57
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/make_css_value_keywords.py8
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/make_media_features.py5
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py2
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/parser/make_atrule_names.py8
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/parser/templates/at_rule_descriptors.cc.tmpl12
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/parser/templates/at_rule_descriptors.h.tmpl2
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_base.py5
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_subclasses.py30
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property.h.tmpl1
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.cc.tmpl144
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl7
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl539
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/templates/media_features.h.tmpl2
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/templates/style_property_shorthand.cc.tmpl16
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/templates/style_property_shorthand.h.tmpl2
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/style/computed_style_fields.py32
17 files changed, 501 insertions, 371 deletions
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/css_properties.py b/chromium/third_party/blink/renderer/build/scripts/core/css/css_properties.py
index fb0fa4673d8..9f807287a88 100755
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/css_properties.py
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/css_properties.py
@@ -3,15 +3,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import json5_generator
-from name_utilities import (
- upper_camel_case,
- lower_camel_case,
- enum_value_name,
- enum_for_css_property,
- enum_for_css_property_alias
-)
+from blinkbuild.name_style_converter import NameStyleConverter
from core.css.field_alias_expander import FieldAliasExpander
+import json5_generator
+from name_utilities import enum_for_css_property, enum_for_css_property_alias
# These values are converted using CSSPrimitiveValue in the setter function,
@@ -122,9 +117,9 @@ class CSSProperties(object):
# This order must match the order in CSSPropertyPriority.h.
priority_numbers = {'Animation': 0, 'High': 1, 'Low': 2}
priority = priority_numbers[property_['priority']]
- name_without_leading_dash = property_['name']
- if property_['name'].startswith('-'):
- name_without_leading_dash = property_['name'][1:]
+ name_without_leading_dash = property_['name'].original
+ if name_without_leading_dash.startswith('-'):
+ name_without_leading_dash = name_without_leading_dash[1:]
property_['sorting_key'] = (priority, name_without_leading_dash)
sorting_keys = {}
@@ -134,8 +129,8 @@ class CSSProperties(object):
('Collision detected - two properties have the same name and '
'priority, a potentially non-deterministic ordering can '
'occur: {}, {} and {}'.format(
- key, property_['name'], sorting_keys[key]))
- sorting_keys[key] = property_['name']
+ key, property_['name'].original, sorting_keys[key]))
+ sorting_keys[key] = property_['name'].original
self._longhands.sort(key=lambda p: p['sorting_key'])
self._shorthands.sort(key=lambda p: p['sorting_key'])
@@ -164,13 +159,11 @@ class CSSProperties(object):
updated_alias = aliased_property.copy()
updated_alias['name'] = alias['name']
updated_alias['alias_for'] = alias['alias_for']
- updated_alias['aliased_property'] = aliased_property['upper_camel_name']
+ updated_alias['aliased_property'] = aliased_property['name'].to_upper_camel_case()
updated_alias['property_id'] = enum_for_css_property_alias(
alias['name'])
updated_alias['enum_value'] = aliased_property['enum_value'] + \
self._alias_offset
- updated_alias['upper_camel_name'] = upper_camel_case(alias['name'])
- updated_alias['lower_camel_name'] = lower_camel_case(alias['name'])
self._aliases[i] = updated_alias
def expand_parameters(self, property_):
@@ -179,27 +172,26 @@ class CSSProperties(object):
property_[key] = value
# Basic info.
- property_['property_id'] = enum_for_css_property(property_['name'])
- property_['upper_camel_name'] = upper_camel_case(property_['name'])
- property_['lower_camel_name'] = lower_camel_case(property_['name'])
- property_['is_internal'] = property_['name'].startswith('-internal-')
- name = property_['name_for_methods']
- if not name:
- name = upper_camel_case(property_['name']).replace('Webkit', '')
+ name = property_['name']
+ property_['property_id'] = enum_for_css_property(name)
+ property_['is_internal'] = name.original.startswith('-internal-')
+ method_name = property_['name_for_methods']
+ if not method_name:
+ method_name = name.to_upper_camel_case().replace('Webkit', '')
set_if_none(property_, 'inherited', False)
# Initial function, Getters and Setters for ComputedStyle.
- property_['initial'] = 'Initial' + name
+ property_['initial'] = 'Initial' + method_name
simple_type_name = str(property_['type_name']).split('::')[-1]
- set_if_none(property_, 'name_for_methods', name)
- set_if_none(property_, 'type_name', 'E' + name)
+ set_if_none(property_, 'name_for_methods', method_name)
+ set_if_none(property_, 'type_name', 'E' + method_name)
set_if_none(
property_,
'getter',
- name if simple_type_name != name else 'Get' + name)
- set_if_none(property_, 'setter', 'Set' + name)
+ method_name if simple_type_name != method_name else 'Get' + method_name)
+ set_if_none(property_, 'setter', 'Set' + method_name)
if property_['inherited']:
- property_['is_inherited_setter'] = 'Set' + name + 'IsInherited'
+ property_['is_inherited_setter'] = 'Set' + method_name + 'IsInherited'
# Figure out whether we should generate style builder implementations.
for x in ['initial', 'inherit', 'value']:
@@ -219,8 +211,8 @@ class CSSProperties(object):
type_name = property_['type_name']
if (property_['field_template'] == 'keyword' or
property_['field_template'] == 'multi_keyword'):
- default_value = type_name + '::' + \
- enum_value_name(property_['default_value'])
+ default_value = (type_name + '::' + NameStyleConverter(
+ property_['default_value']).to_enum_value())
elif (property_['field_template'] == 'external' or
property_['field_template'] == 'primitive' or
property_['field_template'] == 'pointer'):
@@ -245,6 +237,9 @@ class CSSProperties(object):
set_if_none(property_, 'custom_compare', False)
set_if_none(property_, 'mutable', False)
+ if property_['direction_aware_options'] and not property_['style_builder_template']:
+ property_['style_builder_template'] = 'direction_aware'
+
@property
def default_parameters(self):
return self._default_parameters
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/make_css_value_keywords.py b/chromium/third_party/blink/renderer/build/scripts/core/css/make_css_value_keywords.py
index 199fc96d68b..c9ea5d05b8f 100755
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/make_css_value_keywords.py
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/make_css_value_keywords.py
@@ -24,10 +24,10 @@ class CSSValueKeywordsWriter(json5_generator.Writer):
self._value_keywords = self.json5_file.name_dictionaries
first_keyword_id = 1
for offset, keyword in enumerate(self._value_keywords):
- keyword['lower_name'] = keyword['name'].lower()
+ keyword['lower_name'] = keyword['name'].original.lower()
keyword['enum_name'] = enum_for_css_keyword(keyword['name'])
keyword['enum_value'] = first_keyword_id + offset
- if keyword['name'].startswith('-internal-'):
+ if keyword['name'].original.startswith('-internal-'):
assert keyword['mode'] is None, 'Can\'t specify mode for ' \
'value keywords with the prefix "-internal-".'
keyword['mode'] = 'UASheet'
@@ -42,7 +42,7 @@ class CSSValueKeywordsWriter(json5_generator.Writer):
'value_keywords': self._value_keywords,
'value_keywords_count': self._keyword_count,
'max_value_keyword_length':
- max(len(keyword['name']) for keyword in self._value_keywords),
+ max(len(keyword['name'].original) for keyword in self._value_keywords),
}
def _value_keywords_with_mode(self, mode):
@@ -59,7 +59,7 @@ class CSSValueKeywordsWriter(json5_generator.Writer):
current_offset = 0
for keyword in self._value_keywords:
keyword_offsets.append(current_offset)
- current_offset += len(keyword["name"]) + 1
+ current_offset += len(keyword["name"].original) + 1
return {
'value_keywords': self._value_keywords,
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/make_media_features.py b/chromium/third_party/blink/renderer/build/scripts/core/css/make_media_features.py
index 969641970d9..487e6b3f732 100755
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/make_media_features.py
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/make_media_features.py
@@ -8,10 +8,10 @@ import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
+from blinkbuild.name_style_converter import NameStyleConverter
import media_feature_symbol
import json5_generator
import template_expander
-import name_utilities
class MakeMediaFeaturesWriter(json5_generator.Writer):
@@ -21,8 +21,7 @@ class MakeMediaFeaturesWriter(json5_generator.Writer):
}
filters = {
'symbol': media_feature_symbol.getMediaFeatureSymbolWithSuffix(''),
- 'to_macro_style': name_utilities.to_macro_style,
- 'upper_first_letter': name_utilities.upper_first_letter,
+ 'to_function_name': lambda symbol: NameStyleConverter(symbol).to_function_name(),
}
def __init__(self, json5_file_path, output_dir):
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py b/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py
index 5015606ecbf..11e80e2c5c9 100755
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py
@@ -65,7 +65,7 @@ class StylePropertyShorthandWriter(json5_generator.Writer):
# alphabetically
longhands.sort(
key=lambda property_: (
- -len(property_['longhand_property_ids']), property_['name'])
+ -len(property_['longhand_property_ids']), property_['name'].original)
)
@template_expander.use_jinja(
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/parser/make_atrule_names.py b/chromium/third_party/blink/renderer/build/scripts/core/css/parser/make_atrule_names.py
index a083c4d095f..2715f4dcf18 100755
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/parser/make_atrule_names.py
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/parser/make_atrule_names.py
@@ -11,8 +11,6 @@ import gperf
import json5_generator
import template_expander
-from name_utilities import upper_camel_case
-
class AtRuleNamesWriter(json5_generator.Writer):
"""
@@ -38,13 +36,11 @@ class AtRuleNamesWriter(json5_generator.Writer):
chars_used = 0
self._longest_name_length = 0
for offset, descriptor in enumerate(self._descriptors):
- descriptor['upper_camel_name'] = upper_camel_case(
- descriptor['name'])
descriptor['enum_value'] = first_descriptor_id + offset
self._character_offsets.append(chars_used)
- chars_used += len(descriptor['name'])
+ chars_used += len(descriptor['name'].original)
self._longest_name_length = max(
- len(descriptor['name']),
+ len(descriptor['name'].original),
len(descriptor['alias']),
self._longest_name_length)
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/parser/templates/at_rule_descriptors.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/parser/templates/at_rule_descriptors.cc.tmpl
index 14db20859de..225ca7969a7 100644
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/parser/templates/at_rule_descriptors.cc.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/parser/templates/at_rule_descriptors.cc.tmpl
@@ -35,9 +35,9 @@ struct Property;
%enum
%%
{% for descriptor in descriptors %}
-{{descriptor.name}}, static_cast<int>(AtRuleDescriptorID::{{descriptor.upper_camel_name}})
+{{descriptor.name}}, static_cast<int>(AtRuleDescriptorID::{{descriptor.name.to_upper_camel_case()}})
{% if descriptor.alias %}
-{{descriptor.alias}}, static_cast<int>(AtRuleDescriptorID::{{descriptor.upper_camel_name}})
+{{descriptor.alias}}, static_cast<int>(AtRuleDescriptorID::{{descriptor.name.to_upper_camel_case()}})
{% endif %}
{% endfor %}
%%
@@ -84,8 +84,8 @@ AtRuleDescriptorID AsAtRuleDescriptorID(StringView string) {
CSSPropertyID AtRuleDescriptorIDAsCSSPropertyID(AtRuleDescriptorID id) {
switch (id) {
{% for descriptor in descriptors %}
- case AtRuleDescriptorID::{{descriptor.upper_camel_name}}:
- return CSSProperty{{descriptor.upper_camel_name}};
+ case AtRuleDescriptorID::{{descriptor.name.to_upper_camel_case()}}:
+ return CSSProperty{{descriptor.name.to_upper_camel_case()}};
{% endfor %}
default:
NOTREACHED();
@@ -96,8 +96,8 @@ CSSPropertyID AtRuleDescriptorIDAsCSSPropertyID(AtRuleDescriptorID id) {
AtRuleDescriptorID CSSPropertyIDAsAtRuleDescriptor(CSSPropertyID id) {
switch (id) {
{% for descriptor in descriptors %}
- case CSSProperty{{descriptor.upper_camel_name}}:
- return AtRuleDescriptorID::{{descriptor.upper_camel_name}};
+ case CSSProperty{{descriptor.name.to_upper_camel_case()}}:
+ return AtRuleDescriptorID::{{descriptor.name.to_upper_camel_case()}};
{% endfor %}
default:
NOTREACHED();
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/parser/templates/at_rule_descriptors.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/parser/templates/at_rule_descriptors.h.tmpl
index a8ad2854415..0e41a3e1031 100644
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/parser/templates/at_rule_descriptors.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/parser/templates/at_rule_descriptors.h.tmpl
@@ -14,7 +14,7 @@ namespace blink {
enum class AtRuleDescriptorID {
Invalid = 0,
{% for descriptor in descriptors %}
- {{descriptor.upper_camel_name}} = {{descriptor.enum_value}},
+ {{descriptor.name.to_upper_camel_case()}} = {{descriptor.enum_value}},
{% endfor %}
};
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_base.py b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_base.py
index 9f7309f112e..8399000b7f2 100755
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_base.py
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_base.py
@@ -12,7 +12,6 @@ import template_expander
from collections import namedtuple
from core.css import css_properties
-from name_utilities import snake_case
class PropertyClassData(
@@ -73,9 +72,9 @@ class CSSPropertyBaseWriter(json5_generator.Writer):
return PropertyClassData(
enum_value=property_['enum_value'],
property_id=property_['property_id'],
- classname=property_['upper_camel_name'],
+ classname=property_['name'].to_upper_camel_case(),
namespace_group=namespace_group,
- filename=snake_case(property_['upper_camel_name']))
+ filename=property_['name'].to_snake_case())
@property
def css_properties(self):
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_subclasses.py b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_subclasses.py
index b9a8c3ce0e8..6f8788f3404 100755
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_subclasses.py
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_subclasses.py
@@ -32,8 +32,8 @@ class CSSPropertiesWriter(CSSPropertyBaseWriter):
property_methods = json5_generator.Json5File.load_from_files(
[json5_file_paths[2]])
for property_method in property_methods.name_dictionaries:
- self._property_methods[property_method['name']] = PropertyMethod(
- name=property_method['name'],
+ self._property_methods[property_method['name'].original] = PropertyMethod(
+ name=property_method['name'].original,
return_type=property_method['return_type'],
parameters=property_method['parameters'],
)
@@ -56,7 +56,7 @@ class CSSPropertiesWriter(CSSPropertyBaseWriter):
self._outputs[class_data.filename + '.h'] = (
self.generate_property_h_builder(
class_data.classname, class_data.filename, property_))
- if 'should_implement_apply_functions_in_cpp' in property_:
+ if not property_['style_builder_inline']:
self._outputs[class_data.filename + '.cc'] = (
self.generate_property_cpp_builder(
class_data.filename, property_))
@@ -97,15 +97,17 @@ class CSSPropertiesWriter(CSSPropertyBaseWriter):
return generate_property_cpp
def calculate_apply_functions_to_declare(self, property_):
- if property_['style_builder_template'] in ['background_layer', 'color', 'counter', 'mask_layer']:
- property_['should_implement_apply_functions_in_cpp'] = True
+ cc_templates = ['background_layer', 'color', 'counter', 'grid', 'mask_layer']
+ property_['style_builder_inline'] = property_['style_builder_template'] not in cc_templates
- property_['should_implement_apply_functions'] = (
+ property_['style_builder_declare'] = (
property_['is_property'] and
- not property_['longhands'] and
- not property_['direction_aware_options'] and
- not property_['builder_skip'] and
- not property_['style_builder_legacy'])
+ not property_['longhands'])
+
+ if not property_['style_builder_declare']:
+ for x in ['initial', 'inherit', 'value']:
+ property_['style_builder_generate_%s' % x] = False
+
def h_includes(self, property_):
if property_['alias_for']:
@@ -120,7 +122,7 @@ class CSSPropertiesWriter(CSSPropertyBaseWriter):
yield "third_party/blink/renderer/platform/runtime_enabled_features.h"
def cpp_includes(self, property_):
- if 'should_implement_apply_functions_in_cpp' in property_:
+ if not property_['style_builder_inline']:
for include in self.apply_includes(property_):
yield 'third_party/blink/renderer/' + include
@@ -132,6 +134,9 @@ class CSSPropertiesWriter(CSSPropertyBaseWriter):
yield "core/css/css_primitive_value_mappings.h"
elif property_['converter'] == "CSSIdentifierValue":
yield "core/css/css_identifier_value.h"
+ elif property_['converter'] == "ConvertElementReference":
+ yield "core/css/resolver/style_builder_converter.h"
+ yield "core/style/style_svg_resource.h"
else:
yield "core/css/css_primitive_value_mappings.h"
yield "core/css/resolver/style_builder_converter.h"
@@ -153,7 +158,8 @@ class CSSPropertiesWriter(CSSPropertyBaseWriter):
if property_.get('style_builder_template') in ['counter']:
yield "core/css/css_value_pair.h"
yield "core/css/css_custom_ident_value.h"
-
+ if property_.get('style_builder_template') in ['grid']:
+ yield "core/css/resolver/style_builder_converter.h"
if __name__ == '__main__':
json5_generator.Maker(CSSPropertiesWriter).main()
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property.h.tmpl
index 0465168f963..1947b2ffc35 100644
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property.h.tmpl
@@ -58,6 +58,7 @@ class CSSProperty : public CSSUnresolvedProperty {
virtual bool IsAffectedByAll() const { return IsEnabled() && IsProperty(); }
virtual bool IsLayoutDependentProperty() const { return false; }
virtual bool IsLayoutDependent(const ComputedStyle* style, LayoutObject* layout_object) const { return false; }
+ virtual bool IsValidForVisitedLink() const { return false; }
// Properties that do not override this method:
// CSSPropertyWebkitFontSizeDelta
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.cc.tmpl
index af83d306752..3647ca60c02 100644
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.cc.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.cc.tmpl
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-{% from 'core/css/properties/templates/style_builder_functions.tmpl' import declare_initial, declare_inherit, declare_value, set_value %}
+{% from 'core/css/properties/templates/style_builder_functions.tmpl' import style_builder_functions %}
{% from 'templates/macros.tmpl' import source_files_for_generated_file %}
{{source_files_for_generated_file(template_file, input_files)}}
@@ -15,147 +15,7 @@
namespace blink {
namespace CSSLonghand {
-{% if property.style_builder_template in ['background_layer', 'mask_layer'] %}
-{% set layer_type = 'Background' if property.style_builder_template == 'background_layer' else 'Mask' %}
-{% set fill_type = property.style_builder_template_args['fill_type'] %}
-{% set fill_type_getter = property.style_builder_template_args['fill_type_getter'] or fill_type %}
-{{declare_initial(property.upper_camel_name)}} {
- FillLayer* currChild = &state.Style()->Access{{layer_type}}Layers();
- currChild->Set{{fill_type}}(FillLayer::InitialFill{{fill_type}}(EFillLayerType::k{{layer_type}}));
- for (currChild = currChild->Next(); currChild; currChild = currChild->Next())
- currChild->Clear{{fill_type}}();
-}
-
-{{declare_inherit(property.upper_camel_name)}} {
- FillLayer* currChild = &state.Style()->Access{{layer_type}}Layers();
- FillLayer* prevChild = 0;
- const FillLayer* currParent = &state.ParentStyle()->{{layer_type}}Layers();
- while (currParent && currParent->Is{{fill_type}}Set()) {
- if (!currChild)
- currChild = prevChild->EnsureNext();
- currChild->Set{{fill_type}}(currParent->{{fill_type_getter}}());
- {% if fill_type == "PositionX" %}
- if (currParent->IsBackgroundXOriginSet())
- currChild->SetBackgroundXOrigin(currParent->BackgroundXOrigin());
- {% endif %}
- {% if fill_type == "PositionY" %}
- if (currParent->IsBackgroundYOriginSet())
- currChild->SetBackgroundYOrigin(currParent->BackgroundYOrigin());
- {% endif %}
- prevChild = currChild;
- currChild = prevChild->Next();
- currParent = currParent->Next();
- }
-
- while (currChild) {
- // Reset any remaining layers to not have the property set.
- currChild->Clear{{fill_type}}();
- currChild = currChild->Next();
- }
-}
-
-{{declare_value(property.upper_camel_name)}} {
- FillLayer* currChild = &state.Style()->Access{{layer_type}}Layers();
- FillLayer* prevChild = 0;
- if (value.IsValueList() && !value.IsImageSetValue()) {
- // Walk each value and put it into a layer, creating new layers as needed.
- const CSSValueList& valueList = ToCSSValueList(value);
- for (unsigned int i = 0; i < valueList.length(); i++) {
- if (!currChild)
- currChild = prevChild->EnsureNext();
- CSSToStyleMap::MapFill{{fill_type}}(state, currChild, valueList.Item(i));
- prevChild = currChild;
- currChild = currChild->Next();
- }
- } else {
- CSSToStyleMap::MapFill{{fill_type}}(state, currChild, value);
- currChild = currChild->Next();
- }
- while (currChild) {
- // Reset all remaining layers to not have the property set.
- currChild->Clear{{fill_type}}();
- currChild = currChild->Next();
- }
-}
-{% elif property.style_builder_template == 'color' %}
-{% set initial_color = property.style_builder_template_args['initial_color'] or 'StyleColor::CurrentColor' %}
-{% set visited_link_setter = 'SetVisitedLink' + property.name_for_methods %}
-{{declare_initial(property.upper_camel_name)}} {
- StyleColor color = {{initial_color}}();
- if (state.ApplyPropertyToRegularStyle())
- {{set_value(property)}}(color);
- if (state.ApplyPropertyToVisitedLinkStyle())
- state.Style()->{{visited_link_setter}}(color);
-}
-
-{{declare_inherit(property.upper_camel_name)}} {
- // Visited link style can never explicitly inherit from parent visited link
- // style so no separate getters are needed.
- StyleColor color = state.ParentStyle()->{{property.getter}}();
- if (state.ApplyPropertyToRegularStyle())
- {{set_value(property)}}(color);
- if (state.ApplyPropertyToVisitedLinkStyle())
- state.Style()->{{visited_link_setter}}(color);
-}
-
-{{declare_value(property.upper_camel_name)}} {
- if (state.ApplyPropertyToRegularStyle())
- {{set_value(property)}}(StyleBuilderConverter::{{property.converter}}(state, value));
- if (state.ApplyPropertyToVisitedLinkStyle()) {
- state.Style()->{{visited_link_setter}}(
- StyleBuilderConverter::{{property.converter}}(state, value, true));
- }
-}
-{% elif property.style_builder_template == 'counter' %}
-{% set action = property.style_builder_template_args['action'] %}
-{{declare_initial(property.upper_camel_name)}} {
- state.Style()->Clear{{action}}Directives();
-}
-
-{{declare_inherit(property.upper_camel_name)}} {
- const CounterDirectiveMap* parentMap = state.ParentStyle()->GetCounterDirectives();
- if (!parentMap)
- return;
-
- CounterDirectiveMap& map = state.Style()->AccessCounterDirectives();
- DCHECK(!parentMap->IsEmpty());
-
- typedef CounterDirectiveMap::const_iterator Iterator;
- Iterator end = parentMap->end();
- for (Iterator it = parentMap->begin(); it != end; ++it) {
- CounterDirectives& directives = map.insert(it->key, CounterDirectives()).stored_value->value;
- directives.Inherit{{action}}(it->value);
- }
-}
-
-{{declare_value(property.upper_camel_name)}} {
- state.Style()->Clear{{action}}Directives();
-
- if (!value.IsValueList()) {
- DCHECK(value.IsIdentifierValue());
- DCHECK_EQ(ToCSSIdentifierValue(value).GetValueID(), CSSValueNone);
- return;
- }
-
- CounterDirectiveMap& map = state.Style()->AccessCounterDirectives();
-
- const CSSValueList& list = ToCSSValueList(value);
-
- for (size_t i = 0; i < list.length(); ++i) {
- const CSSValuePair& pair = ToCSSValuePair(list.Item(i));
- AtomicString identifier(ToCSSCustomIdentValue(pair.First()).Value());
- int counter_value = ToCSSPrimitiveValue(pair.Second()).GetIntValue();
- CounterDirectives& directives =
- map.insert(identifier, CounterDirectives()).stored_value->value;
- {% if action == 'Reset' %}
- directives.SetResetValue(counter_value);
- {% else %}
- directives.AddIncrementValue(counter_value);
- {% endif %}
- }
- DCHECK(!map.IsEmpty());
-}
-{% endif %}
+{{style_builder_functions(property, false)}}
} // namespace CSSLonghand
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl
index ae5c2740e5a..fd32fbc302c 100644
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl
@@ -80,6 +80,9 @@ class {{property_classname}} final : public {{property.namespace_group}} {
{% if not property.affected_by_all %}
bool IsAffectedByAll() const override { return false; }
{% endif %}
+ {% if property.valid_for_visited_link %}
+ bool IsValidForVisitedLink() const override { return true; }
+ {% endif %}
{% if property.direction_aware_options %}
const CSSValue* CSSValueFromComputedStyleInternal(
const ComputedStyle& ,
@@ -119,10 +122,10 @@ class {{property_classname}} final : public {{property.namespace_group}} {
}
{% endif %}
{% endif %}
- {% if property.should_implement_apply_functions %}
+ {% if property.style_builder_declare %}
// Style builder functions
-{{style_builder_functions(property)}}
+{{style_builder_functions(property, true)}}
{%- endif %}
{% endif %}
};
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl
index 832acd8bd9f..e10f98b0b49 100644
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl
@@ -12,6 +12,45 @@ void {{prefix ~ '::' if prefix}}ApplyInherit(StyleResolverState& state) const{{'
void {{prefix ~ '::' if prefix}}ApplyValue(StyleResolverState& state, const CSSValue& value) const{{' override' if not prefix}}
{%- endmacro %}
+{% macro apply_initial(property, header) %}
+ {% set spaces = 2 if header else 0 %}
+ {% if property.style_builder_declare %}
+ {% if property.style_builder_inline == header and property.style_builder_generate_initial %}
+{{declare_initial(property.name.to_upper_camel_case() if not header)|indent(spaces, true)}} {
+{{caller(property)|indent(spaces, true)-}}
+{{'}'|indent(spaces, true)}}
+ {% else %}
+{{declare_initial()|indent(spaces, true)-}};
+ {% endif %}
+ {% endif %}
+{% endmacro %}
+
+{% macro apply_inherit(property, header) %}
+ {% set spaces = 2 if header else 0 %}
+ {% if property.style_builder_declare %}
+ {% if property.style_builder_inline == header and property.style_builder_generate_inherit %}
+{{declare_inherit(property.name.to_upper_camel_case() if not header)|indent(spaces, true)}} {
+{{caller(property)|indent(spaces, true)-}}
+{{'}'|indent(spaces, true)}}
+ {% else %}
+{{declare_inherit()|indent(spaces, true)-}};
+ {% endif %}
+ {% endif %}
+{% endmacro %}
+
+{% macro apply_value(property, header) %}
+ {% set spaces = 2 if header else 0 %}
+ {% if property.style_builder_declare %}
+ {% if property.style_builder_inline == header and property.style_builder_generate_value %}
+{{declare_value(property.name.to_upper_camel_case() if not header)|indent(spaces, true)}} {
+{{caller(property)|indent(spaces, true)-}}
+{{'}'|indent(spaces, true)}}
+ {% else %}
+{{declare_value()|indent(spaces, true)-}};
+ {% endif %}
+ {% endif %}
+{% endmacro %}
+
{% macro set_value(property) %}
{% if property.svg %}
state.Style()->AccessSVGStyle().{{property.setter}}
@@ -32,176 +71,410 @@ state.Style()->{{property.setter}}
{%- endif %}
{% endmacro %}
-{% macro style_builder_functions(property) %}
- {% if property.should_implement_apply_functions_in_cpp %}
- {# declaration only #}
- {{declare_initial()}};
- {{declare_inherit()}};
- {{declare_value()}};
- {% else %}
- {# full implementation #}
- {% if not property.style_builder_template %}
- {% if property.style_builder_generate_initial %}
- {{declare_initial()}} {
- {% if property.svg %}
- {{set_value(property)}}(SVGComputedStyle::{{property.initial}}());
- {% elif property.font %}
- {{set_value(property)}}(FontBuilder::{{property.initial}}());
- {% else %}
- {{set_value(property)}}(ComputedStyleInitialValues::{{property.initial}}());
- {% endif %}
- {% if property.independent %}
- state.Style()->{{property.is_inherited_setter}}(false);
- {% endif %}
- }
+{% macro resolve_directional_property(apply_call) %}
+const CSSProperty& resolved_property =
+ ResolveDirectionAwareProperty(state.Style()->Direction(),
+ state.Style()->GetWritingMode());
+DCHECK(!resolved_property.IDEquals(PropertyID()));
+ToLonghand(resolved_property).{{apply_call}};
+{% endmacro %}
+
+{% macro style_builder_functions(property, header) %}
+ {% if not property.style_builder_template %}
+ {% call(property) apply_initial(property, header) %}
+ {% if property.svg %}
+ {{set_value(property)}}(SVGComputedStyle::{{property.initial}}());
+ {% elif property.font %}
+ {{set_value(property)}}(FontBuilder::{{property.initial}}());
+ {% else %}
+ {{set_value(property)}}(ComputedStyleInitialValues::{{property.initial}}());
{% endif %}
- {% if property.style_builder_generate_inherit %}
- {{declare_inherit()}} {
- {% if property.svg %}
- {{set_value(property)}}(state.ParentStyle()->SvgStyle().{{property.getter}}());
- {% elif property.font %}
- {{set_value(property)}}(state.ParentFontDescription().{{property.getter}}());
- {% else %}
- {{set_value(property)}}(state.ParentStyle()->{{property.getter}}());
- {% endif %}
- {% if property.independent %}
- state.Style()->{{property.is_inherited_setter}}(true);
- {% endif %}
- }
+ {% if property.independent %}
+ state.Style()->{{property.is_inherited_setter}}(false);
{% endif %}
- {% if property.style_builder_generate_value %}
- {{declare_value()}} {
- {{convert_and_set_value(property)}}
- {% if property.independent %}
- state.Style()->{{property.is_inherited_setter}}(false);
- {% endif %}
- }
+ {% endcall %}
+ {% call(property) apply_inherit(property, header) %}
+ {% if property.svg %}
+ {{set_value(property)}}(state.ParentStyle()->SvgStyle().{{property.getter}}());
+ {% elif property.font %}
+ {{set_value(property)}}(state.ParentFontDescription().{{property.getter}}());
+ {% else %}
+ {{set_value(property)}}(state.ParentStyle()->{{property.getter}}());
+ {% endif %}
+ {% if property.independent %}
+ state.Style()->{{property.is_inherited_setter}}(true);
{% endif %}
- {% elif property.style_builder_template == "auto" %}
- {% set auto_getter = property.style_builder_template_args['auto_getter'] or
- 'HasAuto' + property.name_for_methods %}
- {% set auto_setter = property.style_builder_template_args['auto_setter'] or
- 'SetHasAuto' + property.name_for_methods %}
- {{declare_initial()}} {
+ {% endcall %}
+ {% call(property) apply_value(property, header) %}
+ {{convert_and_set_value(property)}}
+ {% if property.independent %}
+ state.Style()->{{property.is_inherited_setter}}(false);
+ {% endif %}
+ {% endcall %}
+ {% elif property.style_builder_template == 'empty' %}
+ {% call(property) apply_initial(property, header) %}
+ // Intentionally empty.
+ {% endcall %}
+ {% call(property) apply_inherit(property, header) %}
+ // Intentionally empty.
+ {% endcall %}
+ {% call(property) apply_value(property, header) %}
+ // Intentionally empty.
+ {% endcall %}
+ {% elif property.style_builder_template == 'direction_aware' %}
+ {% call(property) apply_initial(property, header) %}
+{{resolve_directional_property('ApplyInitial(state)')|indent(2, true) -}}
+ {% endcall %}
+ {% call(property) apply_inherit(property, header) %}
+{{resolve_directional_property('ApplyInherit(state)')|indent(2, true) -}}
+ {% endcall %}
+ {% call(property) apply_value(property, header) %}
+{{resolve_directional_property('ApplyValue(state, value)')|indent(2, true) -}}
+ {% endcall %}
+ {% elif property.style_builder_template == "auto" %}
+ {% set auto_getter = property.style_builder_template_args['auto_getter'] or
+ 'HasAuto' + property.name_for_methods %}
+ {% set auto_setter = property.style_builder_template_args['auto_setter'] or
+ 'SetHasAuto' + property.name_for_methods %}
+ {% call(property) apply_initial(property, header) %}
+ state.Style()->{{auto_setter}}();
+ {% endcall %}
+ {% call(property) apply_inherit(property, header) %}
+ if (state.ParentStyle()->{{auto_getter}}())
state.Style()->{{auto_setter}}();
- }
- {{declare_inherit()}} {
- if (state.ParentStyle()->{{auto_getter}}())
- state.Style()->{{auto_setter}}();
- else
- {{set_value(property)}}(state.ParentStyle()->{{property.getter}}());
- }
- {{declare_value()}} {
- if (value.IsIdentifierValue() &&
- ToCSSIdentifierValue(value).GetValueID() == CSSValueAuto)
- state.Style()->{{auto_setter}}();
- else
- {{convert_and_set_value(property)}}
- }
- {% elif property.style_builder_template in ['border_image', 'mask_box'] %}
+ else
+ {{set_value(property)}}(state.ParentStyle()->{{property.getter}}());
+ {% endcall %}
+ {% call(property) apply_value(property, header) %}
+ if (value.IsIdentifierValue() &&
+ ToCSSIdentifierValue(value).GetValueID() == CSSValueAuto)
+ state.Style()->{{auto_setter}}();
+ else
+ {{convert_and_set_value(property)}}
+ {% endcall %}
+ {% elif property.style_builder_template in ['border_image', 'mask_box'] %}
{% set is_mask_box = property.style_builder_template == 'mask_box' %}
{% set modifier_type = property.style_builder_template_args['modifier_type'] %}
{% set getter = 'MaskBoxImage' if is_mask_box else 'BorderImage' %}
{% set setter = 'Set' + getter %}
- {{declare_initial()}} {
- const NinePieceImage& currentImage = state.Style()->{{getter}}();
- {# Check for equality in case we can bail out before creating a new NinePieceImage. #}
+ {% call(property) apply_initial(property, header) %}
+ const NinePieceImage& current_image = state.Style()->{{getter}}();
+ {# Check for equality in case we can bail out before creating a new NinePieceImage. #}
{% if modifier_type == 'Outset' %}
- if (StyleBuildingUtils::borderImageLengthMatchesAllSides(currentImage.Outset(),
- BorderImageLength(Length(0, kFixed))))
- return;
+ if (StyleBuildingUtils::BorderImageLengthMatchesAllSides(current_image.Outset(),
+ BorderImageLength(Length(0, kFixed))))
+ return;
{% elif modifier_type == 'Repeat' %}
- if (currentImage.HorizontalRule() == kStretchImageRule &&
- currentImage.VerticalRule() == kStretchImageRule)
- return;
+ if (current_image.HorizontalRule() == kStretchImageRule &&
+ current_image.VerticalRule() == kStretchImageRule)
+ return;
{% elif modifier_type == 'Slice' and is_mask_box %}
- // Masks have a different initial value for slices. Preserve the value of 0
- // for backwards compatibility.
- if (currentImage.Fill() == true &&
- StyleBuildingUtils::lengthMatchesAllSides(currentImage.ImageSlices(), Length(0, kFixed)))
- return;
+ // Masks have a different initial value for slices. Preserve the value of 0
+ // for backwards compatibility.
+ if (current_image.Fill() == true &&
+ StyleBuildingUtils::LengthMatchesAllSides(current_image.ImageSlices(), Length(0, kFixed)))
+ return;
{% elif modifier_type == 'Slice' and not is_mask_box %}
- if (currentImage.Fill() == false &&
- StyleBuildingUtils::lengthMatchesAllSides(currentImage.ImageSlices(), Length(100, kPercent)))
- return;
+ if (current_image.Fill() == false &&
+ StyleBuildingUtils::LengthMatchesAllSides(current_image.ImageSlices(), Length(100, kPercent)))
+ return;
{% elif modifier_type == 'Width' and is_mask_box %}
- // Masks have a different initial value for widths. Preserve the value of
- // 'auto' for backwards compatibility.
- if (StyleBuildingUtils::borderImageLengthMatchesAllSides(currentImage.BorderSlices(),
- BorderImageLength(Length(kAuto))))
- return;
+ // Masks have a different initial value for widths. Preserve the value of
+ // 'auto' for backwards compatibility.
+ if (StyleBuildingUtils::BorderImageLengthMatchesAllSides(current_image.BorderSlices(),
+ BorderImageLength(Length(kAuto))))
+ return;
{% elif modifier_type == 'Width' and not is_mask_box %}
- if (StyleBuildingUtils::borderImageLengthMatchesAllSides(currentImage.BorderSlices(),
- BorderImageLength(1.0)))
- return;
+ if (StyleBuildingUtils::BorderImageLengthMatchesAllSides(current_image.BorderSlices(),
+ BorderImageLength(1.0)))
+ return;
{% endif %}
- NinePieceImage image(currentImage);
+ NinePieceImage image(current_image);
{% if modifier_type == 'Outset' %}
- image.SetOutset(Length(0, kFixed));
+ image.SetOutset(Length(0, kFixed));
{% elif modifier_type == 'Repeat' %}
- image.SetHorizontalRule(kStretchImageRule);
- image.SetVerticalRule(kStretchImageRule);
+ image.SetHorizontalRule(kStretchImageRule);
+ image.SetVerticalRule(kStretchImageRule);
{% elif modifier_type == 'Slice' and is_mask_box %}
- image.SetImageSlices(LengthBox({{ (['Length(0, kFixed)']*4) | join(', ') }}));
- image.SetFill(true);
+ image.SetImageSlices(LengthBox({{ (['Length(0, kFixed)']*4) | join(', ') }}));
+ image.SetFill(true);
{% elif modifier_type == 'Slice' and not is_mask_box %}
- image.SetImageSlices(LengthBox({{ (['Length(100, kPercent)']*4) | join(', ') }}));
- image.SetFill(false);
+ image.SetImageSlices(LengthBox({{ (['Length(100, kPercent)']*4) | join(', ') }}));
+ image.SetFill(false);
{% elif modifier_type == 'Width' %}
- image.SetBorderSlices({{ 'Length(kAuto)' if is_mask_box else '1.0' }});
+ image.SetBorderSlices({{ 'Length(kAuto)' if is_mask_box else '1.0' }});
{% endif %}
- state.Style()->{{setter}}(image);
- }
- {{declare_inherit()}} {
- NinePieceImage image(state.Style()->{{getter}}());
+ state.Style()->{{setter}}(image);
+ {% endcall %}
+ {% call(property) apply_inherit(property, header) %}
+ NinePieceImage image(state.Style()->{{getter}}());
{% if modifier_type == 'Outset' %}
- image.CopyOutsetFrom(state.ParentStyle()->{{getter}}());
+ image.CopyOutsetFrom(state.ParentStyle()->{{getter}}());
{% elif modifier_type == 'Repeat' %}
- image.CopyRepeatFrom(state.ParentStyle()->{{getter}}());
+ image.CopyRepeatFrom(state.ParentStyle()->{{getter}}());
{% elif modifier_type == 'Slice' %}
- image.CopyImageSlicesFrom(state.ParentStyle()->{{getter}}());
+ image.CopyImageSlicesFrom(state.ParentStyle()->{{getter}}());
{% elif modifier_type == 'Width' %}
- image.CopyBorderSlicesFrom(state.ParentStyle()->{{getter}}());
+ image.CopyBorderSlicesFrom(state.ParentStyle()->{{getter}}());
{% endif %}
- state.Style()->{{setter}}(image);
- }
- {{declare_value()}} {
- NinePieceImage image(state.Style()->{{getter}}());
+ state.Style()->{{setter}}(image);
+ {% endcall %}
+ {% call(property) apply_value(property, header) %}
+ NinePieceImage image(state.Style()->{{getter}}());
{% if modifier_type == 'Outset' %}
- image.SetOutset(CSSToStyleMap::MapNinePieceImageQuad(state, value));
+ image.SetOutset(CSSToStyleMap::MapNinePieceImageQuad(state, value));
{% elif modifier_type == 'Repeat' %}
- CSSToStyleMap::MapNinePieceImageRepeat(state, value, image);
+ CSSToStyleMap::MapNinePieceImageRepeat(state, value, image);
{% elif modifier_type == 'Slice' %}
- CSSToStyleMap::MapNinePieceImageSlice(state, value, image);
+ CSSToStyleMap::MapNinePieceImageSlice(state, value, image);
{% elif modifier_type == 'Width' %}
- image.SetBorderSlices(CSSToStyleMap::MapNinePieceImageQuad(state, value));
+ image.SetBorderSlices(CSSToStyleMap::MapNinePieceImageQuad(state, value));
{% endif %}
- state.Style()->{{setter}}(image);
- }
- {% elif property.style_builder_template in ['animation', 'transition'] %}
+ state.Style()->{{setter}}(image);
+ {% endcall %}
+ {% elif property.style_builder_template in ['animation', 'transition'] %}
{% set attribute = property.style_builder_template_args['attribute'] %}
{% set animation = 'Animation' if property.style_builder_template == 'animation' else 'Transition' %}
{% set vector = attribute + "List()" %}
- {{declare_initial()}} {
- CSS{{animation}}Data& data = state.Style()->Access{{animation}}s();
- data.{{vector}}.clear();
- data.{{vector}}.push_back(CSS{{animation}}Data::Initial{{attribute}}());
+ {% call(property) apply_initial(property, header) %}
+ CSS{{animation}}Data& data = state.Style()->Access{{animation}}s();
+ data.{{vector}}.clear();
+ data.{{vector}}.push_back(CSS{{animation}}Data::Initial{{attribute}}());
+ {% endcall %}
+
+ {% call(property) apply_inherit(property, header) %}
+ const CSS{{animation}}Data* parent_data = state.ParentStyle()->{{animation}}s();
+ if (!parent_data)
+ ApplyInitial{{property_id}}(state);
+ else
+ state.Style()->Access{{animation}}s().{{vector}} = parent_data->{{vector}};
+ {% endcall %}
+
+ {% call(property) apply_value(property, header) %}
+ CSS{{animation}}Data& data = state.Style()->Access{{animation}}s();
+ data.{{vector}}.clear();
+ for (auto& listValue : ToCSSValueList(value))
+ data.{{vector}}.push_back(CSSToStyleMap::MapAnimation{{attribute}}(*listValue));
+ {% endcall %}
+ {% elif property.style_builder_template == 'svg_paint' %}
+ {% set paint_type = property.style_builder_template_args['paint_type'] %}
+ {% set visited_link_setter = 'SetVisitedLink' + paint_type %}
+ {% call(property) apply_initial(property, header) %}
+ if (state.ApplyPropertyToRegularStyle())
+ {{set_value(property)}}(SVGComputedStyle::Initial{{paint_type}}());
+ if (state.ApplyPropertyToVisitedLinkStyle())
+ state.Style()->AccessSVGStyle().{{visited_link_setter}}(SVGComputedStyle::Initial{{paint_type}}());
+ {% endcall %}
+
+ {% call(property) apply_inherit(property, header) %}
+ const SVGComputedStyle& parent_svg_style = state.ParentStyle()->SvgStyle();
+ if (state.ApplyPropertyToRegularStyle())
+ {{set_value(property)}}(parent_svg_style.{{paint_type}}());
+ if (state.ApplyPropertyToVisitedLinkStyle())
+ state.Style()->AccessSVGStyle().{{visited_link_setter}}(parent_svg_style.{{paint_type}}());
+ {% endcall %}
+
+ {% call(property) apply_value(property, header) %}
+ SVGPaint paint = StyleBuilderConverter::{{property.converter}}(state, value);
+ if (state.ApplyPropertyToRegularStyle())
+ {{set_value(property)}}(paint);
+ if (state.ApplyPropertyToVisitedLinkStyle())
+ state.Style()->AccessSVGStyle().{{visited_link_setter}}(paint);
+ {% endcall %}
+ {% elif property.style_builder_template in ['background_layer', 'mask_layer'] %}
+ {% set layer_type = 'Background' if property.style_builder_template == 'background_layer' else 'Mask' %}
+ {% set fill_type = property.style_builder_template_args['fill_type'] %}
+ {% set fill_type_getter = property.style_builder_template_args['fill_type_getter'] or fill_type %}
+ {% call(property) apply_initial(property, header) %}
+ FillLayer* curr_child = &state.Style()->Access{{layer_type}}Layers();
+ curr_child->Set{{fill_type}}(FillLayer::InitialFill{{fill_type}}(EFillLayerType::k{{layer_type}}));
+ for (curr_child = curr_child->Next(); curr_child; curr_child = curr_child->Next())
+ curr_child->Clear{{fill_type}}();
+ {% endcall %}
+
+ {% call(property) apply_inherit(property, header) %}
+ FillLayer* curr_child = &state.Style()->Access{{layer_type}}Layers();
+ FillLayer* prev_child = 0;
+ const FillLayer* curr_parent = &state.ParentStyle()->{{layer_type}}Layers();
+ while (curr_parent && curr_parent->Is{{fill_type}}Set()) {
+ if (!curr_child)
+ curr_child = prev_child->EnsureNext();
+ curr_child->Set{{fill_type}}(curr_parent->{{fill_type_getter}}());
+ {% if fill_type == "PositionX" %}
+ if (curr_parent->IsBackgroundXOriginSet())
+ curr_child->SetBackgroundXOrigin(curr_parent->BackgroundXOrigin());
+ {% endif %}
+ {% if fill_type == "PositionY" %}
+ if (curr_parent->IsBackgroundYOriginSet())
+ curr_child->SetBackgroundYOrigin(curr_parent->BackgroundYOrigin());
+ {% endif %}
+ prev_child = curr_child;
+ curr_child = prev_child->Next();
+ curr_parent = curr_parent->Next();
}
- {{declare_inherit()}} {
- const CSS{{animation}}Data* parentData = state.ParentStyle()->{{animation}}s();
- if (!parentData)
- ApplyInitial{{property_id}}(state);
- else
- state.Style()->Access{{animation}}s().{{vector}} = parentData->{{vector}};
+ while (curr_child) {
+ // Reset any remaining layers to not have the property set.
+ curr_child->Clear{{fill_type}}();
+ curr_child = curr_child->Next();
}
+ {% endcall %}
- {{declare_value()}} {
- CSS{{animation}}Data& data = state.Style()->Access{{animation}}s();
- data.{{vector}}.clear();
- for (auto& listValue : ToCSSValueList(value))
- data.{{vector}}.push_back(CSSToStyleMap::MapAnimation{{attribute}}(*listValue));
+ {% call(property) apply_value(property, header) %}
+ FillLayer* curr_child = &state.Style()->Access{{layer_type}}Layers();
+ FillLayer* prev_child = 0;
+ if (value.IsValueList() && !value.IsImageSetValue()) {
+ // Walk each value and put it into a layer, creating new layers as needed.
+ const CSSValueList& valueList = ToCSSValueList(value);
+ for (unsigned int i = 0; i < valueList.length(); i++) {
+ if (!curr_child)
+ curr_child = prev_child->EnsureNext();
+ CSSToStyleMap::MapFill{{fill_type}}(state, curr_child, valueList.Item(i));
+ prev_child = curr_child;
+ curr_child = curr_child->Next();
+ }
+ } else {
+ CSSToStyleMap::MapFill{{fill_type}}(state, curr_child, value);
+ curr_child = curr_child->Next();
}
- {% endif %}
- {%- endif %}
+ while (curr_child) {
+ // Reset all remaining layers to not have the property set.
+ curr_child->Clear{{fill_type}}();
+ curr_child = curr_child->Next();
+ }
+ {% endcall %}
+ {% elif property.style_builder_template == 'color' %}
+ {% set initial_color = property.style_builder_template_args['initial_color'] or 'StyleColor::CurrentColor' %}
+ {% set visited_link_setter = 'SetVisitedLink' + property.name_for_methods %}
+ {% call(property) apply_initial(property, header) %}
+ StyleColor color = {{initial_color}}();
+ if (state.ApplyPropertyToRegularStyle())
+ {{set_value(property)}}(color);
+ if (state.ApplyPropertyToVisitedLinkStyle())
+ state.Style()->{{visited_link_setter}}(color);
+ {% endcall %}
+
+ {% call(property) apply_inherit(property, header) %}
+ // Visited link style can never explicitly inherit from parent visited link
+ // style so no separate getters are needed.
+ StyleColor color = state.ParentStyle()->{{property.getter}}();
+ if (state.ApplyPropertyToRegularStyle())
+ {{set_value(property)}}(color);
+ if (state.ApplyPropertyToVisitedLinkStyle())
+ state.Style()->{{visited_link_setter}}(color);
+ {% endcall %}
+
+ {% call(property) apply_value(property, header) %}
+ if (state.ApplyPropertyToRegularStyle())
+ {{set_value(property)}}(StyleBuilderConverter::{{property.converter}}(state, value));
+ if (state.ApplyPropertyToVisitedLinkStyle()) {
+ state.Style()->{{visited_link_setter}}(
+ StyleBuilderConverter::{{property.converter}}(state, value, true));
+ }
+ {% endcall %}
+ {% elif property.style_builder_template == 'counter' %}
+ {% set action = property.style_builder_template_args['action'] %}
+ {% call(property) apply_initial(property, header) %}
+ state.Style()->Clear{{action}}Directives();
+ {% endcall %}
+
+ {% call(property) apply_inherit(property, header) %}
+ const CounterDirectiveMap* parent_map = state.ParentStyle()->GetCounterDirectives();
+ if (!parent_map)
+ return;
+
+ CounterDirectiveMap& map = state.Style()->AccessCounterDirectives();
+ DCHECK(!parent_map->IsEmpty());
+
+ typedef CounterDirectiveMap::const_iterator Iterator;
+ Iterator end = parent_map->end();
+ for (Iterator it = parent_map->begin(); it != end; ++it) {
+ CounterDirectives& directives = map.insert(it->key, CounterDirectives()).stored_value->value;
+ directives.Inherit{{action}}(it->value);
+ }
+ {% endcall %}
+
+ {% call(property) apply_value(property, header) %}
+ state.Style()->Clear{{action}}Directives();
+
+ if (!value.IsValueList()) {
+ DCHECK(value.IsIdentifierValue());
+ DCHECK_EQ(ToCSSIdentifierValue(value).GetValueID(), CSSValueNone);
+ return;
+ }
+
+ CounterDirectiveMap& map = state.Style()->AccessCounterDirectives();
+
+ const CSSValueList& list = ToCSSValueList(value);
+
+ for (size_t i = 0; i < list.length(); ++i) {
+ const CSSValuePair& pair = ToCSSValuePair(list.Item(i));
+ AtomicString identifier(ToCSSCustomIdentValue(pair.First()).Value());
+ int counter_value = ToCSSPrimitiveValue(pair.Second()).GetIntValue();
+ CounterDirectives& directives =
+ map.insert(identifier, CounterDirectives()).stored_value->value;
+ {% if action == 'Reset' %}
+ directives.SetResetValue(counter_value);
+ {% else %}
+ directives.AddIncrementValue(counter_value);
+ {% endif %}
+ }
+ DCHECK(!map.IsEmpty());
+ {% endcall %}
+ {% elif property.style_builder_template == 'grid' %}
+ {% set type = property.style_builder_template_args['type'] %}
+ {% call(property) apply_initial(property, header) %}
+ state.Style()->SetGridTemplate{{type}}s(ComputedStyleInitialValues::InitialGridTemplate{{type}}s());
+ state.Style()->SetNamedGrid{{type}}Lines(ComputedStyleInitialValues::InitialNamedGrid{{type}}Lines());
+ state.Style()->SetOrderedNamedGrid{{type}}Lines(ComputedStyleInitialValues::InitialOrderedNamedGrid{{type}}Lines());
+ state.Style()->SetGridAutoRepeat{{type}}s(ComputedStyleInitialValues::InitialGridAutoRepeat{{type}}s());
+ state.Style()->SetGridAutoRepeat{{type}}sInsertionPoint(ComputedStyleInitialValues::InitialGridAutoRepeat{{type}}sInsertionPoint());
+ state.Style()->SetAutoRepeatNamedGrid{{type}}Lines(ComputedStyleInitialValues::InitialNamedGrid{{type}}Lines());
+ state.Style()->SetAutoRepeatOrderedNamedGrid{{type}}Lines(ComputedStyleInitialValues::InitialOrderedNamedGrid{{type}}Lines());
+ state.Style()->SetGridAutoRepeat{{type}}sType(ComputedStyleInitialValues::InitialGridAutoRepeat{{type}}sType());
+ {% endcall %}
+
+ {% call(property) apply_inherit(property, header) %}
+ state.Style()->SetGridTemplate{{type}}s(state.ParentStyle()->GridTemplate{{type}}s());
+ state.Style()->SetNamedGrid{{type}}Lines(state.ParentStyle()->NamedGrid{{type}}Lines());
+ state.Style()->SetOrderedNamedGrid{{type}}Lines(state.ParentStyle()->OrderedNamedGrid{{type}}Lines());
+ state.Style()->SetGridAutoRepeat{{type}}s(state.ParentStyle()->GridAutoRepeat{{type}}s());
+ state.Style()->SetGridAutoRepeat{{type}}sInsertionPoint(state.ParentStyle()->GridAutoRepeat{{type}}sInsertionPoint());
+ state.Style()->SetAutoRepeatNamedGrid{{type}}Lines(state.ParentStyle()->AutoRepeatNamedGrid{{type}}Lines());
+ state.Style()->SetAutoRepeatOrderedNamedGrid{{type}}Lines(state.ParentStyle()->AutoRepeatOrderedNamedGrid{{type}}Lines());
+ state.Style()->SetGridAutoRepeat{{type}}sType(state.ParentStyle()->GridAutoRepeat{{type}}sType());
+ {% endcall %}
+
+ {% call(property) apply_value(property, header) %}
+ Vector<GridTrackSize> track_sizes;
+ Vector<GridTrackSize> auto_repeat_track_sizes;
+ NamedGridLinesMap named_grid_lines;
+ OrderedNamedGridLines ordered_named_grid_lines;
+ NamedGridLinesMap auto_repeat_named_grid_lines;
+ OrderedNamedGridLines auto_repeat_ordered_named_grid_lines;
+ AutoRepeatType autoRepeatType = ComputedStyleInitialValues::InitialGridAutoRepeatType();
+ size_t auto_repeat_insertion_point =
+ ComputedStyleInitialValues::InitialGridAutoRepeatInsertionPoint();
+ StyleBuilderConverter::ConvertGridTrackList(
+ value, track_sizes, named_grid_lines, ordered_named_grid_lines,
+ auto_repeat_track_sizes, auto_repeat_named_grid_lines,
+ auto_repeat_ordered_named_grid_lines, auto_repeat_insertion_point,
+ autoRepeatType, state);
+ const NamedGridAreaMap& named_grid_areas = state.Style()->NamedGridArea();
+ if (!named_grid_areas.IsEmpty()) {
+ StyleBuilderConverter::CreateImplicitNamedGridLinesFromGridArea(
+ named_grid_areas, named_grid_lines, kFor{{type}}s);
+ }
+ state.Style()->SetGridTemplate{{type}}s(track_sizes);
+ state.Style()->SetNamedGrid{{type}}Lines(named_grid_lines);
+ state.Style()->SetOrderedNamedGrid{{type}}Lines(ordered_named_grid_lines);
+ state.Style()->SetGridAutoRepeat{{type}}s(auto_repeat_track_sizes);
+ state.Style()->SetGridAutoRepeat{{type}}sInsertionPoint(
+ auto_repeat_insertion_point);
+ state.Style()->SetAutoRepeatNamedGrid{{type}}Lines(auto_repeat_named_grid_lines);
+ state.Style()->SetAutoRepeatOrderedNamedGrid{{type}}Lines(
+ auto_repeat_ordered_named_grid_lines);
+ state.Style()->SetGridAutoRepeat{{type}}sType(autoRepeatType);
+ {% endcall %}
+ {% endif %}
{%- endmacro %}
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/templates/media_features.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/templates/media_features.h.tmpl
index ad7696f2b9b..4f7fe5d43f3 100644
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/templates/media_features.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/templates/media_features.h.tmpl
@@ -9,7 +9,7 @@
#define CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(macro) \
{% for entry in entries %}
{% set constant_prefix = entry | symbol %}
- {% set method_prefix = constant_prefix | upper_first_letter %}
+ {% set method_prefix = constant_prefix | to_function_name %}
macro({{constant_prefix}}, {{method_prefix}}){% if not loop.last %} \
{% endif %}
{% endfor %}
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/templates/style_property_shorthand.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/templates/style_property_shorthand.cc.tmpl
index 3b7324062b7..aef5305626d 100644
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/templates/style_property_shorthand.cc.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/templates/style_property_shorthand.cc.tmpl
@@ -31,18 +31,18 @@
namespace blink {
{% for property in properties %}
-const StylePropertyShorthand& {{property.lower_camel_name}}Shorthand() {
- static const CSSProperty* {{property.lower_camel_name}}Properties[] = {
+const StylePropertyShorthand& {{property.name.to_lower_camel_case()}}Shorthand() {
+ static const CSSProperty* {{property.name.to_lower_camel_case()}}Properties[] = {
{% for longhand_id in property.longhand_property_ids %}
&Get{{longhand_id}}(),
{% endfor %}
};
- static StylePropertyShorthand {{property.lower_camel_name}}Longhands(
+ static StylePropertyShorthand {{property.name.to_lower_camel_case()}}Longhands(
{{property.property_id}},
- {{property.lower_camel_name}}Properties,
- arraysize({{property.lower_camel_name}}Properties));
- return {{property.lower_camel_name}}Longhands;
+ {{property.name.to_lower_camel_case()}}Properties,
+ arraysize({{property.name.to_lower_camel_case()}}Properties));
+ return {{property.name.to_lower_camel_case()}}Longhands;
}
{% endfor %}
@@ -68,7 +68,7 @@ const StylePropertyShorthand& shorthandForProperty(CSSPropertyID propertyID) {
switch (propertyID) {
{% for property in properties %}
case {{property.property_id}}:
- return {{property.lower_camel_name}}Shorthand();
+ return {{property.name.to_lower_camel_case()}}Shorthand();
{% endfor %}
default: {
return emptyShorthand;
@@ -83,7 +83,7 @@ void getMatchingShorthandsForLonghand(
{% for longhand_id, shorthands in longhands_dictionary.items() %}
case {{longhand_id}}: {
{% for shorthand in shorthands %}
- result->UncheckedAppend({{shorthand.lower_camel_name}}Shorthand());
+ result->UncheckedAppend({{shorthand.name.to_lower_camel_case()}}Shorthand());
{% endfor %}
break;
}
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/templates/style_property_shorthand.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/templates/style_property_shorthand.h.tmpl
index 715ce15bbc8..20ae092e477 100644
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/templates/style_property_shorthand.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/templates/style_property_shorthand.h.tmpl
@@ -57,7 +57,7 @@ class StylePropertyShorthand {
};
{% for property in properties %}
-const StylePropertyShorthand& {{property.lower_camel_name}}Shorthand();
+const StylePropertyShorthand& {{property.name.to_lower_camel_case()}}Shorthand();
{% endfor %}
const StylePropertyShorthand& animationShorthandForParsing();
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/style/computed_style_fields.py b/chromium/third_party/blink/renderer/build/scripts/core/style/computed_style_fields.py
index 9e4795169ba..9f539ca67bf 100644
--- a/chromium/third_party/blink/renderer/build/scripts/core/style/computed_style_fields.py
+++ b/chromium/third_party/blink/renderer/build/scripts/core/style/computed_style_fields.py
@@ -2,12 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-from name_utilities import (
- enum_value_name, class_member_name, method_name, class_name
-)
-
from itertools import chain
+from blinkbuild.name_style_converter import NameStyleConverter
+
def _flatten_list(x):
"""Flattens a list of lists into a single list."""
@@ -31,7 +29,7 @@ class Group(object):
"""Represents a group of fields stored together in a class.
Attributes:
- name: The name of the group as a string.
+ name: The name of the group as a string, or None.
subgroups: List of Group instances that are stored as subgroups under
this group.
fields: List of Field instances stored directly under this group.
@@ -43,8 +41,9 @@ class Group(object):
self.fields = fields
self.parent = None
- self.type_name = class_name(['style', name, 'data'])
- self.member_name = class_member_name([name, 'data'])
+ converter = NameStyleConverter(name or '')
+ self.type_name = converter.to_class_name(prefix='style', suffix='data')
+ self.member_name = converter.to_class_data_member(suffix='data')
self.num_32_bit_words_for_bit_fields = _num_32_bit_words_for_bit_fields(
field for field in fields if field.is_bit_field
)
@@ -78,7 +77,8 @@ class Enum(object):
"""Represents a generated enum in ComputedStyleBaseConstants."""
def __init__(self, type_name, keywords, is_set):
self.type_name = type_name
- self.values = [enum_value_name(keyword) for keyword in keywords]
+ self.values = [NameStyleConverter(keyword).to_enum_value()
+ for keyword in keywords]
self.is_set = is_set
@@ -138,7 +138,8 @@ class Field(object):
custom_copy, custom_compare, mutable, getter_method_name,
setter_method_name, initial_method_name,
computed_style_custom_functions, **kwargs):
- self.name = class_member_name(name_for_methods)
+ name_source = NameStyleConverter(name_for_methods)
+ self.name = name_source.to_class_data_member()
self.property_name = property_name
self.type_name = type_name
self.wrapper_pointer_name = wrapper_pointer_name
@@ -154,13 +155,11 @@ class Field(object):
# Method names
self.getter_method_name = getter_method_name
self.setter_method_name = setter_method_name
- self.internal_getter_method_name = method_name([self.name, 'internal'])
- self.internal_mutable_method_name = method_name(
- ['mutable', name_for_methods, 'internal'])
- self.internal_setter_method_name = method_name(
- [setter_method_name, 'internal'])
+ self.internal_getter_method_name = name_source.to_function_name(suffix='internal')
+ self.internal_mutable_method_name = name_source.to_function_name(prefix='mutable', suffix='internal')
+ self.internal_setter_method_name = NameStyleConverter(setter_method_name).to_function_name(suffix='internal')
self.initial_method_name = initial_method_name
- self.resetter_method_name = method_name(['reset', name_for_methods])
+ self.resetter_method_name = name_source.to_function_name(prefix='reset')
self.computed_style_custom_functions = computed_style_custom_functions
# Only bitfields have sizes.
self.is_bit_field = self.size is not None
@@ -177,7 +176,6 @@ class Field(object):
assert self.is_inherited or not self.is_independent, \
'Only inherited fields can be independent'
- self.is_inherited_method_name = method_name(
- [name_for_methods, 'is inherited'])
+ self.is_inherited_method_name = name_source.to_function_name(suffix=['is', 'inherited'])
assert len(kwargs) == 0, \
'Unexpected arguments provided to Field: ' + str(kwargs)