Uses the utility added in https://github.com/flutter/engine/pull/51361
I counted the removal of 58 static casts. There was one addition made to the original utility however. Vulkan HPP was promoting all enums to its own mask type. This in itself is problematic but we got away with it because there was no one else doing this kind of promotion. Till we added our own utility. To avoid polluting the namespace with methods that may cause ambiguity, enums that are masks must explicitly be marked as maskable with `IMPELLER_ENUM_IS_MASK` in the `impeller` namespace.
No change in functionality.
This is a reland of the change moving the emsdk out of the buildroot, but without the removal of `web_dependencies`, since that removal was causing issues with the rollers.
Reverts: flutter/engine#51299
Initiated by: zanderso
Reason for reverting: Blocking the autoroller
Original PR Author: eyebrowsoffire
Reviewed By: {matanlurey}
This change reverts the following previous change:
This migrates the emscripten toolchain into the flutter repo, as well as the fonts for web unit tests. Also, removed the `web_dependencies` thing which is no longer used.
This fixes https://github.com/flutter/flutter/issues/143332
Depends on a buildroot change here: https://github.com/flutter/buildroot/pull/833
* Update documentation for the annotation
* Add `@keepToString` annotation to web's `Locale` class (similar to
non-webs `Locale` class)
Issue https://github.com/flutter/flutter/issues/52759
This is a prototype of the [PlatformIsolate
API](https://github.com/flutter/flutter/issues/136314).
**UPDATE (Jan 25):** The PR is ready for review. PTAL.
The `PlatformIsolate` creation flow is:
1. `PlatformIsolate.spawn` running on parent isolate
(platform_isolate.dart)
a. Create `isolateReadyPort`
b. `PlatformIsolateNativeApi::Spawn` (platform_isolate.cc)
c. `DartIsolate::CreatePlatformIsolate` (dart_isolate.cc)
d. Isolate created. Entry point invocation task dispatched to platform
thread
e. `PlatformIsolate.spawn` returns a `Future<Isolate>`
2. On the platform thread, `_platformIsolateMain` is invoked in the
platform isolate
a. Create `entryPointPort`
b. Send `Isolate.current` metadata and `entryPointPort` back to the
parent isolate via `isolateReadyPort`
3. Back in the parent isolate, `isolateReadyPort.handler` is invoked
a. Send the user's `entryPoint` and `message` to the platform isolate
via `entryPointPort`
b. Use received isolate metadata to create a new `Isolate` representing
the platform isolate and complete the `Future<Isolate>`
4. In the platform isolate, `entryPointPort.handler` is invoked
a. Run the user's `entryPoint(message)`
The engine shutdown flow is handled by `PlatformIsolateManager`, which
maintains a set of running platform isolates.
This fixes https://github.com/flutter/flutter/issues/143800, where we are attempting to capture an image that is way too large. We only need to render the part of the image that will be visible in the window.
This includes some additional fixes for regressions in the original fix.
This fixes https://github.com/flutter/flutter/issues/141001
This also fixes https://github.com/flutter/flutter/issues/143743
* We need to always call `setStrutEnabled(true)` on `StrutStyle`.
* `getLineMetricsAt` had reversed ternary logic.
* We also need to apply the rounding hack in Skwasm.
* Ported unit tests from CanvasKit over to UI to cover Skwasm ~and HTML~
* ~The HTML renderer should return 0 line metrics for an empty paragraph.~
This fixes https://github.com/flutter/flutter/issues/143800, where we are attempting to capture an image that is way too large. We only need to render the part of the image that will be visible in the window.
This is a reland of the previous PR, now that the blocking Dart SDK issue has been fixed (see https://github.com/dart-lang/sdk/issues/54991).
Also, I addressed an issue where the timings were incorrect due to different time origins on the main thread and web worker. The timings should be accurate now.
Notes from the original PR are as follows:
Fixes https://github.com/flutter/flutter/issues/140429
Some notes here:
* Refactored the frame timing systems so that we can deal with asynchronous rendering.
* Consolidated rendering of multiple pictures in skwasm into a single call, so that the rasterization can be properly measured.
* Pulled the frame timings tests into the `ui` test suite so that they run on all renderers (including skwasm).
@jason-simmons @jiahaog fyi
I need to figure out a test for this still but it seems to work. Hot restart is kind of a mess though, because `Engine::Restart` nulls out the asset manager it ends up reloading the font collection for every engine after a restart. But we separately need to fix hot restart, it's not very usable on the example app
Fixes https://github.com/flutter/flutter/issues/143701
Reverts flutter/engine#50737
Initiated by: goderbauer
Reason for reverting: Fails in device lab, see https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8755350727803344657/+/u/run_web_benchmarks_skwasm/stdout
Original PR Author: eyebrowsoffire
Reviewed By: {mdebbar, yjbanov}
This change reverts the following previous change:
Original Description:
Fixes https://github.com/flutter/flutter/issues/140429
Some notes here:
* Refactored the frame timing systems so that we can deal with asynchronous rendering.
* Consolidated rendering of multiple pictures in skwasm into a single call, so that the rasterization can be properly measured.
* Pulled the frame timings tests into the `ui` test suite so that they run on all renderers (including skwasm).
Fixes https://github.com/flutter/flutter/issues/140429
Some notes here:
* Refactored the frame timing systems so that we can deal with asynchronous rendering.
* Consolidated rendering of multiple pictures in skwasm into a single call, so that the rasterization can be properly measured.
* Pulled the frame timings tests into the `ui` test suite so that they run on all renderers (including skwasm).
This PR changes the format check on CI to use the command added in
https://github.com/flutter/engine/pull/50747.
Additionally, while making this change, I noticed that the CI check was
not checking the formatting of all files, and that as a result, files
were present in the repo with incorrect formatting. I have fixed the
formatting and fixed the check to always check all files.
## Description
On Web, browsers can emit key events with a logical key sets to `Process` when the physical key is MetaLeft. Because the modifier state is 0 despite Meta key being pressed this will trigger an assert.
This PR adds some logic for this specific case. Maybe a more slightly broader solution will be needed (using the same logic for all modifiers ?). I focused on MetaLeft because it was directly reported on https://github.com/flutter/flutter/issues/141186.
## Related Issue
Fixes https://github.com/flutter/flutter/issues/141186.
## Tests
Adds 1 test.
The CLs that migrated to static interop forgot to update the
corresponding comments regarding the need to use `allowInterop`.
The re-exported `allowInterop` function happened in an internal library
(not exposed via `dart:ui*`) and was unused.
Issue https://github.com/dart-lang/sdk/issues/54908
## Description
This PR fixes an 'Unexpected null value' error related to autoFill.
When using Autofill feature, Chrome emits keyboard events whose `event.code` and `event.key` are null.
## Related Issue
Fixes https://github.com/flutter/flutter/issues/114620.
## Tests
Adds 1 test.
### Changes
* Introduces a new `viewConstraints` JS configuration parameter to configure max/min width/height constraints for a view. Those can have the following values:
* An integer `>= 0`: max/min size in pixels
* `Infinity` (or `Number.POSITIVE_INFINITY`): (only for max values) -> **unconstrained**.
* When any value is not set, it defaults to "tight to the current size".
* See [Understanding constraints](https://docs.flutter.dev/ui/layout/constraints).
* Computes the correct `physicalConstraints` of a view off of its `physicalSize` and its `viewConstraints` for the framework to use during layout.
* When no constraints are passed, the current behavior is preserved: the default constraints are "tight" to the `physicalSize`.
* Resizes the current view DOM when requested by the framework and updates its internal physicalSize, then continues with the render procedure.
### Example
This is how we can configure a view to "take as much vertical space as needed":
```js
flutterApp.addView({
viewConstraints: {
minHeight: 0,
maxHeight: Infinity,
},
hostElement: ...,
});
```
### TODO
* Needs actual unit tests
### Issues
* Fixes https://github.com/flutter/flutter/issues/137444
* Closes https://github.com/flutter/engine/pull/48541
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style