3585 Commits

Author SHA1 Message Date
Yegor
a314952184 [web] ignore pointer events on plain text spans (flutter/engine#53694)
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
2024-07-03 22:00:05 +00:00
Mouad Debbar
5fb88851d5 Add Semantics Property linkUrl (flutter/engine#53507)
The new property allows the user to specify a URI for their semantics link node. It's plumbed through for both web and non-web engines, but it's only used in the web engine currently. It sets the `href` of the anchor element associated with semantics node.

This is going to unlock better semantics support in the Link widget on web ([PR](https://github.com/flutter/packages/pull/6711)).

Framework counterpart: https://github.com/flutter/flutter/pull/150639

Part of https://github.com/flutter/flutter/issues/150263
2024-07-03 21:12:26 +00:00
Kingtous
2ee4fd4317 [Flutter Web(HTML)] fix: shader mask is painted incorrectly on shared offscreen canvas (flutter/engine#44998)
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/133134.

The size of the shared canvas should not only be updated if both width and height are not the same.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-07-03 18:22:59 +00:00
Kingtous
86642a856c fix: mask disappeared when having nested mask filter on Flutter web HTML (flutter/engine#45166)
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
2024-07-03 18:22:56 +00:00
auto-submit[bot]
607d1e1bb5 Reverts "Reland "Output .js files as ES6 modules. (#52023)" (#53688)" (flutter/engine#53709)
Reverts: flutter/engine#53688
Initiated by: jiahaog
Reason for reverting: canvaskit.js cannot be loaded in an internal end to end test - see b/350885206
Original PR Author: eyebrowsoffire

Reviewed By: {ditman}

This change reverts the following previous change:
This is an attempt to reland https://github.com/flutter/engine/pull/52023. The issue previously is that if it was not specified by the user, the default CanvasKit base URL did not have a leading slash, which does not work when doing dynamic imports.
2024-07-03 08:39:47 +00:00
Jackson Gardner
18d37a44f5 Reland "Output .js files as ES6 modules. (#52023)" (flutter/engine#53688)
This is an attempt to reland https://github.com/flutter/engine/pull/52023. The issue previously is that if it was not specified by the user, the default CanvasKit base URL did not have a leading slash, which does not work when doing dynamic imports.
2024-07-03 00:56:13 +00:00
Jia Hao
1306b98121 Revert "[web] switch from .didGain/LoseAccessibilityFocus to .focus" (flutter/engine#53679)
Reverts flutter/engine#53360

Breaking google3 in b/350131288.

There is a test that does something like the following, to check if a radio button is selected.

```dart
      // Send a bunch of tabs to focus on the correct radio button
      await tester.sendKeyEvent(LogicalKeyboardKey.tab);
      await tester.pump();
      await tester.sendKeyEvent(LogicalKeyboardKey.tab);
      await tester.pump();
      await tester.sendKeyEvent(LogicalKeyboardKey.tab);
      await tester.pump();

      // Toggle the radio button with space
      await tester.sendKeyEvent(LogicalKeyboardKey.space);
      await tester.pump();

      final selectedRadio =
          tester.widget<Radio<bool>>(find.byType(Radio<bool>).at(1));
      expect(selectedRadio.value, isTrue);
```

After this commit, the above test fails. See the linked bug above for more details.
2024-07-02 17:02:06 +00:00
auto-submit[bot]
10ed9bfd7a Reverts "Output .js files as ES6 modules. (#52023)" (flutter/engine#53674)
Reverts: flutter/engine#52023
Initiated by: eyebrowsoffire
Reason for reverting: Causing issues in engine -> framework roll https://github.com/flutter/flutter/pull/151139
Original PR Author: eyebrowsoffire

Reviewed By: {ditman}

This change reverts the following previous change:
This changes CanvasKit and Skwasm to be compiled and loaded as ES6 modules instead of as vanilla script tags. Currently, the emscripten JS files try to register themselves with require.js or AMD module loading systems. We suspect this is causing issues (https://github.com/flutter/flutter/issues/149565) with DDC's module loading system, which itself uses require.js.

This is probably also the fix for https://github.com/flutter/flutter/issues/147731
2024-07-01 23:19:48 +00:00
Jackson Gardner
c91612ce11 Output .js files as ES6 modules. (flutter/engine#52023)
This changes CanvasKit and Skwasm to be compiled and loaded as ES6 modules instead of as vanilla script tags. Currently, the emscripten JS files try to register themselves with require.js or AMD module loading systems. We suspect this is causing issues (https://github.com/flutter/flutter/issues/149565) with DDC's module loading system, which itself uses require.js.

This is probably also the fix for https://github.com/flutter/flutter/issues/147731
2024-07-01 20:17:17 +00:00
David Iglesias
1b37c5441c [web] Fixes drag scrolling in embedded mode. (flutter/engine#53647)
When Flutter web runs embedded in a page, scrolling by dragging is interrupted very early by the browser.

It turns out that our `pointer` events receive a `pointercancel` + `pointerleave` by the browser because they happen in an area (the flutter glasspane) that is not really scrollable. [See documentation](https://developer.mozilla.org/en-US/docs/Web/API/Element/pointercancel_event).

  > [!NOTE]
  > After the pointercancel event is fired, the browser will also send [pointerout](https://developer.mozilla.org/en-US/docs/Web/API/Element/pointerout_event) followed by [pointerleave](https://developer.mozilla.org/en-US/docs/Web/API/Element/pointerleave_event).

(Firefox is a good browser to test this, because the browser will cancel our events **only if there's scrollable areas around the embedded flutter app**.)

There's several solutions, but one of them (used by PixiJS as well) is to cancel the `touchstart` event that fires with the `pointerdown` event.

(This PR also removes an unnecessary call to `addEventListener` in the `Listener` helper class, and adds some testing to it).

## Testing

* Added a happy case test for the fix (preventDefault on 'touchstart' events)
* Deployed demo app here: https://dit-multiview-scroll.web.app

## Issues

* Fixes https://github.com/flutter/flutter/issues/138985
* Fixes https://github.com/flutter/flutter/issues/146732
* Related to https://github.com/flutter/flutter/issues/139263

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-29 03:47:25 +00:00
Yegor
c5a8a826ef [web] switch from .didGain/LoseAccessibilityFocus to .focus (flutter/engine#53360)
This is a repeat of https://github.com/flutter/engine/pull/53134, which was merged prematurely.

> [!WARNING]  
> Only land this after:
> * https://github.com/flutter/flutter/pull/149840 lands in the framework.
> * You have personally manually tested the change together with the latest framework on all browsers.

## Original PR 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
2024-06-28 21:35:10 +00:00
Srujan Gaddam
554e637a35 Ignore lints that will be triggered by ExternalDartReference changes (flutter/engine#53572)
https://dart-review.googlesource.com/c/sdk/+/370663 makes
ExternalDartReference generic. By doing so, it triggers two
cast_nullable_to_non_nullable lints that need to be silenced for it to
land. Once the above SDK changes land, this can be refactored to utilize
the generic and avoid the manual cast altogether.
2024-06-26 09:32:08 -07:00
Jackson Gardner
8ab7c5d6e9 [skwasm] Fixes for getting pixels from an image. (flutter/engine#53561)
There were two issues here:

1) We have to stop using the emscripten thread scheduling APIs, as they can be invoked out of order from the rest of the messages that are posted. In some cases, out of order message handling can cause the request for reading pixels in an image to be serviced before some of the texture sources have been transfered to the web worker.

2) Skia's `readPixels` fails if there is is a lazy picture image made from a picture that contains a lazy texture image. The pertinent bug is here: https://g-issues.skia.org/issues/349201915

To work around the Skia bug, we just render the image itself onto our scratch canvas and pull the pixels out with `glReadPixels`.

This fixes https://github.com/flutter/flutter/issues/141326
2024-06-25 18:11:11 +00:00
Jason Parrott
384f44cafc fix: web canvaskit fragment shaders were not using updated uniform values (flutter/engine#53246)
This fixes an issue where in CanvasKit builds, uniforms set in setFloat function in the Paint class don't get updated after the initial render.
For example, like in the issue linked below, having a shader that animates a value over time and you want to reuse the Paint object that the shader is set to.

I'm no expert with CanvasKit nor with the Flutter Engine, but from what I could tell it seemed that the uniforms were only being sent to Skia on creation of the shader via _makeEffect.

However, any uniforms set afterwords were just stored in a local dart-side List<double> and forgotten about.

This PR changes the List<double> to use a WASM backed SkFloat32List to keep the references to the uniforms linked to dart-side.

fixes https://github.com/flutter/flutter/issues/149800
2024-06-25 17:59:24 +00:00
Jim Graham
34bb05029e [DisplayList] Switch to recording DrawVertices objects by reference (flutter/engine#53548)
The Vertices objects are already allocated in a shared object by default so copying them inline into the recording buffer is usually a waste of time rather than reusing the memory allocated for the shared object by recording a reference. Note that the shared DlVertices objects already inline all of their data so we have good data locality as it is without further copying the data into the buffer.

Might help with https://github.com/flutter/flutter/issues/150513
2024-06-25 17:41:14 +00:00
Mouad Debbar
2d762001d3 [web] Implement AppLifecycleState.detached as documented (flutter/engine#53506)
Currently, we are transitioning to the `AppLifecycleState.detached` incorrectly. This is causing the framework to stop pumping frames when the app is still active and visible.

This PR re-implements the transition to `AppLifecycleState.detached` as documented [here](https://api.flutter.dev/flutter/dart-ui/AppLifecycleState.html#detached) (based on whether the app has any views or not).

Fixes https://github.com/flutter/flutter/issues/150636
Fixes https://github.com/flutter/flutter/issues/149417
2024-06-25 14:14:17 +00:00
David Iglesias
0131b53f3c [web] Reland "Fix focus management for text fields (#51009)" (flutter/engine#53537)
Relands: [**Fix focus management for text fields** (#51009)](https://github.com/flutter/engine/pull/51009) by:

* Reverting commit: 249de68438 (https://github.com/flutter/engine/pull/53502).
* Keeping the new `ViewFocusBinding` disabled, as [suggested](https://github.com/flutter/engine/pull/51009#discussion_r1649500122).

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-24 22:15:11 +00:00
Chris Bracken
ab3c5ba987 [macOS] Generate universal gen_snapshots (flutter/engine#53524)
This reverts commit b16181fe6adf18f448058fd4e68ceb4f78f601ab (#52913).
This relands commit f73900ba16ab3873c7f631ab321d4f0ac0194a8e (#52885).

Previously, the `gen_snapshot_arm64` and `gen_snapshot_x64` binaries used by the tool were all built for x64 architecture. As such, developers building apps with Flutter rely on Rosetta translation with every build.

This refactors the gen_snapshot build rules on macOS hosts to consistently produce `gen_snapshot_arm64` and `gen_snapshot_x64` binaries with the target architecture of the build but with as universal binaries with both host architectures.

## arm64 host build

Prior to this patch we emitted:
* gen_snapshot_arm64 (arch: x64, target_arch: simarm64)

After this patch, we emit:
* artifacts_x64/gen_snapshot_arm64 (arch: x64, target_arch: simarm64)
* artifacts_arm64/gen_snapshot_arm64 (arch: arm64, target_arch: arm64)
* gen_snapshot_arm64 (universal binary composed of both of the above)

## x64 host build

Prior to this patch we emitted:
* gen_snapshot_x64 (arch: x64, target_arch: x64)

After this patch, we emit:
* artifacts_x64/gen_snapshot_x64 (arch: x64, target_arch: x64)
* artifacts_arm64/gen_snapshot_x64 (arch: arm64, target_arch: simx64)
* gen_snapshot_x64 (universal binary composed of both of the above)

Note that host builds on macOS currently default to a host architecture of x64 (can be overridden via `--force-mac-arm64`) regardless of host architecture and thus, the build itself relies on Rosetta translation when invoked on Apple Silicon arm64 hardware. This is to ensure a consistent build in CI regardless of bot architecture. See: 0d2b0cd0ed/tools/gn (L502-L505)

Issue: https://github.com/flutter/flutter/issues/101138
Issue: https://github.com/flutter/flutter/issues/69157

Related issue: https://github.com/flutter/flutter/issues/103386

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-24 22:01:09 +00:00
Jenn Magder
e517aa1ce2 Run safari-dart2js-html tests on macOS 13 (flutter/engine#53497)
https://github.com/flutter/engine/pull/53402 didn't work. Run these Safari tests on macOS 13 only until it can be fixed for macOS 14.
2024-06-21 20:50:57 +00:00
jezell
d1e6ca839c Add createImageFromTextureSource method to ui_web (flutter/engine#53483)
Adds createImageFromTextureSource for flutter web, exposed in dart:web_ui.

```dart
final ui.Image uiImage = renderer.createImageFromTextureSource(bitmap,
            width: 150, height: 150, transferOwnership: false);
```

In canvaskit renderer, this will use MakeLazyImageFromTextureSource. In SkWasmRenderer, it will call imageCreateFromTextureSource, which was already implemented in SkWasm for createImageFromImageBitmap to use, but was not exposed in a way that it could be taken advantage of.

By default, createImageFromTextureSource will create a copy of the object it is passed, but transferOwnership: true may be specified to allow transferable objects to be transferred to the renderer, avoiding the copy.

Fixes: https://github.com/flutter/flutter/issues/150479
Fixes: https://github.com/flutter/flutter/issues/144815
2024-06-21 20:28:55 +00:00
auto-submit[bot]
249de68438 Reverts "Fix focus management for text fields (#51009)" (flutter/engine#53502)
Reverts: flutter/engine#51009
Initiated by: jiahaog
Reason for reverting: This causes b/348598454. We're getting test failures with stack traces like the following after this PR:

```
Cannot get renderObject of inactive element.
In order for an element to have a valid renderObject, it must be active, which means it is part of the tree.
Instead, this element is in the _ElementLifecycle.inactive state.
If you called this method from a State object, consider guarding
```

Original PR Author: tugorez

Reviewed By: {mdebbar}

This change reverts the following previous change:
Fix focus management for text fields

This PR:

1. Refactors the DOM `focus` function to take [options][1]
2. Removes the timers sorrounding the `activeDomElement.focus()` so that the input elements get focused as immediate as possible.
3. Prevents the default on pointerdown in a Flutter View and schedules a `requestViewFocusChange` to claim focus in that view after some time. This gives `2` the opportunity to focus the right `<input />` or `<textarea />` element. This helps focus correctly transition from one input element to another (without jumping to a flutter view in between).
4. Deactivating a `TextField` doesn't blur the focused element anymore, it insteads schedules for later a call to move the focus to the flutter view if nothing inside it claimed focus first.
5. Prevents scroll in all the focus calls (this should help with the view jumping when focusing one text field after another).

## Sample apps

1. Full screen mode: https://tugorez.com/flutter_focus_web
2. Embedded mode: https://tugorez.com/flutter_focus_web?embedded

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-21 12:56:47 +00:00
Mouad Debbar
00389408cd [web] Add 'flt-semantics-identifier' attribute to semantics nodes (flutter/engine#53278)
Make [`Semantics(identifier: '...')`](https://api.flutter.dev/flutter/semantics/SemanticsProperties/identifier.html) useful on the web. This PR plugs the Semantics `identifier` property as an HTML attribute `semantics-identifier` onto semantics elements.

This is useful in some scenarios:
- In testing to check if a certain semantics node has made it to the page ([example](https://github.com/flutter/flutter/issues/97455)).
- In apps and/or packages to be able to lookup the DOM element that corresponds to a certain semantics node ([example](https://github.com/flutter/packages/pull/6711)).

Fixes https://github.com/flutter/flutter/issues/97455
2024-06-20 23:23:15 +00:00
Mouad Debbar
33e1bcf96f [web] Don't add href="#" to semantics links (flutter/engine#53395)
This is a stopgap for issues like https://github.com/flutter/flutter/issues/146291 until we land better link semantics (in https://github.com/flutter/flutter/issues/150263 and https://github.com/flutter/packages/pull/6711). For the time being, the `href="#"` isn't providing any extra value, and is causing the browser to navigate to to `#` whenever the semantics link is clicked, which is undesirable.

Fixes https://github.com/flutter/flutter/issues/146291
2024-06-20 23:21:36 +00:00
Bruno Leroux
481f292371 [Web] Fix extra new line when inputAction is not newline for a multil… (flutter/engine#53453)
## Description

This PR prevents new line key event from being dispatched for a multiline text field when `TextField.textInputAction` is not `TextInputAction.newline`.

Since https://github.com/flutter/engine/pull/33428, web engine does not prevent new line key events.
In https://github.com/flutter/engine/pull/36893, I fixed a similar issue for single line text fields. At that time I was not sure if we want to fix it for multiline text fields. I checked again on non-web platforms (macos, iOS, Android) and the new line is not added if the input action is not `TextInputAction.newline`.

For a **multiline field**, the default text input action is `TextInputAction.newline`.
If the developer sets text input action to another value:
- before this PR, the action is performed and a new line is added.
- after this PR, the action is performed but no new line is added.

## Related Issue

Fixes https://github.com/flutter/flutter/issues/145051

## Tests

Adds 1 tests, updates 3 tests.
2024-06-20 19:21:47 +00:00
Juanjo Tugores
b1469d7ed7 Fix focus management for text fields (flutter/engine#51009)
Fix focus management for text fields

This PR:

1. Refactors the DOM `focus` function to take [options][1]
2. Removes the timers sorrounding the `activeDomElement.focus()` so that the input elements get focused as immediate as possible.
3. Prevents the default on pointerdown in a Flutter View and schedules a `requestViewFocusChange` to claim focus in that view after some time. This gives `2` the opportunity to focus the right `<input />` or `<textarea />` element. This helps focus correctly transition from one input element to another (without jumping to a flutter view in between).
4. Deactivating a `TextField` doesn't blur the focused element anymore, it insteads schedules for later a call to move the focus to the flutter view if nothing inside it claimed focus first.
5. Prevents scroll in all the focus calls (this should help with the view jumping when focusing one text field after another).

## Sample apps

1. Full screen mode: https://tugorez.com/flutter_focus_web
2. Embedded mode: https://tugorez.com/flutter_focus_web?embedded

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-20 17:51:50 +00:00
Jim Graham
7f44004e56 [DisplayList] delete obsolete PathEffect sources (flutter/engine#53441)
As of https://github.com/flutter/engine/pull/53411 there are no more (non-test) references to path effects anywhere in the engine.

Deleting the dead code.
2024-06-18 07:45:01 +00:00
Jason Simmons
50586aac61 Manual roll of Dart SDK from e90b0a53e058 to dca20ab646c5 (flutter/engine#53410)
Updates dart2wasm invocation to add the --enable-experimental-wasm-interop flag.

(see https://dart.googlesource.com/sdk/+/6f21d19b02eb82c0b44b01dbdb21ec7a17e17120)
2024-06-15 00:52:56 +00:00
Jason Simmons
285c718c82 Roll web_ui dependencies to enable the next roll of the Dart SDK (flutter/engine#53399)
Dart has removed the UnmodifiableXXXView classes, which were used by older versions of the archive package.

See https://dart.googlesource.com/sdk/+/18994e6e46ec9fb2fac8368c43d448119abd579f
2024-06-14 20:52:04 +00:00
Jackson Gardner
5dd33ba48e Hack to prevent Safari from being backgrounded during unit tests. (flutter/engine#53402)
Safari actually pauses execution of our unit tests if the window becomes occluded or non-visible. As such, I am inserting this egregious hack which just makes the Safari window frontmost every 2 seconds so that the unit tests don't get stalled out.

This should fix https://github.com/flutter/flutter/issues/150023
2024-06-14 20:18:32 +00:00
gaaclarke
41f2a43998 [Impeller] makes bgra10xr test more comprehensive (flutter/engine#53320)
fixes https://github.com/flutter/flutter/issues/149946

depends on:
- https://skia-review.googlesource.com/c/skcms/+/864516
- https://skia-review.googlesource.com/c/skia/+/864536

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-11 22:34:19 +00:00
Yegor
c3f77aa187 Revert "[web] switch from .didGain/LoseAccessibilityFocus to .focus (… (flutter/engine#53342)
…#53134)"

This reverts commit f1978535f0355491a67a07ddaf87297361e90d83.

Reverting because the engine PR landed prematurely. It needs to wait for
a framework change, otherwise, things will break.
2024-06-11 13:27:53 -07:00
Jason Simmons
593a9d0da5 Fix character getter API usage in stripLeftSlashes/stripRightSlashes (flutter/engine#53299) 2024-06-11 19:08:22 +00:00
Yegor
f1978535f0 [web] switch from .didGain/LoseAccessibilityFocus to .focus (flutter/engine#53134)
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
2024-06-11 18:41:49 +00:00
Brandon DeRosier
f6559124a1 [Flutter GPU] Generate DescriptorSetLayouts for pipelines & export symbols on Android. (flutter/engine#53184)
Part of https://github.com/flutter/flutter/issues/145011.

This gets Flutter GPU working on Android.
2024-06-11 11:25:29 -07:00
Victoria Ashworth
91d74de0c6 Temporarily run Linux linux_web_engine Mac tests on Mac-13 only (flutter/engine#53318)
Temporary solution for https://github.com/flutter/flutter/issues/150023

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-10 23:11:17 +00:00
Martin Kustermann
d82c365da3 Use dart.library.html to distinguish dart2wasm from dart2js/ddc in conditional imports (flutter/engine#53307)
Users of packages that have specialized code for the VM (which supports
FFI) use conditional imports based on `dart.library.ffi`. We don't want
the VM-specific code to be used for web in dart2wasm.

As a result we're going to make `dart.library.ffi` be false in
conditional imports (as well as in
`const bool.fromEnvironment('dart.library.ffi')`).

Issue https://github.com/dart-lang/sdk/issues/55948
Issue https://github.com/flutter/flutter/issues/149984
2024-06-10 15:58:43 +02:00
Martin Kustermann
b3c296296e Use new dart:js_interop way to externalize/internalize objects (flutter/engine#53304)
The issue in [0] was fixed. So we no longer have to use conditional
imports and dart2wasm vs dart2js specific implementations.

Instead we use the new extension methods introduced due to [0], namely
`Object.toExternalReference` and `ExternalDartReference.toDartObject`.

[0] https://github.com/dart-lang/sdk/issues/55183
2024-06-10 14:08:35 +02:00
Yegor
0068c531ee [web] add test for inefficient overlay allocation (flutter/engine#53284)
Adding a test that demonstrates https://github.com/flutter/flutter/issues/149863. When the issue is fixed, this test can be adjusted to verify the optimal behavior.
2024-06-07 23:38:10 +00:00
Jackson Gardner
7af7be3e5d Update Chrome to 125. (flutter/engine#53282)
Just updating Chrome For Testing because we're about six versions out of date now.
2024-06-07 22:02:21 +00:00
Jackson Gardner
24ca8a9440 Fixes a few issues in flutter_js (flutter/engine#53231)
This addresses a couple things:
https://github.com/flutter/flutter/issues/147610 (Treat `auto` renderer properly)
https://github.com/flutter/flutter/issues/149443 (Add an entrypoint base url config option)

This also adds a `useLocalCanvasKit` configuration option on the build config, which the flutter tool can use to fix https://github.com/flutter/flutter/issues/148713
2024-06-07 20:35:12 +00:00
Victoria Ashworth
a7057a3f7a Run tests on macOS 13 or 14 (flutter/engine#53252)
In preparation of upgrading our fleet to macOS 14, allow tests to run on either macOS 13 or 14.

Fixes https://github.com/flutter/flutter/issues/148879.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-06 17:40:15 +00:00
Tong Mu
48799ceebf Make pointer events ignore invalid views (flutter/engine#51925)
With this PR, Flutter will now ignore pointer events for an invalid view, i.e. views that have not been add or have been removed.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-06 07:18:20 +00:00
Yegor
6dc99dce8a [web] clean up dynamic calls, remove always_specify_types (flutter/engine#53228)
Remove the `avoid_dynamic_calls` exception in `web_ui`, and clean up all dynamic calls.
2024-06-06 02:16:55 +00:00
David Iglesias
6eacdf2be8 [web] Adds allowPlatformDefault for wheel signals. (flutter/engine#51566)
Adds a function to each 'wheel' DataPacket sent to the framework so it can signal whether to `allowPlatformDefault` or not.

The current default is to always `preventDefault` on browser events that get sent to the framework.

This PR enables the framework to call a method on the `DataPacket`s to `allowPlatformDefault: true`, if the framework won't handle the Signal (signals are handled synchronously on the framework).

This lets the engine "wait" for the framework to decide whether to `preventDefault` on a `wheel` event or not.

## Issues

* Needed for: https://github.com/flutter/flutter/issues/139263

## Tests

* Added unit tests for the feature in the engine repo, veryfing whether the event has had its `defaultPrevented` or not.
* Manually tested in a demo app (see below)

## Demo

* https://dit-multiview-scroll.web.app

<details>
<summary>

## Previous approaches

</summary>

1. Add a `handled` bool property to `PointerDataPacket` that the framework can write to (brittle)
2. Modifications to the `PlatformDispatcher` so the framework can `acknowledgePointerData` with a `PointerDataResponse` (fffffatttt change)
3. `acknowledge` function in `PointerDataPacket`

</details>

> [!IMPORTANT]
> * Related: https://github.com/flutter/flutter/pull/145500

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-05 23:25:53 +00:00
gaaclarke
2dc427b86f [Impeller] added test for bgra10xr png encoding (flutter/engine#53182)
fixes: https://github.com/flutter/flutter/issues/148851
depends on: 
 - https://skia-review.googlesource.com/c/skcms/+/861638
 - https://skia-review.googlesource.com/c/skia/+/861516

## 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.
- [x] I added new tests to check the change I am making or feature I am
adding, or 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].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2024-06-05 14:41:05 -07:00
Yegor
33f46701ba [web] enable always_specify_types for web_ui (flutter/engine#53226)
`always_specify_types: false` and `avoid_dynamic_calls: false` is a dangerous combination. Let's clean up `avoid_dynamic_calls` before disabling `always_specify_types`.
2024-06-05 18:05:24 +00:00
Matan Lurey
2565803818 Re-land #52859: Revamp the engine style guide, remove always_specify_types (flutter/engine#53223)
Based on the (internal) discussion around converging on using the official Dart style guide, the design discussion https://flutter.dev/go/use-dart-style-in-flutter-engine, and with the exception of the code that gets published under `dart:ui` (as that is user-facing, and we'd like to evolve the code style in conjunction with the framework), we're going to be (gradually) adopting the Dart style guide in `flutter/engine`.

For now, we:
- Remove `always_specify_types` (except for `lib/ui`, i.e. `dart:ui`)
- Re-enable `type_annotate_public_apis` (which is now relevant since the above is disabled)
- Announce our _intent_ to re-format and apply the Dart formatter (which we'll land in the near future)

---

I also took the opportunity to specify more about our style guide use in general, mostly to make it easier to understand our conventions, and also call out known problem areas (notably, our over-use of `shared_ptr` and `auto` in some cases). I am happy to split those up, but it was easier to make the markdown changes at once.

I also took @cbracken and folks advice and clarified directly that explicit types in Dart are _not_ bad (with examples).
2024-06-05 16:53:06 +00:00
victorgalo
2b309db996 Add support for setting the heading level for web semantics (#97894) (flutter/engine#41435)
This change adds a new property in Semantics widget that would take an integer value corresponding to the heading levels defined by the ARIA heading role. This is necessary in order to get proper accessibility and usability in a website for users who rely on screen readers and other assistive technologies.

Issue fixed by this PR:
https://github.com/flutter/flutter/issues/97894

Framework part:
https://github.com/flutter/flutter/pull/125771
2024-06-04 23:11:17 +00:00
Emmanuel Ferdman
6bee81e9b6 [web] update version-lock file location (flutter/engine#52842)
PR #47573 renamed the version-lock file from `browser_lock.yaml` to `package_lock.yaml`. This PR adjusts sources to changes.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-04 17:50:04 +00:00
David Iglesias
ac58f0a9c2 [web] Add Ethiopic font fallback. (flutter/engine#53180)
Adds `Noto Sans Ethiopic` font as a fallback so Flutter web can render text in ethiopic scripts (for languages like Tigrinya or Amharic)

## Issues

* Fixes https://github.com/flutter/flutter/issues/149616

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-03 23:24:50 +00:00