In the spirit of keeping the happy path's output as clean as possible, let's hide the many lines printed by `pub get` even when it's successful.
If `pub get` fails, its output will be printed on the terminal.
Move the GpuContext to its new home. I added a `flutter_tester` test that just verifies an exception is gracefully thrown when Impeller isn't available.
In a later patch, I'll land a way to eagerly supply the Impeller context on the cpp side to enable testing through the playground (as mentioned in https://github.com/flutter/flutter/issues/127712).
Fixes https://github.com/flutter/flutter/issues/130141
The primary goal of this patch is to move dispatching of `dart:ui` `Canvas` commands to the UI thread.
Before this patch, the architecture is something like:
## UI Thread
- `dart:ui` talks to `DisplayListBuilder`, a `DlCanvas` implementation.
- `DisplayListBuilder` does some clip/bounds tracking and creates a `DisplayList` object that is held by `dart:ui`'s `Picture` objects.
- `DisplayList`s are added to `DisplayListLayer`s in `flow`.
## Raster Thread
- `flow` flattens the various operations into a single `DisplayList` via another `DisplayListBuilder`.
- A `DlOpReceiver`implementation converts that `DisplayList` into an `Aiks` `Canvas`/`Picture`.
After this patch, the architecture instead looks like:
## UI Thread
- No change for Skia.
- If Impeller, use a new `DlCanvasImplementation` that talks to `Aiks`'s `Canvas`.
- If Impeller, `dart:ui` Picture's now hold an `Aiks` `Picture`, which get shared into `AiksLayer`s in `flow`.
## Raster thread
- No change for Skia, but some light refactoring for places that assumed a `DisplayListBuilder` where they really just needed a `DlCanvas`.
- The `Aiks` `Picture`s are combined using new API on `DlCanvas` and still backed by `Aiks`.
These changes show significant improvement on raster times on Android and only very small regressions on UI times in local testing, see https://gist.github.com/dnfield/26528090194c9f5abdbac13cdcbf4f79 for old gallery transition perf numbers.
Many of the other changes in this patch are related to the following:
- Making `DlRTree` usable for Impeller.
- It would be nice to have a version of DlRTree that speaks `impeller::Rect`.
- Creating the requisite classes to support `EmbeddedViews` so that Desktop works.
This patch does not remove the `impeller::DlDispatcher`, which now would only be used in tests.
This should significantly improve the situation described in https://github.com/flutter/flutter/issues/130162.
When the framework merges semantics trees of multiple widgets into a single node, it can expand the tap area of one of the descendants to the size of the combined node as follows:
<img width="865" alt="Screenshot 2023-07-07 at 4 11 30 PM" src="https://github.com/flutter/flutter/assets/211513/50e4f9f2-d36b-4820-93d2-c53714f33b08">
When a screen reader taps on the combined node, the pointer events and the click all land in the center. This produces a stalemate resulting in the user action never producing a tap/click gesture in the framework:
* The web engine, seeing `pointerdown`/`pointerup`, switches to the gesture mode ignores the `click`, believing that the framework will interpret the pointer events as one.
* The framework, seeing pointer events landing outside the checkbox, never reacts to the pointer events.
This PR mostly solves the issue by delaying event sequences starting with pointerdown for up to 200ms. If within those 200ms a click is observed, `SemanticsAction.tap` is sent to the framework. Otherwise, the pointer events are sent to the framework and the DOM `click` event is dropped. The tradeoff is that even when the drag gesture detector is the only one present, there's a 200ms delay before dragging can start. However, it seems to be a better trade-off than missing clicks entirely.
Part of https://github.com/flutter/flutter/issues/131346
Stubs a minimal test of the FFI utilities that `dart:ui` uses, but using
public symbols exported from the engine library. If this goes well, I'll
move the stuff from `dart:ui` into here and begin landing parts of the
API with test coverage.
Add `PlatformViewRoleManager`, the primary role manager for platform views. Currently, all it does is manager the `aria-owns` attribute that determines the screen reader traversal order of the platform view w.r.t. surrounding content.
This is a partial fix for https://github.com/flutter/flutter/issues/124765. While it does not address literally using the TAB key as a means for traversing widgets, it does address traversal via screen reader shortcuts.
Any user @staticInterop types should only subtype the dart:js_interop
types JSObject and or JSAny as user @staticInterop types erase to
JSObject.
In the future, the other JS types will be added as extension types,
allowing users to implement them with their own extension types.
Allows https://dart-review.googlesource.com/c/sdk/+/316865/1 to be
landed.
## Pre-launch Checklist
- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [ ] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [X] I signed the [CLA].
- [ ] All existing and new tests are passing.
This PR is to add support for the expanded/collapsed-state semantics flag to the engine. After adding another PR to Flutter, we will be able to support the expanded/collapsed state in semantics for submenu buttons.
Related to [#127617](https://github.com/flutter/flutter/issues/127617) in flutter
A ~~simpler~~ very similar version of https://github.com/flutter/engine/pull/43854
* Makes it harder for users to accidentally remove default configuration values, while still allowing them to do so if needed (configuration is now overridden with a subset of values, rather than passing a full configuration object).
* Moves `merge` from the configuration object and into the override method.
* Removes a test-only configuration option:
* `window._flutter_canvaskit_variant_for_test_only`
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Some parts of the flutter engine are built using the latest version of the Dart SDK, ignoring SDK constraints in `pubspec.yaml` files. Therefore, before the Dart SDK can switch on the "private field promotion" feature (https://github.com/dart-lang/language/issues/2020), these parts of the flutter engine need to be modified so that they won't have any "unnecessary `!`" warnings after field private field promotion is enabled. This PR makes the necessary changes.
This PR doesn't introduce any functional change. In principle it might improve performance slightly (by avoiding redundant memory accesses), but in practice the difference is unlikely to rise out of the measurement noise.
Issue fixed by this PR: https://github.com/flutter/flutter/issues/131198
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
I've been trying to avoid this, but since the context type may vary
through runtime decisions, we just need something like this to select
which shader data to pull from the Dart GPU bundle at runtime. One
alternative would be to add a special omni shader concept to the HAL,
but that seems worse than just letting renderers key with a backend enum
sometimes.
Cautioned against using it for cap checks in the doc string.
At some point, we started setting `useColorEmoji` to true in our tests, but we were doing it in a way that resets all other configurations to their defaults. This caused the `canvasKitVariant` config to be lost and always set to the default `auto`.
This PR fixes the issue and adds tests to:
1. Make sure that the CanvasKit suite always runs with a specific variant (not `auto`).
2. Make sure the given CanvasKit variant makes it all the way through to the tests.
The test harness uses a backdoor (a global JS property on `window`) to communicate which canvaskit variant it's using. The test then compares that with `configuration.canvasKitVariant` to make sure they match. If they don't match, then the configuration was lost somewhere on the way.
Fixes https://github.com/flutter/flutter/issues/130993
Always add secondary role managers irrespective of the initial state of the semantic node, and have role manager decide whether it applies to the node or not.
Fixes https://github.com/flutter/flutter/issues/130546
The change in [0] has propagated now everywhere, so we can use
`utf8.encode()` instead of the longer `const Utf8Encoder.convert()`.
Also it cleans up code like
```
Uint8List bytes;
bytes.buffer.asByteData();
```
as that is not guaranteed to be correct, the correct version would be
```
Uint8List bytes;
bytes.buffer.asByteData(bytes.offsetInBytes, bytes.length);
```
a shorter hand for that is:
```
Uint8List bytes;
ByteData.sublistView(bytes);
```
[0] https://github.com/dart-lang/sdk/issues/52801
Reverts flutter/engine#43118
The incorrect default value (`true` instead of `false`) was used in the PR and that caused internal test failures. I'll add a test before trying to reland.
This reverts commit dce75ab4cf647eec6699f8a30ba2289a3738b307.
This also makes some small changes to make onBenchmark a
JSExportedDartFunction instead of a JSBoxedDartObject. This is for
changes in https://github.com/flutter/flutter/pull/129436 and to account
for the fact that flutter/packages provides an `allowInterop`'d
function. Benchmarks tests pass with this CL.
## Pre-launch Checklist
- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [ ] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [X] I signed the [CLA].
- [ ] All existing and new tests are passing.
The goal is to remove the rounding applied in skparagraph and in the framework: https://github.com/flutter/flutter/issues/31707
The plumbing is done via a new static variable `ParagraphBuilder.shouldDisableRoundingHack` that toggles the rounding behavior in skparagraph and the flag is read by framework code. Application code and test code can either use `ParagraphBuilder.setDisableRoundingHack` or `--dart-define="SKPARAGRAPH_REMOVE_ROUNDING_HACK=1"` to opt-in.
Once the internal migration is finished the default value of the flag will be set to true.
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Most of the #include directives for SkPicture are removed except where they are still functional. Many comments rewritten to no longer be SkPicture-centric.
- DL unit tests still use it for consistency testing
- rasterizer/engine still use it for screen shot support
- Fuchsia still uses it extensively