2910 Commits

Author SHA1 Message Date
Jackson Gardner
34cfb4d663 Re-enable some wasm tests which have been fixed now. (flutter/engine#40931)
Re-enable some wasm tests which have been fixed now.
2023-04-10 20:15:52 +00:00
Jackson Gardner
439141c38d Skwasm scene (flutter/engine#40330)
Skwasm scene
2023-04-10 17:38:57 +00:00
Dan Field
e92e4daa76 Move Skia conversion utilities to own TU (flutter/engine#40997)
Move Skia conversion utilities to own TU
2023-04-10 16:46:04 +00:00
Mouad Debbar
5d30f3f043 [web] Make 'Noto Color Emoji' opt-in (flutter/engine#40990)
[web] Make 'Noto Color Emoji' opt-in
2023-04-07 16:54:22 +00:00
Dan Field
967f12d809 [Impeller] Make multi-frame image decodes work even if the GPU switch is disabled (flutter/engine#40963)
Fixes https://github.com/flutter/flutter/issues/124269

Manually verified this is safe on an iPhone 11.

We're not creating/encoding command buffers in this path so it's ok.
AFAICT the test I added would fail if we started doing that because it
doesn't provide any real command buffer interfaces. Most of the code
here is related to tests.
2023-04-06 11:40:27 -07:00
htoor3
072045aa3d Revert "[web] Move text editing nodes outside of shadowDOM - reopened" (flutter/engine#40960)
Reverts flutter/engine#40904
2023-04-05 19:47:08 -07:00
htoor3
438394f01e [web] Move text editing nodes outside of shadowDOM - reopened (flutter/engine#40904)
[web] Move text editing nodes outside of shadowDOM - reopened
2023-04-05 23:42:21 +00:00
Yegor
7231a4d15c [web] fix SkFinalizationRegistry for dart2js (attempt 4) (flutter/engine#40938)
(this is attempt 4; details below)

Remove obsolete object caches and introduce a simpler way to manage
native objects:

* Remove the unused `SynchronousSkiaObjectCache`.
* Introduce new library `native_memory.dart` that's smaller and simpler
than `skia_object_cache.dart`.
* Introduce two types of native object references:
  * `UniqueRef` a reference with a unique Dart object owner.
* `CountedRef` a ref-counted reference with multiple Dart object owners.
* All native references use GC (via `FinalizationRegistry`) as a
back-up.
* The new library removes everything related to object resurrection that
was needed only in browsers that didn't support `FinalizationRegistry`.
All browsers support it now.
* Remove the ad hoc `SkParagraph` cache that predates the introduction
of `Paragraph.dispose`.
* Rewrite `CkParagraph` in terms of `UniqueRef`.
* Rewrite `CkImage` in terms of `CountedRef`; delete `SkiaObjectBox`.

This PR does not migrate all objects from the old
`skia_object_cache.dart` to `native_memory.dart`. That would be too big
of a change. The migration can be done in multiple smaller PRs.

This also removes a few unnecessary relayouts observed in
https://github.com/flutter/flutter/issues/120921, but not all of them
(more details in
https://github.com/flutter/flutter/issues/120921#issuecomment-1481958762)

## About attempt 4

More info about the revert of attempt 3 in
https://github.com/flutter/engine/pull/40937.

In this attempt I check that the browser supports `FinalizationRegistry`
before registering the object. This will allow the code to run in older
browsers, but there will be no protection from memory leaks when the app
fails to dispose of the respective objects.

## Benchmarks

Now that this landed in flutter/flutter I have some benchmark numbers
from the devicelab. The `text_out_of_picture_bounds` benchmark dropped
by 3-4x (lower is better):

<img width="358" alt="Screenshot 2023-04-04 at 6 13 06 PM"
src="https://user-images.githubusercontent.com/211513/229956170-a5399ed3-c779-4af0-babb-ea40440f96ff.png">

The repro provided in https://github.com/flutter/flutter/issues/123204
dropped from 110ms/frame to 10ms/frame.
2023-04-05 11:08:00 -07:00
Casey Hillers
8a7ac5f702 Revert "[web] remove obsolete object caches; simplify native object management" (flutter/engine#40937)
Reverts flutter/engine#40894

This is breaking Google Testing. See b/277004090
2023-04-04 21:49:35 -07:00
Yegor
ebfd37a6f7 [web] remove obsolete object caches; simplify native object management (flutter/engine#40894)
(this is attempt 3; details below)

Remove obsolete object caches and introduce a simpler way to manage
native objects:

* Remove the unused `SynchronousSkiaObjectCache`.
* Introduce new library `native_memory.dart` that's smaller and simpler
than `skia_object_cache.dart`.
* Introduce two types of native object references:
  * `UniqueRef` a reference with a unique Dart object owner.
* `CountedRef` a ref-counted reference with multiple Dart object owners.
* All native references use GC (via `FinalizationRegistry`) as a
back-up.
* The new library removes everything related to object resurrection that
was needed only in browsers that didn't support `FinalizationRegistry`.
All browsers support it now.
* Remove the ad hoc `SkParagraph` cache that predates the introduction
of `Paragraph.dispose`.
* Rewrite `CkParagraph` in terms of `UniqueRef`.
* Rewrite `CkImage` in terms of `CountedRef`; delete `SkiaObjectBox`.

This PR does not migrate all objects from the old
`skia_object_cache.dart` to `native_memory.dart`. That would be too big
of a change. The migration can be done in multiple smaller PRs.

This also removes a few unnecessary relayouts observed in
https://github.com/flutter/flutter/issues/120921, but not all of them
(more details in
https://github.com/flutter/flutter/issues/120921#issuecomment-1481958762)

## About attempt 3

More about [attempt 2
here](https://github.com/flutter/engine/pull/40862).

In this attempt 3 I'm replacing the `factory` with a top-level function.
2023-04-04 12:43:31 -07:00
joshualitt
bee9f91790 [web] Migrate EventListener's to JS types. (flutter/engine#40566) 2023-04-04 09:53:13 -07:00
Jackson Gardner
1f7f52ffac Fail the run_suite_step if any test failures are detected. (flutter/engine#40834)
We need to throw if the `run_suite_step` encounters any test failures.
2023-04-03 18:02:31 -07:00
Chinmay Garde
51aca8ead9 [Impeller] Don't crash in image decompression if the context is unavailable. (flutter/engine#40890)
[Impeller] Don't crash in image decompression if the context is unavailable.
2023-04-03 19:49:04 +00:00
Casey Hillers
20cb8b8efc Revert "[web] remove obsolete object caches; simplify native object management" (flutter/engine#40882)
Reverts flutter/engine#40862

Google Testing is failing on

```
The compiler crashed: root:🎯_engine::SkObjectFinalizationRegistry::@methods::|staticInteropFactoryStub is already bound to Reference to dart:_engine::SkObjectFinalizationRegistry::@methods::|staticInteropFactoryStub, trying to bind to Reference to SkObjectFinalizationRegistry.|staticInteropFactoryStub with node SkObjectFinalizationRegistry.|staticInteropFactoryStub (Procedure:1207727)
```
2023-04-03 10:18:26 -07:00
Yegor
e55fd93f5f [web] remove obsolete object caches; simplify native object management (flutter/engine#40862)
[web] remove obsolete object caches; simplify native object management
2023-04-03 04:31:16 +00:00
Casey Hillers
5a226729ad Revert "[web] remove obsolete object caches; simplify native object management" (flutter/engine#40861)
Reverts flutter/engine#40617

See b/276167870. This is causing a build breakage to Google testing for
all web projects.
2023-04-01 18:55:02 -07:00
Zachary Anderson
45e3c0920f Revert "[web] Move text editing nodes outside of shadowDOM" (flutter/engine#40847)
Reverts flutter/engine#39688

Looks like this is causing the roll to the framework to fail. See
https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20web_long_running_tests_4_5/34083/overview

```
00:03 +1 -1: Hello World App enable accessibility [E]

  JavaScriptException (500): javascript error: Cannot read properties of null (reading 'querySelector')
    (Session info: headless chrome=96.0.4664.0)

  package:webdriver/src/handler/w3c/utils.dart 57:9       parseW3cResponse
  package:webdriver/src/handler/w3c/core.dart 59:19       W3cCoreHandler.parseExecuteResponse
  package:webdriver/src/async/web_driver.dart 260:37      WebDriver.execute.<fn>
  package:webdriver/src/common/request_client.dart 96:32  AsyncRequestClient.send
  ===== asynchronous gap ===========================
  test_driver/smoke_web_engine_test.dart 41:40            main.<fn>.<fn>
  ===== asynchronous gap ===========================
  package:test_api/src/backend/declarer.dart 215:9        Declarer.test.<fn>.<fn>
  ===== asynchronous gap ===========================
  package:test_api/src/backend/declarer.dart 213:7        Declarer.test.<fn>
  ===== asynchronous gap ===========================
  package:test_api/src/backend/invoker.dart 258:9         Invoker._waitForOutstandingCallbacks.<fn>


00:03 +1 -1: Hello World App (tearDownAll)

```
2023-03-31 20:05:46 -07:00
Yegor
0d6952f097 Revert "[web] use callConstructor for FinalizationRegistry due to bug… (flutter/engine#40841)
… in dart2js (#40798)"

This reverts commit 5281ec18556a4775594e81f456c2a8ab785fa322.

The original PR resulted in a silent failure.
2023-03-31 18:13:12 -07:00
htoor3
c32816a82c [web] Move text editing nodes outside of shadowDOM (flutter/engine#39688)
[web] Move text editing nodes outside of shadowDOM
2023-03-31 23:13:21 +00:00
Mouad Debbar
c8039e2544 [web] Fix canvasKitVariant test (flutter/engine#40833)
[web] Fix canvasKitVariant test
2023-03-31 23:06:33 +00:00
Yegor
5281ec1855 [web] use callConstructor for FinalizationRegistry due to bug in dart2js (flutter/engine#40798)
[web] use callConstructor for FinalizationRegistry due to bug in dart2js
2023-03-31 22:48:15 +00:00
Zachary Anderson
284b13faae Revert "[macOS] Change view ID to signed" (flutter/engine#40829)
Reverts flutter/engine#39958

Failing the roll to the framework starting with
https://github.com/flutter/flutter/pull/123893

One example:
https://ci.chromium.org/ui/p/flutter/builders/try/Mac%20dart_plugin_registry_test/21819/overview
2023-03-31 13:52:57 -07:00
Tong Mu
d3bbe5cb8a [macOS] Change view ID to signed (flutter/engine#39958)
This PR makes view ID signed from unsigned int64.

Initially, I made view IDs unsigned because they were opaque anyway. As
I'm working deeper into multiview, I found some issues that made me
think signed is better:

* Unsigned integers are worse
  * Sometimes you want negative values to represent special values.
* Unsigned integers are dangerous (if compared with signed ones by
mistake.)
* Unsigned integers are not needed
  * We're very unlikely to reach that big anyway.
  * Almost all other languages support only signed integers.
  * Also JavaScript only supports up to 51 bits of integer.

Therefore I think it's better to change them to signed int64, especially
before these APIs are widely used by developers.

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] 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.
- [ ] 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 `///`).
- [ ] I signed the [CLA].
- [ ] 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-03-31 12:11:49 -07:00
Jackson Gardner
1a59a35e3c ui_web library (flutter/engine#40608)
`ui_web` library
2023-03-30 23:14:18 +00:00
Kevin Lubick
f944e918a1 Use new SkImages namespace instead of legacy SkImage static functions (flutter/engine#40761)
Use new SkImages namespace instead of legacy SkImage static functions
2023-03-30 20:22:09 +00:00
Bernardo Ferrari
60663bccf0 SemanticsFlag/SemanticsAction enum migration (part 1) (flutter/engine#40571)
`SemanticsFlag`/`SemanticsAction` enum migration (part 1)
2023-03-30 18:32:38 +00:00
Mouad Debbar
89becd1e69 [web] LRU cache for text segmentation (flutter/engine#40782)
[web] LRU cache for text segmentation
2023-03-30 18:01:08 +00:00
Harry Terkelsen
8f9c5e83dd Switch from Noto Emoji to Noto Color Emoji and update font data (flutter/engine#40666) 2023-03-29 14:12:25 -07:00
Dan Field
340d78d20b [Impeller] Start a more generic stroke tessellator for path (flutter/engine#40690)
[Impeller] Start a more generic stroke tessellator for path
2023-03-29 06:07:05 +00:00
Yegor
7315c36b16 [web] remove obsolete object caches; simplify native object management (flutter/engine#40617)
[web] remove obsolete object caches; simplify native object management
2023-03-29 05:17:53 +00:00
Harry Terkelsen
868f1c628f Revert "Revert "[canvaskit] Use FontCollection API from CanvasKit to mitigate caching issues (#40673)" (#40705)" (flutter/engine#40740)
Reland "[canvaskit] Use FontCollection API from CanvasKit to mitigate caching issues"
2023-03-29 03:55:13 +00:00
Jackson Gardner
77dadc582f Forward stdout and stderr from dart2wasm when verbose. (flutter/engine#40731)
Forward stdout and stderr from dart2wasm when verbose.
2023-03-29 00:46:05 +00:00
Harry Terkelsen
e8d9ea46c2 Revert "Revert "Reland "Default the CanvasKit base URL to local artifacts. (#40293)" (#40470)" (#40700)" (flutter/engine#40717)
This reverts commit aee0a1a6db53cfdada6d00fe50a94c3216950bb6.
2023-03-28 17:21:10 -07:00
David Iglesias
4fe214f62a Reland "[web] Accepts assetBase through JS config. (#40615)" (flutter/engine#40677)
Reland "[web] Accepts assetBase through JS config. (#40615)"
2023-03-28 20:21:56 +00:00
joshualitt
bf360f6176 Reland "[web] Migrate canvaskit_api to JS types." (flutter/engine#40613) 2023-03-28 13:03:34 -07:00
Jason Simmons
504f891d91 Reland "Return an empty JavaScript object as a replacement for exports/module in patchCanvasKitModule (#40582)" (flutter/engine#40698)
Reland "Return an empty JavaScript object as a replacement for exports/module in patchCanvasKitModule (#40582)"
2023-03-28 14:30:17 +00:00
Harry Terkelsen
158cf5c52a Revert "[canvaskit] Use FontCollection API from CanvasKit to mitigate caching issues (#40673)" (flutter/engine#40705)
Revert "[canvaskit] Use FontCollection API from CanvasKit to mitigate caching issues"
2023-03-28 07:52:21 +00:00
Harry Terkelsen
7f23c4f85f [canvaskit] Use FontCollection API from CanvasKit to mitigate caching issues (flutter/engine#40673)
[canvaskit] Use FontCollection API from CanvasKit to mitigate caching issues
2023-03-28 06:02:09 +00:00
Kevin Chisholm
aee0a1a6db Revert "Reland "Default the CanvasKit base URL to local artifacts. (#40293)" (#40470)" (flutter/engine#40700)
Revert "Reland "Default the CanvasKit base URL to local artifacts.""
2023-03-28 04:49:13 +00:00
Michael Goderbauer
a508065bbc Reland "Post 3.0 lint sync (#40394)" (flutter/engine#40688)
Reland "Post 3.0 lint sync (#40394)"
2023-03-28 03:25:02 +00:00
Jackson Gardner
82886d52b3 Web test reorganization (flutter/engine#39984)
Web test reorganization
2023-03-28 00:08:48 +00:00
Brandon DeRosier
9e9590a68f Revert "Post 3.0 lint sync (#40394)" (flutter/engine#40687)
This reverts commit 8ba209121d2671b0d202d9731fe67ec5eb1529b4.
2023-03-27 15:45:59 -07:00
Brandon DeRosier
2af281a806 Revert "Return an empty JavaScript object as a replacement for exports/module in patchCanvasKitModule (#40582)" (flutter/engine#40686)
This reverts commit 33dd135fc0034f0fc4dcb8803721d9a77d35852a.
2023-03-27 15:40:29 -07:00
bungeman
13b279990a Simplify SkFontMgr classes for sk_sp (flutter/engine#40627)
These subclasses were previously made very generic to work with both the
pre-sk_sp version of SkFontMgr and the using-sk_sp version of SkFontMgr.
Now that SkFontMgr uses sk_sp for return types, simplify the subclasses.
2023-03-27 16:06:07 -04:00
Jason Simmons
33dd135fc0 Return an empty JavaScript object as a replacement for exports/module in patchCanvasKitModule (flutter/engine#40582)
Return an empty JavaScript object as a replacement for exports/module in patchCanvasKitModule
2023-03-27 20:04:28 +00:00
David Iglesias
34a936b07e Revert "[web] Accepts assetBase through JS config. (#40615)" (flutter/engine#40670)
This reverts commit e0be0c5676f56ef918eb806e1173346dcbadbe5b.

This commit is causing problems with new lint rules:

```
   info - test/engine/assets_test.dart:5:1 - This annotation must be attached to a library directive. Try attaching library annotations to library directives. - library_annotations
```
2023-03-27 12:07:01 -07:00
David Iglesias
e0be0c5676 [web] Accepts assetBase through JS config. (flutter/engine#40615)
[web] Accepts assetBase through JS config.
2023-03-27 17:43:47 +00:00
Michael Goderbauer
8ba209121d Post 3.0 lint sync (flutter/engine#40394)
Post 3.0 lint sync
2023-03-27 17:15:08 +00:00
Brandon DeRosier
7cfb268a9a [Impeller] Keep impeller scene build working (flutter/engine#40635) 2023-03-26 12:32:13 -07:00
Dan Field
96773d7c04 Avoid implicit conversions to floats in dart:ui (flutter/engine#40098)
Avoid implicit conversions to floats in dart:ui
2023-03-24 21:36:41 +00:00