Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 88e8502

Browse files
committed
Remove shadow trees and custom elements from sky/engine/.
Remove all code relating to shadow trees, insertion points, shadow boundaries, traversing composed trees, distribution, template documents, custom elements, registering elements, element registries, element factories, shadow roots, etc. Remove the following features from the IDLs and from the binding generators: CustomElementCallbacks, Reflect*, EventHandler. Remove the CSS custom pseudo-element concept, since we no longer have a UA style sheet worth talking about, no longer have shadow trees or custom elements, no longer use pseudo-elements, and generally therefore don't use this code at all.
1 parent ba949fd commit 88e8502

File tree

111 files changed

+205
-4386
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+205
-4386
lines changed

sky/engine/bindings/IDLExtendedAttributes.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ CallWith=ScriptState|ScriptArguments|ActiveWindow|FirstWindow|ThisValue
3838
Constructor
3939
Custom=|Getter|Setter|VisitDOMWrapper|Wrap|PropertyGetter|PropertyEnumerator|PropertyQuery
4040
CustomConstructor
41-
CustomElementCallbacks
4241
Default=Undefined
4342
DependentLifetime
4443
DoNotCheckConstants
@@ -64,11 +63,6 @@ PartialInterfaceImplementedAs=*
6463
PrivateDart
6564
PutForwards=*
6665
RaisesException=|Getter|Setter|Constructor
67-
Reflect=|*
68-
ReflectEmpty=*
69-
ReflectInvalid=*
70-
ReflectMissing=*
71-
ReflectOnly=*
7266
Replaceable
7367
SetterCallWith=ExecutionContext|ScriptArguments|ActiveWindow|FirstWindow
7468
SetWrapperReferenceFrom=*

sky/engine/bindings/scripts/dart_attributes.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,19 @@ def getter_context(interface, attribute, context):
114114
extended_attributes = attribute.extended_attributes
115115

116116
cpp_value = getter_expression(interface, attribute, context)
117-
# Normally we can inline the function call into the return statement to
118-
# avoid the overhead of using a Ref<> temporary, but for some cases
119-
# (nullable types, EventHandler, [CachedAttribute], or if there are
120-
# exceptions), we need to use a local variable.
117+
# Normally we can inline the function call into the return
118+
# statement to avoid the overhead of using a Ref<> temporary, but
119+
# for some cases (nullable types, [CachedAttribute], or if there
120+
# are exceptions), we need to use a local variable.
121121
# FIXME: check if compilers are smart enough to inline this, and if so,
122122
# always use a local variable (for readability and CG simplicity).
123123
release = False
124124
if (idl_type.is_nullable or
125-
base_idl_type == 'EventHandler' or
126125
'CachedAttribute' in extended_attributes or
127-
'ReflectOnly' in extended_attributes or
128126
context['is_getter_raises_exception']):
129127
context['cpp_value_original'] = cpp_value
130128
cpp_value = 'result'
131-
# EventHandler has special handling
132-
if base_idl_type != 'EventHandler' and idl_type.is_interface_type:
129+
if idl_type.is_interface_type:
133130
release = True
134131

135132
dart_set_return_value = \
@@ -229,16 +226,8 @@ def setter_expression(interface, attribute, context):
229226
not attribute.is_static):
230227
arguments.append('*receiver')
231228
idl_type = attribute.idl_type
232-
if idl_type.base_type == 'EventHandler':
233-
getter_name = DartUtilities.scoped_name(interface, attribute, DartUtilities.cpp_name(attribute))
234-
context['event_handler_getter_expression'] = '%s(%s)' % (
235-
getter_name, ', '.join(arguments))
236-
# FIXME(vsm): Do we need to support this? If so, what's our analogue of
237-
# V8EventListenerList?
238-
arguments.append('nullptr')
239-
else:
240-
attribute_name = dart_types.check_reserved_name(attribute.name)
241-
arguments.append(attribute_name)
229+
attribute_name = dart_types.check_reserved_name(attribute.name)
230+
arguments.append(attribute_name)
242231
if context['is_setter_raises_exception']:
243232
arguments.append('es')
244233

