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

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

Issue 54923006: Revert "Fixing the BeforeUnloadEvent" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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 | « tools/dom/dom.json ('k') | tools/dom/templates/html/impl/impl_Window.darttemplate » ('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.
479 # TODO(jacobr): cleanup and augment this list. 477 # TODO(jacobr): cleanup and augment this list.
480 removed_html_members = monitored.Set('htmlrenamer.removed_html_members', [ 478 removed_html_members = monitored.Set('htmlrenamer.removed_html_members', [
481 'AudioBufferSourceNode.looping', # TODO(vsm): Use deprecated IDL annotation 479 'AudioBufferSourceNode.looping', # TODO(vsm): Use deprecated IDL annotation
482 'CSSStyleDeclaration.getPropertyCSSValue', 480 'CSSStyleDeclaration.getPropertyCSSValue',
483 'CanvasRenderingContext2D.clearShadow', 481 'CanvasRenderingContext2D.clearShadow',
484 'CanvasRenderingContext2D.drawImageFromRect', 482 'CanvasRenderingContext2D.drawImageFromRect',
485 'CanvasRenderingContext2D.setAlpha', 483 'CanvasRenderingContext2D.setAlpha',
486 'CanvasRenderingContext2D.setCompositeOperation', 484 'CanvasRenderingContext2D.setCompositeOperation',
487 'CanvasRenderingContext2D.setFillColor', 485 'CanvasRenderingContext2D.setFillColor',
488 'CanvasRenderingContext2D.setLineCap', 486 'CanvasRenderingContext2D.setLineCap',
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 'Element.innerText', 587 'Element.innerText',
590 'Element.on:wheel', 588 'Element.on:wheel',
591 'Element.outerText', 589 'Element.outerText',
592 'Element.removeAttributeNode', 590 'Element.removeAttributeNode',
593 'Element.set:outerHTML', 591 'Element.set:outerHTML',
594 'Element.setAttributeNode', 592 'Element.setAttributeNode',
595 'Element.setAttributeNodeNS', 593 'Element.setAttributeNodeNS',
596 'Element.webkitCreateShadowRoot', 594 'Element.webkitCreateShadowRoot',
597 'Element.webkitPseudo', 595 'Element.webkitPseudo',
598 'Element.webkitShadowRoot', 596 'Element.webkitShadowRoot',
599 '=Event.returnValue', # Only suppress on Event, allow for BeforeUnloadEvnt. 597 'Event.returnValue',
600 'Event.srcElement', 598 'Event.srcElement',
601 'EventSource.URL', 599 'EventSource.URL',
602 'FontFaceSet.load', 600 'FontFaceSet.load',
603 'FontFaceSet.ready', 601 'FontFaceSet.ready',
604 'HTMLAnchorElement.charset', 602 'HTMLAnchorElement.charset',
605 'HTMLAnchorElement.coords', 603 'HTMLAnchorElement.coords',
606 'HTMLAnchorElement.rev', 604 'HTMLAnchorElement.rev',
607 'HTMLAnchorElement.shape', 605 'HTMLAnchorElement.shape',
608 'HTMLAnchorElement.text', 606 'HTMLAnchorElement.text',
609 'HTMLAppletElement.*', 607 'HTMLAppletElement.*',
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 if self._metadata.IsDeprecated(interface, metadata_member): 838 if self._metadata.IsDeprecated(interface, metadata_member):
841 return True 839 return True
842 return False 840 return False
843 841
844 def ShouldSuppressInterface(self, interface): 842 def ShouldSuppressInterface(self, interface):
845 """ Returns true if the interface should be suppressed.""" 843 """ Returns true if the interface should be suppressed."""
846 if interface.id in _removed_html_interfaces: 844 if interface.id in _removed_html_interfaces:
847 return True 845 return True
848 846
849 def _FindMatch(self, interface, member, member_prefix, candidates): 847 def _FindMatch(self, interface, member, member_prefix, candidates):
850 def find_match(interface_id): 848 for interface in self._database.Hierarchy(interface):
851 member_name = interface_id + '.' + member 849 member_name = interface.id + '.' + member
852 if member_name in candidates: 850 if member_name in candidates:
853 return member_name 851 return member_name
854 member_name = interface_id + '.' + member_prefix + member 852 member_name = interface.id + '.' + member_prefix + member
855 if member_name in candidates: 853 if member_name in candidates:
856 return member_name 854 return member_name
857 member_name = interface_id + '.*' 855 member_name = interface.id + '.*'
858 if member_name in candidates: 856 if member_name in candidates:
859 return member_name 857 return member_name
860 858
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
871 def GetLibraryName(self, interface): 859 def GetLibraryName(self, interface):
872 # Some types have attributes merged in from many other interfaces. 860 # Some types have attributes merged in from many other interfaces.
873 if interface.id in _library_names: 861 if interface.id in _library_names:
874 return _library_names[interface.id] 862 return _library_names[interface.id]
875 863
876 # TODO(ager, blois): The conditional has been removed from indexed db, 864 # TODO(ager, blois): The conditional has been removed from indexed db,
877 # so we can no longer determine the library based on the conditionals. 865 # so we can no longer determine the library based on the conditionals.
878 if interface.id.startswith("IDB"): 866 if interface.id.startswith("IDB"):
879 return 'indexed_db' 867 return 'indexed_db'
880 if interface.id.startswith("SQL"): 868 if interface.id.startswith("SQL"):
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 945
958 # We're looking for a sequence of letters which start with capital letter 946 # We're looking for a sequence of letters which start with capital letter
959 # then a series of caps and finishes with either the end of the string or 947 # then a series of caps and finishes with either the end of the string or
960 # a capital letter. 948 # a capital letter.
961 # The [0-9] check is for names such as 2D or 3D 949 # The [0-9] check is for names such as 2D or 3D
962 # The following test cases should match as: 950 # The following test cases should match as:
963 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue 951 # WebKitCSSFilterValue: WebKit(C)(SS)(F)ilterValue
964 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change) 952 # XPathNSResolver: (X)()(P)ath(N)(S)(R)esolver (no change)
965 # IFrameElement: (I)()(F)rameElement (no change) 953 # IFrameElement: (I)()(F)rameElement (no change)
966 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name) 954 return re.sub(r'([A-Z])([A-Z]{2,})([A-Z]|$)', toLower, name)
OLDNEW
« no previous file with comments | « tools/dom/dom.json ('k') | tools/dom/templates/html/impl/impl_Window.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698