summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/build/scripts
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-24 12:15:48 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-28 13:30:04 +0000
commitb014812705fc80bff0a5c120dfcef88f349816dc (patch)
tree25a2e2d9fa285f1add86aa333389a839f81a39ae /chromium/third_party/blink/renderer/build/scripts
parent9f4560b1027ae06fdb497023cdcaf91b8511fa74 (diff)
downloadqtwebengine-chromium-b014812705fc80bff0a5c120dfcef88f349816dc.tar.gz
BASELINE: Update Chromium to 68.0.3440.125
Change-Id: I23f19369e01f688e496f5bf179abb521ad73874f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/build/scripts')
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/aria_properties.py24
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/blinkbuild/__init__.py3
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter.py153
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter_test.py159
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/css_properties.py11
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/make_css_value_keywords.py4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/make_cssom_types.py4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/make_media_features.py4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/parser/make_atrule_names.py4
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/parser/templates/at_rule_descriptors.h.tmpl6
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_base.py4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_subclasses.py70
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property.h.tmpl11
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.cc.tmpl91
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl22
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_unresolved_property.cc.tmpl4
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_unresolved_property.h.tmpl11
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl85
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/css/templates/style_property_shorthand.cc.tmpl4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/core/style/make_computed_style_initial_values.py4
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl6
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/gperf.py4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/in_file_unittest.py5
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/json5_generator.py22
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_computed_style_base.py4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_css_primitive_value_unit_trie.py4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_css_property_names.py4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_css_value_id_mappings.py4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_element_factory.py12
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_element_lookup_trie.py4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_element_type_helpers.py13
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_event_factory.py5
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_html_entity_table.py237
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/make_instrumenting_probes.py162
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_internal_runtime_flags.py4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_internal_settings.py5
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_names.py8
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_origin_trials.py4
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_qualified_names.py30
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_runtime_features.py11
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_settings.py5
-rwxr-xr-xchromium/third_party/blink/renderer/build/scripts/make_style_builder.py33
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/name_utilities.py73
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/scripts.gni1
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/InstrumentingProbesImpl.cpp.tmpl46
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/InstrumentingProbesInl.h.tmpl2
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/ProbeSink.h.tmpl14
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/computed_style_base.h.tmpl8
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/computed_style_base_constants.h.tmpl8
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/css_property_names.cc.tmpl4
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/css_property_names.h.tmpl8
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/css_value_id_mappings_generated.h.tmpl10
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl10
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/element_factory.h.tmpl8
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.cc.tmpl6
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.h.tmpl8
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl4
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl10
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/internal_runtime_flags.h.tmpl2
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/internal_runtime_flags.idl.tmpl4
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.cc.tmpl8
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.h.tmpl4
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.idl.tmpl2
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/make_names.cc.tmpl4
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/make_names.h.tmpl10
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.cc.tmpl11
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl10
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl2
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.h.tmpl2
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl8
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/style_builder_functions.cc.tmpl141
72 files changed, 1082 insertions, 614 deletions
diff --git a/chromium/third_party/blink/renderer/build/scripts/aria_properties.py b/chromium/third_party/blink/renderer/build/scripts/aria_properties.py
new file mode 100644
index 00000000000..bca80493236
--- /dev/null
+++ b/chromium/third_party/blink/renderer/build/scripts/aria_properties.py
@@ -0,0 +1,24 @@
+# Copyright 2018 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.
+
+import os
+import os.path
+import sys
+
+PYJSON5_DIR = os.path.join(os.path.dirname(__file__),
+ '..', '..', '..', '..', 'pyjson5', 'src')
+sys.path.insert(0, PYJSON5_DIR)
+
+import json5 # pylint: disable=import-error
+
+
+class ARIAReader(object):
+ def __init__(self, json5_file_path):
+ self._input_files = [json5_file_path]
+
+ with open(os.path.abspath(json5_file_path)) as json5_file:
+ self._data = json5.loads(json5_file.read())
+
+ def attributes_list(self):
+ return {'data': [item[u'name'] for item in self._data['attributes']]}
diff --git a/chromium/third_party/blink/renderer/build/scripts/blinkbuild/__init__.py b/chromium/third_party/blink/renderer/build/scripts/blinkbuild/__init__.py
new file mode 100644
index 00000000000..1adf20d2c9a
--- /dev/null
+++ b/chromium/third_party/blink/renderer/build/scripts/blinkbuild/__init__.py
@@ -0,0 +1,3 @@
+# Copyright 2018 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.
diff --git a/chromium/third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter.py b/chromium/third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter.py
new file mode 100644
index 00000000000..1b6c7dab31b
--- /dev/null
+++ b/chromium/third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter.py
@@ -0,0 +1,153 @@
+# 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.
+
+# pylint: disable=import-error,print-statement,relative-import
+
+import copy
+import re
+
+SPECIAL_TOKENS = [
+ # This list should be sorted by length.
+ 'WebSocket',
+ 'String16',
+ 'CString',
+ 'Float32',
+ 'Float64',
+ 'Base64',
+ 'IFrame',
+ 'Latin1',
+ 'PlugIn',
+ 'SQLite',
+ 'Uint16',
+ 'Uint32',
+ 'WebGL2',
+ 'ASCII',
+ 'CSSOM',
+ 'CType',
+ 'DList',
+ 'Int16',
+ 'Int32',
+ 'MPath',
+ 'OList',
+ 'TSpan',
+ 'UList',
+ 'UTF16',
+ 'Uint8',
+ 'WebGL',
+ 'XPath',
+ 'ETC1',
+ 'HTML',
+ 'Int8',
+ 'S3TC',
+ 'SPv2',
+ 'UTF8',
+ 'sRGB',
+ 'API',
+ 'CSS',
+ 'DNS',
+ 'DOM',
+ 'EXT',
+ 'RTC',
+ 'SVG',
+ 'XSS',
+ '2D',
+ 'AX',
+ 'FE',
+ 'V0',
+ 'V8',
+]
+
+# Applying _TOKEN_PATTERNS repeatedly should capture any sequence of a-z, A-Z,
+# 0-9.
+_TOKEN_PATTERNS = [
+ # 'Foo' 'foo'
+ '[A-Z]?[a-z]+',
+ # The following pattern captures only 'FOO' in 'FOOElement'.
+ '[A-Z]+(?![a-z])',
+ # '2D' '3D', but not '2Dimension'
+ '[0-9][Dd](?![a-z])',
+ '[0-9]+',
+]
+
+_TOKEN_RE = re.compile(r'(' + '|'.join(SPECIAL_TOKENS + _TOKEN_PATTERNS) + r')')
+
+
+def tokenize_name(name):
+ """Tokenize the specified name.
+
+ A token consists of A-Z, a-z, and 0-9 characters. Other characters work as
+ token delimiters, and the resultant list won't contain such characters.
+ Capital letters also work as delimiters. E.g. 'FooBar-baz' is tokenized to
+ ['Foo', 'Bar', 'baz']. See _TOKEN_PATTERNS for more details.
+
+ This function detects special cases that are not easily discernible without
+ additional knowledge, such as recognizing that in SVGSVGElement, the first
+ two SVGs are separate tokens, but WebGL is one token.
+
+ Returns:
+ A list of token strings.
+
+ """
+ return _TOKEN_RE.findall(name)
+
+
+class NameStyleConverter(object):
+ """Converts names from camelCase to various other styles.
+ """
+
+ def __init__(self, name):
+ self.tokens = tokenize_name(name)
+
+ def to_snake_case(self):
+ """Snake case is the file and variable name style per Google C++ Style
+ Guide:
+ https://google.github.io/styleguide/cppguide.html#Variable_Names
+
+ Also known as the hacker case.
+ https://en.wikipedia.org/wiki/Snake_case
+ """
+ return '_'.join([token.lower() for token in self.tokens])
+
+ def to_upper_camel_case(self):
+ """Upper-camel case is the class and function name style per
+ Google C++ Style Guide:
+ https://google.github.io/styleguide/cppguide.html#Function_Names
+
+ Also known as the PascalCase.
+ https://en.wikipedia.org/wiki/Camel_case.
+ """
+ tokens = self.tokens
+ # If the first token is one of SPECIAL_TOKENS, we should replace the
+ # token with the matched special token.
+ # e.g. ['css', 'External', 'Scanner', 'Preload'] => 'CSSExternalScannerPreload'
+ if tokens and tokens[0].lower() == tokens[0]:
+ for special in SPECIAL_TOKENS:
+ if special.lower() == tokens[0]:
+ tokens = copy.deepcopy(tokens)
+ tokens[0] = special
+ break
+ return ''.join([token[0].upper() + token[1:] for token in tokens])
+
+ def to_lower_camel_case(self):
+ """Lower camel case is the name style for attribute names and operation
+ names in web platform APIs.
+ e.g. 'addEventListener', 'documentURI', 'fftSize'
+ https://en.wikipedia.org/wiki/Camel_case.
+ """
+ if not self.tokens:
+ return ''
+ return self.tokens[0].lower() + ''.join([token[0].upper() + token[1:] for token in self.tokens[1:]])
+
+ def to_macro_case(self):
+ """Macro case is the macro name style per Google C++ Style Guide:
+ https://google.github.io/styleguide/cppguide.html#Macro_Names
+ """
+ return '_'.join([token.upper() for token in self.tokens])
+
+ def to_all_cases(self):
+ return {
+ 'snake_case': self.to_snake_case(),
+ 'upper_camel_case': self.to_upper_camel_case(),
+ 'macro_case': self.to_macro_case(),
+ }
diff --git a/chromium/third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter_test.py b/chromium/third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter_test.py
new file mode 100644
index 00000000000..1b343b7086a
--- /dev/null
+++ b/chromium/third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter_test.py
@@ -0,0 +1,159 @@
+# 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.
+
+# pylint: disable=import-error,print-statement,relative-import,protected-access
+
+"""Unit tests for name_style_converter.py."""
+
+import unittest
+
+from name_style_converter import NameStyleConverter
+from name_style_converter import tokenize_name
+
+
+class SmartTokenizerTest(unittest.TestCase):
+ def test_simple_cases(self):
+ self.assertEqual(tokenize_name('foo'), ['foo'])
+
+ self.assertEqual(tokenize_name('fooBar'), ['foo', 'Bar'])
+
+ self.assertEqual(tokenize_name('fooBarBaz'), ['foo', 'Bar', 'Baz'])
+
+ self.assertEqual(tokenize_name('Baz'), ['Baz'])
+
+ self.assertEqual(tokenize_name(''), [])
+
+ self.assertEqual(tokenize_name('FOO'), ['FOO'])
+
+ self.assertEqual(tokenize_name('foo2'), ['foo', '2'])
+
+ def test_tricky_cases(self):
+ self.assertEqual(tokenize_name('XMLHttpRequest'), ['XML', 'Http', 'Request'])
+
+ self.assertEqual(tokenize_name('HTMLElement'), ['HTML', 'Element'])
+
+ self.assertEqual(tokenize_name('WebGLRenderingContext'),
+ ['WebGL', 'Rendering', 'Context'])
+
+ self.assertEqual(tokenize_name('CanvasRenderingContext2D'),
+ ['Canvas', 'Rendering', 'Context', '2D'])
+ self.assertEqual(tokenize_name('CanvasRenderingContext2DAPITest'),
+ ['Canvas', 'Rendering', 'Context', '2D', 'API', 'Test'])
+
+ self.assertEqual(tokenize_name('SVGSVGElement'), ['SVG', 'SVG', 'Element'])
+
+ self.assertEqual(tokenize_name('CanvasRenderingContext2D'),
+ ['Canvas', 'Rendering', 'Context', '2D'])
+
+ self.assertEqual(tokenize_name('CSSURLImageValue'), ['CSS', 'URL', 'Image', 'Value'])
+ self.assertEqual(tokenize_name('CSSPropertyAPID'), ['CSS', 'Property', 'API', 'D'])
+ self.assertEqual(tokenize_name('AXARIAGridCell'), ['AX', 'ARIA', 'Grid', 'Cell'])
+
+ self.assertEqual(tokenize_name('CDATASection'), ['CDATA', 'Section'])
+
+ self.assertEqual(tokenize_name('ASCIICType'), ['ASCII', 'CType'])
+ self.assertEqual(tokenize_name('CString'), ['CString'])
+
+ self.assertEqual(tokenize_name('HTMLDListElement'), ['HTML', 'DList', 'Element'])
+ self.assertEqual(tokenize_name('HTMLOListElement'), ['HTML', 'OList', 'Element'])
+ self.assertEqual(tokenize_name('HTMLIFrameElement'), ['HTML', 'IFrame', 'Element'])
+ self.assertEqual(tokenize_name('HTMLPlugInElement'), ['HTML', 'PlugIn', 'Element'])
+
+ # No special handling for OptGroup, FieldSet, and TextArea.
+ self.assertEqual(tokenize_name('HTMLOptGroupElement'), ['HTML', 'Opt', 'Group', 'Element'])
+ self.assertEqual(tokenize_name('HTMLFieldSetElement'), ['HTML', 'Field', 'Set', 'Element'])
+ self.assertEqual(tokenize_name('HTMLTextAreaElement'), ['HTML', 'Text', 'Area', 'Element'])
+
+ self.assertEqual(tokenize_name('Path2D'), ['Path', '2D'])
+ self.assertEqual(tokenize_name('Point2D'), ['Point', '2D'])
+ self.assertEqual(tokenize_name('CanvasRenderingContext2DState'),
+ ['Canvas', 'Rendering', 'Context', '2D', 'State'])
+ self.assertEqual(tokenize_name('Accelerated2dCanvas'), ['Accelerated', '2d', 'Canvas'])
+
+ self.assertEqual(tokenize_name('RTCDTMFSender'), ['RTC', 'DTMF', 'Sender'])
+
+ self.assertEqual(tokenize_name('WebGLCompressedTextureS3TCsRGB'),
+ ['WebGL', 'Compressed', 'Texture', 'S3TC', 'sRGB'])
+ self.assertEqual(tokenize_name('WebGL2CompressedTextureETC1'),
+ ['WebGL2', 'Compressed', 'Texture', 'ETC1'])
+ self.assertEqual(tokenize_name('EXTsRGB'), ['EXT', 'sRGB'])
+ # 'PVRTC' contains a special token 'RTC', but it should be a
+ # single token.
+ self.assertEqual(tokenize_name('WebGLCompressedTexturePVRTC'),
+ ['WebGL', 'Compressed', 'Texture', 'PVRTC'])
+
+ self.assertEqual(tokenize_name('SVGFEBlendElement'), ['SVG', 'FE', 'Blend', 'Element'])
+ self.assertEqual(tokenize_name('SVGMPathElement'), ['SVG', 'MPath', 'Element'])
+ self.assertEqual(tokenize_name('SVGTSpanElement'), ['SVG', 'TSpan', 'Element'])
+ self.assertEqual(tokenize_name('SVGURIReference'), ['SVG', 'URI', 'Reference'])
+
+ self.assertEqual(tokenize_name('UTF16TextIterator'), ['UTF16', 'Text', 'Iterator'])
+ self.assertEqual(tokenize_name('UTF8Decoder'), ['UTF8', 'Decoder'])
+ self.assertEqual(tokenize_name('Uint8Array'), ['Uint8', 'Array'])
+ self.assertEqual(tokenize_name('DOMWindowBase64'), ['DOM', 'Window', 'Base64'])
+ self.assertEqual(tokenize_name('TextCodecLatin1'), ['Text', 'Codec', 'Latin1'])
+ self.assertEqual(tokenize_name('V8BindingForCore'), ['V8', 'Binding', 'For', 'Core'])
+ self.assertEqual(tokenize_name('V8DOMRect'), ['V8', 'DOM', 'Rect'])
+ self.assertEqual(tokenize_name('String16MojomTraits'), ['String16', 'Mojom', 'Traits'])
+
+ self.assertEqual(tokenize_name('V0InsertionPoint'), ['V0', 'Insertion', 'Point'])
+ self.assertEqual(tokenize_name('ShadowDOMV0Test'), ['Shadow', 'DOM', 'V0', 'Test'])
+ self.assertEqual(tokenize_name('ElementShadowV0'), ['Element', 'Shadow', 'V0'])
+ self.assertEqual(tokenize_name('StubChromeClientForSPv2'),
+ ['Stub', 'Chrome', 'Client', 'For', 'SPv2'])
+
+ self.assertEqual(tokenize_name('SQLiteAuthorizer'), ['SQLite', 'Authorizer'])
+ self.assertEqual(tokenize_name('XPathEvaluator'), ['XPath', 'Evaluator'])
+
+ self.assertEqual(tokenize_name('IsXHTMLDocument'), ['Is', 'XHTML', 'Document'])
+ self.assertEqual(tokenize_name('isHTMLDocument'), ['is', 'HTML', 'Document'])
+
+ self.assertEqual(tokenize_name('matrix3d'), ['matrix', '3d'])
+
+ def test_ignoring_characters(self):
+ self.assertEqual(tokenize_name('Animation.idl'), ['Animation', 'idl'])
+ self.assertEqual(tokenize_name('-webkit-appearance'), ['webkit', 'appearance'])
+ self.assertEqual(tokenize_name(' foo_bar!#"$'), ['foo', 'bar'])
+
+
+class NameStyleConverterTest(unittest.TestCase):
+ def test_snake_case(self):
+ converter = NameStyleConverter('HTMLElement')
+ self.assertEqual(converter.to_snake_case(), 'html_element')
+
+ def test_upper_camel_case(self):
+ converter = NameStyleConverter('someSuperThing')
+ self.assertEqual(converter.to_upper_camel_case(), 'SomeSuperThing')
+ converter = NameStyleConverter('SVGElement')
+ self.assertEqual(converter.to_upper_camel_case(), 'SVGElement')
+ converter = NameStyleConverter('cssExternalScannerPreload')
+ self.assertEqual(converter.to_upper_camel_case(), 'CSSExternalScannerPreload')
+ converter = NameStyleConverter('xpathExpression')
+ self.assertEqual(converter.to_upper_camel_case(), 'XPathExpression')
+ converter = NameStyleConverter('feDropShadow')
+ self.assertEqual(converter.to_upper_camel_case(), 'FEDropShadow')
+
+ def test_lower_camel_case(self):
+ converter = NameStyleConverter('someSuperThing')
+ self.assertEqual(converter.to_lower_camel_case(), 'someSuperThing')
+ converter = NameStyleConverter('SVGElement')
+ self.assertEqual(converter.to_lower_camel_case(), 'svgElement')
+ converter = NameStyleConverter('documentURI')
+ self.assertEqual(converter.to_lower_camel_case(), 'documentURI')
+ converter = NameStyleConverter('-webkit-margin-start')
+ self.assertEqual(converter.to_lower_camel_case(), 'webkitMarginStart')
+ converter = NameStyleConverter('Accelerated2dCanvas')
+ self.assertEqual(converter.to_lower_camel_case(), 'accelerated2dCanvas')
+
+ def test_macro_case(self):
+ converter = NameStyleConverter('WebGLBaz2D')
+ self.assertEqual(converter.to_macro_case(), 'WEBGL_BAZ_2D')
+
+ def test_all_cases(self):
+ converter = NameStyleConverter('SVGScriptElement')
+ self.assertEqual(converter.to_all_cases(), {
+ 'snake_case': 'svg_script_element',
+ 'upper_camel_case': 'SVGScriptElement',
+ 'macro_case': 'SVG_SCRIPT_ELEMENT',
+ })
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 7e646855f6b..fb0fa4673d8 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
@@ -201,13 +201,12 @@ class CSSProperties(object):
if property_['inherited']:
property_['is_inherited_setter'] = 'Set' + name + 'IsInherited'
- # Expand whether there are custom StyleBuilder methods.
- if property_['custom_apply_functions_all']:
- property_['custom_apply_functions_inherit'] = True
- property_['custom_apply_functions_initial'] = True
- property_['custom_apply_functions_value'] = True
+ # Figure out whether we should generate style builder implementations.
+ for x in ['initial', 'inherit', 'value']:
+ suppressed = x in property_['style_builder_custom_functions']
+ property_['style_builder_generate_%s' % x] = not suppressed
- # Expand StyleBuilderConverter params where ncessary.
+ # Expand StyleBuilderConverter params where necessary.
if property_['type_name'] in PRIMITIVE_TYPES:
set_if_none(property_, 'converter', 'CSSPrimitiveValue')
else:
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 e2435d12350..199fc96d68b 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
@@ -14,8 +14,8 @@ import gperf
class CSSValueKeywordsWriter(json5_generator.Writer):
- def __init__(self, file_paths):
- json5_generator.Writer.__init__(self, file_paths)
+ def __init__(self, file_paths, output_dir):
+ json5_generator.Writer.__init__(self, file_paths, output_dir)
self._outputs = {
"css_value_keywords.h": self.generate_header,
"css_value_keywords.cc": self.generate_implementation
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/make_cssom_types.py b/chromium/third_party/blink/renderer/build/scripts/core/css/make_cssom_types.py
index 14ea88d4ac6..6c44db014ce 100755
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/make_cssom_types.py
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/make_cssom_types.py
@@ -19,8 +19,8 @@ class CSSOMTypesWriter(json5_generator.Writer):
utility methods for determining whether a given CSSStyleValue is valid
for a given CSS property. The header files live in core/css/cssom.
"""
- def __init__(self, json5_file_paths):
- super(CSSOMTypesWriter, self).__init__([])
+ def __init__(self, json5_file_paths, output_dir):
+ super(CSSOMTypesWriter, self).__init__([], output_dir)
self._input_files = json5_file_paths
self._properties = (
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 a01713ae939..969641970d9 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
@@ -25,8 +25,8 @@ class MakeMediaFeaturesWriter(json5_generator.Writer):
'upper_first_letter': name_utilities.upper_first_letter,
}
- def __init__(self, json5_file_path):
- super(MakeMediaFeaturesWriter, self).__init__(json5_file_path)
+ def __init__(self, json5_file_path, output_dir):
+ super(MakeMediaFeaturesWriter, self).__init__(json5_file_path, output_dir)
self._outputs = {
('media_features.h'): self.generate_header,
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 edd4e2df805..5015606ecbf 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
@@ -41,8 +41,8 @@ import template_expander
class StylePropertyShorthandWriter(json5_generator.Writer):
class_name = 'StylePropertyShorthand'
- def __init__(self, json5_file_paths):
- super(StylePropertyShorthandWriter, self).__init__([])
+ def __init__(self, json5_file_paths, output_dir):
+ super(StylePropertyShorthandWriter, self).__init__([], output_dir)
self._input_files = json5_file_paths
self._outputs = {
'style_property_shorthand.cc':
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 0c964b902f5..a083c4d095f 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
@@ -19,8 +19,8 @@ class AtRuleNamesWriter(json5_generator.Writer):
Generates AtRuleNames. This class provides utility methods for parsing
@rules (e.g. @font-face, @viewport, etc)
"""
- def __init__(self, json5_file_paths):
- super(AtRuleNamesWriter, self).__init__(json5_file_paths)
+ def __init__(self, json5_file_paths, output_dir):
+ super(AtRuleNamesWriter, self).__init__(json5_file_paths, output_dir)
self._outputs = {
'at_rule_descriptors.h': self.generate_header,
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 59694741efc..a8ad2854415 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
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BLINK_CORE_CSS_PARSER_AT_RULE_DESCRIPTORS_H_
-#define BLINK_CORE_CSS_PARSER_AT_RULE_DESCRIPTORS_H_
+#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_AT_RULE_DESCRIPTORS_H_
+#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_AT_RULE_DESCRIPTORS_H_
#include "third_party/blink/renderer/core/css_property_names.h"
#include "third_party/blink/renderer/platform/wtf/text/string_view.h"
@@ -29,4 +29,4 @@ AtRuleDescriptorID CSSPropertyIDAsAtRuleDescriptor(CSSPropertyID id);
} // namespace blink
-#endif // BLINK_CORE_CSS_PARSER_AT_RULE_DESCRIPTORS_H_
+#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_AT_RULE_DESCRIPTORS_H_
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 5eb812eaf43..9f7309f112e 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
@@ -21,8 +21,8 @@ class PropertyClassData(
class CSSPropertyBaseWriter(json5_generator.Writer):
- def __init__(self, json5_file_paths):
- super(CSSPropertyBaseWriter, self).__init__([])
+ def __init__(self, json5_file_paths, output_dir):
+ super(CSSPropertyBaseWriter, self).__init__([], output_dir)
self._input_files = json5_file_paths
self._outputs = {
'css_unresolved_property.h': self.generate_unresolved_property_header,
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 972829eeb48..b9a8c3ce0e8 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
@@ -19,8 +19,8 @@ class PropertyMethod(namedtuple('PropertyMethod', 'name,return_type,parameters')
class CSSPropertiesWriter(CSSPropertyBaseWriter):
- def __init__(self, json5_file_paths):
- super(CSSPropertiesWriter, self).__init__(json5_file_paths)
+ def __init__(self, json5_file_paths, output_dir):
+ super(CSSPropertiesWriter, self).__init__(json5_file_paths, output_dir)
assert len(json5_file_paths) == 3,\
('CSSPropertiesWriter requires 3 input json5 files, ' +
'got {}.'.format(len(json5_file_paths)))
@@ -97,64 +97,32 @@ class CSSPropertiesWriter(CSSPropertyBaseWriter):
return generate_property_cpp
def calculate_apply_functions_to_declare(self, property_):
- if property_['custom_apply_functions_all']:
- property_name = property_['upper_camel_name']
- if (property_name in ['Clip', 'ColumnCount', 'ColumnWidth', 'ZIndex']):
- property_['custom_apply'] = "auto"
- property_['custom_apply_args'] = {'auto_identity': 'CSSValueAuto'}
- elif (property_name in [
- 'BorderImageOutset', 'BorderImageRepeat', 'BorderImageSlice', 'BorderImageWidth', 'WebkitMaskBoxImageOutset',
- 'WebkitMaskBoxImageRepeat', 'WebkitMaskBoxImageSlice', 'WebkitMaskBoxImageWidth']):
- property_['custom_apply'] = 'border_image'
- is_mask_box = 'WebkitMaskBox' in property_name
- getter = 'MaskBoxImage' if is_mask_box else 'BorderImage'
- modifier_type = property_name[len('WebkitMaskBoxImage'):] if is_mask_box else property_name[len('BorderImage'):]
- property_['custom_apply_args'] = {
- 'is_mask_box': is_mask_box,
- 'modifier_type': modifier_type,
- 'getter': getter,
- 'setter': 'Set' + getter
- }
- elif (property_name in [
- 'BackgroundAttachment', 'BackgroundBlendMode', 'BackgroundClip', 'BackgroundImage', 'BackgroundOrigin',
- 'BackgroundPositionX', 'BackgroundPositionY', 'BackgroundRepeatX', 'BackgroundRepeatY', 'BackgroundSize',
- 'MaskSourceType', 'WebkitMaskClip', 'WebkitMaskComposite', 'WebkitMaskImage', 'WebkitMaskOrigin',
- 'WebkitMaskPositionX', 'WebkitMaskPositionY', 'WebkitMaskRepeatX', 'WebkitMaskRepeatY', 'WebkitMaskSize']):
- fill_type = property_name if property_name == 'MaskSourceType' else property_name[len('Background'):]
- property_['custom_apply'] = 'fill_layer'
- property_['should_implement_apply_functions_in_cpp'] = True
- property_['custom_apply_args'] = {
- 'layer_type': 'Background' if 'Background' in property_name else 'Mask',
- 'fill_type': fill_type,
- 'fill_type_getter': 'Get' + fill_type if fill_type == "Image" else fill_type
- }
+ if property_['style_builder_template'] in ['background_layer', 'color', 'counter', 'mask_layer']:
+ property_['should_implement_apply_functions_in_cpp'] = True
+
property_['should_implement_apply_functions'] = (
property_['is_property'] and
not property_['longhands'] and
not property_['direction_aware_options'] and
not property_['builder_skip'] and
- (not (property_['custom_apply_functions_initial'] and
- property_['custom_apply_functions_inherit'] and
- property_['custom_apply_functions_value']) or
- 'custom_apply' in property_))
+ not property_['style_builder_legacy'])
def h_includes(self, property_):
if property_['alias_for']:
- yield "core/css/properties/css_unresolved_property.h"
+ yield "third_party/blink/renderer/core/css/properties/css_unresolved_property.h"
else:
- yield "core/css/properties/" + property_['namespace_group'].lower() + ".h"
+ yield "third_party/blink/renderer/core/css/properties/" + property_['namespace_group'].lower() + ".h"
if property_['direction_aware_options']:
- yield "core/style_property_shorthand.h"
- if property_['runtime_flag']:
- yield "platform/runtime_enabled_features.h"
- if property_['should_implement_apply_functions']:
- for include in self.apply_includes(property_):
- yield include
+ yield "third_party/blink/renderer/core/style_property_shorthand.h"
+ for include in self.apply_includes(property_):
+ yield 'third_party/blink/renderer/' + include
+ if property_['runtime_flag']:
+ yield "third_party/blink/renderer/platform/runtime_enabled_features.h"
def cpp_includes(self, property_):
if 'should_implement_apply_functions_in_cpp' in property_:
for include in self.apply_includes(property_):
- yield include
+ yield 'third_party/blink/renderer/' + include
def apply_includes(self, property_):
yield "core/css/resolver/style_resolver_state.h"
@@ -175,12 +143,16 @@ class CSSPropertiesWriter(CSSPropertyBaseWriter):
yield "core/style/svg_computed_style.h"
else:
yield "core/style/computed_style.h"
- if ('custom_apply_args' in property_ and
- property_['custom_apply_args'].get('modifier_type')
+ if ('style_builder_template_args' in property_ and
+ property_['style_builder_template_args'].get('modifier_type')
in ['Width', 'Slice', 'Outset']):
yield "core/css/properties/style_building_utils.h"
- if property_.get('custom_apply') == "fill_layer":
+ if property_.get('style_builder_template') in ['animation', 'background_layer', 'counter',
+ 'mask_layer', 'transition']:
yield "core/css/css_value_list.h"
+ if property_.get('style_builder_template') in ['counter']:
+ yield "core/css/css_value_pair.h"
+ yield "core/css/css_custom_ident_value.h"
if __name__ == '__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 6e5f8ea72ae..0465168f963 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
@@ -6,8 +6,8 @@
{{source_files_for_generated_file(template_file, input_files)}}
// clang-format off
-#ifndef BLINK_CORE_CSS_PROPERTY_H_
-#define BLINK_CORE_CSS_PROPERTY_H_
+#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTY_H_
+#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTY_H_
#include "third_party/blink/renderer/core/css_property_names.h"
#include "third_party/blink/renderer/core/css/css_value.h"
@@ -44,10 +44,6 @@ class CSSProperty : public CSSUnresolvedProperty {
}
bool IDEquals(CSSPropertyID id) const { return PropertyID() == id; }
bool IsResolvedProperty() const override { return true; }
- virtual const WTF::String GetJSPropertyName() const {
- NOTREACHED();
- return g_empty_string;
- }
virtual bool IsInterpolable() const { return false; }
virtual bool IsInherited() const { return false; }
virtual bool IsCompositableProperty() const { return false; }
@@ -59,7 +55,6 @@ class CSSProperty : public CSSUnresolvedProperty {
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 bool IsAffectedByAll() const { return IsEnabled() && IsProperty(); }
virtual bool IsLayoutDependentProperty() const { return false; }
virtual bool IsLayoutDependent(const ComputedStyle* style, LayoutObject* layout_object) const { return false; }
@@ -146,4 +141,4 @@ CORE_EXPORT const CSSProperty& Get{{property_class_data.property_id}}();
} // namespace blink
-#endif // BLINK_CORE_CSS_PROPERTY_H_
+#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTY_H_
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 481236ffc6e..af83d306752 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,11 +2,11 @@
// 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 %}
+{% from 'core/css/properties/templates/style_builder_functions.tmpl' import declare_initial, declare_inherit, declare_value, set_value %}
{% from 'templates/macros.tmpl' import source_files_for_generated_file %}
{{source_files_for_generated_file(template_file, input_files)}}
-#include "core/css/properties/{{property.namespace_group.lower()}}s/{{property_filename}}.h"
+#include "third_party/blink/renderer/core/css/properties/{{property.namespace_group.lower()}}s/{{property_filename}}.h"
{% for include in includes %}
#include "{{include}}"
@@ -15,9 +15,10 @@
namespace blink {
namespace CSSLonghand {
-{% if property.custom_apply == "fill_layer" %}
-{% set layer_type = property.custom_apply_args['layer_type'] %}
-{% set fill_type = property.custom_apply_args['fill_type'] %}
+{% 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}}));
@@ -32,7 +33,7 @@ namespace CSSLonghand {
while (currParent && currParent->Is{{fill_type}}Set()) {
if (!currChild)
currChild = prevChild->EnsureNext();
- currChild->Set{{fill_type}}(currParent->{{property.custom_apply_args['fill_type_getter']}}());
+ currChild->Set{{fill_type}}(currParent->{{fill_type_getter}}());
{% if fill_type == "PositionX" %}
if (currParent->IsBackgroundXOriginSet())
currChild->SetBackgroundXOrigin(currParent->BackgroundXOrigin());
@@ -76,6 +77,84 @@ namespace CSSLonghand {
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 %}
} // namespace CSSLonghand
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 0063da3f592..ae5c2740e5a 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
@@ -6,8 +6,8 @@
{% from 'core/css/properties/templates/style_builder_functions.tmpl' import style_builder_functions %}
{{source_files_for_generated_file(template_file, input_files)}}
-#ifndef GEN_BLINK_CORE_CSS_PROPERTIES_{{property.namespace_group.upper()}}_{{property_filename|upper}}_H_
-#define GEN_BLINK_CORE_CSS_PROPERTIES_{{property.namespace_group.upper()}}_{{property_filename|upper}}_H_
+#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_{{property.namespace_group.upper()}}_{{property_filename|upper}}_H_
+#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_{{property.namespace_group.upper()}}_{{property_filename|upper}}_H_
{% for include in includes %}
#include "{{include}}"
@@ -31,15 +31,22 @@ class {{property_classname}} final : public {{property.namespace_group}} {
public:
constexpr {{property_classname}}() : {{property.namespace_group}}() {}
{% endif %}
+ {% if property.is_internal %}
+ bool IsEnabled() const override { return false; }
+ {% elif property.runtime_flag %}
+ bool IsEnabled() const override {
+ return RuntimeEnabledFeatures::{{property.runtime_flag}}Enabled();
+ }
+ {% endif %}
const char* GetPropertyName() const override { return "{{property.name}}\0"; }
const WTF::AtomicString& GetPropertyNameAtomicString() const override {
static const WTF::AtomicString& name = WTF::AtomicString("{{property.name}}\0");
return name;
}
- {% if property.alias_for == None %}
const WTF::String GetJSPropertyName() const override {
return WTF::String("{{property_classname[0].lower() + property_classname[1:]}}\0");
}
+ {% if property.alias_for == None %}
CSSPropertyID PropertyID() const override { return {{property.property_id}}; }
{%if property.layout_dependent %}
bool IsLayoutDependentProperty() const override { return true; }
@@ -70,13 +77,6 @@ class {{property_classname}} final : public {{property.namespace_group}} {
{% if not property.is_property %}
bool IsProperty() const override { return false; }
{% endif %}
- {% if property.is_internal %}
- bool IsEnabled() const override { return false; }
- {% elif property.runtime_flag %}
- bool IsEnabled() const override {
- return RuntimeEnabledFeatures::{{property.runtime_flag}}Enabled();
- }
- {% endif %}
{% if not property.affected_by_all %}
bool IsAffectedByAll() const override { return false; }
{% endif %}
@@ -130,4 +130,4 @@ class {{property_classname}} final : public {{property.namespace_group}} {
} // namespace CSS{{property.namespace_group}}
} // namespace blink
-#endif // GEN_BLINK_CORE_CSS_PROPERTIES_{{property.namespace_group.upper()}}_{{property_filename|upper}}_H_
+#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_{{property.namespace_group.upper()}}_{{property_filename|upper}}_H_
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_unresolved_property.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_unresolved_property.cc.tmpl
index d1e21d0d9c0..78721960a97 100644
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_unresolved_property.cc.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_unresolved_property.cc.tmpl
@@ -11,11 +11,11 @@
#include "third_party/blink/renderer/core/css/properties/longhands/variable.h"
{% for property_filename in longhand_property_filenames %}
{% if property_filename != "longhand" %}
-#include "core/css/properties/longhands/{{property_filename}}.h"
+#include "third_party/blink/renderer/core/css/properties/longhands/{{property_filename}}.h"
{% endif %}
{% endfor %}
{% for property_filename in shorthand_property_filenames %}
-#include "core/css/properties/shorthands/{{property_filename}}.h"
+#include "third_party/blink/renderer/core/css/properties/shorthands/{{property_filename}}.h"
{% endfor %}
namespace blink {
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_unresolved_property.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_unresolved_property.h.tmpl
index a4841bed503..5071d7b09bf 100644
--- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_unresolved_property.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_unresolved_property.h.tmpl
@@ -6,8 +6,8 @@
{{source_files_for_generated_file(template_file, input_files)}}
// clang-format off
-#ifndef BLINK_CORE_CSS_UNRESOLVED_PROPERTY_H_
-#define BLINK_CORE_CSS_UNRESOLVED_PROPERTY_H_
+#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_UNRESOLVED_PROPERTY_H_
+#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_UNRESOLVED_PROPERTY_H_
#include "third_party/blink/renderer/core/css_property_names.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
@@ -21,6 +21,7 @@ class CSSUnresolvedProperty {
public:
CORE_EXPORT static const CSSUnresolvedProperty& Get(CSSPropertyID);
+ virtual bool IsEnabled() const { return true; }
virtual bool IsResolvedProperty() const { return false; }
virtual const char* GetPropertyName() const {
NOTREACHED();
@@ -30,6 +31,10 @@ class CSSUnresolvedProperty {
NOTREACHED();
return g_empty_atom;
}
+ virtual const WTF::String GetJSPropertyName() const {
+ NOTREACHED();
+ return g_empty_string;
+ }
WTF::String GetPropertyNameString() const {
// We share the StringImpl with the AtomicStrings.
return GetPropertyNameAtomicString().GetString();
@@ -49,4 +54,4 @@ class CSSUnresolvedProperty {
} // namespace blink
-#endif // BLINK_CORE_CSS_UNRESOLVED_PROPERTY_H_
+#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_UNRESOLVED_PROPERTY_H_
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 36b37a9be76..832acd8bd9f 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
@@ -40,49 +40,48 @@ state.Style()->{{property.setter}}
{{declare_value()}};
{% else %}
{# full implementation #}
- {% if not property.custom_apply_functions_initial %}
+ {% if not property.style_builder_template %}
+ {% if property.style_builder_generate_initial %}
{{declare_initial()}} {
- {% if property.svg %}
+ {% if property.svg %}
{{set_value(property)}}(SVGComputedStyle::{{property.initial}}());
- {% elif property.font %}
+ {% elif property.font %}
{{set_value(property)}}(FontBuilder::{{property.initial}}());
- {% else %}
+ {% else %}
{{set_value(property)}}(ComputedStyleInitialValues::{{property.initial}}());
- {% endif %}
- {% if property.independent %}
+ {% endif %}
+ {% if property.independent %}
state.Style()->{{property.is_inherited_setter}}(false);
- {% endif %}
+ {% endif %}
}
- {% endif %}
- {% if not property.custom_apply_functions_inherit %}
+ {% endif %}
+ {% if property.style_builder_generate_inherit %}
{{declare_inherit()}} {
- {% if property.svg %}
+ {% if property.svg %}
{{set_value(property)}}(state.ParentStyle()->SvgStyle().{{property.getter}}());
- {% elif property.font %}
+ {% elif property.font %}
{{set_value(property)}}(state.ParentFontDescription().{{property.getter}}());
- {% else %}
+ {% else %}
{{set_value(property)}}(state.ParentStyle()->{{property.getter}}());
- {% endif %}
- {% if property.independent %}
+ {% endif %}
+ {% if property.independent %}
state.Style()->{{property.is_inherited_setter}}(true);
- {% endif %}
+ {% endif %}
}
- {% endif %}
- {% if not property.custom_apply_functions_value %}
+ {% endif %}
+ {% if property.style_builder_generate_value %}
{{declare_value()}} {
{{convert_and_set_value(property)}}
- {% if property.independent %}
+ {% if property.independent %}
state.Style()->{{property.is_inherited_setter}}(false);
- {% endif %}
+ {% endif %}
}
- {% endif %}
- {% if property.custom_apply == "auto" %}
- {% set auto_getter = property.custom_apply_args['auto_getter'] or
+ {% 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.custom_apply_args['auto_setter'] or
+ {% set auto_setter = property.style_builder_template_args['auto_setter'] or
'SetHasAuto' + property.name_for_methods %}
- {% set auto_identity = property.custom_apply_args['auto_identity'] or
- 'CSSValueAuto' %}
{{declare_initial()}} {
state.Style()->{{auto_setter}}();
}
@@ -94,16 +93,16 @@ state.Style()->{{property.setter}}
}
{{declare_value()}} {
if (value.IsIdentifierValue() &&
- ToCSSIdentifierValue(value).GetValueID() == {{auto_identity}})
+ ToCSSIdentifierValue(value).GetValueID() == CSSValueAuto)
state.Style()->{{auto_setter}}();
else
{{convert_and_set_value(property)}}
}
- {% elif property.custom_apply == "border_image" %}
- {% set is_mask_box = property.custom_apply_args['is_mask_box'] %}
- {% set modifier_type = property.custom_apply_args['modifier_type'] %}
- {% set getter = property.custom_apply_args['getter'] %}
- {% set setter = property.custom_apply_args['setter'] %}
+ {% 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. #}
@@ -179,6 +178,30 @@ state.Style()->{{property.setter}}
{% endif %}
state.Style()->{{setter}}(image);
}
+ {% 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}}());
+ }
+
+ {{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}};
+ }
+
+ {{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));
+ }
{% endif %}
{%- endif %}
{%- endmacro %}
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 a03a22612ac..3b7324062b7 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
@@ -41,7 +41,7 @@ const StylePropertyShorthand& {{property.lower_camel_name}}Shorthand() {
static StylePropertyShorthand {{property.lower_camel_name}}Longhands(
{{property.property_id}},
{{property.lower_camel_name}}Properties,
- WTF_ARRAY_LENGTH({{property.lower_camel_name}}Properties));
+ arraysize({{property.lower_camel_name}}Properties));
return {{property.lower_camel_name}}Longhands;
}
{% endfor %}
@@ -53,7 +53,7 @@ const StylePropertyShorthand& offsetShorthandWithoutPositionAnchor() {
&GetCSSPropertyOffsetDistance(),
&GetCSSPropertyOffsetRotate(),
};
- DEFINE_STATIC_LOCAL(StylePropertyShorthand, offsetLonghands, (CSSPropertyOffset, offsetProperties, WTF_ARRAY_LENGTH(offsetProperties)));
+ DEFINE_STATIC_LOCAL(StylePropertyShorthand, offsetLonghands, (CSSPropertyOffset, offsetProperties, arraysize(offsetProperties)));
return offsetLonghands;
}
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/style/make_computed_style_initial_values.py b/chromium/third_party/blink/renderer/build/scripts/core/style/make_computed_style_initial_values.py
index 16d11732b93..c2627b20542 100755
--- a/chromium/third_party/blink/renderer/build/scripts/core/style/make_computed_style_initial_values.py
+++ b/chromium/third_party/blink/renderer/build/scripts/core/style/make_computed_style_initial_values.py
@@ -14,8 +14,8 @@ from core.css import css_properties
class ComputedStyleInitialValuesWriter(json5_generator.Writer):
- def __init__(self, json5_file_paths):
- super(ComputedStyleInitialValuesWriter, self).__init__([])
+ def __init__(self, json5_file_paths, output_dir):
+ super(ComputedStyleInitialValuesWriter, self).__init__([], output_dir)
json_properties = css_properties.CSSProperties(json5_file_paths)
diff --git a/chromium/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl
index 943a7d51d7a..a4d59972366 100644
--- a/chromium/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BLINK_CORE_STYLE_COMPUTED_STYLE_INITIAL_VALUES_H_
-#define BLINK_CORE_STYLE_COMPUTED_STYLE_INITIAL_VALUES_H_
+#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/style/computed_style_constants.h"
@@ -129,4 +129,4 @@ class ComputedStyleInitialValues{
} // namespace blink
-#endif // BLINK_CORE_STYLE_COMPUTED_STYLE_INITIAL_VALUES_H_
+#endif // THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_COMPUTED_STYLE_INITIAL_VALUES_H_
diff --git a/chromium/third_party/blink/renderer/build/scripts/gperf.py b/chromium/third_party/blink/renderer/build/scripts/gperf.py
index 770f867daf4..057796677c4 100644
--- a/chromium/third_party/blink/renderer/build/scripts/gperf.py
+++ b/chromium/third_party/blink/renderer/build/scripts/gperf.py
@@ -32,11 +32,11 @@ def generate_gperf(gperf_path, gperf_input, gperf_args):
# TODO(thakis): Upstream these to gperf so we don't need massaging.
# `register` is deprecated in C++11 and removed in C++17, so remove
# it from gperf's output.
- # https://savannah.gnu.org/bugs/index.php?53029
+ # https://savannah.gnu.org/bugs/index.php?53028
gperf_output = re.sub(r'\bregister ', '', gperf_output)
# -Wimplicit-fallthrough needs an explicit fallthrough statement,
# so replace gperf's /*FALLTHROUGH*/ comment with the statement.
- # https://savannah.gnu.org/bugs/index.php?53028
+ # https://savannah.gnu.org/bugs/index.php?53029
gperf_output = gperf_output.replace('/*FALLTHROUGH*/', ' FALLTHROUGH;')
script = 'third_party/WebKit/Source/build/scripts/gperf.py'
return '// Generated by %s\n' % script + gperf_output
diff --git a/chromium/third_party/blink/renderer/build/scripts/in_file_unittest.py b/chromium/third_party/blink/renderer/build/scripts/in_file_unittest.py
index 950efb03cc6..45229034717 100755
--- a/chromium/third_party/blink/renderer/build/scripts/in_file_unittest.py
+++ b/chromium/third_party/blink/renderer/build/scripts/in_file_unittest.py
@@ -42,7 +42,7 @@ name2
'arg': None,
'arg2': [],
}
- in_file = InFile(lines, defaults, None)
+ in_file = InFile(['test_basic_parse.in'], lines, defaults, None)
expected_values = [
{'name': 'name1', 'arg': 'value', 'arg2': ['value2', 'value3']},
{'name': 'name2', 'arg': None, 'arg2': []},
@@ -65,7 +65,8 @@ name2
'namespace': '',
'fruit': False,
}
- in_file = InFile(lines, defaults, default_parameters=default_parameters)
+ in_file = InFile(['test_with_parameters.in'], lines, defaults,
+ default_parameters=default_parameters)
expected_parameters = {
'namespace': 'TestNamespace',
'fruit': True,
diff --git a/chromium/third_party/blink/renderer/build/scripts/json5_generator.py b/chromium/third_party/blink/renderer/build/scripts/json5_generator.py
index c791bb4fef8..159936e246d 100644
--- a/chromium/third_party/blink/renderer/build/scripts/json5_generator.py
+++ b/chromium/third_party/blink/renderer/build/scripts/json5_generator.py
@@ -60,9 +60,7 @@ import os.path
import re
import sys
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..',
- 'third_party', 'blink', 'tools'))
-from blinkpy.common.name_style_converter import NameStyleConverter
+from blinkbuild.name_style_converter import NameStyleConverter
def _json5_load(lines):
@@ -162,6 +160,7 @@ class Json5File(object):
entry = copy.deepcopy(self._defaults)
if type(item) is not dict:
entry["name"] = item
+ entry["tokenized_name"] = NameStyleConverter(entry["name"])
return entry
if "name" not in item:
raise Exception("Missing name in item: %s" % item)
@@ -170,6 +169,7 @@ class Json5File(object):
return entry
assert "name" not in self.parameters, "The parameter 'name' is reserved, use a different name."
entry["name"] = item.pop("name")
+ entry["tokenized_name"] = NameStyleConverter(entry["name"])
# Validate parameters if it's specified.
for key, value in item.items():
if key not in self.parameters:
@@ -201,14 +201,18 @@ class Json5File(object):
raise Exception("Unknown value: '%s'\nValid values: %s, \
Please change your value to a valid value" % (value, valid_values))
+ def merge_from(self, doc):
+ self._process(doc)
+
class Writer(object):
# Subclasses should override.
class_name = None
default_metadata = None
default_parameters = None
+ snake_case_source_files = False
- def __init__(self, json5_files):
+ def __init__(self, json5_files, output_dir):
self._input_files = copy.copy(json5_files)
self._outputs = {} # file_name -> generator
self.gperf_path = None
@@ -216,6 +220,11 @@ class Writer(object):
self.json5_file = Json5File.load_from_files(json5_files,
self.default_metadata,
self.default_parameters)
+ match = re.search(r'\bgen[\\/]', output_dir)
+ if match:
+ self._relative_output_dir = output_dir[match.end():].replace(os.path.sep, '/') + '/'
+ else:
+ self._relative_output_dir = ''
def _write_file_if_changed(self, output_dir, contents, file_name):
path = os.path.join(output_dir, file_name)
@@ -245,6 +254,9 @@ class Writer(object):
# Use NameStyleConverter instead of name_utilities for consistency.
return NameStyleConverter(name).to_snake_case()
+ def make_header_guard(self, path):
+ return re.sub(r'[-/.]', '_', path).upper() + '_'
+
class Maker(object):
def __init__(self, writer_class):
@@ -263,6 +275,6 @@ class Maker(object):
if args.developer_dir:
os.environ["DEVELOPER_DIR"] = args.developer_dir
- writer = self._writer_class(args.files)
+ writer = self._writer_class(args.files, args.output_dir)
writer.set_gperf_path(args.gperf)
writer.write_files(args.output_dir)
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_computed_style_base.py b/chromium/third_party/blink/renderer/build/scripts/make_computed_style_base.py
index 6384357618c..fb38a038878 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_computed_style_base.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_computed_style_base.py
@@ -499,8 +499,8 @@ def _evaluate_rare_inherit_group(properties, properties_ranking,
class ComputedStyleBaseWriter(json5_generator.Writer):
- def __init__(self, json5_file_paths):
- super(ComputedStyleBaseWriter, self).__init__([])
+ def __init__(self, json5_file_paths, output_dir):
+ super(ComputedStyleBaseWriter, self).__init__([], output_dir)
self._input_files = json5_file_paths
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_css_primitive_value_unit_trie.py b/chromium/third_party/blink/renderer/build/scripts/make_css_primitive_value_unit_trie.py
index cf9d1f413a7..695ddb1b72e 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_css_primitive_value_unit_trie.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_css_primitive_value_unit_trie.py
@@ -11,8 +11,8 @@ import template_expander
class UnitTrieWriter(json5_generator.Writer):
- def __init__(self, json5_file_paths):
- super(UnitTrieWriter, self).__init__(json5_file_paths)
+ def __init__(self, json5_file_paths, output_dir):
+ super(UnitTrieWriter, self).__init__(json5_file_paths, output_dir)
self._units = {entry['name']: entry['unit_type'] for entry in self.json5_file.name_dictionaries}
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_css_property_names.py b/chromium/third_party/blink/renderer/build/scripts/make_css_property_names.py
index d6be31c2d33..4be0dd384ba 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_css_property_names.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_css_property_names.py
@@ -10,8 +10,8 @@ class CSSPropertyNamesWriter(json5_generator.Writer):
class_name = "CSSPropertyNames"
file_basename = "css_property_names"
- def __init__(self, json5_file_path):
- super(CSSPropertyNamesWriter, self).__init__(json5_file_path)
+ def __init__(self, json5_file_path, output_dir):
+ super(CSSPropertyNamesWriter, self).__init__(json5_file_path, output_dir)
self._outputs = {
(self.file_basename + ".h"): self.generate_header,
(self.file_basename + ".cc"): self.generate_implementation,
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_css_value_id_mappings.py b/chromium/third_party/blink/renderer/build/scripts/make_css_value_id_mappings.py
index b621d5d38d4..a5f95f554e4 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_css_value_id_mappings.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_css_value_id_mappings.py
@@ -97,8 +97,8 @@ def _find_enum_longest_continuous_segment(property_, name_to_position_dictionary
class CSSValueIDMappingsWriter(make_style_builder.StyleBuilderWriter):
- def __init__(self, json5_file_paths):
- super(CSSValueIDMappingsWriter, self).__init__(json5_file_paths)
+ def __init__(self, json5_file_paths, output_dir):
+ super(CSSValueIDMappingsWriter, self).__init__(json5_file_paths, output_dir)
self._outputs = {
'css_value_id_mappings_generated.h': self.generate_css_value_mappings,
}
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_element_factory.py b/chromium/third_party/blink/renderer/build/scripts/make_element_factory.py
index 09256525eaf..f4ce8d42286 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_element_factory.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_element_factory.py
@@ -54,8 +54,8 @@ class MakeElementFactoryWriter(MakeQualifiedNamesWriter):
})
filters = MakeQualifiedNamesWriter.filters
- def __init__(self, json5_file_paths):
- super(MakeElementFactoryWriter, self).__init__(json5_file_paths)
+ def __init__(self, json5_file_paths, output_dir):
+ super(MakeElementFactoryWriter, self).__init__(json5_file_paths, output_dir)
basename = self.namespace.lower() + '_element_factory'
self._outputs.update({
@@ -99,14 +99,10 @@ class MakeElementFactoryWriter(MakeQualifiedNamesWriter):
def _interface(self, tag):
if tag['interfaceName']:
return tag['interfaceName']
- name = name_utilities.upper_first(tag['name'])
+ name = tag['tokenized_name'].to_upper_camel_case()
# FIXME: We shouldn't hard-code HTML here.
if name == 'HTML':
name = 'Html'
- dash = name.find('-')
- while dash != -1:
- name = name[:dash] + name[dash + 1].upper() + name[dash + 2:]
- dash = name.find('-')
return '%s%sElement' % (self.namespace, name)
def _js_interface(self, tag):
@@ -120,7 +116,7 @@ class MakeElementFactoryWriter(MakeQualifiedNamesWriter):
def _interface_header_dir(self, tag):
if tag['interfaceHeaderDir']:
return tag['interfaceHeaderDir']
- return 'core/' + self.namespace.lower()
+ return 'third_party/blink/renderer/core/' + self.namespace.lower()
if __name__ == "__main__":
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_element_lookup_trie.py b/chromium/third_party/blink/renderer/build/scripts/make_element_lookup_trie.py
index c391a5e774e..24e96e73eb8 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_element_lookup_trie.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_element_lookup_trie.py
@@ -54,8 +54,8 @@ class ElementLookupTrieWriter(json5_generator.Writer):
'namespaceURI': '',
}
- def __init__(self, json5_file_paths):
- super(ElementLookupTrieWriter, self).__init__(json5_file_paths)
+ def __init__(self, json5_file_paths, output_dir):
+ super(ElementLookupTrieWriter, self).__init__(json5_file_paths, output_dir)
self._tags = {}
for entry in self.json5_file.name_dictionaries:
self._tags[entry['name']] = entry['name']
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_element_type_helpers.py b/chromium/third_party/blink/renderer/build/scripts/make_element_type_helpers.py
index 030f4a21298..dd44d9d56dd 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_element_type_helpers.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_element_type_helpers.py
@@ -42,8 +42,8 @@ class MakeElementTypeHelpersWriter(json5_generator.Writer):
'symbol': _symbol,
}
- def __init__(self, json5_file_path):
- super(MakeElementTypeHelpersWriter, self).__init__(json5_file_path)
+ def __init__(self, json5_file_path, output_dir):
+ super(MakeElementTypeHelpersWriter, self).__init__(json5_file_path, output_dir)
self.namespace = self.json5_file.metadata['namespace'].strip('"')
self.fallback_interface = self.json5_file.metadata['fallbackInterfaceName'].strip('"')
@@ -56,7 +56,8 @@ class MakeElementTypeHelpersWriter(json5_generator.Writer):
(basename + '.cc'): self.generate_helper_implementation,
}
- base_element_header = 'core/%s/%s_element.h' % (self.namespace.lower(), self.namespace.lower())
+ base_element_header = 'third_party/blink/renderer/core/' \
+ '{0}/{0}_element.h'.format(self.namespace.lower())
self._template_context = {
'base_element_header': base_element_header,
'input_files': self._input_files,
@@ -90,14 +91,10 @@ class MakeElementTypeHelpersWriter(json5_generator.Writer):
def _interface(self, tag):
if tag['interfaceName']:
return tag['interfaceName']
- name = name_utilities.upper_first(tag['name'])
+ name = tag['tokenized_name'].to_upper_camel_case()
# FIXME: We shouldn't hard-code HTML here.
if name == 'HTML':
name = 'Html'
- dash = name.find('-')
- while dash != -1:
- name = name[:dash] + name[dash + 1].upper() + name[dash + 2:]
- dash = name.find('-')
return '%s%sElement' % (self.namespace, name)
if __name__ == "__main__":
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_event_factory.py b/chromium/third_party/blink/renderer/build/scripts/make_event_factory.py
index 6322ceb479b..67e56f22e7e 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_event_factory.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_event_factory.py
@@ -100,15 +100,14 @@ class EventFactoryWriter(json5_generator.Writer):
}
filters = {
'cpp_name': name_utilities.cpp_name,
- 'lower_first': name_utilities.lower_first,
'script_name': name_utilities.script_name,
'create_event_whitelist': create_event_whitelist,
'create_event_measure_whitelist': create_event_measure_whitelist,
'measure_name': measure_name,
}
- def __init__(self, json5_file_path):
- super(EventFactoryWriter, self).__init__(json5_file_path)
+ def __init__(self, json5_file_path, output_dir):
+ super(EventFactoryWriter, self).__init__(json5_file_path, output_dir)
self.namespace = self.json5_file.metadata['namespace'].strip('"')
assert self.namespace == 'Event', 'namespace field should be "Event".'
self.suffix = self.json5_file.metadata['suffix'].strip('"')
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_html_entity_table.py b/chromium/third_party/blink/renderer/build/scripts/make_html_entity_table.py
new file mode 100755
index 00000000000..27a31985e5a
--- /dev/null
+++ b/chromium/third_party/blink/renderer/build/scripts/make_html_entity_table.py
@@ -0,0 +1,237 @@
+#!/usr/bin/env python
+# Copyright (c) 2010 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""This python script creates the raw data that is our entity
+database. The representation is one string database containing all
+strings we could need, and then a mapping from offset+length -> entity
+data. That is compact, easy to use and efficient."""
+
+import csv
+import os.path
+import sys
+
+ENTITY = 0
+VALUE = 1
+
+
+def convert_value_to_int(value):
+ if not value:
+ return "0"
+ assert value[0] == "U"
+ assert value[1] == "+"
+ return "0x" + value[2:]
+
+
+def offset_table_entry(offset):
+ return " &staticEntityTable[%s]," % offset
+
+
+def check_ascii(entity_string):
+ for ch in entity_string:
+ code = ord(ch)
+ assert 0 <= code <= 127, (ch + " is not ASCII. Need to change type " +
+ "of storage from LChar to UChar to support " +
+ "this entity.")
+
+
+def main():
+ program_name = os.path.basename(__file__)
+ if len(sys.argv) < 4 or sys.argv[1] != "-o":
+ # Python 3, change to: print("Usage: %s -o OUTPUT_FILE INPUT_FILE" % program_name, file=sys.stderr)
+ sys.stderr.write("Usage: %s -o OUTPUT_FILE INPUT_FILE\n" % program_name)
+ exit(1)
+
+ output_path = sys.argv[2]
+ input_path = sys.argv[3]
+
+ with open(input_path) as html_entity_names_file:
+ entries = list(csv.reader(html_entity_names_file))
+
+ entries.sort(key=lambda entry: entry[ENTITY])
+ entity_count = len(entries)
+
+ output_file = open(output_path, "w")
+
+ output_file.write("""/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// THIS FILE IS GENERATED BY build/scripts/make_html_entity_table.py.
+// DO NOT EDIT (unless you are a ninja)!
+
+#include "third_party/blink/renderer/core/html/parser/html_entity_table.h"
+
+namespace blink {
+
+namespace {
+""")
+
+ assert len(entries) > 0, "Code assumes a non-empty entity array."
+
+ output_file.write("static const LChar staticEntityStringStorage[] = {\n")
+ output_file.write("'")
+ all_data = ""
+ entity_offset = 0
+ first_output = True
+ for entry in entries:
+ check_ascii(entry[ENTITY])
+ # Reuse substrings from earlier entries. This saves 1-2000
+ # characters, but it's O(n^2) and not very smart. The optimal
+ # solution has to solve the "Shortest Common Superstring" problem
+ # and that is NP-Complete or worse.
+ #
+ # This would be even more efficient if we didn't store the
+ # semi-colon in the array but as a bit in the entry.
+ entity = entry[ENTITY]
+ already_existing_offset = all_data.find(entity)
+ if already_existing_offset != -1:
+ # Reusing space.
+ this_offset = already_existing_offset
+ else:
+ if not first_output:
+ output_file.write(",\n'")
+ first_output = False
+
+ # Try the end of the string and see if we can reuse that to
+ # fit the start of the new entity.
+ data_to_add = entity
+ this_offset = entity_offset
+ for truncated_len in range(len(entity) - 1, 0, -1):
+ if all_data.endswith(entity[:truncated_len]):
+ data_to_add = entity[truncated_len:]
+ this_offset = entity_offset - truncated_len
+ break
+
+ output_file.write("', '".join(data_to_add))
+ all_data += data_to_add
+ output_file.write("'")
+ entity_offset += len(data_to_add)
+ assert len(entry) == 2, "We will use slot [2] in the list for the offset."
+ assert this_offset < 32768 # Stored in a 16 bit short.
+ entry.append(this_offset)
+
+ output_file.write("};\n")
+
+ index = {}
+ for offset, entry in enumerate(entries):
+ starting_letter = entry[ENTITY][0]
+ if starting_letter not in index:
+ index[starting_letter] = offset
+
+ output_file.write("""
+static const HTMLEntityTableEntry staticEntityTable[%s] = {\n""" % entity_count)
+
+ for entry in entries:
+ values = entry[VALUE].split(' ')
+ assert len(values) <= 2, values
+ output_file.write(' { %s, %s, %s, %s }, // &%s\n' % (
+ convert_value_to_int(values[0]),
+ convert_value_to_int(values[1] if len(values) >= 2 else ""),
+ entry[2],
+ len(entry[ENTITY]),
+ entry[ENTITY],
+ ))
+
+ output_file.write("};\n\n")
+ output_file.write("\n}\n")
+
+ output_file.write("static const short uppercaseOffset[] = {\n")
+ for letter in range(ord('A'), ord('Z') + 1):
+ output_file.write("%d,\n" % index[chr(letter)])
+ output_file.write("%d\n" % index['a'])
+ output_file.write("};\n\nstatic const short lowercaseOffset[] = {\n")
+ for letter in range(ord('a'), ord('z') + 1):
+ output_file.write("%d,\n" % index[chr(letter)])
+ output_file.write("%d\n" % entity_count)
+ output_file.write("""};
+
+const LChar* HTMLEntityTable::EntityString(const HTMLEntityTableEntry& entry)
+{
+ return staticEntityStringStorage + entry.entity_offset;
+}
+
+LChar HTMLEntityTableEntry::LastCharacter() const
+{
+ return HTMLEntityTable::EntityString(*this)[length - 1];
+}
+
+const HTMLEntityTableEntry* HTMLEntityTable::FirstEntryStartingWith(UChar c)
+{
+ if (c >= 'A' && c <= 'Z')
+ return &staticEntityTable[uppercaseOffset[c - 'A']];
+ if (c >= 'a' && c <= 'z')
+ return &staticEntityTable[lowercaseOffset[c - 'a']];
+ return 0;
+}
+
+const HTMLEntityTableEntry* HTMLEntityTable::LastEntryStartingWith(UChar c)
+{
+ if (c >= 'A' && c <= 'Z')
+ return &staticEntityTable[uppercaseOffset[c - 'A' + 1]] - 1;
+ if (c >= 'a' && c <= 'z')
+ return &staticEntityTable[lowercaseOffset[c - 'a' + 1]] - 1;
+ return 0;
+}
+
+const HTMLEntityTableEntry* HTMLEntityTable::FirstEntry()
+{
+ return &staticEntityTable[0];
+}
+
+const HTMLEntityTableEntry* HTMLEntityTable::LastEntry()
+{
+ return &staticEntityTable[%s - 1];
+}
+
+}
+""" % entity_count)
+
+if __name__ == "__main__":
+ main()
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_instrumenting_probes.py b/chromium/third_party/blink/renderer/build/scripts/make_instrumenting_probes.py
index aa345ad3566..e89f3b33860 100644
--- a/chromium/third_party/blink/renderer/build/scripts/make_instrumenting_probes.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_instrumenting_probes.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import ast
+from functools import partial
import optparse
import os.path
import re
@@ -16,16 +17,18 @@ import sys
# If paths differ between pre-caching and individual file compilation, the cache
# is regenerated, which causes a race condition and breaks concurrent build,
# since some compile processes will try to read the partially written cache.
-module_path, module_filename = os.path.split(os.path.realpath(__file__))
-third_party_dir = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir, os.pardir, os.pardir))
+_MODULE_PATH, _ = os.path.split(os.path.realpath(__file__))
+_THIRD_PARTY_DIR = os.path.normpath(os.path.join(_MODULE_PATH, os.pardir, os.pardir, os.pardir, os.pardir))
# jinja2 is in chromium's third_party directory.
# Insert at 1 so at front to override system libraries, and
# after path[0] == invoking script dir
-sys.path.insert(1, third_party_dir)
+sys.path.insert(1, _THIRD_PARTY_DIR)
import jinja2
+from blinkbuild.name_style_converter import NameStyleConverter
from name_utilities import method_name
+
def _json5_loads(lines):
# Use json5.loads when json5 is available. Currently we use simple
# regexs to convert well-formed JSON5 to PYL format.
@@ -48,22 +51,22 @@ def to_lower_case(name):
return name[:1].lower() + name[1:]
-def agent_config(agent_name, field):
+def agent_config(config, agent_name, field):
return config["observers"].get(agent_name, {}).get(field)
-def agent_name_to_class(agent_name):
- return agent_config(agent_name, "class") or "Inspector%sAgent" % agent_name
-
+def agent_name_to_class(config, agent_name):
+ return agent_config(config, agent_name, "class") or agent_name
-def agent_name_to_include(agent_name):
- include_path = agent_config(agent_name, "include_path") or config["settings"]["include_path"]
- return os.path.join(include_path, agent_name_to_class(agent_name) + ".h")
+def agent_name_to_include(config, agent_name):
+ include_path = agent_config(config, agent_name, "include_path") or config["settings"]["include_path"]
+ agent_class = agent_name_to_class(config, agent_name)
+ return os.path.join(include_path, NameStyleConverter(agent_class).to_snake_case() + ".h")
-def initialize_jinja_env(cache_dir):
+def initialize_jinja_env(config, cache_dir):
jinja_env = jinja2.Environment(
- loader=jinja2.FileSystemLoader(os.path.join(module_path, "templates")),
+ loader=jinja2.FileSystemLoader(os.path.join(_MODULE_PATH, "templates")),
# Bytecode cache is not concurrency-safe unless pre-cached:
# if pre-cached this is read-only, but writing creates a race condition.
bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir),
@@ -73,8 +76,8 @@ def initialize_jinja_env(cache_dir):
jinja_env.filters.update({
"to_lower_case": to_lower_case,
"to_singular": to_singular,
- "agent_name_to_class": agent_name_to_class,
- "agent_name_to_include": agent_name_to_include})
+ "agent_name_to_class": partial(agent_name_to_class, config),
+ "agent_name_to_include": partial(agent_name_to_include, config)})
jinja_env.add_extension('jinja2.ext.loopcontrols')
return jinja_env
@@ -176,7 +179,7 @@ def load_config(file_name):
return _json5_loads(config_file.read()) or default_config
-def build_observers():
+def build_observers(config, files):
all_pidl_probes = set()
for f in files:
probes = set([probe.name for probe in f.declarations])
@@ -204,62 +207,73 @@ def build_observers():
return all_observers
-cmdline_parser = optparse.OptionParser()
-cmdline_parser.add_option("--output_dir")
-cmdline_parser.add_option("--config")
-
-try:
- arg_options, arg_values = cmdline_parser.parse_args()
- if len(arg_values) != 1:
- raise Exception("Exactly one plain argument expected (found %s)" % len(arg_values))
- input_path = arg_values[0]
- output_dirpath = arg_options.output_dir
- if not output_dirpath:
- raise Exception("Output directory must be specified")
- config_file_name = arg_options.config
-except Exception:
- # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html
- exc = sys.exc_info()[1]
- sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc)
- sys.stderr.write("Usage: <script> [options] <probes.pidl>\n")
- sys.stderr.write("Options:\n")
- sys.stderr.write("\t--config <config_file.json5>\n")
- sys.stderr.write("\t--output_dir <output_dir>\n")
- exit(1)
-
-config = load_config(config_file_name)
-jinja_env = initialize_jinja_env(output_dirpath)
-base_name = os.path.splitext(os.path.basename(input_path))[0]
-
-fin = open(input_path, "r")
-files = load_model_from_idl(fin.read())
-fin.close()
-
-template_context = {
- "files": files,
- "agents": build_observers(),
- "config": config,
- "method_name": method_name,
- "name": base_name,
- "input_files": [os.path.basename(input_path)]
-}
-
-template_context["template_file"] = "/InstrumentingProbesImpl.cpp.tmpl"
-cpp_template = jinja_env.get_template(template_context["template_file"])
-cpp_file = open(output_dirpath + "/" + base_name + "Impl.cpp", "w")
-cpp_file.write(cpp_template.render(template_context))
-cpp_file.close()
-
-template_context["template_file"] = "/ProbeSink.h.tmpl"
-sink_h_template = jinja_env.get_template(template_context["template_file"])
-sink_h_file = open(output_dirpath + "/" + to_singular(base_name) + "Sink.h", "w")
-sink_h_file.write(sink_h_template.render(template_context))
-sink_h_file.close()
-
-for f in files:
- template_context["file"] = f
- template_context["template_file"] = "/InstrumentingProbesInl.h.tmpl"
- h_template = jinja_env.get_template(template_context["template_file"])
- h_file = open(output_dirpath + "/" + f.header_name + ".h", "w")
- h_file.write(h_template.render(template_context))
- h_file.close()
+def main():
+ cmdline_parser = optparse.OptionParser()
+ cmdline_parser.add_option("--output_dir")
+ cmdline_parser.add_option("--config")
+
+ try:
+ arg_options, arg_values = cmdline_parser.parse_args()
+ if len(arg_values) != 1:
+ raise ValueError("Exactly one plain argument expected (found %s)" % len(arg_values))
+ input_path = arg_values[0]
+ output_dirpath = arg_options.output_dir
+ if not output_dirpath:
+ raise ValueError("Output directory must be specified")
+ config_file_name = arg_options.config
+ except ValueError:
+ # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html
+ exc = sys.exc_info()[1]
+ sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc)
+ sys.stderr.write("Usage: <script> [options] <probes.pidl>\n")
+ sys.stderr.write("Options:\n")
+ sys.stderr.write("\t--config <config_file.json5>\n")
+ sys.stderr.write("\t--output_dir <output_dir>\n")
+ exit(1)
+
+ match = re.search(r"\bgen[\\/]", output_dirpath)
+ if match:
+ output_path_in_gen_dir = output_dirpath[match.end():].replace(os.path.sep, '/') + '/'
+ else:
+ output_path_in_gen_dir = ''
+
+ config = load_config(config_file_name)
+ jinja_env = initialize_jinja_env(config, output_dirpath)
+ base_name = os.path.splitext(os.path.basename(input_path))[0]
+
+ fin = open(input_path, "r")
+ files = load_model_from_idl(fin.read())
+ fin.close()
+
+ template_context = {
+ "files": files,
+ "agents": build_observers(config, files),
+ "config": config,
+ "method_name": method_name,
+ "name": base_name,
+ "input_files": [os.path.basename(input_path)],
+ "output_path_in_gen_dir": output_path_in_gen_dir
+ }
+
+ template_context["template_file"] = "/InstrumentingProbesImpl.cpp.tmpl"
+ cpp_template = jinja_env.get_template(template_context["template_file"])
+ cpp_file = open(output_dirpath + "/" + base_name + "Impl.cpp", "w")
+ cpp_file.write(cpp_template.render(template_context))
+ cpp_file.close()
+
+ template_context["template_file"] = "/ProbeSink.h.tmpl"
+ sink_h_template = jinja_env.get_template(template_context["template_file"])
+ sink_h_file = open(output_dirpath + "/" + to_singular(base_name) + "Sink.h", "w")
+ sink_h_file.write(sink_h_template.render(template_context))
+ sink_h_file.close()
+
+ for f in files:
+ template_context["file"] = f
+ template_context["template_file"] = "/InstrumentingProbesInl.h.tmpl"
+ h_template = jinja_env.get_template(template_context["template_file"])
+ h_file = open(output_dirpath + "/" + f.header_name + ".h", "w")
+ h_file.write(h_template.render(template_context))
+ h_file.close()
+
+if __name__ == "__main__":
+ main()
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_internal_runtime_flags.py b/chromium/third_party/blink/renderer/build/scripts/make_internal_runtime_flags.py
index 7225397e5d5..d8e2fa99bfc 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_internal_runtime_flags.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_internal_runtime_flags.py
@@ -40,8 +40,8 @@ import template_expander
# but generate different files.
class InternalRuntimeFlagsWriter(make_runtime_features.RuntimeFeatureWriter):
- def __init__(self, json5_file_path):
- super(InternalRuntimeFlagsWriter, self).__init__(json5_file_path)
+ def __init__(self, json5_file_path, output_dir):
+ super(InternalRuntimeFlagsWriter, self).__init__(json5_file_path, output_dir)
self._outputs = {
'internal_runtime_flags.idl': self.generate_idl,
'internal_runtime_flags.h': self.generate_header,
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_internal_settings.py b/chromium/third_party/blink/renderer/build/scripts/make_internal_settings.py
index 5f34f3c1d4b..e1e59b87677 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_internal_settings.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_internal_settings.py
@@ -37,13 +37,12 @@ from make_settings import to_passing_type, to_idl_type
class MakeInternalSettingsWriter(json5_generator.Writer):
filters = {
- 'upper_first': name_utilities.upper_first,
'to_passing_type': to_passing_type,
'to_idl_type': to_idl_type,
}
- def __init__(self, json5_file_path):
- super(MakeInternalSettingsWriter, self).__init__(json5_file_path)
+ def __init__(self, json5_file_path, output_dir):
+ super(MakeInternalSettingsWriter, self).__init__(json5_file_path, output_dir)
self.json5_file.name_dictionaries.sort(key=lambda entry: entry['name'])
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_names.py b/chromium/third_party/blink/renderer/build/scripts/make_names.py
index cd35d27671f..305fb77b990 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_names.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_names.py
@@ -64,8 +64,8 @@ class MakeNamesWriter(json5_generator.Writer):
'to_macro_style': name_utilities.to_macro_style,
}
- def __init__(self, json5_file_path):
- super(MakeNamesWriter, self).__init__(json5_file_path)
+ def __init__(self, json5_file_path, output_dir):
+ super(MakeNamesWriter, self).__init__(json5_file_path, output_dir)
namespace = self.json5_file.metadata['namespace'].strip('"')
suffix = self.json5_file.metadata['suffix'].strip('"')
@@ -78,13 +78,15 @@ class MakeNamesWriter(json5_generator.Writer):
(basename + '.h'): self.generate_header,
(basename + '.cc'): self.generate_implementation,
}
+ qualified_header = self._relative_output_dir + basename + '.h'
self._template_context = {
'namespace': namespace,
'suffix': suffix,
'export': export,
'entries': self.json5_file.name_dictionaries,
+ 'header_guard': self.make_header_guard(qualified_header),
'input_files': self._input_files,
- 'this_include_header_name': basename + '.h',
+ 'this_include_path': qualified_header,
}
@template_expander.use_jinja("templates/make_names.h.tmpl", filters=filters)
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_origin_trials.py b/chromium/third_party/blink/renderer/build/scripts/make_origin_trials.py
index b6e1bcdb117..06c6e0ccc69 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_origin_trials.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_origin_trials.py
@@ -40,8 +40,8 @@ import template_expander
class OriginTrialsWriter(make_runtime_features.RuntimeFeatureWriter):
file_basename = 'origin_trials'
- def __init__(self, json5_file_path):
- super(OriginTrialsWriter, self).__init__(json5_file_path)
+ def __init__(self, json5_file_path, output_dir):
+ super(OriginTrialsWriter, self).__init__(json5_file_path, output_dir)
self._outputs = {
(self.file_basename + '.cc'): self.generate_implementation,
(self.file_basename + '.h'): self.generate_header,
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_qualified_names.py b/chromium/third_party/blink/renderer/build/scripts/make_qualified_names.py
index fe84169fdd9..1bb9d4eaf14 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_qualified_names.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_qualified_names.py
@@ -35,6 +35,7 @@ import json5_generator
import name_utilities
import template_expander
+from aria_properties import ARIAReader
from json5_generator import Json5File
@@ -57,19 +58,33 @@ class MakeQualifiedNamesWriter(json5_generator.Writer):
'to_macro_style': name_utilities.to_macro_style,
}
- def __init__(self, json5_file_paths):
- super(MakeQualifiedNamesWriter, self).__init__(None)
+ def __init__(self, json5_file_paths, output_dir):
+ super(MakeQualifiedNamesWriter, self).__init__(None, output_dir)
self._input_files = copy.copy(json5_file_paths)
- assert len(json5_file_paths) <= 2, 'MakeQualifiedNamesWriter requires at most 2 in files, got %d.' % len(json5_file_paths)
+ assert len(json5_file_paths) <= 3, 'MakeQualifiedNamesWriter requires at most 3 in files, got %d.' % len(json5_file_paths)
- if len(json5_file_paths) == 2:
- self.tags_json5_file = Json5File.load_from_files(
- [json5_file_paths.pop(0)], self.default_metadata, self.default_parameters)
+ # Input files are in a strict order with more optional files *first*:
+ # 1) ARIA properties
+ # 2) Tags
+ # 3) Attributes
+
+ if len(json5_file_paths) >= 3:
+ aria_json5_filename = json5_file_paths.pop(0)
+ self.aria_reader = ARIAReader(aria_json5_filename)
+ else:
+ self.aria_reader = None
+
+ if len(json5_file_paths) >= 2:
+ tags_json5_filename = json5_file_paths.pop(0)
+ self.tags_json5_file = Json5File.load_from_files([tags_json5_filename], self.default_metadata, self.default_parameters)
else:
self.tags_json5_file = None
self.attrs_json5_file = Json5File.load_from_files([json5_file_paths.pop()], self.default_metadata, self.default_parameters)
+ if self.aria_reader is not None:
+ self.attrs_json5_file.merge_from(self.aria_reader.attributes_list())
+
self.namespace = self._metadata('namespace')
namespace_prefix = self._metadata('namespacePrefix') or self.namespace.lower()
@@ -81,14 +96,17 @@ class MakeQualifiedNamesWriter(json5_generator.Writer):
(self.namespace.lower() + "_names.h"): self.generate_header,
(self.namespace.lower() + "_names.cc"): self.generate_implementation,
}
+ qualified_header = self._relative_output_dir + self.namespace.lower() + '_names.h'
self._template_context = {
'attrs': self.attrs_json5_file.name_dictionaries,
'export': self._metadata('export'),
+ 'header_guard': self.make_header_guard(qualified_header),
'input_files': self._input_files,
'namespace': self.namespace,
'namespace_prefix': namespace_prefix,
'namespace_uri': namespace_uri,
'tags': self.tags_json5_file.name_dictionaries if self.tags_json5_file else [],
+ 'this_include_path': qualified_header,
'use_namespace_for_attrs': use_namespace_for_attrs,
}
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py b/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py
index c0742151631..9627fde37eb 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py
@@ -29,10 +29,10 @@
import sys
+from blinkbuild.name_style_converter import NameStyleConverter
import json5_generator
import name_utilities
from name_utilities import class_member_name
-from name_utilities import lower_first
import template_expander
@@ -40,8 +40,8 @@ class RuntimeFeatureWriter(json5_generator.Writer):
class_name = 'RuntimeEnabledFeatures'
file_basename = 'runtime_enabled_features'
- def __init__(self, json5_file_path):
- super(RuntimeFeatureWriter, self).__init__(json5_file_path)
+ def __init__(self, json5_file_path, output_dir):
+ super(RuntimeFeatureWriter, self).__init__(json5_file_path, output_dir)
self._outputs = {(self.file_basename + '.h'): self.generate_header,
(self.file_basename + '.cc'): self.generate_implementation,
}
@@ -49,7 +49,6 @@ class RuntimeFeatureWriter(json5_generator.Writer):
self._features = self.json5_file.name_dictionaries
# Make sure the resulting dictionaries have all the keys we expect.
for feature in self._features:
- feature['first_lowered_name'] = lower_first(feature['name'])
feature['class_member_name'] = class_member_name(feature['name'])
# Most features just check their isFooEnabled bool
# but some depend on or are implied by other bools.
@@ -90,8 +89,8 @@ class RuntimeFeatureTestHelpersWriter(json5_generator.Writer):
class_name = 'ScopedRuntimeEnabledFeatureForTest'
file_basename = 'runtime_enabled_features_test_helpers'
- def __init__(self, json5_file_path):
- super(RuntimeFeatureTestHelpersWriter, self).__init__(json5_file_path)
+ def __init__(self, json5_file_path, output_dir):
+ super(RuntimeFeatureTestHelpersWriter, self).__init__(json5_file_path, output_dir)
self._outputs = {('testing/' + self.file_basename + '.h'): self.generate_header}
self._features = self.json5_file.name_dictionaries
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_settings.py b/chromium/third_party/blink/renderer/build/scripts/make_settings.py
index 8c73c68e2c1..269d105edf8 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_settings.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_settings.py
@@ -58,13 +58,12 @@ def to_idl_type(typename):
class MakeSettingsWriter(json5_generator.Writer):
filters = {
'cpp_bool': name_utilities.cpp_bool,
- 'upper_first': name_utilities.upper_first,
'to_passing_type': to_passing_type,
'to_idl_type': to_idl_type,
}
- def __init__(self, json5_file_path):
- super(MakeSettingsWriter, self).__init__(json5_file_path)
+ def __init__(self, json5_file_path, output_dir):
+ super(MakeSettingsWriter, self).__init__(json5_file_path, output_dir)
self.json5_file.name_dictionaries.sort(key=lambda entry: entry['name'])
diff --git a/chromium/third_party/blink/renderer/build/scripts/make_style_builder.py b/chromium/third_party/blink/renderer/build/scripts/make_style_builder.py
index b4d9793f80e..6be87079705 100755
--- a/chromium/third_party/blink/renderer/build/scripts/make_style_builder.py
+++ b/chromium/third_party/blink/renderer/build/scripts/make_style_builder.py
@@ -32,7 +32,6 @@ import types
from core.css import css_properties
import json5_generator
-from name_utilities import lower_first
import template_expander
@@ -44,30 +43,13 @@ def calculate_apply_functions_to_declare(property_):
and property_['is_property']
property_['use_property_class_in_stylebuilder'] = \
property_['should_declare_functions'] \
- and not (property_['custom_apply_functions_initial'] or
- property_['custom_apply_functions_inherit'] or
- property_['custom_apply_functions_value'])
- # TODO(crbug.com/751354): Remove this hard coded list of supported
- # properties once all of them have been implemented
- if property_['custom_apply_functions_all']:
- if (property_['upper_camel_name'] in [
- 'BackgroundAttachment', 'BackgroundBlendMode', 'BackgroundClip', 'BackgroundImage', 'BackgroundOrigin',
- 'BackgroundPositionX', 'BackgroundPositionY', 'BackgroundRepeatX', 'BackgroundRepeatY', 'BackgroundSize',
- 'BorderImageOutset', 'BorderImageRepeat', 'BorderImageSlice', 'BorderImageWidth', 'Clip', 'ColumnCount',
- 'ColumnWidth', 'MaskSourceType', 'WebkitMaskBoxImageOutset', 'WebkitMaskBoxImageRepeat',
- 'WebkitMaskBoxImageSlice', 'WebkitMaskBoxImageWidth', 'WebkitMaskClip', 'WebkitMaskComposite', 'WebkitMaskImage',
- 'WebkitMaskOrigin', 'WebkitMaskPositionX', 'WebkitMaskPositionY', 'WebkitMaskRepeatX', 'WebkitMaskRepeatY',
- 'WebkitMaskSize', 'ZIndex']):
- property_['use_property_class_in_stylebuilder'] = True
+ and not property_['style_builder_legacy']
class StyleBuilderWriter(json5_generator.Writer):
- filters = {
- 'lower_first': lower_first,
- }
- def __init__(self, json5_file_paths):
- super(StyleBuilderWriter, self).__init__([])
+ def __init__(self, json5_file_paths, output_dir):
+ super(StyleBuilderWriter, self).__init__([], output_dir)
self._outputs = {
'style_builder_functions.h': self.generate_style_builder_functions_h,
'style_builder_functions.cc':
@@ -86,16 +68,14 @@ class StyleBuilderWriter(json5_generator.Writer):
def css_properties(self):
return self._json5_properties
- @template_expander.use_jinja('templates/style_builder_functions.h.tmpl',
- filters=filters)
+ @template_expander.use_jinja('templates/style_builder_functions.h.tmpl')
def generate_style_builder_functions_h(self):
return {
'input_files': self._input_files,
'properties': self._properties,
}
- @template_expander.use_jinja('templates/style_builder_functions.cc.tmpl',
- filters=filters)
+ @template_expander.use_jinja('templates/style_builder_functions.cc.tmpl')
def generate_style_builder_functions_cpp(self):
return {
'input_files': self._input_files,
@@ -103,8 +83,7 @@ class StyleBuilderWriter(json5_generator.Writer):
'properties_by_id': self._json5_properties.properties_by_id,
}
- @template_expander.use_jinja(
- 'templates/style_builder.cc.tmpl', filters=filters)
+ @template_expander.use_jinja('templates/style_builder.cc.tmpl')
def generate_style_builder(self):
return {
'input_files': self._input_files,
diff --git a/chromium/third_party/blink/renderer/build/scripts/name_utilities.py b/chromium/third_party/blink/renderer/build/scripts/name_utilities.py
index 1b13b0e5d20..637ba53ed59 100644
--- a/chromium/third_party/blink/renderer/build/scripts/name_utilities.py
+++ b/chromium/third_party/blink/renderer/build/scripts/name_utilities.py
@@ -29,67 +29,7 @@
import os.path
import re
-
-# Acronyms are kept as all caps.
-ACRONYMS = [
- '2D',
- '2G',
- '3D',
- '3G',
- 'API',
- 'CORS',
- 'CSP',
- 'CSS',
- 'CSSOM',
- 'DNS',
- 'DOM',
- 'FE',
- 'FTP',
- 'GL',
- 'HTML',
- 'IDB',
- 'IFrame',
- 'JS',
- 'NFC',
- 'NG',
- 'OM',
- 'RFC',
- 'RTCRtp',
- 'SMIL',
- 'SVG',
- 'UI',
- 'URL',
- 'USB',
- 'VR',
- 'VTT',
- 'WOFF',
- 'XML',
- 'XSLT',
- 'XSS',
- 'YUV',
-]
-
-
-def lower_first(name):
- """Return name with first letter or initial acronym lowercased.
-
- E.g., 'SetURL' becomes 'setURL', but 'URLFoo' becomes 'urlFoo'.
- """
- for acronym in ACRONYMS:
- if name.startswith(acronym):
- return name.replace(acronym, acronym.lower(), 1)
- return name[0].lower() + name[1:]
-
-
-def upper_first(name):
- """Return name with first letter or initial acronym uppercased.
- The acronym must have a capital letter following it to be considered.
- """
- for acronym in ACRONYMS:
- if name.startswith(acronym.lower()):
- if len(name) == len(acronym) or name[len(acronym)].isupper():
- return name.replace(acronym.lower(), acronym, 1)
- return upper_first_letter(name)
+from blinkbuild.name_style_converter import tokenize_name
def lower_first_letter(name):
@@ -146,17 +86,11 @@ def enum_for_css_property_alias(property_name):
# API below instead.
-def split_name(name):
- """Splits a name in some format to a list of words"""
- return re.findall('|'.join(ACRONYMS) + r'|(?:[A-Z][a-z]*)|[a-z]+|(?:\d+[a-z]*)',
- upper_first_letter(name))
-
-
def join_names(*names):
"""Given a list of names, join them into a single space-separated name."""
result = []
for name in names:
- result.extend(split_name(name))
+ result.extend(tokenize_name(name))
return ' '.join(result)
@@ -170,7 +104,8 @@ def naming_style(f):
names = name_or_names if isinstance(name_or_names, list) else [name_or_names]
words = []
for name in names:
- words.extend(split_name(name))
+ if name:
+ words.extend(tokenize_name(name))
return f(words)
return inner
diff --git a/chromium/third_party/blink/renderer/build/scripts/scripts.gni b/chromium/third_party/blink/renderer/build/scripts/scripts.gni
index d5fd015277a..ae0ace19a74 100644
--- a/chromium/third_party/blink/renderer/build/scripts/scripts.gni
+++ b/chromium/third_party/blink/renderer/build/scripts/scripts.gni
@@ -14,6 +14,7 @@ scripts_for_json5_files = [
# dependency for whole jinja2 package
"//third_party/jinja2/__init__.py",
"//third_party/markupsafe/__init__.py", # jinja2 dep
+ "$_scripts_dir/blinkbuild/name_style_converter.py",
"$_scripts_dir/hasher.py",
"$_scripts_dir/json5_generator.py",
"$_scripts_dir/license.py",
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/InstrumentingProbesImpl.cpp.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/InstrumentingProbesImpl.cpp.tmpl
index 6442159918c..cbe935a4531 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/InstrumentingProbesImpl.cpp.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/InstrumentingProbesImpl.cpp.tmpl
@@ -5,16 +5,15 @@
{% from 'macros.tmpl' import source_files_for_generated_file %}
{{source_files_for_generated_file(template_file, input_files)}}
-#include "third_party/blink/renderer/platform/wtf/threading_primitives.h"
-
{% set sink_class = (name | to_singular) + "Sink" %}
{% for file in files %}
-#include "{{file.name}}Inl.h"
+#include "{{output_path_in_gen_dir}}{{file.name}}Inl.h"
{% endfor %}
-#include "{{sink_class}}.h"
+#include "{{output_path_in_gen_dir}}{{sink_class}}.h"
{% for agent in agents %}
#include "{{agent | agent_name_to_include}}"
{% endfor %}
+#include "third_party/blink/renderer/platform/wtf/threading_primitives.h"
namespace blink {
@@ -35,46 +34,45 @@ std::atomic<unsigned> {{sink_class}}::s_existingAgents;
{{sink_class}}::~{{sink_class}}() {
MutexLocker lock(AgentCountMutex());
{% for agent in agents %}
-{% set class_name = agent | agent_name_to_class %}
- if (has{{class_name}}s() && --s_numSinksWith{{class_name}} == 0)
- s_existingAgents &= ~k{{class_name}};
+ if (has{{agent}}s() && --s_numSinksWith{{agent}} == 0)
+ s_existingAgents &= ~k{{agent}};
{% endfor %}
}
{% for agent in agents %}
{% set class_name = agent | agent_name_to_class %}
-{% set getter_name = class_name | to_lower_case %}
+{% set getter_name = agent | to_lower_case %}
// static
-unsigned {{sink_class}}::s_numSinksWith{{class_name}} = 0;
+unsigned {{sink_class}}::s_numSinksWith{{agent}} = 0;
-void {{sink_class}}::add{{class_name}}({{class_name}}* agent) {
- bool already_had_agent = has{{class_name}}s();
+void {{sink_class}}::add{{agent}}({{class_name}}* agent) {
+ bool already_had_agent = has{{agent}}s();
m_{{getter_name}}s.insert(agent);
if (!already_had_agent) {
MutexLocker lock(AgentCountMutex());
- if (++s_numSinksWith{{class_name}} == 1)
- s_existingAgents |= k{{class_name}};
+ if (++s_numSinksWith{{agent}} == 1)
+ s_existingAgents |= k{{agent}};
}
- DCHECK(HasAgentsGlobal(k{{class_name}}));
+ DCHECK(HasAgentsGlobal(k{{agent}}));
}
-void {{sink_class}}::remove{{class_name}}({{class_name}}* agent) {
- if (!has{{class_name}}s())
+void {{sink_class}}::remove{{agent}}({{class_name}}* agent) {
+ if (!has{{agent}}s())
return;
m_{{getter_name}}s.erase(agent);
- if (!has{{class_name}}s()) {
+ if (!has{{agent}}s()) {
MutexLocker lock(AgentCountMutex());
- if (--s_numSinksWith{{class_name}} == 0)
- s_existingAgents &= ~k{{class_name}};
+ if (--s_numSinksWith{{agent}} == 0)
+ s_existingAgents &= ~k{{agent}};
}
- if (has{{class_name}}s())
- DCHECK(HasAgentsGlobal(k{{class_name}}));
+ if (has{{agent}}s())
+ DCHECK(HasAgentsGlobal(k{{agent}}));
}
{% endfor -%}
@@ -82,7 +80,7 @@ void {{sink_class}}::remove{{class_name}}({{class_name}}* agent) {
void {{sink_class}}::Trace(Visitor* visitor)
{
{% for agent in agents %}
-{% set getter_name = agent | agent_name_to_class | to_lower_case %}
+{% set getter_name = agent | to_lower_case %}
visitor->Trace(m_{{getter_name}}s);
{% endfor %}
}
@@ -101,8 +99,8 @@ namespace probe {
return;
{% for agent in probe.agents %}
{% set class_name = agent | agent_name_to_class %}
- if (probe_sink->has{{class_name}}s()) {
- for ({{class_name}}* agent : probe_sink->{{ class_name | to_lower_case }}s())
+ if (probe_sink->has{{agent}}s()) {
+ for ({{class_name}}* agent : probe_sink->{{ agent | to_lower_case }}s())
agent->{{agent_probe_name}}({{caller()}});
}
{% endfor %}
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/InstrumentingProbesInl.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/InstrumentingProbesInl.h.tmpl
index bfd640f5ae8..1fa858b634c 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/InstrumentingProbesInl.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/InstrumentingProbesInl.h.tmpl
@@ -62,7 +62,7 @@ inline void {{probe.name}}({{params_list(probe)}}) {
if (!{{sink_class}}::HasAgentsGlobal(
{%- for agent in probe.agents %}
{% if not loop.first %} | {% endif -%}
- {{sink_class}}::k{{agent | agent_name_to_class}}
+ {{sink_class}}::k{{agent}}
{%- endfor %}))
return;
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/ProbeSink.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/ProbeSink.h.tmpl
index 61f72483d19..37c94f69606 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/ProbeSink.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/ProbeSink.h.tmpl
@@ -28,7 +28,7 @@ class {{export_symbol}} {{sink_class}} : public GarbageCollectedFinalized<{{sink
public:
enum AgentType : unsigned {
{% for agent in agents %}
- k{{agent | agent_name_to_class }} = 1u << {{loop.index0}},
+ k{{agent}} = 1u << {{loop.index0}},
{% endfor %}
};
@@ -41,11 +41,11 @@ class {{export_symbol}} {{sink_class}} : public GarbageCollectedFinalized<{{sink
{% for agent in agents %}
{% set class_name = agent | agent_name_to_class %}
-{% set getter_name = class_name | to_lower_case %}
- bool has{{class_name}}s() const { return !m_{{getter_name}}s.IsEmpty(); }
+{% set getter_name = agent | to_lower_case %}
+ bool has{{agent}}s() const { return !m_{{getter_name}}s.IsEmpty(); }
const HeapListHashSet<Member<{{class_name}}>>& {{getter_name}}s() const { return m_{{getter_name}}s; }
- void add{{class_name}}({{class_name}}* agent);
- void remove{{class_name}}({{class_name}}* agent);
+ void add{{agent}}({{class_name}}* agent);
+ void remove{{agent}}({{class_name}}* agent);
{% endfor %}
// Queries process-wide. Intended for fast-return cases only.
@@ -56,7 +56,7 @@ class {{export_symbol}} {{sink_class}} : public GarbageCollectedFinalized<{{sink
private:
{% for agent in agents %}
{% set class_name = agent | agent_name_to_class %}
-{% set getter_name = class_name | to_lower_case %}
+{% set getter_name = agent | to_lower_case %}
HeapListHashSet<Member<{{class_name}}>> m_{{getter_name}}s;
{% endfor %}
@@ -64,7 +64,7 @@ class {{export_symbol}} {{sink_class}} : public GarbageCollectedFinalized<{{sink
// |s_existingAgents| up to date.
// Access must be guarded by AgentCountMutex in the source file.
{% for agent in agents %}
- static unsigned s_numSinksWith{{agent | agent_name_to_class}};
+ static unsigned s_numSinksWith{{agent}};
{% endfor %}
// Bit-set of types of enabled agent which exist in this process.
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/computed_style_base.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/computed_style_base.h.tmpl
index 28536de608f..4b0dd5134f3 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/computed_style_base.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/computed_style_base.h.tmpl
@@ -5,8 +5,8 @@
{{source_files_for_generated_file(template_file, input_files)}}
-#ifndef BLINK_CORE_COMPUTED_STYLE_BASE_H_
-#define BLINK_CORE_COMPUTED_STYLE_BASE_H_
+#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_COMPUTED_STYLE_BASE_H_
+#define THIRD_PARTY_BLINK_RENDERER_CORE_COMPUTED_STYLE_BASE_H_
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/layout/layout_theme.h"
@@ -183,6 +183,6 @@ class ComputedStyleBase {
{% endfor %}
};
-} // namespace blink
+} // namespace blink
-#endif // BLINK_CORE_COMPUTED_STYLE_BASE_H_
+#endif // THIRD_PARTY_BLINK_RENDERER_CORE_COMPUTED_STYLE_BASE_H_
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/computed_style_base_constants.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/computed_style_base_constants.h.tmpl
index 67eb2a29402..ef98612f9f5 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/computed_style_base_constants.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/computed_style_base_constants.h.tmpl
@@ -3,8 +3,8 @@
{{source_files_for_generated_file(template_file, input_files)}}
-#ifndef BLINK_CORE_COMPUTED_STYLE_BASE_CONSTANTS_H_
-#define BLINK_CORE_COMPUTED_STYLE_BASE_CONSTANTS_H_
+#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_COMPUTED_STYLE_BASE_CONSTANTS_H_
+#define THIRD_PARTY_BLINK_RENDERER_CORE_COMPUTED_STYLE_BASE_CONSTANTS_H_
namespace blink {
@@ -34,6 +34,6 @@ inline {{enum.type_name}}& operator{{op}}=({{enum.type_name}}& a, {{enum.type_na
{% endfor %}
{% endif %}
{% endfor %}
-} // namespace blink
+} // namespace blink
-#endif // BLINK_CORE_COMPUTED_STYLE_BASE_CONSTANTS_H_
+#endif // THIRD_PARTY_BLINK_RENDERER_CORE_COMPUTED_STYLE_BASE_CONSTANTS_H_
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/css_property_names.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/css_property_names.cc.tmpl
index 25ebd97e168..54c9f645a8c 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/css_property_names.cc.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/css_property_names.cc.tmpl
@@ -3,7 +3,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "core/{{file_basename}}.h"
+#include "third_party/blink/renderer/core/{{file_basename}}.h"
#include <string.h>
#include "third_party/blink/renderer/core/css/hash_tools.h"
@@ -46,4 +46,4 @@ CSSPropertyID cssPropertyID(const String& string)
return resolveCSSPropertyID(unresolvedCSSPropertyID(string));
}
-} // namespace blink
+} // namespace blink
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/css_property_names.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/css_property_names.h.tmpl
index 368a338291e..b20372d39c1 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/css_property_names.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/css_property_names.h.tmpl
@@ -1,8 +1,8 @@
{% from 'templates/macros.tmpl' import license %}
{{license()}}
-#ifndef BLINK_CORE_CSS_PROPERTY_NAMES_H_
-#define BLINK_CORE_CSS_PROPERTY_NAMES_H_
+#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTY_NAMES_H_
+#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTY_NAMES_H_
#include <stddef.h>
#include "third_party/blink/renderer/core/core_export.h"
@@ -60,6 +60,6 @@ CSSPropertyID unresolvedCSSPropertyID(const WTF::String&);
CSSPropertyID CORE_EXPORT cssPropertyID(const WTF::String&);
-} // namespace blink
+} // namespace blink
-#endif // BLINK_CORE_CSS_PROPERTY_NAMES_H_
+#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTY_NAMES_H_
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/css_value_id_mappings_generated.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/css_value_id_mappings_generated.h.tmpl
index 8ebe7c46240..8e371e71baa 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/css_value_id_mappings_generated.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/css_value_id_mappings_generated.h.tmpl
@@ -3,8 +3,8 @@
{{source_files_for_generated_file(template_file, input_files)}}
-#ifndef BLINK_CORE_CSS_VALUE_ID_MAPPINGS_GENERATED_H_
-#define BLINK_CORE_CSS_VALUE_ID_MAPPINGS_GENERATED_H_
+#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_VALUE_ID_MAPPINGS_GENERATED_H_
+#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_VALUE_ID_MAPPINGS_GENERATED_H_
#include "base/logging.h"
#include "third_party/blink/renderer/core/computed_style_base_constants.h"
@@ -96,8 +96,8 @@ inline CSSValueID platformEnumToCSSValueIDGenerated({{enum_name}} v) {
{% endif %}
{% endfor %}
-} // namespace detail
+} // namespace detail
-} // namespace blink
+} // namespace blink
-#endif // BLINK_CORE_CSS_VALUE_ID_MAPPINGS_GENERATED_H_
+#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_VALUE_ID_MAPPINGS_GENERATED_H_
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl
index b88330ab674..96d8303736e 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl
@@ -3,14 +3,14 @@
{{source_files_for_generated_file(template_file, input_files)}}
-#include "core/{{namespace|lower}}_element_factory.h"
+#include "third_party/blink/renderer/core/{{namespace|lower}}_element_factory.h"
-#include "core/{{namespace|lower}}_names.h"
+#include "third_party/blink/renderer/core/{{namespace|lower}}_names.h"
{% for header in tags|groupby('interface_header') %}
#include "{{header[0]}}"
{% endfor %}
{% if fallback_interface %}
-#include "core/{{namespace|lower}}/{{fallback_interface_header}}"
+#include "third_party/blink/renderer/core/{{namespace|lower}}/{{fallback_interface_header}}"
{% endif %}
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/hash_map.h"
@@ -56,7 +56,7 @@ static void create{{namespace}}FunctionMap() {
{ {{namespace}}Names::{{tag|symbol}}Tag, {{namespace}}{{tag|symbol}}Constructor },
{% endfor %}
};
- for (size_t i = 0; i < WTF_ARRAY_LENGTH(data); i++)
+ for (size_t i = 0; i < arraysize(data); i++)
g_{{namespace}}_constructors->Set(data[i].tag.LocalName(), data[i].func);
}
@@ -71,4 +71,4 @@ static void create{{namespace}}FunctionMap() {
return nullptr;
}
-} // namespace blink
+} // namespace blink
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.h.tmpl
index d448a732f98..87ae48e8072 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.h.tmpl
@@ -3,8 +3,8 @@
{{source_files_for_generated_file(template_file, input_files)}}
-#ifndef BLINK_CORE_{{namespace|upper}}_ELEMENT_FACTORY_H_
-#define BLINK_CORE_{{namespace|upper}}_ELEMENT_FACTORY_H_
+#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_{{namespace|upper}}_ELEMENT_FACTORY_H_
+#define THIRD_PARTY_BLINK_RENDERER_CORE_{{namespace|upper}}_ELEMENT_FACTORY_H_
#include "third_party/blink/renderer/core/dom/create_element_flags.h"
#include "third_party/blink/renderer/platform/wtf/forward.h"
@@ -23,6 +23,6 @@ class {{namespace}}ElementFactory {
const CreateElementFlags flags);
};
-} // namespace blink
+} // namespace blink
-#endif
+#endif // THIRD_PARTY_BLINK_RENDERER_CORE_{{namespace|upper}}_ELEMENT_FACTORY_H_
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.cc.tmpl
index 014d59c6d7f..8c5096044e0 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.cc.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.cc.tmpl
@@ -5,9 +5,9 @@
{{source_files_for_generated_file(template_file, input_files)}}
-#include "core/{{namespace|lower}}_element_lookup_trie.h"
+#include "third_party/blink/renderer/core/{{namespace|lower}}_element_lookup_trie.h"
-#include "core/{{namespace|lower}}_names.h"
+#include "third_party/blink/renderer/core/{{namespace|lower}}_names.h"
namespace blink {
@@ -21,4 +21,4 @@ const AtomicString& lookup{{namespace}}Tag(const UChar* data, unsigned length) {
return g_null_atom;
}
-} // namespace blink
+} // namespace blink
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.h.tmpl
index 622bd813ac9..fc240a99fc9 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.h.tmpl
@@ -3,8 +3,8 @@
{{source_files_for_generated_file(template_file, input_files)}}
-#ifndef BLINK_CORE_{{namespace|upper}}_ELEMENT_LOOKUP_TRIE_H_
-#define BLINK_CORE_{{namespace|upper}}_ELEMENT_LOOKUP_TRIE_H_
+#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_{{namespace|upper}}_ELEMENT_LOOKUP_TRIE_H_
+#define THIRD_PARTY_BLINK_RENDERER_CORE_{{namespace|upper}}_ELEMENT_LOOKUP_TRIE_H_
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
@@ -13,6 +13,6 @@ namespace blink {
CORE_EXPORT const AtomicString& lookup{{namespace}}Tag(const UChar* data, unsigned length);
-} // namespace blink
+} // namespace blink
-#endif
+#endif // THIRD_PARTY_BLINK_RENDERER_CORE_{{namespace|upper}}_ELEMENT_LOOKUP_TRIE_H_
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl
index f3b7a76fbf0..9951adb809f 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl
@@ -3,7 +3,7 @@
{{source_files_for_generated_file(template_file, input_files)}}
-#include "core/{{namespace|lower}}_element_type_helpers.h"
+#include "third_party/blink/renderer/core/{{namespace|lower}}_element_type_helpers.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
@@ -49,4 +49,4 @@ HTMLElementType htmlElementTypeForTag(const AtomicString& tagName) {
return it->value;
}
{% endif %}
-} // namespace blink
+} // namespace blink
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl
index d9beef37586..d0f65a3f7ba 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl
@@ -3,11 +3,11 @@
{{source_files_for_generated_file(template_file, input_files)}}
-#ifndef BLINK_CORE_{{namespace|upper}}_ELEMENT_TYPE_HELPERS_H_
-#define BLINK_CORE_{{namespace|upper}}_ELEMENT_TYPE_HELPERS_H_
+#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_{{namespace|upper}}_ELEMENT_TYPE_HELPERS_H_
+#define THIRD_PARTY_BLINK_RENDERER_CORE_{{namespace|upper}}_ELEMENT_TYPE_HELPERS_H_
#include "{{base_element_header}}"
-#include "core/{{namespace|lower}}_names.h"
+#include "third_party/blink/renderer/core/{{namespace|lower}}_names.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
namespace blink {
@@ -69,6 +69,6 @@ enum class HTMLElementType {
HTMLElementType htmlElementTypeForTag(const AtomicString& tagName);
{% endif %}
-} // namespace blink
+} // namespace blink
-#endif
+#endif // THIRD_PARTY_BLINK_RENDERER_CORE_{{namespace|upper}}_ELEMENT_TYPE_HELPERS_H_
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/internal_runtime_flags.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/internal_runtime_flags.h.tmpl
index 49d60b6b017..a28c58cc617 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/internal_runtime_flags.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/internal_runtime_flags.h.tmpl
@@ -30,7 +30,7 @@ class InternalRuntimeFlags : public ScriptWrappable {
{% endfor %}
{% for feature in standard_features %}
- bool {{feature.first_lowered_name}}Enabled() {
+ bool {{feature.tokenized_name.to_lower_camel_case()}}Enabled() {
{% if feature.origin_trial_feature_name %}
return RuntimeEnabledFeatures::{{feature.name}}EnabledByRuntimeFlag();
{% else %}
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/internal_runtime_flags.idl.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/internal_runtime_flags.idl.tmpl
index 551ed907445..5006b34050a 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/internal_runtime_flags.idl.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/internal_runtime_flags.idl.tmpl
@@ -7,9 +7,9 @@ interface InternalRuntimeFlags {
{% for feature in standard_features %}
{%+ if feature.condition %}[Conditional={{feature.condition}}] {% endif -%}
{% if feature.settable_from_internals %}
- attribute boolean {{feature.first_lowered_name}}Enabled;
+ attribute boolean {{feature.tokenized_name.to_lower_camel_case()}}Enabled;
{% else %}
- readonly attribute boolean {{feature.first_lowered_name}}Enabled;
+ readonly attribute boolean {{feature.tokenized_name.to_lower_camel_case()}}Enabled;
{% endif %}
{% endfor %}
};
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.cc.tmpl
index 835a2cbe80e..5633a721614 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.cc.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.cc.tmpl
@@ -13,7 +13,7 @@ namespace blink {
InternalSettingsGenerated::InternalSettingsGenerated(Page* page)
: m_page(page)
{% for setting in settings if setting.type|to_idl_type %}
- , m_{{setting.name}}(page->GetSettings().Get{{setting.name|upper_first}}())
+ , m_{{setting.name}}(page->GetSettings().Get{{setting.tokenized_name.to_upper_camel_case()}}())
{% endfor %}
{
}
@@ -22,13 +22,13 @@ InternalSettingsGenerated::~InternalSettingsGenerated() {}
void InternalSettingsGenerated::resetToConsistentState() {
{% for setting in settings if setting.type|to_idl_type %}
- m_page->GetSettings().Set{{setting.name|upper_first}}(m_{{setting.name}});
+ m_page->GetSettings().Set{{setting.tokenized_name.to_upper_camel_case()}}(m_{{setting.name}});
{% endfor %}
}
{% for setting in settings if setting.type|to_idl_type %}
-void InternalSettingsGenerated::set{{setting.name|upper_first}}({{setting.type|to_passing_type}} {{setting.name}}) {
- m_page->GetSettings().Set{{setting.name|upper_first}}({{setting.name}});
+void InternalSettingsGenerated::set{{setting.tokenized_name.to_upper_camel_case()}}({{setting.type|to_passing_type}} {{setting.name}}) {
+ m_page->GetSettings().Set{{setting.tokenized_name.to_upper_camel_case()}}({{setting.name}});
}
{% endfor %}
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.h.tmpl
index 3eaa5c192c2..2fcb1195601 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.h.tmpl
@@ -24,10 +24,10 @@ class InternalSettingsGenerated : public ScriptWrappable {
virtual ~InternalSettingsGenerated();
void resetToConsistentState();
{% for setting in settings if setting.type|to_idl_type %}
- void set{{setting.name|upper_first}}({{setting.type|to_passing_type}} {{setting.name}});
+ void set{{setting.tokenized_name.to_upper_camel_case()}}({{setting.type|to_passing_type}} {{setting.name}});
{% endfor %}
- virtual void Trace(Visitor*);
+ void Trace(Visitor*) override;
private:
Member<Page> m_page;
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.idl.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.idl.tmpl
index 0efd9471505..9d7be66b932 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.idl.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/internal_settings_generated.idl.tmpl
@@ -5,6 +5,6 @@
interface InternalSettingsGenerated {
{% for setting in settings if setting.type|to_idl_type %}
- void set{{setting.name|upper_first}}({{setting.type|to_idl_type}} {{setting.name}});
+ void set{{setting.tokenized_name.to_upper_camel_case()}}({{setting.type|to_idl_type}} {{setting.name}});
{% endfor %}
};
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/make_names.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/make_names.cc.tmpl
index a8ff9bfe9f2..8be40d6920a 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/make_names.cc.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/make_names.cc.tmpl
@@ -3,7 +3,7 @@
{{source_files_for_generated_file(template_file, input_files)}}
-#include "{{this_include_header_name}}"
+#include "{{this_include_path}}"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
@@ -33,7 +33,7 @@ void init{{suffix}}() {
{% endfor %}
};
- for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNames); i++) {
+ for (size_t i = 0; i < arraysize(kNames); i++) {
StringImpl* stringImpl = StringImpl::CreateStatic(kNames[i].name, kNames[i].length, kNames[i].hash);
void* address = reinterpret_cast<AtomicString*>(&{{suffix}}NamesStorage) + i;
new (address) AtomicString(stringImpl);
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/make_names.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/make_names.h.tmpl
index a5a84a38ef3..621c966d6ee 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/make_names.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/make_names.h.tmpl
@@ -3,8 +3,8 @@
{{source_files_for_generated_file(template_file, input_files)}}
-#ifndef {{namespace}}{{suffix}}Names_h
-#define {{namespace}}{{suffix}}Names_h
+#ifndef {{header_guard}}
+#define {{header_guard}}
{% set symbol_export = '%s ' % export if export else '' %}
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
@@ -27,7 +27,7 @@ const unsigned {{namespace}}{{suffix}}NamesCount = {{entries|length}};
{{symbol_export}}void init{{suffix}}();
-} // {{namespace}}Names
-} // namespace blink
+} // {{namespace}}Names
+} // namespace blink
-#endif
+#endif // {{header_guard}}
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.cc.tmpl
index 37e2d4a24c6..9a602d58b2e 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.cc.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.cc.tmpl
@@ -3,11 +3,12 @@
{{source_files_for_generated_file(template_file, input_files)}}
-#include "{{namespace|lower}}_names.h"
+#include "{{this_include_path}}"
+
+#include <memory>
#include "third_party/blink/renderer/platform/wtf/static_constructors.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
-#include <memory>
namespace blink {
namespace {{namespace}}Names {
@@ -77,7 +78,7 @@ void init() {
size_t tag_i = 0;
{% endif %}
size_t attr_i = 0;
- for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNames); i++) {
+ for (size_t i = 0; i < arraysize(kNames); i++) {
StringImpl* stringImpl = StringImpl::CreateStatic(kNames[i].name, kNames[i].length, kNames[i].hash);
{% if tags %}
if (kNames[i].isTag) {
@@ -103,5 +104,5 @@ void init() {
DCHECK_EQ(attr_i, {{namespace}}AttrsCount);
}
-} // {{namespace}}
-} // namespace blink
+} // namespace {{namespace}}Names
+} // namespace blink
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl
index ff2a394ade7..b4c5c86d63a 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl
@@ -3,8 +3,8 @@
{{source_files_for_generated_file(template_file, input_files)}}
-#ifndef BLINK_CORE_{{namespace|upper}}_NAMES_H_
-#define BLINK_CORE_{{namespace|upper}}_NAMES_H_
+#ifndef {{header_guard}}
+#define {{header_guard}}
{% if export == 'CORE_EXPORT' %}
#include "third_party/blink/renderer/core/core_export.h"
@@ -44,7 +44,7 @@ std::unique_ptr<const QualifiedName*[]> get{{namespace}}Attrs();
void init();
-} // {{namespace}}Names
-} // namespace blink
+} // namespace {{namespace}}Names
+} // namespace blink
-#endif
+#endif // {{header_guard}}
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl
index 0248a716eec..dcac3707d68 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl
@@ -19,7 +19,7 @@ const char OriginTrials::k{{feature.name}}TrialName[] = "{{feature.origin_trial_
{% for feature in features %}
{% if feature.origin_trial_feature_name %}
-bool OriginTrials::{{feature.first_lowered_name}}Enabled(const ExecutionContext* executionContext) {
+bool OriginTrials::{{feature.tokenized_name.to_lower_camel_case()}}Enabled(const ExecutionContext* executionContext) {
if (RuntimeEnabledFeatures::{{feature.name}}EnabledByRuntimeFlag())
return true;
{% if feature.origin_trial_os %}
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.h.tmpl
index 4c803b0a3e1..0034cbd7b75 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.h.tmpl
@@ -27,7 +27,7 @@ CORE_EXPORT extern const char k{{feature.name}}TrialName[];
{% for feature in features %}
{% if feature.origin_trial_feature_name %}
-CORE_EXPORT bool {{feature.first_lowered_name}}Enabled(const ExecutionContext*);
+CORE_EXPORT bool {{feature.tokenized_name.to_lower_camel_case()}}Enabled(const ExecutionContext*);
{% endif %}
{% endfor %}
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl
index efbb2fa3127..0171eedeefb 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl
@@ -8,8 +8,8 @@
#define SETTINGS_GETTERS_AND_SETTERS \
{% for setting in settings %}
- {{setting.type|to_passing_type}} Get{{setting.name|upper_first}}() const { return {{setting.name}}_; } \
- void Set{{setting.name|upper_first}}({{setting.type|to_passing_type}} {{setting.name}}); \
+ {{setting.type|to_passing_type}} Get{{setting.tokenized_name.to_upper_camel_case()}}() const { return {{setting.name}}_; } \
+ void Set{{setting.tokenized_name.to_upper_camel_case()}}({{setting.type|to_passing_type}} {{setting.name}}); \
{% endfor %}
void SetFromStrings(const String& name, const String& value);
// End of SETTINGS_GETTERS_AND_SETTERS.
@@ -34,7 +34,7 @@
#define SETTINGS_SETTER_BODIES \
{% for setting in settings %}
-void Settings::Set{{setting.name|upper_first}}({{setting.type|to_passing_type}} {{setting.name}}) { \
+void Settings::Set{{setting.tokenized_name.to_upper_camel_case()}}({{setting.type|to_passing_type}} {{setting.name}}) { \
if ({{setting.name}}_ == {{setting.name}}) \
return; \
{{setting.name}}_ = {{setting.name}}; \
@@ -46,7 +46,7 @@ void Settings::Set{{setting.name|upper_first}}({{setting.type|to_passing_type}}
void Settings::SetFromStrings(const String& name, const String& value) { \
{% for setting in settings %}
if (name == "{{setting.name}}") { \
- Set{{setting.name|upper_first}}( \
+ Set{{setting.tokenized_name.to_upper_camel_case()}}( \
{% if setting.type == 'String' %}
value \
{% elif setting.type == 'bool' %}
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/style_builder_functions.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/style_builder_functions.cc.tmpl
index 0395f7a69d0..1907e3eb9e4 100644
--- a/chromium/third_party/blink/renderer/build/scripts/templates/style_builder_functions.cc.tmpl
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/style_builder_functions.cc.tmpl
@@ -43,8 +43,9 @@ state.Style()->{{property.is_inherited_setter}}
namespace blink {
{% for property in properties if property.should_declare_functions
- and not property.use_property_class_in_stylebuilder %}
-{% if not property.custom_apply_functions_initial %}
+ and not property.use_property_class_in_stylebuilder
+ and not property.style_builder_template %}
+{% if property.style_builder_generate_initial %}
{{declare_initial_function(property.property_id)}} {
{% if property.svg %}
{{set_value(property)}}(SVGComputedStyle::{{property.initial}}());
@@ -59,7 +60,7 @@ namespace blink {
}
{% endif %}
-{% if not property.custom_apply_functions_inherit %}
+{% if property.style_builder_generate_inherit %}
{{declare_inherit_function(property.property_id)}} {
{% if property.svg %}
{{set_value(property)}}(state.ParentStyle()->SvgStyle().{{property.getter}}());
@@ -74,7 +75,7 @@ namespace blink {
}
{% endif %}
-{% if not property.custom_apply_functions_value %}
+{% if property.style_builder_generate_value %}
{{declare_value_function(property.property_id)}} {
{{convert_and_set_value(property)}}
{% if property.independent %}
@@ -85,138 +86,6 @@ namespace blink {
{% endif %}
{% endfor %}
-{% macro apply_animation(property_id, attribute, animation) %}
-{% set vector = attribute + "List()" %}
-{{declare_initial_function(property_id)}} {
- CSS{{animation}}Data& data = state.Style()->Access{{animation}}s();
- data.{{vector}}.clear();
- data.{{vector}}.push_back(CSS{{animation}}Data::Initial{{attribute}}());
-}
-
-{{declare_inherit_function(property_id)}} {
- const CSS{{animation}}Data* parentData = state.ParentStyle()->{{animation}}s();
- if (!parentData)
- applyInitial{{property_id}}(state);
- else
- state.Style()->Access{{animation}}s().{{vector}} = parentData->{{vector}};
-}
-
-{{declare_value_function(property_id)}} {
- 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));
-}
-{% endmacro %}
-{{apply_animation('CSSPropertyAnimationDelay', 'Delay', 'Animation')}}
-{{apply_animation('CSSPropertyAnimationDirection', 'Direction', 'Animation')}}
-{{apply_animation('CSSPropertyAnimationDuration', 'Duration', 'Animation')}}
-{{apply_animation('CSSPropertyAnimationFillMode', 'FillMode', 'Animation')}}
-{{apply_animation('CSSPropertyAnimationIterationCount', 'IterationCount', 'Animation')}}
-{{apply_animation('CSSPropertyAnimationName', 'Name', 'Animation')}}
-{{apply_animation('CSSPropertyAnimationPlayState', 'PlayState', 'Animation')}}
-{{apply_animation('CSSPropertyAnimationTimingFunction', 'TimingFunction', 'Animation')}}
-{{apply_animation('CSSPropertyTransitionDelay', 'Delay', 'Transition')}}
-{{apply_animation('CSSPropertyTransitionDuration', 'Duration', 'Transition')}}
-{{apply_animation('CSSPropertyTransitionProperty', 'Property', 'Transition')}}
-{{apply_animation('CSSPropertyTransitionTimingFunction', 'TimingFunction', 'Transition')}}
-
-{% macro apply_color(property_id, initial_color='StyleColor::CurrentColor') %}
-{% set property = properties_by_id[property_id] %}
-{% set visited_link_setter = 'SetVisitedLink' + property.name_for_methods %}
-{{declare_initial_function(property_id)}} {
- StyleColor color = {{initial_color}}();
- if (state.ApplyPropertyToRegularStyle())
- {{set_value(property)}}(color);
- if (state.ApplyPropertyToVisitedLinkStyle())
- state.Style()->{{visited_link_setter}}(color);
-}
-
-{{declare_inherit_function(property_id)}} {
- // 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_function(property_id)}}
-{
- if (state.ApplyPropertyToRegularStyle())
- {{set_value(property)}}(StyleBuilderConverter::ConvertStyleColor(state, value));
- if (state.ApplyPropertyToVisitedLinkStyle()) {
- state.Style()->{{visited_link_setter}}(
- StyleBuilderConverter::ConvertStyleColor(state, value, true));
- }
-}
-{% endmacro %}
-{{apply_color('CSSPropertyBackgroundColor', initial_color='ComputedStyleInitialValues::InitialBackgroundColor') }}
-{{apply_color('CSSPropertyBorderBottomColor')}}
-{{apply_color('CSSPropertyBorderLeftColor')}}
-{{apply_color('CSSPropertyBorderRightColor')}}
-{{apply_color('CSSPropertyBorderTopColor')}}
-{{apply_color('CSSPropertyOutlineColor')}}
-{{apply_color('CSSPropertyTextDecorationColor')}}
-{{apply_color('CSSPropertyColumnRuleColor')}}
-{{apply_color('CSSPropertyWebkitTextEmphasisColor')}}
-{{apply_color('CSSPropertyWebkitTextFillColor')}}
-{{apply_color('CSSPropertyWebkitTextStrokeColor')}}
-
-{% macro apply_counter(property_id, action) %}
-{% set property = properties_by_id[property_id] %}
-{{declare_initial_function(property_id)}} {
- state.Style()->Clear{{action}}Directives();
-}
-
-{{declare_inherit_function(property_id)}} {
- 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_function(property_id)}} {
- 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());
-}
-{% endmacro %}
-{{apply_counter('CSSPropertyCounterIncrement', 'Increment')}}
-{{apply_counter('CSSPropertyCounterReset', 'Reset')}}
-
{% macro apply_grid_template(property_id, type) %}
{{declare_initial_function(property_id)}} {
state.Style()->SetGridTemplate{{type}}s(ComputedStyleInitialValues::InitialGridTemplate{{type}}s());