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

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

Issue 12851013: Adding web_gl library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: sync to tot Created 7 years, 8 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 | « tools/dom/scripts/dartdomgenerator.py ('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',
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 676
677 if 'Conditional' in interface.ext_attrs: 677 if 'Conditional' in interface.ext_attrs:
678 if 'WEB_AUDIO' in interface.ext_attrs['Conditional']: 678 if 'WEB_AUDIO' in interface.ext_attrs['Conditional']:
679 return 'web_audio' 679 return 'web_audio'
680 if 'SVG' in interface.ext_attrs['Conditional']: 680 if 'SVG' in interface.ext_attrs['Conditional']:
681 return 'svg' 681 return 'svg'
682 if 'INDEXED_DATABASE' in interface.ext_attrs['Conditional']: 682 if 'INDEXED_DATABASE' in interface.ext_attrs['Conditional']:
683 return 'indexed_db' 683 return 'indexed_db'
684 if 'SQL_DATABASE' in interface.ext_attrs['Conditional']: 684 if 'SQL_DATABASE' in interface.ext_attrs['Conditional']:
685 return 'web_sql' 685 return 'web_sql'
686 if 'WEBGL' in interface.ext_attrs['Conditional']:
687 return 'web_gl'
686 688
687 return 'html' 689 return 'html'
688 690
689 def DartifyTypeName(self, type_name): 691 def DartifyTypeName(self, type_name):
690 """Converts a DOM name to a Dart-friendly class name. """ 692 """Converts a DOM name to a Dart-friendly class name. """
691 693
692 if type_name in html_interface_renames: 694 if type_name in html_interface_renames:
693 return html_interface_renames[type_name] 695 return html_interface_renames[type_name]
694 696
695 # Strip off any standard prefixes. 697 # Strip off any standard prefixes.
696 name = re.sub(r'^SVG', '', type_name) 698 name = re.sub(r'^SVG', '', type_name)
697 name = re.sub(r'^IDB', '', name) 699 name = re.sub(r'^IDB', '', name)
700 name = re.sub(r'^WebGL', '', name)
698 701
699 return self._CamelCaseName(name) 702 return self._CamelCaseName(name)
700 703
701 def _DartifyMemberName(self, member_name): 704 def _DartifyMemberName(self, member_name):
702 # Strip off any OpenGL ES suffixes. 705 # Strip off any OpenGL ES suffixes.
703 name = re.sub(r'OES$', '', member_name) 706 name = re.sub(r'OES$', '', member_name)
704 return self._CamelCaseName(name) 707 return self._CamelCaseName(name)
705 708
706 def _CamelCaseName(self, name): 709 def _CamelCaseName(self, name):
707 710
708 def toLower(match): 711 def toLower(match):
709 return match.group(1) + match.group(2).lower() + match.group(3) 712 return match.group(1) + match.group(2).lower() + match.group(3)
710 713
711 # We're looking for a sequence of letters which start with capital letter 714 # We're looking for a sequence of letters which start with capital letter
712 # then a series of caps and finishes with either the end of the string or 715 # then a series of caps and finishes with either the end of the string or
713 # a capital letter. 716 # a capital letter.
714 # The [0-9] check is for names such as 2D or 3D 717 # The [0-9] check is for names such as 2D or 3D
715 # The following test cases should match as: 718 # The following test cases should match as:
716 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue 719 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue
717 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) 720 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change)
718 # IFrameElement: (I)()(F)rameElement (no change) 721 # IFrameElement: (I)()(F)rameElement (no change)
719 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) 722 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name)
OLDNEW
« no previous file with comments | « tools/dom/scripts/dartdomgenerator.py ('k') | tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698