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

Side by Side Diff: tools/dom/scripts/htmlrenamer.py

Issue 11871018: Revert "Fixing up Navigator.getUserMedia." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « tests/html/media_stream_test.dart ('k') | tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import logging 5 import logging
6 import monitored 6 import monitored
7 import re 7 import re
8 8
9 html_interface_renames = monitored.Dict('htmlrenamer.html_interface_renames', { 9 html_interface_renames = monitored.Dict('htmlrenamer.html_interface_renames', {
10 'CDATASection': 'CDataSection', 10 'CDATASection': 'CDataSection',
11 'DOMApplicationCache': 'ApplicationCache', 11 'DOMApplicationCache': 'ApplicationCache',
12 'DOMCoreException': 'DomException', 12 'DOMCoreException': 'DomException',
13 'DOMFileSystem': 'FileSystem', 13 'DOMFileSystem': 'FileSystem',
14 'DOMFileSystemSync': 'FileSystemSync', 14 'DOMFileSystemSync': 'FileSystemSync',
15 'DOMFormData': 'FormData', 15 'DOMFormData': 'FormData',
16 'DOMURL': 'Url', 16 'DOMURL': 'Url',
17 'DOMWindow': 'Window', 17 'DOMWindow': 'Window',
18 'HTMLAppletElement' : '_AppletElement', 18 'HTMLAppletElement' : '_AppletElement',
19 'HTMLBaseFontElement' : '_BaseFontElement', 19 'HTMLBaseFontElement' : '_BaseFontElement',
20 'HTMLDirectoryElement' : '_DirectoryElement', 20 'HTMLDirectoryElement' : '_DirectoryElement',
21 'HTMLDocument' : 'HtmlDocument', 21 'HTMLDocument' : 'HtmlDocument',
22 'HTMLFontElement' : '_FontElement', 22 'HTMLFontElement' : '_FontElement',
23 'HTMLFrameElement' : '_FrameElement', 23 'HTMLFrameElement' : '_FrameElement',
24 'HTMLFrameSetElement' : '_FrameSetElement', 24 'HTMLFrameSetElement' : '_FrameSetElement',
25 'HTMLMarqueeElement' : '_MarqueeElement', 25 'HTMLMarqueeElement' : '_MarqueeElement',
26 'IDBAny': '_Any', # Suppressed, but needs to exist for Dartium. 26 'IDBAny': '_Any', # Suppressed, but needs to exist for Dartium.
27 'IDBFactory': 'IdbFactory', # Manual to avoid name conflicts. 27 'IDBFactory': 'IdbFactory', # Manual to avoid name conflicts.
28 'NavigatorUserMediaErrorCallback': '_NavigatorUserMediaErrorCallback',
29 'NavigatorUserMediaSuccessCallback': '_NavigatorUserMediaSuccessCallback',
30 'SVGDocument': 'SvgDocument', # Manual to avoid name conflicts. 28 'SVGDocument': 'SvgDocument', # Manual to avoid name conflicts.
31 'SVGElement': 'SvgElement', # Manual to avoid name conflicts. 29 'SVGElement': 'SvgElement', # Manual to avoid name conflicts.
32 'SVGException': 'SvgException', # Manual of avoid conflict with Exception. 30 'SVGException': 'SvgException', # Manual of avoid conflict with Exception.
33 'SVGSVGElement': 'SvgSvgElement', # Manual to avoid name conflicts. 31 'SVGSVGElement': 'SvgSvgElement', # Manual to avoid name conflicts.
34 'WebGLVertexArrayObjectOES': 'WebGLVertexArrayObject', 32 'WebGLVertexArrayObjectOES': 'WebGLVertexArrayObject',
35 'WebKitAnimationEvent': 'AnimationEvent', 33 'WebKitAnimationEvent': 'AnimationEvent',
36 'WebKitCSSKeyframeRule': 'CssKeyframeRule', 34 'WebKitCSSKeyframeRule': 'CssKeyframeRule',
37 'WebKitCSSKeyframesRule': 'CssKeyframesRule', 35 'WebKitCSSKeyframesRule': 'CssKeyframesRule',
38 'WebKitCSSMatrix': 'CssMatrix', 36 'WebKitCSSMatrix': 'CssMatrix',
39 'WebKitCSSTransformValue': 'CssTransformValue', 37 'WebKitCSSTransformValue': 'CssTransformValue',
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 'DOMWindow.webkitNotifications': 'notifications', 148 'DOMWindow.webkitNotifications': 'notifications',
151 'DOMWindow.webkitRequestFileSystem': 'requestFileSystem', 149 'DOMWindow.webkitRequestFileSystem': 'requestFileSystem',
152 'DOMWindow.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl', 150 'DOMWindow.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl',
153 'DOMWindow.webkitRequestFileSystem': 'requestFileSystem', 151 'DOMWindow.webkitRequestFileSystem': 'requestFileSystem',
154 'DOMWindow.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl', 152 'DOMWindow.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl',
155 'Document.createCDATASection': 'createCDataSection', 153 'Document.createCDATASection': 'createCDataSection',
156 'Document.defaultView': 'window', 154 'Document.defaultView': 'window',
157 'Element.scrollIntoViewIfNeeded': 'scrollIntoView', 155 'Element.scrollIntoViewIfNeeded': 'scrollIntoView',
158 'Element.webkitCreateShadowRoot': 'createShadowRoot', 156 'Element.webkitCreateShadowRoot': 'createShadowRoot',
159 'Element.webkitMatchesSelector' : 'matches', 157 'Element.webkitMatchesSelector' : 'matches',
160 'Navigator.webkitGetUserMedia': '_getUserMedia',
161 'Node.cloneNode': 'clone', 158 'Node.cloneNode': 'clone',
162 'Node.nextSibling': 'nextNode', 159 'Node.nextSibling': 'nextNode',
163 'Node.ownerDocument': 'document', 160 'Node.ownerDocument': 'document',
164 'Node.parentElement': 'parent', 161 'Node.parentElement': 'parent',
165 'Node.previousSibling': 'previousNode', 162 'Node.previousSibling': 'previousNode',
166 'Node.textContent': 'text', 163 'Node.textContent': 'text',
167 'SVGElement.className': '$dom_svgClassName', 164 'SVGElement.className': '$dom_svgClassName',
168 'SVGStylable.className': '$dom_svgClassName', 165 'SVGStylable.className': '$dom_svgClassName',
169 'WorkerContext.webkitRequestFileSystem': 'requestFileSystem', 166 'WorkerContext.webkitRequestFileSystem': 'requestFileSystem',
170 'WorkerContext.webkitRequestFileSystemSync': 'requestFileSystemSync', 167 'WorkerContext.webkitRequestFileSystemSync': 'requestFileSystemSync',
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 if 'SVG' in interface.ext_attrs['Conditional']: 505 if 'SVG' in interface.ext_attrs['Conditional']:
509 return 'svg' 506 return 'svg'
510 if 'INDEXED_DATABASE' in interface.ext_attrs['Conditional']: 507 if 'INDEXED_DATABASE' in interface.ext_attrs['Conditional']:
511 return 'indexed_db' 508 return 'indexed_db'
512 509
513 return 'html' 510 return 'html'
514 511
515 def DartifyTypeName(self, type_name): 512 def DartifyTypeName(self, type_name):
516 """Converts a DOM name to a Dart-friendly class name. """ 513 """Converts a DOM name to a Dart-friendly class name. """
517 514
518 if type_name in html_interface_renames:
519 return html_interface_renames[type_name]
520
521 # Strip off any standard prefixes. 515 # Strip off any standard prefixes.
522 name = re.sub(r'^SVG', '', type_name) 516 name = re.sub(r'^SVG', '', type_name)
523 name = re.sub(r'^IDB', '', name) 517 name = re.sub(r'^IDB', '', name)
524 518
525 return self._CamelCaseName(name) 519 return self._CamelCaseName(name)
526 520
527 def _DartifyMemberName(self, member_name): 521 def _DartifyMemberName(self, member_name):
528 # Strip off any OpenGL ES suffixes. 522 # Strip off any OpenGL ES suffixes.
529 name = re.sub(r'OES$', '', member_name) 523 name = re.sub(r'OES$', '', member_name)
530 return self._CamelCaseName(name) 524 return self._CamelCaseName(name)
531 525
532 def _CamelCaseName(self, name): 526 def _CamelCaseName(self, name):
533 527
534 def toLower(match): 528 def toLower(match):
535 return match.group(1) + match.group(2).lower() + match.group(3) 529 return match.group(1) + match.group(2).lower() + match.group(3)
536 530
537 # We're looking for a sequence of letters which start with capital letter 531 # We're looking for a sequence of letters which start with capital letter
538 # then a series of caps and finishes with either the end of the string or 532 # then a series of caps and finishes with either the end of the string or
539 # a capital letter. 533 # a capital letter.
540 # The [0-9] check is for names such as 2D or 3D 534 # The [0-9] check is for names such as 2D or 3D
541 # The following test cases should match as: 535 # The following test cases should match as:
542 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue 536 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue
543 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) 537 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change)
544 # IFrameElement: (I)()(F)rameElement (no change) 538 # IFrameElement: (I)()(F)rameElement (no change)
545 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) 539 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name)
OLDNEW
« no previous file with comments | « tests/html/media_stream_test.dart ('k') | tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698