sky/engine/bindings/scripts/dart_types.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -500,15 +500,6 @@ def preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes):
500500
# FIXME(vsm): V8 maps 'long long' and 'unsigned long long' to double
501501
# as they are not representable in ECMAScript. Should we do the same?
502502

503-
# HTML5 says that unsigned reflected attributes should be in the range
504-
# [0, 2^31). When a value isn't in this range, a default value (or 0)
505-
# should be returned instead.
506-
extended_attributes = extended_attributes or {}
507-
if ('Reflect' in extended_attributes and
508-
idl_type.base_type in ['unsigned long', 'unsigned short']):
509-
cpp_value = cpp_value.replace('getUnsignedIntegralAttribute',
510-
'getIntegralAttribute')
511-
cpp_value = 'std::max(0, %s)' % cpp_value
512503
return idl_type, cpp_value
513504

514505

@@ -645,8 +636,8 @@ def dart_conversion_type(idl_type, extended_attributes):
645636
# TODO(terry): Remove ForMainWorld stuff.
646637
'DOMWrapperForMainWorld': DART_FIX_ME,
647638
# FIXME(vsm): V8 has a fast path. Do we?
648-
'DOMWrapperFast': 'DartConverter<{implemented_as}*>::SetReturnValue(args, WTF::getPtr({cpp_value}), {auto_scope})',
649-
'DOMWrapperDefault': 'DartConverter<{implemented_as}*>::SetReturnValue(args, WTF::getPtr({cpp_value}), {auto_scope})',
639+
'DOMWrapperFast': '/*DOMWrapperFast*/ DartConverter<{implemented_as}*>::SetReturnValue(args, WTF::getPtr({cpp_value}), {auto_scope})',
640+
'DOMWrapperDefault': '/*DOMWrapperDefault*/ DartConverter<{implemented_as}*>::SetReturnValue(args, WTF::getPtr({cpp_value}), {auto_scope})',
650641
# Typed arrays don't have special Dart* classes for Dart.
651642
'ArrayBuffer': 'Dart_SetReturnValue(args, DartUtilities::arrayBufferToDart({cpp_value}))',
652643
'TypedList': 'Dart_SetReturnValue(args, DartUtilities::arrayBufferViewToDart({cpp_value}))',

