Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/v8_interface.py

Issue 2385073002: HTMLConstructor implementation (Closed)
Patch Set: Move V8HTMLConstructor.cpp outside of 'custom' dir, spelling error fix Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # coding=utf-8 2 # coding=utf-8
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 if constructor.name == 'Constructor'] 284 if constructor.name == 'Constructor']
285 if len(constructors) > 1: 285 if len(constructors) > 1:
286 context['constructor_overloads'] = overloads_context(interface, construc tors) 286 context['constructor_overloads'] = overloads_context(interface, construc tors)
287 287
288 # [CustomConstructor] 288 # [CustomConstructor]
289 custom_constructors = [{ # Only needed for computing interface length 289 custom_constructors = [{ # Only needed for computing interface length
290 'number_of_required_arguments': 290 'number_of_required_arguments':
291 number_of_required_arguments(constructor), 291 number_of_required_arguments(constructor),
292 } for constructor in interface.custom_constructors] 292 } for constructor in interface.custom_constructors]
293 293
294 # [HTMLConstructor]
295 html_constructor = 'HTMLConstructor' in extended_attributes
296 if html_constructor:
297 # https://html.spec.whatwg.org/#html-element-constructors
298 if ('Constructor' in extended_attributes) or ('NoInterfaceObject' in ext ended_attributes):
299 raise Exception('[Constructor] and [NoInterfaceObject] MUST NOT be'
300 ' specified with [HTMLConstructor]: '
301 '%s' % interface.name)
302
294 # [NamedConstructor] 303 # [NamedConstructor]
295 named_constructor = named_constructor_context(interface) 304 named_constructor = named_constructor_context(interface)
296 305
297 if constructors or custom_constructors or named_constructor: 306 if constructors or custom_constructors or html_constructor or named_construc tor:
298 if interface.is_partial: 307 if interface.is_partial:
299 raise Exception('[Constructor] and [NamedConstructor] MUST NOT be' 308 raise Exception('[Constructor] and [NamedConstructor] MUST NOT be'
300 ' specified on partial interface definitions: ' 309 ' specified on partial interface definitions: '
301 '%s' % interface.name) 310 '%s' % interface.name)
302 311
303 includes.add('bindings/core/v8/V8ObjectConstructor.h') 312 includes.add('bindings/core/v8/V8ObjectConstructor.h')
304 includes.add('core/frame/LocalDOMWindow.h') 313 includes.add('core/frame/LocalDOMWindow.h')
305 elif 'Measure' in extended_attributes or 'MeasureAs' in extended_attributes: 314 elif 'Measure' in extended_attributes or 'MeasureAs' in extended_attributes:
306 raise Exception('[Measure] or [MeasureAs] specified for interface withou t a constructor: ' 315 raise Exception('[Measure] or [MeasureAs] specified for interface withou t a constructor: '
307 '%s' % interface.name) 316 '%s' % interface.name)
(...skipping 14 matching lines...) Expand all
322 interface.named_property_setter, 331 interface.named_property_setter,
323 interface.named_property_deleter, 332 interface.named_property_deleter,
324 ) 333 )
325 has_ce_reactions = any(setter_or_deleter and 'CEReactions' in setter_or_dele ter.extended_attributes 334 has_ce_reactions = any(setter_or_deleter and 'CEReactions' in setter_or_dele ter.extended_attributes
326 for setter_or_deleter in setter_or_deleters) 335 for setter_or_deleter in setter_or_deleters)
327 if has_ce_reactions: 336 if has_ce_reactions:
328 includes.add('core/dom/custom/CEReactionsScope.h') 337 includes.add('core/dom/custom/CEReactionsScope.h')
329 338
330 context.update({ 339 context.update({
331 'constructors': constructors, 340 'constructors': constructors,
341 'has_html_constructor': bool(html_constructor),
haraken 2016/10/03 06:13:04 Alphabetical order.
332 'has_custom_constructor': bool(custom_constructors), 342 'has_custom_constructor': bool(custom_constructors),
333 'interface_length': 343 'interface_length':
334 interface_length(constructors + custom_constructors), 344 interface_length(constructors + custom_constructors),
335 'is_constructor_raises_exception': extended_attributes.get('RaisesExcept ion') == 'Constructor', # [RaisesException=Constructor] 345 'is_constructor_raises_exception': extended_attributes.get('RaisesExcept ion') == 'Constructor', # [RaisesException=Constructor]
336 'named_constructor': named_constructor, 346 'named_constructor': named_constructor,
337 'unscopables': sorted(unscopables), 347 'unscopables': sorted(unscopables),
338 }) 348 })
339 349
340 # Constants 350 # Constants
341 context.update({ 351 context.update({
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 extended_attributes = deleter.extended_attributes 1429 extended_attributes = deleter.extended_attributes
1420 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') 1430 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState')
1421 is_ce_reactions = 'CEReactions' in extended_attributes 1431 is_ce_reactions = 'CEReactions' in extended_attributes
1422 return { 1432 return {
1423 'is_call_with_script_state': is_call_with_script_state, 1433 'is_call_with_script_state': is_call_with_script_state,
1424 'is_ce_reactions': is_ce_reactions, 1434 'is_ce_reactions': is_ce_reactions,
1425 'is_custom': 'Custom' in extended_attributes, 1435 'is_custom': 'Custom' in extended_attributes,
1426 'is_raises_exception': 'RaisesException' in extended_attributes, 1436 'is_raises_exception': 'RaisesException' in extended_attributes,
1427 'name': cpp_name(deleter), 1437 'name': cpp_name(deleter),
1428 } 1438 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698