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

Side by Side Diff: Source/bindings/scripts/v8_types.py

Issue 386353002: Implement reflected attributes of HTMLMarqueeElement in Blink-in-JS (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 idl_type = IdlType('double', is_nullable=idl_type.is_nullable) 532 idl_type = IdlType('double', is_nullable=idl_type.is_nullable)
533 cpp_value = 'static_cast<double>(%s)' % cpp_value 533 cpp_value = 'static_cast<double>(%s)' % cpp_value
534 # HTML5 says that unsigned reflected attributes should be in the range 534 # HTML5 says that unsigned reflected attributes should be in the range
535 # [0, 2^31). When a value isn't in this range, a default value (or 0) 535 # [0, 2^31). When a value isn't in this range, a default value (or 0)
536 # should be returned instead. 536 # should be returned instead.
537 extended_attributes = extended_attributes or {} 537 extended_attributes = extended_attributes or {}
538 if ('Reflect' in extended_attributes and 538 if ('Reflect' in extended_attributes and
539 idl_type.base_type in ['unsigned long', 'unsigned short']): 539 idl_type.base_type in ['unsigned long', 'unsigned short']):
540 cpp_value = cpp_value.replace('getUnsignedIntegralAttribute', 540 cpp_value = cpp_value.replace('getUnsignedIntegralAttribute',
541 'getIntegralAttribute') 541 'getIntegralAttribute')
542 cpp_value = 'std::max(0, %s)' % cpp_value 542 cpp_value = 'std::max(0, static_cast<int>(%s))' % cpp_value
543 return idl_type, cpp_value 543 return idl_type, cpp_value
544 544
545 545
546 def v8_conversion_type(idl_type, extended_attributes): 546 def v8_conversion_type(idl_type, extended_attributes):
547 """Returns V8 conversion type, adding any additional includes. 547 """Returns V8 conversion type, adding any additional includes.
548 548
549 The V8 conversion type is used to select the C++ -> V8 conversion function 549 The V8 conversion type is used to select the C++ -> V8 conversion function
550 or v8SetReturnValue* function; it can be an idl_type, a cpp_type, or a 550 or v8SetReturnValue* function; it can be an idl_type, a cpp_type, or a
551 separate name for the type of conversion (e.g., 'DOMWrapper'). 551 separate name for the type of conversion (e.g., 'DOMWrapper').
552 """ 552 """
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 741
742 def is_explicit_nullable(idl_type): 742 def is_explicit_nullable(idl_type):
743 # Nullable type that isn't implicit nullable (see above.) For such types, 743 # Nullable type that isn't implicit nullable (see above.) For such types,
744 # we use Nullable<T> or similar explicit ways to represent a null value. 744 # we use Nullable<T> or similar explicit ways to represent a null value.
745 return idl_type.is_nullable and not idl_type.is_implicit_nullable 745 return idl_type.is_nullable and not idl_type.is_implicit_nullable
746 746
747 IdlType.is_implicit_nullable = property(is_implicit_nullable) 747 IdlType.is_implicit_nullable = property(is_implicit_nullable)
748 IdlType.is_explicit_nullable = property(is_explicit_nullable) 748 IdlType.is_explicit_nullable = property(is_explicit_nullable)
749 IdlUnionType.is_implicit_nullable = False 749 IdlUnionType.is_implicit_nullable = False
750 IdlUnionType.is_explicit_nullable = property(is_explicit_nullable) 750 IdlUnionType.is_explicit_nullable = property(is_explicit_nullable)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698