sky/engine/bindings/scripts/templates/attributes_cpp.template

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ ExceptionState es;
4848
{% endif %}
4949
{% if attribute.cached_attribute_validation_method or
5050
attribute.is_getter_raises_exception or
51-
attribute.is_nullable or
52-
attribute.idl_type == 'EventHandler' %}
51+
attribute.is_nullable %}
5352
{{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_original}};
5453
{% endif %}
5554
{% if attribute.is_nullable %}
@@ -74,17 +73,14 @@ DART_UNIMPLEMENTED();
7473
{% macro attribute_setter(cpp_class, attribute) %}
7574
static void {{static_attribute_name(attribute, 'Setter')}}(Dart_NativeArguments args)
7675
{
77-
{% if attribute.idl_type == "EventHandler" or not attribute.cpp_setter %}
76+
{% if not attribute.cpp_setter %}
7877
{# TODO(terry): Need to fix properly. #}
7978
// FIXME: proper implementation.
8079
DART_UNIMPLEMENTED();
8180
{% else %}
8281
Dart_Handle exception = nullptr;
8382
{
8483
{{cpp_class}}* receiver = GetReceiver<{{cpp_class}}>(args);
85-
{% if attribute.is_custom_element_callbacks %}
86-
CustomElementCallbackScope deliveryScope;
87-
{% endif %}
8884
{% set attribute_name = attribute.name if not attribute.put_forwards else 'value' %}
8985

9086
{{attribute.local_cpp_type}} {{attribute.setter_lvalue}} = {{attribute.dart_value_to_local_cpp_value}};
@@ -151,7 +147,6 @@ if (result.isNull()) {
151147
result = "{{reflect_empty}}";
152148
{% else %}
153149
if (result.isEmpty()) {
154-
{# FIXME: should use [ReflectEmpty] instead; need to change IDL files #}
155150
{% if reflect_missing %}
156151
result = "{{reflect_missing}}";
157152
{% else %}

sky/engine/bindings/scripts/templates/interface_h.template

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ namespace {{dart_class}}Internal {
3636
{% if has_event_constructor %}
3737
void initialize{{interface_name}}ForDart({{interface_name}}Init&, const String&, const HashMap<String, Dart_Handle>&, Dart_Handle&);
3838
{% endif %}
39-
{% for method in methods if method.is_custom_element_callbacks and not method.suppressed %}
40-
void {{method.name}}_{{method.number_of_arguments}}(Dart_NativeArguments);
41-
{% endfor %}
4239
{% for method in methods if method.is_custom or method.custom_dart_new %}
4340
void {{static_method_name(method.name)}}(Dart_NativeArguments args);
4441
{% if method.overload_index == 1 %}

sky/engine/bindings/scripts/templates/methods_cpp.template

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ static void {{static_method_name(method.name, overload_index)}}(Dart_NativeArgum
8080
{% if not method.is_static %}
8181
{{cpp_class}}* /* FIXME(vsm): Remove this. */ ALLOW_UNUSED receiver = GetReceiver<{{cpp_class}}>(args);
8282
{% endif %}
83-
{% if method.is_custom_element_callbacks %}
84-
CustomElementCallbackScope deliveryScope;
85-
{% endif %}
8683
{% if arguments_count > 0 or
8784
method.has_exception_state or
8885
method.is_call_with_script_state or

sky/engine/bindings/scripts/v8_attributes.py

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,12 @@ def attribute_context(interface, attribute):
5050

5151
idl_type.add_includes_for_type()
5252

53-
# [CustomElementCallbacks], [Reflect]
54-
is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes
55-
is_reflect = 'Reflect' in extended_attributes
56-
if is_custom_element_callbacks or is_reflect:
57-
includes.add('sky/engine/core/dom/custom/custom_element_callback_scope.h')
5853
# [TypeChecking]
5954
has_type_checking_unrestricted = (
6055
(has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or
6156
has_extended_attribute_value(attribute, 'TypeChecking', 'Unrestricted')) and
6257
idl_type.name in ('Float', 'Double'))
6358

64-
if (base_idl_type == 'EventHandler' and
65-
interface.name in ['Window'] and
66-
attribute.name == 'onerror'):
67-
includes.add('bindings/core/v8/V8ErrorHandler.h')
68-
6959
context = {
7060
'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True),
7161
'cached_attribute_validation_method': extended_attributes.get('CachedAttribute'),
@@ -82,7 +72,6 @@ def attribute_context(interface, attribute):
8272
'idl_type': str(idl_type), # need trailing [] on array for Dictionary::ConversionContext::setConversionType
8373
'is_call_with_execution_context': v8_utilities.has_extended_attribute_value(attribute, 'CallWith', 'ExecutionContext'),
8474
'is_call_with_script_state': v8_utilities.has_extended_attribute_value(attribute, 'CallWith', 'ScriptState'),
85-
'is_custom_element_callbacks': is_custom_element_callbacks,
8675
'is_getter_raises_exception': # [RaisesException]
8776
'RaisesException' in extended_attributes and
8877
extended_attributes['RaisesException'] in (None, 'Getter'),
@@ -94,16 +83,11 @@ def attribute_context(interface, attribute):
9483
'is_partial_interface_member':
9584
'PartialInterfaceImplementedAs' in extended_attributes,
9685
'is_read_only': attribute.is_read_only,
97-
'is_reflect': is_reflect,
9886
'is_replaceable': 'Replaceable' in attribute.extended_attributes,
9987
'is_static': attribute.is_static,
10088
'is_url': 'URL' in extended_attributes,
10189
'name': attribute.name,
10290
'put_forwards': 'PutForwards' in extended_attributes,
103-
'reflect_empty': extended_attributes.get('ReflectEmpty'),
104-
'reflect_invalid': extended_attributes.get('ReflectInvalid', ''),
105-
'reflect_missing': extended_attributes.get('ReflectMissing'),
106-
'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly'),
10791
'setter_callback': setter_callback_name(interface, attribute),
10892
}
10993

@@ -161,10 +145,9 @@ def getter_expression(interface, attribute, context):
161145
def getter_base_name(interface, attribute, arguments):
162146
extended_attributes = attribute.extended_attributes
163147

164-
if 'Reflect' not in extended_attributes:
165-
return uncapitalize(cpp_name(attribute))
148+
return uncapitalize(cpp_name(attribute))
166149

167-
content_attribute_name = extended_attributes['Reflect'] or attribute.name.lower()
150+
content_attribute_name = attribute.name.lower()
168151
if content_attribute_name in ['class', 'id']:
169152
# Special-case for performance optimization.
170153
return 'get%sAttribute' % content_attribute_name.capitalize()
@@ -254,18 +237,11 @@ def setter_context(interface, attribute, context):
254237

255238

256239
def setter_base_name(interface, attribute, arguments):
257-
if 'Reflect' not in attribute.extended_attributes:
258-
return 'set%s' % capitalize(cpp_name(attribute))
259-
arguments.append(scoped_content_attribute_name(interface, attribute))
260-
261-
base_idl_type = attribute.idl_type.base_type
262-
if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES:
263-
return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type]
264-
return 'setAttribute'
240+
return 'set%s' % capitalize(cpp_name(attribute))
265241

266242

267243
def scoped_content_attribute_name(interface, attribute):
268-
content_attribute_name = attribute.extended_attributes['Reflect'] or attribute.name.lower()
244+
content_attribute_name = attribute.name.lower()
269245
namespace = 'HTMLNames'
270246
includes.add('gen/sky/core/%s.h' % namespace)
271247
return '%s::%sAttr' % (namespace, content_attribute_name)

sky/engine/bindings/scripts/v8_interface.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def interface_context(interface):
282282
return context
283283

284284

285-
# [DeprecateAs], [Reflect]
285+
# [DeprecateAs]
286286
def constant_context(constant):
287287
# (Blink-only) string literals are unquoted in tokenizer, must be re-quoted
288288
# in C++.
@@ -296,8 +296,6 @@ def constant_context(constant):
296296
'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'),
297297
'idl_type': constant.idl_type.name,
298298
'name': constant.name,
299-
# FIXME: use 'reflected_name' as correct 'name'
300-
'reflected_name': extended_attributes.get('Reflect', constant.name),
301299
'value': value,
302300
}
303301

sky/engine/bindings/scripts/v8_methods.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ def function_template():
9999
is_call_with_script_state = has_extended_attribute_value(method, 'CallWith', 'ScriptState')
100100
if is_call_with_script_state:
101101
includes.add('bindings/core/v8/ScriptState.h')
102-
is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes
103-
if is_custom_element_callbacks:
104-
includes.add('sky/engine/core/dom/custom/custom_element_callback_scope.h')
105102

106103
is_raises_exception = 'RaisesException' in extended_attributes
107104

@@ -135,7 +132,6 @@ def function_template():
135132
'is_call_with_script_arguments': is_call_with_script_arguments,
136133
'is_call_with_script_state': is_call_with_script_state,
137134
'is_custom': 'Custom' in extended_attributes,
138-
'is_custom_element_callbacks': is_custom_element_callbacks,
139135
'is_explicit_nullable': idl_type.is_explicit_nullable,
140136
'is_partial_interface_member':
141137
'PartialInterfaceImplementedAs' in extended_attributes,

sky/engine/bindings/scripts/v8_types.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,6 @@ def preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes):
319319
if is_nullable:
320320
idl_type = IdlNullableType(idl_type)
321321
cpp_value = 'static_cast<double>(%s)' % cpp_value
322-
# HTML5 says that unsigned reflected attributes should be in the range
323-
# [0, 2^31). When a value isn't in this range, a default value (or 0)
324-
# should be returned instead.
325-
extended_attributes = extended_attributes or {}
326-
if ('Reflect' in extended_attributes and
327-
idl_type.base_type in ['unsigned long', 'unsigned short']):
328-
cpp_value = cpp_value.replace('getUnsignedIntegralAttribute',
329-
'getIntegralAttribute')
330-
cpp_value = 'std::max(0, static_cast<int>(%s))' % cpp_value
331322
return idl_type, cpp_value
332323

333324

sky/engine/build/scripts/make_element_factory.py

Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -36,92 +36,8 @@
3636

3737
from make_qualified_names import MakeQualifiedNamesWriter
3838

39-
4039
class MakeElementFactoryWriter(MakeQualifiedNamesWriter):
41-
defaults = dict(MakeQualifiedNamesWriter.default_parameters, **{
42-
'JSInterfaceName': None,
43-
'Conditional': None,
44-
'constructorNeedsCreatedByParser': None,
45-
'interfaceName': None,
46-
'noConstructor': None,
47-
'noTypeHelpers': None,
48-
'runtimeEnabled': None,
49-
})
50-
default_parameters = dict(MakeQualifiedNamesWriter.default_parameters, **{
51-
'fallbackInterfaceName': '',
52-
'fallbackJSInterfaceName': '',
53-
})
54-
filters = MakeQualifiedNamesWriter.filters
55-
56-
def __init__(self, in_file_paths):
57-
super(MakeElementFactoryWriter, self).__init__(in_file_paths)
58-
59-
# FIXME: When we start using these element factories, we'll want to
60-
# remove the "new" prefix and also have our base class generate
61-
# *Names.h and *Names.cpp.
62-
self._outputs.update({
63-
(self.namespace + 'ElementFactory.h'): self.generate_factory_header,
64-
(self.namespace + 'ElementFactory.cpp'): self.generate_factory_implementation,
65-
('V8' + self.namespace + 'ElementWrapperFactory.h'): self.generate_wrapper_factory_header,
66-
('V8' + self.namespace + 'ElementWrapperFactory.cpp'): self.generate_wrapper_factory_implementation,
67-
})
68-
69-
fallback_interface = self.tags_in_file.parameters['fallbackInterfaceName'].strip('"')
70-
fallback_js_interface = self.tags_in_file.parameters['fallbackJSInterfaceName'].strip('"') or fallback_interface
71-
72-
interface_counts = defaultdict(int)
73-
tags = self._template_context['tags']
74-
for tag in tags:
75-
tag['has_js_interface'] = self._has_js_interface(tag)
76-
tag['js_interface'] = self._js_interface(tag)
77-
tag['interface'] = self._interface(tag)
78-
interface_counts[tag['interface']] += 1
79-
80-
for tag in tags:
81-
tag['multipleTagNames'] = (interface_counts[tag['interface']] > 1 or tag['interface'] == fallback_interface)
82-
83-
self._template_context.update({
84-
'fallback_interface': fallback_interface,
85-
'fallback_js_interface': fallback_js_interface,
86-
})
87-
88-
@template_expander.use_jinja('ElementFactory.h.tmpl', filters=filters)
89-
def generate_factory_header(self):
90-
return self._template_context
91-
92-
@template_expander.use_jinja('ElementFactory.cpp.tmpl', filters=filters)
93-
def generate_factory_implementation(self):
94-
return self._template_context
95-
96-
@template_expander.use_jinja('ElementWrapperFactory.h.tmpl', filters=filters)
97-
def generate_wrapper_factory_header(self):
98-
return self._template_context
99-
100-
@template_expander.use_jinja('ElementWrapperFactory.cpp.tmpl', filters=filters)
101-
def generate_wrapper_factory_implementation(self):
102-
return self._template_context
103-
104-
def _interface(self, tag):
105-
if tag['interfaceName']:
106-
return tag['interfaceName']
107-
name = name_utilities.upper_first(tag['name'])
108-
# FIXME: We shouldn't hard-code HTML here.
109-
if name == 'HTML':
110-
name = 'Html'
111-
dash = name.find('-')
112-
while dash != -1:
113-
name = name[:dash] + name[dash + 1].upper() + name[dash + 2:]
114-
dash = name.find('-')
115-
return '%s%sElement' % (self.namespace, name)
116-
117-
def _js_interface(self, tag):
118-
if tag['JSInterfaceName']:
119-
return tag['JSInterfaceName']
120-
return self._interface(tag)
121-
122-
def _has_js_interface(self, tag):
123-
return not tag['noConstructor'] and self._js_interface(tag) != ('%sElement' % self.namespace)
124-
40+
pass
12541

12642
if __name__ == "__main__":
12743
in_generator.Maker(MakeElementFactoryWriter).main(sys.argv)

0 commit comments

Comments
 (0)