| 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 from systemfrog import * | 9 from systemfrog import * |
| 10 from systeminterface import * | 10 from systeminterface import * |
| 11 | 11 |
| 12 # Members from the standard dom that should not be exposed publicly in dart:html | 12 # Members from the standard dom that should not be exposed publicly in dart:html |
| 13 # but need to be exposed internally to implement dart:html on top of a standard | 13 # but need to be exposed internally to implement dart:html on top of a standard |
| 14 # browser. | 14 # browser. |
| 15 _private_html_members = set([ | 15 _private_html_members = set([ |
| 16 'Document.createElement', | 16 'Document.createElement', |
| 17 'Document.createElementNS', | 17 'Document.createElementNS', |
| 18 'Document.createEvent', | 18 'Document.createEvent', |
| 19 'Document.createTextNode', | 19 'Document.createTextNode', |
| 20 'Document.createTouchList', | 20 'Document.createTouchList', |
| 21 'Document.getElementById', | 21 'Document.getElementById', |
| 22 'Document.getElementsByClassName', | 22 'Document.getElementsByClassName', |
| 23 'Document.getElementsByName', | 23 'Document.getElementsByName', |
| 24 'Document.getElementsByTagName', | 24 'Document.getElementsByTagName', |
| 25 'Document.querySelector', |
| 25 'Document.querySelectorAll', | 26 'Document.querySelectorAll', |
| 27 'DocumentFragment.querySelector', |
| 26 'DocumentFragment.querySelectorAll', | 28 'DocumentFragment.querySelectorAll', |
| 27 'Element.childElementCount', | 29 'Element.childElementCount', |
| 28 'Element.children', | 30 'Element.children', |
| 29 'Element.className', | 31 'Element.className', |
| 30 'Element.clientHeight', | 32 'Element.clientHeight', |
| 31 'Element.clientLeft', | 33 'Element.clientLeft', |
| 32 'Element.clientTop', | 34 'Element.clientTop', |
| 33 'Element.clientWidth', | 35 'Element.clientWidth', |
| 34 'Element.firstElementChild', | 36 'Element.firstElementChild', |
| 35 'Element.getAttribute', | 37 'Element.getAttribute', |
| 36 'Element.getBoundingClientRect', | 38 'Element.getBoundingClientRect', |
| 37 'Element.getClientRects', | 39 'Element.getClientRects', |
| 38 'Element.getElementsByClassName', | 40 'Element.getElementsByClassName', |
| 39 'Element.getElementsByTagName', | 41 'Element.getElementsByTagName', |
| 40 'Element.hasAttribute', | 42 'Element.hasAttribute', |
| 41 'Element.lastElementChild', | 43 'Element.lastElementChild', |
| 42 'Element.offsetHeight', | 44 'Element.offsetHeight', |
| 43 'Element.offsetLeft', | 45 'Element.offsetLeft', |
| 44 'Element.offsetTop', | 46 'Element.offsetTop', |
| 45 'Element.offsetWidth', | 47 'Element.offsetWidth', |
| 48 'Element.querySelector', |
| 46 'Element.querySelectorAll', | 49 'Element.querySelectorAll', |
| 47 'Element.removeAttribute', | 50 'Element.removeAttribute', |
| 48 'Element.scrollHeight', | 51 'Element.scrollHeight', |
| 49 'Element.scrollLeft', | 52 'Element.scrollLeft', |
| 50 'Element.scrollTop', | 53 'Element.scrollTop', |
| 51 'Element.scrollWidth', | 54 'Element.scrollWidth', |
| 52 'Element.setAttribute', | 55 'Element.setAttribute', |
| 53 'Event.initEvent', | 56 'Event.initEvent', |
| 54 'EventTarget.addEventListener', | 57 'EventTarget.addEventListener', |
| 55 'EventTarget.dispatchEvent', | 58 'EventTarget.dispatchEvent', |
| 56 'EventTarget.removeEventListener', | 59 'EventTarget.removeEventListener', |
| 57 'MouseEvent.initMouseEvent', | 60 'MouseEvent.initMouseEvent', |
| 58 'Node.appendChild', | 61 'Node.appendChild', |
| 59 'Node.attributes', | 62 'Node.attributes', |
| 60 'Node.childNodes', | 63 'Node.childNodes', |
| 61 'Node.firstChild', | 64 'Node.firstChild', |
| 62 'Node.lastChild', | 65 'Node.lastChild', |
| 63 "Node.nodeType", | 66 "Node.nodeType", |
| 64 'Node.removeChild', | 67 'Node.removeChild', |
| 65 'Node.replaceChild', | 68 'Node.replaceChild', |
| 66 'NodeSelector.querySelectorAll', | |
| 67 'Storage.length', | 69 'Storage.length', |
| 68 'Storage.clear', | 70 'Storage.clear', |
| 69 'Storage.getItem', | 71 'Storage.getItem', |
| 70 'Storage.key', | 72 'Storage.key', |
| 71 'Storage.removeItem', | 73 'Storage.removeItem', |
| 72 'Storage.setItem', | 74 'Storage.setItem', |
| 73 'Window.getComputedStyle', | 75 'Window.getComputedStyle', |
| 74 ]) | 76 ]) |
| 75 | 77 |
| 76 # Members from the standard dom that exist in the dart:html library with | 78 # Members from the standard dom that exist in the dart:html library with |
| 77 # identical functionality but with cleaner names. | 79 # identical functionality but with cleaner names. |
| 78 _html_library_renames = { | 80 _html_library_renames = { |
| 79 'Document.defaultView': 'window', | 81 'Document.defaultView': 'window', |
| 80 'DocumentFragment.querySelector': 'query', | |
| 81 'NodeSelector.querySelector': 'query', | |
| 82 'Element.querySelector': 'query', | |
| 83 'Element.webkitMatchesSelector' : 'matchesSelector', | 82 'Element.webkitMatchesSelector' : 'matchesSelector', |
| 84 'Element.scrollIntoViewIfNeeded': 'scrollIntoView', | 83 'Element.scrollIntoViewIfNeeded': 'scrollIntoView', |
| 85 'Node.cloneNode': 'clone', | 84 'Node.cloneNode': 'clone', |
| 86 'Node.nextSibling': 'nextNode', | 85 'Node.nextSibling': 'nextNode', |
| 87 'Node.ownerDocument': 'document', | 86 'Node.ownerDocument': 'document', |
| 88 'Node.parentNode': 'parent', | 87 'Node.parentNode': 'parent', |
| 89 'Node.previousSibling': 'previousNode', | 88 'Node.previousSibling': 'previousNode', |
| 90 'Node.textContent': 'text', | 89 'Node.textContent': 'text', |
| 91 'SVGElement.className': '$dom_svgClassName', | 90 'SVGElement.className': '$dom_svgClassName', |
| 92 'SVGAnimatedString.className': '$dom_svgClassName', | 91 'SVGAnimatedString.className': '$dom_svgClassName', |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 "Node.set:nodeValue", | 249 "Node.set:nodeValue", |
| 251 "Node.get:CDATA_SECTION_NODE", | 250 "Node.get:CDATA_SECTION_NODE", |
| 252 "Node.get:nodeName", | 251 "Node.get:nodeName", |
| 253 "Node.lookupPrefix", | 252 "Node.lookupPrefix", |
| 254 "Node.get:PROCESSING_INSTRUCTION_NODE", | 253 "Node.get:PROCESSING_INSTRUCTION_NODE", |
| 255 "IFrameElement.get:contentDocument", | 254 "IFrameElement.get:contentDocument", |
| 256 "Window.get:frameElement", | 255 "Window.get:frameElement", |
| 257 ]) | 256 ]) |
| 258 | 257 |
| 259 _html_library_custom = set([ | 258 _html_library_custom = set([ |
| 260 'Document.querySelector', | |
| 261 'IFrameElement.get:contentWindow', | 259 'IFrameElement.get:contentWindow', |
| 262 'Window.get:document', | 260 'Window.get:document', |
| 263 'Window.get:top', | 261 'Window.get:top', |
| 264 ]) | 262 ]) |
| 265 | 263 |
| 266 # Events without onEventName attributes in the IDL we want to support. | 264 # Events without onEventName attributes in the IDL we want to support. |
| 267 # We can automatically extract most event event names by checking for | 265 # We can automatically extract most event event names by checking for |
| 268 # onEventName methods in the IDL but some events aren't listed so we need | 266 # onEventName methods in the IDL but some events aren't listed so we need |
| 269 # to manually add them here so that they are easy for users to find. | 267 # to manually add them here so that they are easy for users to find. |
| 270 _html_manual_events = { | 268 _html_manual_events = { |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 Collect(database.GetInterface(parent.type.id), | 1315 Collect(database.GetInterface(parent.type.id), |
| 1318 seen, collected) | 1316 seen, collected) |
| 1319 | 1317 |
| 1320 inheritance_closure = {} | 1318 inheritance_closure = {} |
| 1321 for interface in database.GetInterfaces(): | 1319 for interface in database.GetInterfaces(): |
| 1322 seen = set() | 1320 seen = set() |
| 1323 collected = [] | 1321 collected = [] |
| 1324 Collect(interface, seen, collected) | 1322 Collect(interface, seen, collected) |
| 1325 inheritance_closure[interface.id] = collected | 1323 inheritance_closure[interface.id] = collected |
| 1326 return inheritance_closure | 1324 return inheritance_closure |
| OLD | NEW |