This reverts commit f8ff12008e.
This CL is a revert of the initial revert and should be landed once
Flutter changes have been merged to handle the changes here.
Change-Id: I300a5efd776bf2a596743971f4e15ad62da77f5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153368
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Two tricks let us compile this more efficiently:
e.children.addAll(cs);
Normally, get$children is inlined, returning a _ChildrenElementList
wrapper, generating:
new W._ChildrenElementList(e, e.children).addAll$1(0, cs);
The two tricks:
1. Split _ChildElementList.addAll into an 'unwrap' that then calls the
logic in '_addAll'
2. Add information about the properties of e.children that allow it to
be removed.
With these tricks, dart2js can optimize the code to this version that
avoids allocating a wrapper or accessing the 'children' property:
W._ChildrenElementList__addAll(e, cs);
Change-Id: Ifdf533ac4f9790f09f87302e67304b5696097266
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153904
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This reverts commits aff77e7e..e24f205d.
Due to a breakage in a Flutter roll, this CL stack needs to be
reverted. It should be reintroduced with changes to Flutter code to
compile with the changes in dart:html.
Breakage: https://github.com/flutter/engine/runs/828631927
Change-Id: I9c93c4eab823337d09d2e347015ad9ec402f2038
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152910
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Getter types need to be a subtype of the setter type, so if getters
are nullable due to incompatibility, the setter needs to be as well.
This change makes those changes, updates documentation, and modifies
a template and test file.
Change-Id: I2130538bb4005b3553eb7951af022c1c2ed59c1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152607
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Mostly null-assertions to make code compatible with compat
data changes.
Change-Id: I8f7c6c2421d6427851a44588978910deae8440bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152047
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Native getters in src/template files are modified to reflect the info
in the compatibility data.
Change-Id: I98f96737e21c7b4ce6bd17ea398e9806c61122b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152046
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Native getters that are incompatible were marked as nullable even
though they may override methods that aren't nullable. This fixes
those conflicts for various HTML methods.
Change-Id: I7c2456d5d223d825428cedb847d20139b7d271c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152045
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Bug: https://github.com/dart-lang/sdk/issues/41944
Note that the compatibility data on secure contexts is fairly
sparse and has missing information. There are only two APIs that
have secure context info on them and they're already marked as
incompatible.
Change-Id: Iaf9ecb7a916c8ac20b32e1ea92ed44981f675659
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152044
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Bug: https://github.com/dart-lang/sdk/issues/41905
Uses MDN information in the generator script to get a better idea
of which attributes are compatible and are not. mdnreader.py is
introduced to parse the data present in third_party.
Change-Id: I330ccf918cb42deb4c09ab97db5f3d2f0c432d99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149800
Reviewed-by: Stephen Adams <sra@google.com>
Since the sdk has been unforked, scripts should be updated to
generate files by always using NNBD. As such, nnbd_src has been
moved to src and the old src has been deleted. This does not address
the nnbd tokens e.g. $NULLABLE. That will be done in a future CL.
Change-Id: I00bead16a9d19569b07ad0601f581fc14400fdce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151864
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Move the nnbd core libraries from sdk_nnbd to sdk, and updates
references in build files and elsewhere accordingly.
Change-Id: I09760fe1e006657aacdfe80f3b22fdf6f7e30a9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151121
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Some fields that were changed to native getters/setters should include
renaming/metadata whenever possible to account for name differences.
While this is already the case with most fields, this CL adds it to
some places that missed it. Annotations for
AnimationEffectTiming.duration are changed to be accurate as well.
Change-Id: Idb8b94a9b916086d127753f868e97f1a1b9db53f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148464
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
trackEvents and onTrack were not being generated by the event
generation and should be added to the allowlist.
Change-Id: I5bc6bcc17c56b26d7fc43e69e4867532ab1b80a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151043
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Generated code uses the html_name, which could be a Dart rename,
in the JS call instead of the JS name associated with it.
Change-Id: I7362abf0e089705be5e532b5281f326305c96246
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148180
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Closes https://github.com/dart-lang/sdk/issues/41911
Fields were translated to native getters/setters, but static attributes
did not maintain their static modifier. This fixes that.
Change-Id: I52b75ecbf40c4f39d301c6aaedd2492ce7deae5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148239
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Navigator.deviceMemory is not supported on some browsers and
therefore the native call returns null on undefined.
Change-Id: I529ae29cf8c875d8c62146e7f59c173c3c3523ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147810
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Bug: https://github.com/dart-lang/sdk/issues/35253
This API was suppressed initially due to issues with conversions
between promises and futures. Now that that has been resolved, this
should be unsuppressed. Tests have been refactored to use both
navigator.getUserMedia and navigator.mediaDevices.getUserMedia.
Change-Id: Ia131b303192c7eaa3f08475cf700a53665ab3584
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147640
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
createContextualFragment accepts a non-nullable string, so if html
is null, it's called with 'null'.
Change-Id: If11a4c397c939017f501707130385d967ee05910
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146691
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Bug: https://github.com/dart-lang/sdk/issues/41653
Since StreamSubscription.cancel now returns a non-nullable Future,
EventStreamSubscription.cancel checks for strong mode and returns null
in weak mode and a void future in strong mode. This preserves synchronous
behavior in weak mode.
Change-Id: Ifc7a6b565e99061d30e42a005bdd5fc3578b0e91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146680
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Closes https://github.com/dart-lang/sdk/issues/41699
createFragment should accept a nullable html string in its
implementation. As such, usages of createFragment within dart:html
are modified as well so the html string does not have to be
non-nullable.
Change-Id: Ia04ad2da9e2a48cabda8774f0af75559fb03a7d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145570
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Closes https://github.com/dart-lang/sdk/issues/41616
When merging interfaces, nullable and non-nullable types
should not be treated as the same. This also fixes some nullability
information that was not included in dart.idl but is part of the
Chromium IDL.
Change-Id: I6e94176d905b63364bc93dc2120d194452cf05f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144464
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Needed to type nullability for List parameters correctly.
Change-Id: I55732a34f9e221324a15312985cb83b49a6811a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142211
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Bug: https://github.com/dart-lang/sdk/issues/41275
insertAll should be unimplemented. It was previously relying
on a call to ChildrenElementList.length in the List mixin to
throw an UnsupportedError.
Change-Id: Ie8e5b126ea75a538e9db8b939bff0be012814efb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142201
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Pre-nnbd, add and toggle were allowed to return null, but with the
change in the Set interface, they must return a non-nullable bool.
Change-Id: I1dfcb43d8c816f46f847d22d6f62507c6a77e4a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141500
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
There are several instances where there are non-nullable
variables with null checks associated with them that should
be converted back to nullable. Attribute functions in Element
are clarified as well.
Change-Id: I23cf020f02f3d4b512e041f0339daafb46fdd7f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140909
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Allows it to be used as a boolean expression.
Change-Id: Id638eba4d1b0f745bfabc038f92fe930b5f454f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141641
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Changes types of return values depending on if the
call allows a Null type.
Change-Id: Id9b3d69eee1008d46a6b3b16f217a6b9c892fc6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141260
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
initMouseEvent uses this conversion to call the native function,
and it is allowed for the EventTarget to be null in the native
call.
Change-Id: I345e82fa00f4cca72e15f713cd7a271d306b7d37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141040
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Related to DOM clobbering of previousSibling
Change-Id: Ib4ed1cdba4217c351804b0689a999b73713f79ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140622
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Since we transitioned to natives for dart:html, manually written native
fields should be rewritten. Similarly, if there are fields in abstract
classes that represent interfaces, they should be converted. Fields in
abstract classes that are used in that class are left alone.
Change-Id: I924363639a4430b88b810b7348815bbc3f040e7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137642
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
New analyzer errors are reported for dart:html around nullability.
Non-nullable fields are translated to native getters and setters if part
of a concrete class and normal getters and setters if abstract.
Change-Id: I2fd87803a08872b2a7eae4de0af704f184997c7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137481
Reviewed-by: Stephen Adams <sra@google.com>
NNBD fields that were non-nullable or final were transformed to getters
so that they were compilable. They need to be transformed to natives now
for performance.
Change-Id: Ice0082f9468c542098a6d12083a826438d15eba4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135860
Reviewed-by: Stephen Adams <sra@google.com>
These assertions need to be added back into the nnbd sdk in order to be
compatible with weak mode.
Change-Id: Ie774fffda1fb0e79dbc7fe13cb75b9d28e4268fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136720
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
CSSStyleDeclaration.getPropertyValue returns a non-nullable string.
It will also return an empty string if the property is not found. Since
getPropertyValue returns the value of the native getPropertyValue, the
null check should be removed.
Change-Id: I9846553d3f9fcd68cbd15b9c39d2104cab594b7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136413
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
In the legacy SDK these two methods in ListMixin take Object, not E.
When I migrated them to NNBD, I changed them to E to match the
declaration of the methods in List. This was an unintended breaking
change.
Fix that by changing them to "Object?", which is the NNBD equivalent of
the declarations in the legacy SDK.
Change-Id: I2a75e9f26a8198e4f51cb32a55055d5e64a69ed1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136412
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Several method bodies did not return a value conditionally or at all.
Change-Id: I01ca87e2e0501597bacb49bcddd10668b59026b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135626
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Addresses discrepancies between IDL and template files for some
operations. There's probably more I'm missing since this was
from a cursory check through all the templates.
Change-Id: Id79710b343f4a5fe0b5529f64c341d4f63d69b9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135222
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Fixes tests lib_2/html/event_customerevent_test
co19_2/LibtTest/html/Document/window_A01_t01
JS inline incorrectly uses the converted html name for attributes for
getters. Similarly, dynamics do not need to be marked as nullable as
they are already nullable. This also fixes some of the nullability logic
for conversion input and output.
Change-Id: I77efde95a4e5d52461b3412f8650578e967ca5cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135201
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Optionals were being ignored for some methods and for optionals that
have a default of Undefined or None, they should be marked nullable in
Dart syntax regardless of whether they are in the IDL.
Change-Id: Icc71300dc7d8e06fef640a5ca8d502b093c0580c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134765
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>