Enhances the overlay optimization by pushing new pictures to the earliest RenderCanvas they can go into. This improvement is made especially clear in the new test case I added to `embedded_views_test.dart`, with the previous algorithm we would have used an overlay for each platform view even though all of the pictures could go into the base canvas with no issue.
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Reverts flutter/engine#54453
Not quite ready to remove Impeller Scene yet because I'm still porting
the animation functionality. Keeping it around allows me to switch back
and forth to compare without having to recompile the engine.
Over a month ago I said something like "we can revert this a couple of
weeks from now" in one of the Impeller meetings. But for better or worse
(better, I think), I ended up spending a ton of time trying to make the
PBR good first (which doesn't exist in this C++ version).
Rename "dialog" to "route" to match the framework. The ARIA role "dialog" is an implementation detail, and it might change if a better implementation comes along. The semantic node itself implements the framework's "route" concept.
Replaces and closes https://github.com/flutter/engine/pull/53997.
This PR migrates the following packages to the pub workspace:
- testing/benchmark
- testing/dart
- testing/litetest
- testing/pkg_test_demo
- testing/scenario_app
- testing/skia_gold_client
- testing/symbols
- tools/golden_tests_harvester
- tools/pkg/process_fakes
It also makes minor changes to the Dart build rules in order to resolve the root package_config, instead of per-package.
I am _not_ totally confident of the `_embedder.yaml` change, but I also can't explain what is needed to continue analyzing `lib/ui` without analysis failures that all of the symbols in `dart:nativewrappers` are missing.
This only addresses the following:
- Removes `JSVoid` in favor of `void`. `JSVoid`, which is just a
typedef, should be deprecated and removed eventually.
- Removes extra interop methods that were needed to make sure arity was
correct. These are no longer needed as interop methods are
invocation-sensitive and calls to them do not forward more arguments
than were passed by the user.
- Removes unnecessary annotations on extensions.
Still left to do (not comprehensive):
- Migrate to extension types.
- Remove forwarding methods that are only used to convert primitives in
favor of changing the interop method to include the Dart primitive type.
It might be a bit slower in dart2wasm to do this, but will need to
verify and fix it if that's the case.
- Remove usage of `js_util`.
- See if we can replace types with their `package:web` equivalent for
easier maintenance.
A few non-functional clean-ups in semantics:
* Rename `RoleManager` to `SemanticBehavior`.
* Rename `PrimaryRoleManager` to `SemanticRole`.
* Remove the `Role` enum. Move the enum docs into the respective classes.
## Why?
Previous naming was confusing. It's not clear what the difference is between a "role manager" and a "primary role manager". The word "manager" is a meaningless addition; the `Semantic*` prefix is much more meaningful. The `Role` enum was only used for tests, but tests can just use `SemanticRole.runtimeType`.
## New state of the world
After this PR the semantics system has "objects" (class `SemanticsObject`), "roles" (class `SemanticRole`), and "behaviors" (class `SemanticBehavior`).
- A semantic _object_ is an object attached to the framework-side `SemanticNode`. It lives as long as the semantic node does, and provides basic functionality that's common across all nodes.
- A semantic object has exactly one semantic _role_. This role is determined from the flags set on the semantic node. Flags can change, causing a semantic object to change its role, which is why these are two separate classes. If an object had just one permanent role, we could combine these classes into one (maybe one day we'll do it, as changing roles dynamically is weird, but that needs major changes in the framework).
- A semantic role may have zero or more semantic _behaviors_. A behavior supplies a piece of functionality, such as focusability, clickability/tappability, live regions, etc. A behavior can be shared by multiple roles. For example, both `Button` and `Checkable` roles use the `Tappable` behavior. This is why there's a many-to-many relationship between roles and behaviors.
Or in entity relationship terms:
```mermaid
---
title: Semantic object relationships
---
erDiagram
SemanticsNode ||--|| SemanticsObject : managed-by
SemanticsObject ||--o{ SemanticRole : has-a
SemanticRole }o--o{ SemanticBehavior : has
```
This merges the macOS and iOS rules for creating the `gen_snapshot_arm64` and `gen_snapshot_x64` used to build for iOS devices, as well as for iOS simulators on both arm64 hosts (`gen_snapshot_arm64`) and x64 hosts (`gen_snapshot_x64`). The macOS rules have already been updated to generate universal binaries for each of these that can be run on both Apple Silicon and Intel Mac hosts.
This also updates `create_full_ios_framework.py` to bundle the newly-generated universal gen_snapshot binaries and produce the artifacts.zip archive that is uploaded via the build config in `mac_ios_engine.json`.
The `create_arm_gen_snapshot` rule remains until I'm 100% convinced it's not used for macOS host Android target builds.
Issue: https://github.com/flutter/flutter/issues/101138
Issue: https://github.com/flutter/flutter/issues/69157
This is stacked on top of https://github.com/flutter/engine/pull/54008.
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
The occlusion rectangle for platform views was going through this `inverseMapRect` code path, which actually was giving us the wrong results. The operations should just be doing the normal transformation on the rectangles to get the right result. It actually turns out we don't need the inverse mapping function, so I removed it, and I renamed the somewhat confusingly named `cullRect` function to `mapRect` which I think makes a bit more sense.
This should resolve https://github.com/flutter/flutter/issues/152139
This is in preparation for
https://dart-review.googlesource.com/c/sdk/+/373884, which will add length to the extension type itself. This will shadow the extension member, so we should make sure the type signatures match.
Reverts: flutter/engine#54002
Initiated by: kevmoo
Reason for reverting: the issue in google 3 has been fixed.
Original PR Author: auto-submit[bot]
Reviewed By: {fluttergithubbot}
This change reverts the following previous change:
Reverts: flutter/engine#54000
Initiated by: chingjun
Reason for reverting: Broke Google Testing.
See b/352191023 for more details.
Original PR Author: kevmoo
Reviewed By: {jonahwilliams}
This change reverts the following previous change:
Fixes https://github.com/flutter/flutter/issues/151679
Reverts: flutter/engine#54000
Initiated by: chingjun
Reason for reverting: Broke Google Testing.
See b/352191023 for more details.
Original PR Author: kevmoo
Reviewed By: {jonahwilliams}
This change reverts the following previous change:
Fixes https://github.com/flutter/flutter/issues/151679
Our treatment of the interaction between offset and transform was incorrect. Modified our platform view unit tests to cover more cases of nested offsets and transforms.
Always mark scrollable containers with `role="group"` to prevent the browser from merging all child elements into one giant string. Default to `preventScroll` to true across the web engine code, because it's a better default for Flutter than otherwise.
Fixes https://github.com/flutter/flutter/issues/130950
This relands https://github.com/flutter/engine/pull/53679.
The difference from the previous attempt is in the last commit, which prevents synthetic focus requests from echoing back into the framework. That part broke too many tests in g3 and needs to be revisited.
## Original description
Stop using `SemanticsAction.didGain/LoseAccessibilityFocus` on the web, start using `SemanticsAction.focus`. This is because on the web, a11y focus is not observable, only input focus is. Sending `SemanticsAction.focus` will guarantee that the framework move focus to the respective widget. There currently is no "unfocus" signal, because it seems to be already covered: either another widget gains focus, or an HTML DOM element outside the Flutter view does, both of which have their respective signals already.
More details in the discussion in the issue https://github.com/flutter/flutter/issues/83809.
Fixes https://github.com/flutter/flutter/issues/83809
Fixes https://github.com/flutter/flutter/issues/148285
Fixes https://github.com/flutter/flutter/issues/143337
Previously, each platform view contained styling/placement information from the entire stack of the layer builder. This caused issues when using `addRetained`, since it would contain stale styling/placement information from its old parent layers. I have changed it so that platform views only contain local styling information, and that styling is combined with the parent only when the layers are merged.
This PR addresses an issue where autocompleting a text field, even without direct keyboard input, unexpectedly triggers keydown events. To resolve this, the code now relaxes the casting assumptions to accommodate a wider range of event types, not just keyboard events.
By just adding the following script to the console, and filling the text field using autocomplete, you can see that indeed the fired event is not of type `KeyboardEvent` but `Event`.
```javascript
document.body.addEventListener('keydown', console.log)
```
Fixes https://github.com/flutter/flutter/issues/149968
*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Second attempt to reland https://github.com/flutter/engine/pull/52023
Fixes since the previous reland attempt:
* We need to pass the skwasm main JS URI when loading the module so that it can pass that along to the worker. Since the worker uses the workaround to allow a cross script worker, it has trouble locating the main JS URI in relation to itself in a way that actually works for dynamic imports, so passing it along fixes that issue.
* Some of the Google3 tests relied on the relative default canvaskit path. Dynamic module imports seems to not handle relative paths the way we expect, so we do our own URL resolution using the URL constructor before passing it into the dynamic import API. Also cleaned up some of the other relative pathing stuff that we do around the base URI. in flutter.js
Reverts: flutter/engine#53787
Initiated by: jiahaog
Reason for reverting: There are still internal users of these hash functions (b/352191023). Flutter also exports it [here](72f83d3237/packages/flutter/lib/src/painting/basic_types.dart (L58)) so its easy for developers to use them even without importing `dart:ui`. Though it's an easy fix, I'd imagine this to be a breaking change for the OSS ecosystem a
Original PR Author: kevmoo
Reviewed By: {jonahwilliams}
This change reverts the following previous change:
These were deprecated a LONG time ago
Reverts: flutter/engine#53783
Initiated by: jiahaog
Reason for reverting: There are still internal users of these hash functions (b/352191023). Flutter also exports it [here](72f83d3237/packages/flutter/lib/src/painting/basic_types.dart (L58)) so its easy for developers to use them even without importing `dart:ui`. Though it's an easy fix, I'd imagine this to be a breaking change for the OSS ecosystem a
Original PR Author: kevmoo
Reviewed By: {yjbanov}
This change reverts the following previous change:
We moved to dart:core Object functions a while ago
Reverts: flutter/engine#45166
Initiated by: jiahaog
Reason for reverting: This commit seems to cause the debug banner of a material app to be unnecessarily blurred. For example, one of the tests runs the following flutter app:
<details>
<summary>Code</summary>
```dart
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Materia
Original PR Author: Kingtous
Reviewed By: {yjbanov, harryterkelsen}
This change reverts the following previous change:
Hi from [Dora team](https://www.dora.run/), which powers web developers to build their 3d websites in just a few seconds.
This PR fixes: https://github.com/flutter/flutter/issues/133443, related: https://github.com/flutter/flutter/issues/58546
The original codes attempts to cache the css string but it causes bugs when encountering nested the same mask filter blur. We should also set `filter` properties when currentFilter == incoming mask filter using the cached css string, not just ignore it.
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
A semantic node may be tappable without having a more concrete role set on it, such as "button". It will just have a tap handler. This could lead to the sized span to be chosen as the label representation. However, when pointer events land on the span the DOM `target` becomes the span rather than the tappable element, and that breaks the debouncing logic in `pointer_binding.dart`.
This PR removes pointer event handling from inert text spans. This fixes the click debounce logic.
Fixes https://github.com/flutter/flutter/issues/151265