3075 Commits

Author SHA1 Message Date
Mouad Debbar
d205cf6af6 [web] Preserve correct CanvasKit Variant during test initialization (flutter/engine#43854)
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
2023-07-20 18:06:24 +00:00
Mouad Debbar
6d0be04af3 [web] sync => isSync , scuba => golden (flutter/engine#43699)
This PR addresses some of the items in https://github.com/flutter/flutter/issues/100394
2023-07-18 18:28:13 +00:00
Brian Osman
b8a91e96a8 Fix drawVertices documentation (flutter/engine#43747)
Update the blend mode section of the documentation to specify the correct blend modes.

Fixes https://github.com/flutter/flutter/issues/130747
2023-07-17 22:48:14 +00:00
Michael Goderbauer
40c304099d Move ViewConfiguration ownership to FlutterView (flutter/engine#43701)
This makes the FlutterView object a little bit less brittle by not depending on the PlatformDispatcher so much.
2023-07-15 01:21:09 +00:00
Yegor
7413bfb203 [web] always add secondary role managers (flutter/engine#43663)
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
2023-07-14 23:59:04 +00:00
Kevin Lubick
bdc24b3d18 Remove calls to SkCanvas::flush() (flutter/engine#43684)
In https://skia-review.googlesource.com/c/skia/+/716476, Skia removed
calls to SkCanvas::flush(). This replaces those calls that Flutter was
making with what had been going on - calling GrDirectContext::flush() if
the canvas was backed by a Ganesh backend. Raster-backed canvases did
not need flushing.

## 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].
- [ ] 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 Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [ ] 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
[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
2023-07-14 16:34:22 -04:00
Martin Kustermann
0e369e0e4e Use utf8.encode() instead of longer const Utf8Encoder.convert() (flutter/engine#43675)
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
2023-07-14 13:44:54 +02:00
Ian Hickson
34c0f686c5 Add more points to [MediaQuery]. (flutter/engine#43649)
See https://github.com/flutter/flutter/issues/11697
2023-07-14 00:34:14 +00:00
Ian Hickson
1ca3a2c32a Remove unimplemented API call saveCompilationTrace (flutter/engine#43656)
Fixes https://github.com/flutter/flutter/issues/59205
2023-07-14 00:34:12 +00:00
LongCatIsLooong
b7472f9a45 Reland #43118 "Add a flag to ParagraphBuilder for rounding hack migration" (flutter/engine#43647)
real diff: aedc37a3e0

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-07-13 22:30:32 +00:00
LongCatIsLooong
64c139e98a Revert "Add a flag to ParagraphBuilder for rounding hack migration" (flutter/engine#43642)
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.
2023-07-13 17:54:33 +00:00
chunhtai
8f5fb30a7f [web] TextField a11y focus should call didGain/didLose a11y focus action (flutter/engine#43279)
fixes https://github.com/flutter/flutter/issues/128709

requires https://github.com/flutter/flutter/pull/129652

The issue is that when textfield focus in framework and web engine a11y are out of sync, the framework keep sending update with textfield focus = true and causes web engine to keep refocusing the textfield.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-07-13 17:43:53 +00:00
Jason Simmons
49813d1e77 Apply the transform of an image filter layer to paint bounds in the CanvasKit backend (flutter/engine#43353)
Fixes https://github.com/flutter/flutter/issues/128788
2023-07-13 14:26:04 +00:00
Ian Hickson
eaca35dd7c Document (and assert) that channel names can't contains nulls (flutter/engine#43593)
Fixes https://github.com/flutter/flutter/issues/116652
2023-07-12 21:44:31 +00:00
Srujan Gaddam
49e8ec8b0b Reland "Refactor JSNumber.toDart and Object.toJS" (flutter/engine#43363)
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.
2023-07-12 14:27:16 -07:00
LongCatIsLooong
3b27aa3e95 Add a flag to ParagraphBuilder for rounding hack migration (flutter/engine#43118)
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
2023-07-12 20:36:45 +00:00
Jim Graham
870fc78163 header file cleanup focusing on removing unnecessary SkPicture includes (flutter/engine#43589)
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
2023-07-12 08:17:06 +00:00
Jim Graham
77514c4f43 Use full 4x4 matrix transforms in TransformLayer (flutter/engine#43536)
Fixes: https://github.com/flutter/flutter/issues/82961
Fixes: https://github.com/flutter/flutter/issues/113346

The fix was a simple fallout from the previous work to add support for SkM44 throughout the DL and Diff mechanisms (see https://github.com/flutter/flutter/issues/82955, https://github.com/flutter/flutter/issues/116198, https://github.com/flutter/engine/pull/37394)

Tested with its own existing and new unit tests as well as the test case from https://github.com/flutter/flutter/issues/113346
2023-07-11 01:55:07 +00:00
Jonah Williams
83ba0cd2d0 [Impeller] Don't decompress into device buffer for Vulkan/GLES. (flutter/engine#43493)
My observations on the Pixel 6 device are that performing device allocations from multiple threads can dramatically slow down the raster task workload. As a stopgap solution, we can adjust image upload to only touch the device allocator on the IO thread which reduces the parallel access.

This doesn't have any impact on the S10, but locally on the Pixel 6 it is a night and day difference. I am testing using jonahwilliams/forked_gallery and navigating to the Reply demo. This demo has a large number of images, several of which are quite large.

Work towards https://github.com/flutter/flutter/issues/129392

### Before

Page transition is ~4 frames.

![image](https://github.com/flutter/engine/assets/8975114/b6d1c225-060b-4a20-9737-ad668423799a)

### After

Page transition is ~20 frames.

![image](https://github.com/flutter/engine/assets/8975114/5ff1f857-8327-4d04-b40a-3da4a5fc91a4)
2023-07-10 20:48:18 +00:00
Tong Mu
489f9c3d01 Make updating window metrics multi-view (flutter/engine#43366)
This PR adds multi-view support to various methods that updates the window metrics by adding a `view_id` parameter.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-07-08 05:54:16 +00:00
Loïc Sharma
78783ef68f Fix typo in painting.dart (flutter/engine#43378) 2023-07-06 02:39:31 +00:00
Jonah Williams
a74c376962 [Impeller] Allocate fewer textures in dedicated memory and adjust buffer flags. (flutter/engine#43313)
Following some thresholds from ANGLE, lets try allocating fewer of our resources into dedicated memory to see if that improves allocator performance.

https://github.com/flutter/flutter/issues/129737
2023-07-05 21:05:47 +00:00
David Iglesias
f1b51a702c [web] Add nonce configuration. (flutter/engine#42829)
This PR adds a `nonce` JS configuration attribute so users can pass a nonce value to their flutter engine initialization code.

This `nonce` is used to mark all scripts/styles needed by Flutter web that are considered `unsafe-inline` by CSP. In this change, there are only two tags that benefit from this:

* canvaskit.js
* inline styles for text editing

Before this change, the most strict CSP that allows a Flutter Web app to run would look like:

```
script-src 'self' 'nonce-flutter-init-scripts' 'wasm-unsafe-eval' https://www.gstatic.com/flutter-canvaskit/;
font-src https://fonts.gstatic.com;
style-src 'unsafe-inline';
```

After this change, CSP could be tightened to:

```
script-src 'self' 'nonce-YOUR_NONCE_VALUE' 'wasm-unsafe-eval';
font-src https://fonts.gstatic.com;
style-src 'nonce-YOUR_NONCE_VALUE';
```

By initializing the Flutter web app with something like this:

```html
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'nonce-YOUR_NONCE_VALUE' 'wasm-unsafe-eval'; font-src https://fonts.gstatic.com; style-src 'nonce-YOUR_NONCE_VALUE';">

...

<script nonce="YOUR_NONCE_VALUE">
  _flutter.loader.loadEntrypoint({
    onEntrypointLoaded: async function(engineInitializer) {
      let appRunner = await engineInitializer.initializeEngine({
        nonce: 'YOUR_NONCE_VALUE',
      });
      appRunner.runApp();
    }
  });
</script>
```

## Issues

Fixes https://github.com/flutter/flutter/issues/126977 (does not address `flutter.js`, that's a [different story](https://github.com/flutter/flutter/issues/128061))
Helps with https://github.com/flutter/flutter/issues/80221

---

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-06-30 01:48:04 +00:00
Brandon DeRosier
2523231c29 [Impeller] Remove all double empties (flutter/engine#43345)
Unwrap optionals that already have an empty state that must be checked, like `std::optional<std::shared_ptr<T>>` and `std::optional<std::function<T>>`.
2023-06-29 22:04:51 +00:00
Mouad Debbar
647d4fca2b [web] Move web-only initialization APIs to dart:ui_web (flutter/engine#43111)
| Old API in `dart:ui` | New API in `dart:ui_web` |
|-|-|
| ~`webOnlyInitializePlatform`~ | ~`ui_web.initializePlatform`~ |
| `webOnlyWarmupEngine` | `ui_web.bootstrapEngine` |
| `debugEmulateFlutterTesterEnvironment` | `ui_web.debugEmulateFlutterTesterEnvironment` |
| `webOnlySetPluginHandler` | `ui_web.setPluginHandler` |

Part of https://github.com/flutter/flutter/issues/126831
2023-06-29 19:52:48 +00:00
Martin Kustermann
d6f96120e9 Prepare for utf8.encode() to return more precise Uint8List type (flutter/engine#43335)
To avoid analyzer warnings when utf8.encode() will return the more
precise Uint8List type, we use const Utf8Encoder().convert() which
already returns Uint8List

See https://github.com/dart-lang/sdk/issues/52801
2023-06-29 19:27:49 +02:00
Jason Simmons
ff3ce46a4d Include the SkRTreeFactory headers in the skwasm picture recorder (flutter/engine#43292) 2023-06-28 00:45:38 +00:00
Srujan Gaddam
fe300ba3c6 Revert "Refactor JSNumber.toDart and Object.toJS" (flutter/engine#43286)
Reverts flutter/engine#43149

Reason for reverting: Broke the roll into the framework.
2023-06-27 22:31:17 +00:00
Yegor
007bc8126e [web:a11y] introduce primary role responsible for ARIA roles (flutter/engine#43159)
This PR fixes https://github.com/flutter/flutter/issues/128468 by changing the relationship between semantics nodes and their roles from this:

```
SemanticsNode one-to-many RoleManager
```

To this:

```
SemanticsNode one-to-one PrimaryRoleManager one-to-many RoleManager
```

Previously a node would simply have multiple role managers, some of which would be responsible for setting the `role` attribute. It wasn't clear which role manager should be doing this. It also wasn't clear which role managers were safe to reuse across multiple types of nodes. This led to the unfortunate situation in https://github.com/flutter/flutter/issues/128468 where `LabelAndValue` ended up overriding the role assigned by `Checkable`.

With this PR, a `SemanticsNode` has exactly one `PrimaryRoleManager`. A primary role manager is responsible for setting the `role` attribute, and importantly, it's the _only_ thing responsible for it. It's _not safe_ to share primary role managers across different kinds of nodes. They are meant to provide very specific functionality for the widget's main role. OTOH, a non-primary `RoleManager` provides a piece of functionality that's safe to share.

A `Checkable` is a `PrimaryRoleManager` and is the only thing that decides on the `role` attribute. `LabelAndValue` is now a `RoleManager` that's not responsible for setting the role. It's only responsible for `aria-label`. No more confusion.

This also drastically simplifies the logic for role assignment. There's no more [logical soup](d4889c682d/lib/web_ui/lib/src/engine/semantics/semantics.dart (L1340)) attempting to find a good subset of roles to assign to a node. [Finding](93df91df95/lib/web_ui/lib/src/engine/semantics/semantics.dart (L1477)) and [instantiating](93df91df95/lib/web_ui/lib/src/engine/semantics/semantics.dart (L1498)) primary roles are very linear steps, as is [assigning a set of secondary roles](93df91df95/lib/web_ui/lib/src/engine/semantics/image.dart (L16)).
2023-06-27 20:49:03 +00:00
Jackson Gardner
3a44bbda74 Initialize skwasm codecs before handing them back to the user. (flutter/engine#43274)
Benchmarks were failing because the code was reading the `frameCount` and `repetitionCount` before reading any frames out of the codec. The codec gets implicitly initialized when you read a frame, but we should return it to the user initialized so that `frameCount` and `repetitionCount` work even if you haven't read a frame yet. This is consistent with how CanvasKit's codec works.

Also, modified our unit tests so that they exercise the codecs in this way.
2023-06-27 20:17:30 +00:00
Jonah Williams
ac3ce651f3 [Impeller] Give Impeller a dedicated raster priority level worker loop. (flutter/engine#43166)
We'd like to (or already are) using the concurrent message loop for high priority rendering tasks like PSO construction and render pass encoding. The default priority level for the engine managed concurrent message loop is 2, which is a significantly lower priority than the raster thread at -5. This is almost certainly causing priority inversion.

We must move back to dedicated runners so we can adjust thread priorities.
2023-06-27 18:08:49 +00:00
David Iglesias
af5ad81ca7 [web] Removes patchCanvasKitModule. (flutter/engine#42941)
**This must land _after_ https://github.com/flutter/flutter/pull/129032**

Flutter web uses requireJS in `debug` mode to assemble a DDC-compiled app from a bunch of small files ("modules").

This caused that `canvaskit.js` (then, but probably all other modules that used a browserify-like loading header) didn't work because it attempted to use the `define` function provided by Flutter's instance of `requireJS` (which kept the defined modules private, rather than as globals on the page, as the users of the JS expected).

A [fix](https://github.com/flutter/engine/pull/27342) was added to `flutter/engine` to trick loaders into *not* using the `requireJS` module loader, but a recent change in the fix's js-interop layer *subtly* changed its JS output on the page (objects went from `undefined` to `null`), causing this:

* https://github.com/flutter/flutter/issues/126131 (and others)

After flutter/flutter#129032, the engine fix shouldn't be required anymore, so this PR removes it.

## Issues

* Fixes https://github.com/flutter/flutter/issues/126131 (and possibly others)

## Testing

* Manually tested with some test apps, and miscellanous JS scripts as reported by users.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-06-27 00:01:21 +00:00
Srujan Gaddam
a4ed4a8536 Refactor JSNumber.toDart and Object.toJS (flutter/engine#43149)
JSNumber.toDart will now be two functions: toDartDouble and toDartInt.
Note that some code that looks like `toDart.toInt()` was kept as
`toDartDouble.toInt()` instead of `toDartInt`, since `toDartInt` throws
if the value is not an integer.

Object.toJS is now Object.toJSBox. An actual box is introduced on all
backends now, and is unwrapped in JSBoxedDartObject.toDart. There are
many usages of toJSAnyShallow that we should modify, but that's for a
later CL.

This is to help land this CL:
https://dart-review.googlesource.com/c/sdk/+/309082

https://dart-review.googlesource.com/c/sdk/+/309081 is the CL that added
the new methods.

## 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].
- [x] All existing and new tests are passing.
2023-06-26 15:10:50 -07:00
fzyzcjy
7d5a34cf72 ParagraphStyle uses the wrong bit mask (flutter/engine#43070)
For example, `_encodeParagraphStyle` says:

```dart
  if (locale != null) {
    result[0] |= 1 << 12;
    // Passed separately to native.
  }
```

We know `1<<12` is 4096.

On the other hand, the old code uses `0x800`, which is 2048.

And the strutStyle field is missing.

*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*List which issues are fixed by this PR. You must list at least one issue.*

*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
2023-06-26 18:58:47 +00:00
Hassan
d4889c682d [web] - Fix for Safari partially autofilling form (flutter/engine#43058)
We have an issue where autofill in Safari Desktop is only partially autofilling the form.  The only input that gets filled is the currently focused one. 

This is happening for a couple of reasons:
- We hide non-focused inputs that are part of the autofill form by sizing them to 0px height and width, among other styles.
- This doesn't cause issues in most browsers.  However, Safari does not respect offscreen or 0-sized inputs, and this leads to the partial form autofill issue. 

The solution is to make sure we hide the inputs in the rest of the form from the users, without hiding it from Safari. 

Fixes https://github.com/flutter/flutter/issues/71275
2023-06-23 20:19:37 +00:00
Jonah Williams
07e900baf6 [Impeller] re-enable buffer to texture blit Vulkan. (flutter/engine#43129)
I was missing the VMA flush.

Because skia is writing directly to the exposed ptr, we don't go through the OnSetContents which makes a flush call. Add a flush API and implement it for Vk DeviceBuffers.
2023-06-23 16:27:51 +00:00
Dan Field
682e06b5fc Removed outdated comment from lib/ui/canvas.h (flutter/engine#43112)
This no longer applies.
2023-06-23 04:29:19 +00:00
Mouad Debbar
907fcd3245 [web] Don't get break type from v8BreakIterator (flutter/engine#43053)
In some languages, when the text contains a new line "\n", the `v8BreakIterator` starts returning different values from `breakType()`. This caused our code to think that those line breaks were hard line breaks when in fact they were soft line breaks. Still unclear if this is a `v8BreakIterator` bug or a wrong expectation on our side regarding how `breakType()` is supposed to work.

Instead of using `v8BreakIterator.breakType()`, let's do the `soft` vs `hard` detection ourselves (we already have all the necessary pieces).

Fixes https://github.com/flutter/flutter/issues/127379
2023-06-22 17:35:44 +00:00
Jonah Williams
0b17d31261 Revert "[Impeller] dont use concurrent runner to decode images on Android." (flutter/engine#43061)
Reverts flutter/engine#42944

This didn't improve any of the benchmarks, which I think at least disproves my theory on overloading. Lets go back to the prior strategy and look for improvements elsewhere.
2023-06-22 17:19:42 +00:00
Jason Simmons
c4e22ba089 Implement the APNG_DISPOSE_OP_BACKGROUND disposal method in the animated PNG decoder (flutter/engine#42933) 2023-06-21 00:36:49 +00:00
Jason Simmons
91f507c27c A few minor cleanups of the MultiFrameCodec (flutter/engine#42935) 2023-06-20 17:57:17 +00:00
Michael Goderbauer
12e586914e Reland "Add deprecations to PlatformMessage stuff" (#42580) (flutter/engine#42929)
This reverts commit 2b5c1f8d95c9c54e51787f5ceaeb142c0666aa72.

This is a straight reland without any additional changes. The package that was still using the outdated API causing the original revert has been updated in https://github.com/flutter/packages/pull/4233. **Do not land this until that PR has rolled into the framework.**
2023-06-20 16:42:25 +00:00
Jonah Williams
6ddcc5c032 Fix prefer_final_in_foreach analysis errors (flutter/engine#42971)
This is now failing the engine roll for some reason https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20analyze/58456/overview
2023-06-18 23:49:28 +00:00
Jonah Williams
93351f1448 [Impeller] dont use concurrent runner to decode images on Android. (flutter/engine#42944)
Even with separate allocators and queues, I think that using the concurrent runner is just overloading the phone.

On Android force it all onto the I/O thread.

https://github.com/flutter/flutter/issues/128919
2023-06-18 03:54:04 +00:00
Hassan
5e05d8b967 [web] Fix for Safari autofill flickering bug (flutter/engine#42830)
Safari web autofill has an issue where the autofill dialog flickers and doesn't completely render and allow users to fill any forms. 

This is caused by a collision between default browser behavior on the `pointerdown` event and the programatic focusing of our inputs. 

### Problem

When we click into an input, the element is created, placed, and (explicitly) focused.  However, all of this is done before the `pointerdown` event can finish.  Since all `pointerdown` elements target the `flutter-view` (formerly `flt-glass-pane`), default browser behavior is to trigger a `blur` event since the target doesn't match what's currently focused, which is the input element.  This doesn't manifest into most text editing issues because we listen for `blur` events on the `input` and call `focus()`.  However, in Safari, this near-instant focus/blur results in the disappearance of the autofill popup. 

The current chain of events looks like: 

`pointerdown` event starts -> input is created + focused -> `pointerdown` event ends, and triggers a `blur` -> input refocuses on `blur`

### Solution

This change ensures that we don't focus the input until after the `pointerdown` event concludes, thus preventing any rapid-fire `blur` event from being emitted.  We do this via wrapping the focus logic within a zero-duration Timer.  

The new chain of events looks like:

`pointerdown` event starts -> `pointerdown` event ends ->  input is created + focused

### Alternative approach

Note: Another option was to call `preventDefault()` on the `pointerdown` event to prevent the `blur` from occurring that way.  There may be unintended side effects from that approach, especially as it relates to platform views.  The surface area of the chosen approach is much more contained and should result in no side effects outside of Safari Desktop's text editing strategy. 

<img width="699" alt="Screenshot 2023-06-15 at 7 34 02 PM" src="https://github.com/flutter/engine/assets/110993981/3548d1ea-65f7-412f-b3c7-f94db2658127">

Fixes https://github.com/flutter/flutter/issues/127960
2023-06-16 21:48:59 +00:00
gaaclarke
2b5c1f8d95 Revert "Add deprecations to PlatformMessage stuff" (flutter/engine#42921)
Reverts flutter/engine#42580
2023-06-16 10:54:40 -07:00
Mouad Debbar
3dc65b209f [web] Move webOnlyAssetManager to dart:ui_web (flutter/engine#42642)
Moving `webOnlyAssetManager` to `dart:ui_web` and renaming it to simply `assetManager`. This will make it easier for plugins and apps to get a hold of the asset manager without doing `dart:ui` shims or other shenanigans.

Part of https://github.com/flutter/flutter/issues/126831
2023-06-16 14:54:09 +00:00
Konstantin Scheglov
327e2a3d85 Fix prefer_final_in_for_each (flutter/engine#42899)
Context: https://dart-review.googlesource.com/c/sdk/+/309821
2023-06-15 20:57:43 -07:00
Michael Goderbauer
57ffdedfc4 Add deprecations to PlatformMessage stuff (flutter/engine#42580)
Fixes old TODOs originally added in https://github.com/flutter/engine/pull/22181.
The framework appears to be fully migrated off these.
2023-06-15 19:53:13 +00:00
Kevin Lubick
471a8975bd Remove unnecessary #include of SkPromiseImageTexture (flutter/engine#42770)
I was refactoring this class on the Skia side and saw Flutter #included it, but did not appear to actually use it.

This replaces an unnecessary #include with a necessary one.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-06-12 16:16:48 +00:00