diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart index 1bb284fe162..77a36ed1898 100644 --- a/sdk/lib/html/dart2js/html_dart2js.dart +++ b/sdk/lib/html/dart2js/html_dart2js.dart @@ -744,6 +744,7 @@ class AnimationEffectTiming extends AnimationEffectTimingReadOnly { // Shadowing definition. + @Returns('num|String|Null') Object get duration native; set duration(Object value) native; diff --git a/sdk/lib/svg/dart2js/svg_dart2js.dart b/sdk/lib/svg/dart2js/svg_dart2js.dart index 5704564d778..c54ac08c685 100644 --- a/sdk/lib/svg/dart2js/svg_dart2js.dart +++ b/sdk/lib/svg/dart2js/svg_dart2js.dart @@ -3244,7 +3244,7 @@ class SvgElement extends Element implements GlobalEventHandlers, NoncedElement { SvgElement.created() : super.created(); // Shadowing definition. - + @JSName('className') AnimatedString get _svgClassName native; @JSName('ownerSVGElement') diff --git a/sdk_nnbd/lib/html/dart2js/html_dart2js.dart b/sdk_nnbd/lib/html/dart2js/html_dart2js.dart index 94b857b4936..04dcc3d96ea 100644 --- a/sdk_nnbd/lib/html/dart2js/html_dart2js.dart +++ b/sdk_nnbd/lib/html/dart2js/html_dart2js.dart @@ -745,6 +745,7 @@ class AnimationEffectTiming extends AnimationEffectTimingReadOnly { // Shadowing definition. + @Returns('num|String|Null') Object? get duration native; set duration(Object? value) native; diff --git a/sdk_nnbd/lib/svg/dart2js/svg_dart2js.dart b/sdk_nnbd/lib/svg/dart2js/svg_dart2js.dart index eea4d4995fc..ebb90155e14 100644 --- a/sdk_nnbd/lib/svg/dart2js/svg_dart2js.dart +++ b/sdk_nnbd/lib/svg/dart2js/svg_dart2js.dart @@ -3282,7 +3282,7 @@ class SvgElement extends Element implements GlobalEventHandlers, NoncedElement { SvgElement.created() : super.created(); // Shadowing definition. - + @JSName('className') AnimatedString get _svgClassName native; @JSName('ownerSVGElement') diff --git a/tools/dom/scripts/dartmetadata.py b/tools/dom/scripts/dartmetadata.py index f7a6bcb393e..71f76022222 100644 --- a/tools/dom/scripts/dartmetadata.py +++ b/tools/dom/scripts/dartmetadata.py @@ -30,8 +30,7 @@ _dart2js_annotations = monitored.Dict( 'dartmetadata._dart2js_annotations', { 'AnimationEffectTiming.duration': [ - "@Creates('Null')", - "@Returns('num|String')", + "@Returns('num|String|Null')", ], 'ArrayBufferView': [ "@Creates('TypedData')", diff --git a/tools/dom/scripts/systemhtml.py b/tools/dom/scripts/systemhtml.py index 4807cf8f583..70248c60f46 100644 --- a/tools/dom/scripts/systemhtml.py +++ b/tools/dom/scripts/systemhtml.py @@ -1394,6 +1394,14 @@ class Dart2JSBackend(HtmlDartGenerator): self._AddAttributeUsingProperties(attribute, html_name, read_only) return + output_type = self.SecureOutputType(attribute.type.id, + can_narrow_type=read_only, + nullable=attribute.type.nullable) + + rename = self._RenamingAnnotation(attribute.id, html_name) + metadata = self._Metadata(attribute.type.id, attribute.id, output_type, + attribute.type.nullable) + # If the attribute is shadowing, we can't generate a shadowing # getter or setter (Issue 1633). # TODO(sra): _FindShadowedAttribute does not take into account the html @@ -1426,7 +1434,8 @@ class Dart2JSBackend(HtmlDartGenerator): 'TreatNullAs' in attribute.ext_attrs)) return self._members_emitter.Emit('\n // Shadowing definition.') - self._AddAttributeUsingProperties(attribute, html_name, read_only) + self._AddAttributeUsingProperties(attribute, html_name, read_only, + rename, metadata) return # If the attribute is shadowed incompatibly in a subclass then we also @@ -1438,23 +1447,18 @@ class Dart2JSBackend(HtmlDartGenerator): if (self._interface.id == 'DOMMatrixReadOnly' or self._interface.id == 'DOMPointReadOnly' or self._interface.id == 'DOMRectReadOnly'): - self._AddAttributeUsingProperties(attribute, html_name, read_only) + self._AddAttributeUsingProperties(attribute, html_name, read_only, + rename, metadata) return # If the type has a conversion we need a getter or setter to contain the # conversion code. if (self._OutputConversion(attribute.type.id, attribute.id) or self._InputConversion(attribute.type.id, attribute.id)): - self._AddAttributeUsingProperties(attribute, html_name, read_only) + self._AddAttributeUsingProperties(attribute, html_name, read_only, + rename, metadata) return - rename = self._RenamingAnnotation(attribute.id, html_name) - output_type = self.SecureOutputType(attribute.type.id, - can_narrow_type=read_only, - nullable=attribute.type.nullable) - metadata = self._Metadata(attribute.type.id, attribute.id, output_type, - attribute.type.nullable) - input_type = self._NarrowInputType(attribute.type.id) if self._nnbd and attribute.type.nullable: input_type += '?' @@ -1536,7 +1540,6 @@ class Dart2JSBackend(HtmlDartGenerator): return self._AddConvertingGetter(attr, html_name, conversion) return_type = self.SecureOutputType(attr.type.id, nullable=attr.type.nullable) - native_type = self._NarrowToImplementationType(attr.type.id) self._members_emitter.Emit( '\n $RENAME' '\n $METADATA'