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

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

Issue 56933002: Version 0.8.10.1 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 | « dart/tools/dom/dom.json ('k') | dart/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 typed_array_renames = { 9 typed_array_renames = {
10 'ArrayBuffer': 'ByteBuffer', 10 'ArrayBuffer': 'ByteBuffer',
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 renamed_html_members[member] = '_' + renamed_html_members[member] 467 renamed_html_members[member] = '_' + renamed_html_members[member]
468 else: 468 else:
469 renamed_html_members[member] = '_' + member[member.find('.') + 1 :] 469 renamed_html_members[member] = '_' + member[member.find('.') + 1 :]
470 470
471 # Members and classes from the dom that should be removed completely from 471 # Members and classes from the dom that should be removed completely from
472 # dart:html. These could be expressed in the IDL instead but expressing this 472 # dart:html. These could be expressed in the IDL instead but expressing this
473 # as a simple table instead is more concise. 473 # as a simple table instead is more concise.
474 # Syntax is: ClassName.(get\:|set\:|call\:|on\:)?MemberName 474 # Syntax is: ClassName.(get\:|set\:|call\:|on\:)?MemberName
475 # Using get: and set: is optional and should only be used when a getter needs 475 # Using get: and set: is optional and should only be used when a getter needs
476 # to be suppressed but not the setter, etc. 476 # to be suppressed but not the setter, etc.
477 # Prepending ClassName with = will only match against direct class, not for
478 # subclasses.
477 # TODO(jacobr): cleanup and augment this list. 479 # TODO(jacobr): cleanup and augment this list.
478 removed_html_members = monitored.Set('htmlrenamer.removed_html_members', [ 480 removed_html_members = monitored.Set('htmlrenamer.removed_html_members', [
479 'AudioBufferSourceNode.looping', # TODO(vsm): Use deprecated IDL annotation 481 'AudioBufferSourceNode.looping', # TODO(vsm): Use deprecated IDL annotation
480 'CSSStyleDeclaration.getPropertyCSSValue', 482 'CSSStyleDeclaration.getPropertyCSSValue',
481 'CanvasRenderingContext2D.clearShadow', 483 'CanvasRenderingContext2D.clearShadow',
482 'CanvasRenderingContext2D.drawImageFromRect', 484 'CanvasRenderingContext2D.drawImageFromRect',
483 'CanvasRenderingContext2D.setAlpha', 485 'CanvasRenderingContext2D.setAlpha',
484 'CanvasRenderingContext2D.setCompositeOperation', 486 'CanvasRenderingContext2D.setCompositeOperation',
485 'CanvasRenderingContext2D.setFillColor', 487 'CanvasRenderingContext2D.setFillColor',
486 'CanvasRenderingContext2D.setLineCap', 488 'CanvasRenderingContext2D.setLineCap',
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 'Element.innerText', 589 'Element.innerText',
588 'Element.on:wheel', 590 'Element.on:wheel',
589 'Element.outerText', 591 'Element.outerText',
590 'Element.removeAttributeNode', 592 'Element.removeAttributeNode',
591 'Element.set:outerHTML', 593 'Element.set:outerHTML',
592 'Element.setAttributeNode', 594 'Element.setAttributeNode',
593 'Element.setAttributeNodeNS', 595 'Element.setAttributeNodeNS',
594 'Element.webkitCreateShadowRoot', 596 'Element.webkitCreateShadowRoot',
595 'Element.webkitPseudo', 597 'Element.webkitPseudo',
596 'Element.webkitShadowRoot', 598 'Element.webkitShadowRoot',
597 'Event.returnValue', 599 '=Event.returnValue', # Only suppress on Event, allow for BeforeUnloadEvnt.
598 'Event.srcElement', 600 'Event.srcElement',
599 'EventSource.URL', 601 'EventSource.URL',
600 'FontFaceSet.load', 602 'FontFaceSet.load',
601 'FontFaceSet.ready', 603 'FontFaceSet.ready',
602 'HTMLAnchorElement.charset', 604 'HTMLAnchorElement.charset',
603 'HTMLAnchorElement.coords', 605 'HTMLAnchorElement.coords',
604 'HTMLAnchorElement.rev', 606 'HTMLAnchorElement.rev',
605 'HTMLAnchorElement.shape', 607 'HTMLAnchorElement.shape',
606 'HTMLAnchorElement.text', 608 'HTMLAnchorElement.text',
607 'HTMLAppletElement.*', 609 'HTMLAppletElement.*',
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 if self._metadata.IsDeprecated(interface, metadata_member): 840 if self._metadata.IsDeprecated(interface, metadata_member):
839 return True 841 return True
840 return False 842 return False
841 843
842 def ShouldSuppressInterface(self, interface): 844 def ShouldSuppressInterface(self, interface):
843 """ Returns true if the interface should be suppressed.""" 845 """ Returns true if the interface should be suppressed."""
844 if interface.id in _removed_html_interfaces: 846 if interface.id in _removed_html_interfaces:
845 return True 847 return True
846 848
847 def _FindMatch(self, interface, member, member_prefix, candidates): 849 def _FindMatch(self, interface, member, member_prefix, candidates):
848 for interface in self._database.Hierarchy(interface): 850 def find_match(interface_id):
849 member_name = interface.id + '.' + member 851 member_name = interface_id + '.' + member
850 if member_name in candidates: 852 if member_name in candidates:
851 return member_name 853 return member_name
852 member_name = interface.id + '.' + member_prefix + member 854 member_name = interface_id + '.' + member_prefix + member
853 if member_name in candidates: 855 if member_name in candidates:
854 return member_name 856 return member_name
855 member_name = interface.id + '.*' 857 member_name = interface_id + '.*'
856 if member_name in candidates: 858 if member_name in candidates:
857 return member_name 859 return member_name
858 860
861 # Check direct matches first
862 match = find_match('=%s' % interface.id)
863 if match:
864 return match
865
866 for interface in self._database.Hierarchy(interface):
867 match = find_match(interface.id)
868 if match:
869 return match
870
859 def GetLibraryName(self, interface): 871 def GetLibraryName(self, interface):
860 # Some types have attributes merged in from many other interfaces. 872 # Some types have attributes merged in from many other interfaces.
861 if interface.id in _library_names: 873 if interface.id in _library_names:
862 return _library_names[interface.id] 874 return _library_names[interface.id]
863 875
864 # TODO(ager, blois): The conditional has been removed from indexed db, 876 # TODO(ager, blois): The conditional has been removed from indexed db,
865 # so we can no longer determine the library based on the conditionals. 877 # so we can no longer determine the library based on the conditionals.
866 if interface.id.startswith("IDB"): 878 if interface.id.startswith("IDB"):
867 return 'indexed_db' 879 return 'indexed_db'
868 if interface.id.startswith("SQL"): 880 if interface.id.startswith("SQL"):
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 957
946 # We're looking for a sequence of letters which start with capital letter 958 # We're looking for a sequence of letters which start with capital letter
947 # then a series of caps and finishes with either the end of the string or 959 # then a series of caps and finishes with either the end of the string or
948 # a capital letter. 960 # a capital letter.
949 # The [0-9] check is for names such as 2D or 3D 961 # The [0-9] check is for names such as 2D or 3D
950 # The following test cases should match as: 962 # The following test cases should match as:
951 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue 963 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue
952 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) 964 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change)
953 # IFrameElement: (I)()(F)rameElement (no change) 965 # IFrameElement: (I)()(F)rameElement (no change)
954 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) 966 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name)
OLDNEW
« no previous file with comments | « dart/tools/dom/dom.json ('k') | dart/tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698