| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """This module provides shared functionality for the system to generate | 6 """This module provides shared functionality for the system to generate |
| 7 Dart:html APIs from the IDL database.""" | 7 Dart:html APIs from the IDL database.""" |
| 8 | 8 |
| 9 import emitter | 9 import emitter |
| 10 import os | 10 import os |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 'HTMLKeygenElement': "Element.isTagSupported('keygen') " | 82 'HTMLKeygenElement': "Element.isTagSupported('keygen') " |
| 83 "&& (new Element.tag('keygen') is KeygenElement)", | 83 "&& (new Element.tag('keygen') is KeygenElement)", |
| 84 'HTMLMeterElement': "Element.isTagSupported('meter')", | 84 'HTMLMeterElement': "Element.isTagSupported('meter')", |
| 85 'HTMLObjectElement': "Element.isTagSupported('object')", | 85 'HTMLObjectElement': "Element.isTagSupported('object')", |
| 86 'HTMLOutputElement': "Element.isTagSupported('output')", | 86 'HTMLOutputElement': "Element.isTagSupported('output')", |
| 87 'HTMLProgressElement': "Element.isTagSupported('progress')", | 87 'HTMLProgressElement': "Element.isTagSupported('progress')", |
| 88 'HTMLShadowElement': "Element.isTagSupported('shadow')", | 88 'HTMLShadowElement': "Element.isTagSupported('shadow')", |
| 89 'HTMLTrackElement': "Element.isTagSupported('track')", | 89 'HTMLTrackElement': "Element.isTagSupported('track')", |
| 90 'NotificationCenter': "JS('bool', '!!(window.webkitNotifications)')", | 90 'NotificationCenter': "JS('bool', '!!(window.webkitNotifications)')", |
| 91 'Performance': "JS('bool', '!!(window.performance)')", | 91 'Performance': "JS('bool', '!!(window.performance)')", |
| 92 'SpeechRecognition': "JS('bool', '!!(window.SpeechRecognition || " |
| 93 "window.webkitSpeechRecognition)')", |
| 92 'WebSocket': "JS('bool', 'typeof window.WebSocket != \"undefined\"')", | 94 'WebSocket': "JS('bool', 'typeof window.WebSocket != \"undefined\"')", |
| 93 } | 95 } |
| 94 | 96 |
| 95 # Classes that offer only static methods, and therefore we should suppress | 97 # Classes that offer only static methods, and therefore we should suppress |
| 96 # constructor creation. | 98 # constructor creation. |
| 97 _static_classes = set(['Url']) | 99 _static_classes = set(['Url']) |
| 98 | 100 |
| 99 # Information for generating element constructors. | 101 # Information for generating element constructors. |
| 100 # | 102 # |
| 101 # TODO(sra): maybe remove all the argument complexity and use cascades. | 103 # TODO(sra): maybe remove all the argument complexity and use cascades. |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 return self._interface.doc_js_name in js_support_checks | 507 return self._interface.doc_js_name in js_support_checks |
| 506 | 508 |
| 507 def GetSupportCheck(self): | 509 def GetSupportCheck(self): |
| 508 return js_support_checks.get(self._interface.doc_js_name) | 510 return js_support_checks.get(self._interface.doc_js_name) |
| 509 | 511 |
| 510 def EmitStaticFactory(self, constructor_info): | 512 def EmitStaticFactory(self, constructor_info): |
| 511 WITH_CUSTOM_STATIC_FACTORY = [ | 513 WITH_CUSTOM_STATIC_FACTORY = [ |
| 512 'AudioContext', | 514 'AudioContext', |
| 513 'Blob', | 515 'Blob', |
| 514 'MutationObserver', | 516 'MutationObserver', |
| 517 'SpeechRecognition', |
| 515 ] | 518 ] |
| 516 | 519 |
| 517 if self._interface.doc_js_name in WITH_CUSTOM_STATIC_FACTORY: | 520 if self._interface.doc_js_name in WITH_CUSTOM_STATIC_FACTORY: |
| 518 return | 521 return |
| 519 | 522 |
| 520 has_optional = any(param_info.is_optional | 523 has_optional = any(param_info.is_optional |
| 521 for param_info in constructor_info.param_infos) | 524 for param_info in constructor_info.param_infos) |
| 522 | 525 |
| 523 def FormatJS(index): | 526 def FormatJS(index): |
| 524 arguments = constructor_info.ParametersAsArgumentList(index) | 527 arguments = constructor_info.ParametersAsArgumentList(index) |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 for library_name in libraries: | 1047 for library_name in libraries: |
| 1045 self._libraries[library_name] = DartLibrary( | 1048 self._libraries[library_name] = DartLibrary( |
| 1046 library_name, template_loader, library_type, output_dir) | 1049 library_name, template_loader, library_type, output_dir) |
| 1047 | 1050 |
| 1048 def AddFile(self, basename, library_name, path): | 1051 def AddFile(self, basename, library_name, path): |
| 1049 self._libraries[library_name].AddFile(path) | 1052 self._libraries[library_name].AddFile(path) |
| 1050 | 1053 |
| 1051 def Emit(self, emitter, auxiliary_dir): | 1054 def Emit(self, emitter, auxiliary_dir): |
| 1052 for lib in self._libraries.values(): | 1055 for lib in self._libraries.values(): |
| 1053 lib.Emit(emitter, auxiliary_dir) | 1056 lib.Emit(emitter, auxiliary_dir) |
| OLD | NEW |