613 Commits

Author SHA1 Message Date
Kate Lovett
a04fb324be
Bump Dart to 3.8 and reformat (#171703)
Bumps the Dart version to 3.8 across the repo (excluding
engine/src/flutter/third_party) and applies formatting updates from Dart
3.8.

## 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], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [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/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-07-07 17:58:32 +00:00
Jackson Gardner
2b5ef64fc4
Skwasm heavy (#166619)
This produces a build of Skwasm that works on Firefox and Safari. This
means we use `SkAnimatedImage` for animated gifs and webps and use
builtin ICU data in Skia.

I have unit test suites for Safari and Firefox with dart2wasm and both
`ui` and `engine` test sets. However, there are a few issues with
running these on CI:
* Safari+dart2wasm doesn't work yet until the CI bots are upgraded to
macOS 15, so these have been disabled on CI for now (but you can run the
unit test suite locally).
* Firefox+ui doesn't work because our Linux bots have no GPU and
therefore no WebGL2 support, so that one is disabled. Firefox+dart2wasm
with the `engine` suite is enabled on CI though.

I did make some changes to the host page for our unit test harness so
that Safari actually works though. Even though we're not running on CI,
you can still run locally if you have macOS 15.
2025-05-05 17:56:26 +00:00
Mouad Debbar
f454856afc
[WebParagraph] Initial wiring for the experimental WebParagraph implementation (#167763)
In this PR:
- `felt build --experimental-webparagraph` builds a 3rd variant of
CanvasKit to be used for `WebParagraph`.
- `felt test --suite=chrome-dart2js-experimental-webparagraph-ui` runs
`test/ui/` tests against `WebParagraph`.
- `felt test --suite=chrome-dart2js-experimental-webparagraph-ui` runs
Chrome with the extra flag:
    - `--enable-experimental-web-platform-features`

In the future:
- Upgrade to Chrome@133.0.6943.53 or above.
- Actual implementation and tests of WebParagraph coming in
https://github.com/flutter/flutter/pull/167559
- Run the `chrome-dart2js-experimental-webparagraph-ui` suite in CI.
- Trim the new experimental build of CK to realize the reduction in
size.
2025-05-02 16:51:13 +00:00
Jackson Gardner
34ea67bdbf
Reland "[skwasm] Dynamic Threading" (#166454)
This is a reland of https://github.com/flutter/flutter/pull/164748,
which was reverted here: https://github.com/flutter/flutter/pull/165350

It was reverted due to some issues in the flutter packages roller:
https://github.com/flutter/flutter/issues/165347

The unit test in flutter/packages was modified to be more deterministic
and less affected by minor timing differences:
https://github.com/flutter/packages/pull/8920

So this is basically being relanded without any significant changes,
since the downstream tests have been fixed.
2025-04-02 21:27:09 +00:00
Jason Simmons
08d2703016
Roll libcxx to bd557f6f (#165621)
Changes required for this roll:
* addition of LLVM libc (which is now a dependency of libcxx)
* updates the to license script
* patching the verify_exported check to allow some symbols added by
libcxx
* annotations for clang-tidy warnings
2025-03-24 15:39:26 +00:00
Jackson Gardner
1d954f4e96
Revert "[skwasm] Dynamic Threading (#164748)" (#165350)
This reverts commit b2a4a05683b95e9c08efafb3a0f17193915897d5.

This has been causing issues when rolling to flutter/packages repo. See
https://github.com/flutter/flutter/issues/165347.
2025-03-17 23:40:59 +00:00
Jackson Gardner
b2a4a05683
[skwasm] Dynamic Threading (#164748)
This switches skwasm over from the emscripten pthreads implementation to
emscripten's "wasm workers" threading implementation. The pthreads
implementation simply will not run at all in a non-crossOriginIsolated
context, but the wasm workers implementation only fails if we actually
attempt to spawn a thread. This means we can actually choose whether to
use a single-threaded or multi-threaded strategy at runtime, which means
we don't have to build two variants of skwasm for single- vs
multi-threaded.
2025-03-10 21:23:29 +00:00
Jason Simmons
47a710ba99
Move flutter/third_party/txt into flutter/txt (#164248)
The flutter/txt library does not currently contain any third-party code.
2025-03-04 16:13:40 +00:00
Jason Simmons
1d25f6953d
Reland "Add a buildtools directory and move third_party/ninja to the project root in order to match the expectations of depot_tools" (#164240)
Relands https://github.com/flutter/flutter/pull/163890 and updates the
Ninja path used by the engine tool
2025-02-27 00:13:58 +00:00
auto-submit[bot]
52876a0b25
Reverts "Add a buildtools directory and move third_party/ninja to the project root in order to match the expectations of depot_tools (#163890)" (#164209)
<!-- start_original_pr_link -->
Reverts: flutter/flutter#163890
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: jason-simmons
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: et and related packages in
https://github.com/flutter/flutter/tree/master/engine/src/flutter/tools
need to be updated for the new Ninja path
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: jason-simmons
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {matanlurey, jtmcdole}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
The depot_tools Ninja wrapper looks for Ninja at specific paths within
the tree. The use of "name": "." in the engine's .gclient file is not
expected by the depot_tools logic for locating the engine's source
directory.

This PR creates an alternative layout that is supported by depot_tools.
If the project root directory contains a "buildtools" subdirectory, then
depot_tools will look for Ninja at "third_party/ninja" within the root.

Fixes https://github.com/flutter/flutter/issues/163487
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
2025-02-26 17:53:36 +00:00
Jason Simmons
3d018b5924
Add a buildtools directory and move third_party/ninja to the project root in order to match the expectations of depot_tools (#163890)
The depot_tools Ninja wrapper looks for Ninja at specific paths within
the tree. The use of "name": "." in the engine's .gclient file is not
expected by the depot_tools logic for locating the engine's source
directory.

This PR creates an alternative layout that is supported by depot_tools.
If the project root directory contains a "buildtools" subdirectory, then
depot_tools will look for Ninja at "third_party/ninja" within the root.

Fixes https://github.com/flutter/flutter/issues/163487
2025-02-26 15:11:31 +00:00
Jim Graham
f825cccda2
[DisplayList] Delete all legacy Skia-oriented method overloads in DlCanvas (#164054)
Delete remaining DlCanvas method overloads that were allowing the use of
Skia geometry objects in rendering code.

The only remaining uses of Skia classes in the DlCanvas interface are
SkImageInfo and SkTextBlob.
2025-02-26 00:44:27 +00:00
Chinmay Garde
cd586eea50
[DisplayList] Move nested canvas enums into their own TU. (#162037)
These cause ambiguous compiler reference errors on some GCC versions.
And, the errors seem right. But, newer versions of clang seem to resolve
that ambiguity by also checking if the references to the types are also
references to identical types.

Per the chat with Jim, also added the Dl prefix to those types.

No change in functionality. Just a rename of the types and removal of
the now unnecessary typedefs.
2025-01-27 22:00:01 +00:00
Jackson Gardner
bfe31d607c
Fix skwasm target in wasm_debug_unopt build. (#162100)
Fixes a couple issues in the skwasm build rules:
* `DEMANGLE_SUPPORT` is deprecated in emscripten, so just remove it.
* `sSHARED_MEMORY=1` needs to be added to the cflags so that emscripten
appends the proper feature flags (`-matomics` and `-mbulk-memory`) when
doing the compile so that the flags match the linking step.
2025-01-23 22:05:52 +00:00
Jason Simmons
bdecbaec9d
Do not handle Dart isolate messages if the isolate is being shut down (#161824)
This fixes a race that can happen if Dart invokes an isolate's message
handling callback during isolate shutdown. The callback installed by
Tonic will invoke a dispatcher set by the engine's
DartIsolate::SetMessageHandlingTaskRunner, which will queue a message
handling task to the designated task runner.

If the queued task runs after DartIsolate::Shutdown has been called,
then Tonic's DartMessageHandler::OnHandleMessage will fail when it tries
to enter the isolate.

DartIsolate will set a shutdown flag on the DartState when Dart invokes
the isolate's shutdown callback. Tonic can avoid this race by checking
that flag before proceeding with message handling.

Fixes https://github.com/flutter/flutter/issues/160003
2025-01-21 19:10:01 +00:00
Jackson Gardner
eb6af3d029
Get et working for local web engine builds. (#161825)
This PR makes a few different changes to make building the web engine
via `et` a bit smoother:
* Adds a few build steps to `local_engine.json` so that et can build
`wasm_release` and `wasm_debug_unopt` builds on Linux and Mac locally.
* Removed the part of our `generate_builder_json` step which generates
the `linux_web_engine_build.json` file. This previously used to be
generated based off of the contents of `felt_config.yaml` but now it's
just not parameterized at all, so there is no benefit to generating it
and we can just manually maintain the file now.
* Fixed an issue where the skwasm debug build was failing due to a wrong
output file being specified in the gn rule.
2025-01-21 18:15:18 +00:00
John McDole
f0bf495594
Trigger Build Part Deux (#160481)
Hello, Monorepo Part Deux - after adding commit to datastore.
2024-12-18 20:18:06 +00:00
Michael Goderbauer
75f9549553 Bump Dart SDK to 3.7 (flutter/engine#56989) 2024-12-06 01:41:03 +00:00
Alexander Aprelev
e05a44277f Manual roll dart to 470117150f34d712ee6d8c4558b3c656d973f656 (flutter/engine#56915)
Roll dart to 470117150f34d712ee6d8c4558b3c656d973f656

Changes since last roll

```
470117150f3 Version 3.7.0-208.0.dev
10867627709 CHANGELOG: move AOT invocation bits to the end of the 3.7 section
83863711d3b Migrate NotImportedCompletionPass.
e01bbdfd1f4 Deprecate completions from plugins api.
2a2905228fb Add extension on Completer to simplify code.
05696d50ccf Migrate postfix_completion.dart, statement_completion.dart.
ed49d04e2e0 [analysis_server] Extract some shared code from editableArguments to be used by editArgument
c54255fe9db [element model] migrate `prefer_asserts_in_initializer_lists`
eaf3912b5d6 [deps] rev core, ecosystem, glob, http_multi_server, lints, markdown, package_config, pool, protobuf, pub_semver, shelf, source_maps, source_span, stack_trace, stream_channel, string_scanner, sync_http, term_glyph, test, test_descriptor, test_process, test_reflective_loader, tools, vector_math, watcher, web, web_socket_channel, webdriver, webkit_inspection_protocol, yaml, yaml_edit
11a11259724 Switch boringssl to the pre-generated GN source list.
a635ccf2f57 [analysis_server] Only mark positional arguments as editable if they wouldn't require inserting additional values
619c8511aba [analysis_server] Add tests for formatter language version for legacy protocol
a8f5e64a330 Roll Fuchsia Test Scripts from 6FgM4KTbxxmyYoiOs... to VilXq4eGH5A24wRWA...
623c574b817 [vm] Clean up few isolate fields.
bfb507a3af9 Migrate utilities.dart
06caa3fa11e [DAS] Adds new import with show option
0197beaa8e0 [flow analysis] Remove _typeContains method.
56b6e5b9f60 Json codable no type assumption in custom fromJson
e013a4c9bfa [analysis_server] Add some notes on how to use the CPU Profiler for the analysis server hosted by VS Code
0f723b3ef3c [vm] Fix build on gcc 14.2.0.
```

This is manual roll because dart_boringssl_gen_rev is no longer present
in dart sdk DEPS has to be removed from flutter engine DEPS manually.
2024-12-04 17:03:02 +00:00
LN Liberda
daed210840 IWYU: add some missing includes failing with libstdc++13/14 (flutter/engine#56822)
Fixes builds of engine with libstdc++13 and libstdc++14.

*List which issues are fixed by this PR. You must list at least one issue.*
closes https://github.com/flutter/flutter/issues/159513

*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
2024-11-27 20:11:17 +00:00
Jim Graham
0c245ce56b [DisplayList] Delete (publicly) unused DlColorColorSource (flutter/engine#56825)
While recently updating the DlColorSource sources I noticed some questionably implementation choices in the Color variant of the color sources.

I then realized that there was no public use of these classes (other than mostly their own unit tests) and so they should be deleted to focus on implementing the variants that are actually used by Flutter.
2024-11-27 00:13:22 +00:00
Jia Hao
a442db2c24 Add missing import for malloc (flutter/engine#56781)
Internal bug: b/380745221

The use of `malloc` in L70:

d48ceb1ba2/third_party/tonic/filesystem/filesystem/file.cc (L70)

Results in the following error, after an update to the internal toolchain. For some reason, this error only appears when targeting Linux.

```
tonic/filesystem/filesystem/file.cc:70:28: error: use of undeclared identifier 'malloc'
   70 |   uint8_t* ptr = (uint8_t*)malloc(file_size);
      |                            ^
1 error generated.
```

This PR fixes it by including the header file.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-25 16:47:19 +00:00
Jim Graham
dee413e427 [DisplayList] migrate DlColorSource objects to Impeller geometry (flutter/engine#56735)
The DlColorSource code uses Skia geometry classes for its internal computations. This PR switches those implementations to use the Impeller geometry classes for consistency and 3rd party header file independence.
2024-11-22 20:30:21 +00:00
Chris Bracken
bcbcb6631e iOS,macOS: Enable ARC in flutter_cflags_objc[c] (flutter/engine#56685)
Enables the `-fobjc-arc` compiler flag for Objective-C and Objective-C++
translation units.

Eliminates the flutter_cflags_objc[c]_arc settings, since they're now
redundant.

All Obj-C/Obj-C++ code in our codebase has now been migrated to ARC.

Issue: https://github.com/flutter/flutter/issues/137801
2024-11-18 13:37:40 -08:00
Chris Bracken
5a3f245710 iOS,macOS: Add Obj-C cflags to all Obj-C targets (flutter/engine#56386)
Ensure that all Objective-C code in the codebase is being built with the standard set of Flutter Objective-C compiler flags with ARC enabled.

Also bumps the cflags config up to the top of the first block within each target in which Objective-C sources appear, so that the location is consistent.

Migrates The following targets to ARC, which had been missed in previous passes since they didn't declare the standard Flutter Obj-C[++] cflags:
* `//flutter/fml:fml_unittests`
* `//flutter/impeller/golden_tests:metal_screenshot`
* `//flutter/impeller/playground:playground`
* `//flutter/impeller/backend/metal:metal`
* `//flutter/impeller/backend/metal:metal_unittests`
* `//shell/gpu:gpu_surface_metal_unittests`
* `//flutter/shell/platform/embedder:embedder_unittests`

This patch includes no semantic changes.

Issue: https://github.com/flutter/flutter/issues/137801

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-11-06 20:17:08 +00:00
Jackson Gardner
8cced6a0ac Reland single threaded Skwasm (flutter/engine#56282)
This attempts to reland the single-threaded Skwasm PR: https://github.com/flutter/engine/pull/56206

The main changes here are in the second commit:
* We need to actually bundle the `skwasm_st` artifacts in `flutter_web_sdk.zip`
* The `locateFile` hack no longer works since emscripten doesn't actually create a worker.js file anymore. So instead, that has been modified to use the `mainScriptUrlOrBlob` module API to do a very similar hack.

Note: I did presubmit testing with the framework CI and it appears the pertinent tests pass. See https://github.com/flutter/flutter/pull/157967
2024-11-01 19:00:08 +00:00
Chris Bracken
e1c05b7dd8 macOS: migrate third_party/accessibility to ARC (flutter/engine#56281)
Migrates all Objective-C++ translation units under third_party/accessibility to ARC.

Issue: https://github.com/flutter/flutter/issues/137801

No test changes because this change introduces no semantic changes.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-10-31 22:32:22 +00:00
auto-submit[bot]
38f7a81e37 Reverts "Skwasm single threaded (#56206)" (flutter/engine#56264)
Reverts: flutter/engine#56206
Initiated by: jonahwilliams
Reason for reverting: failing to roll into framework: https://github.com/flutter/flutter/pull/157919 
Original PR Author: eyebrowsoffire

Reviewed By: {harryterkelsen}

This change reverts the following previous change:
This PR creates a single-threaded version of the skwasm renderer, appropriate for non-crossOriginIsolated browsing contexts.
* The single threaded renderer is essentially the same as the multi-threaded renderer, except instead of spawning a web worker and posting messages to it, it simply schedules microtasks on the main thread in their place.
* The new renderer is vended as `skwasm_st.js` and `skwasm_st.wasm` in the same location as multithreaded skwasm. In order to properly build and function, we needed some fixes I put into emscripten that landed in version 3.1.70. That version also changed some behavior that required a few fixes to the CanvasKit build files.
* The skwasm loader in flutter.js has been modified to use the skwasm_st variants when encountering a non-crossOriginIsolated context but a browser and configuration that otherwise would allow the use of skwasm. I also added a new `forceSingleThreadedSkwasm` option to the flutter configuration so that we can override this behavior, especially so that we can accurately benchmark the single threaded renderer in a crossOriginIsolated environment.
* I also consolidated a bunch of our shards that run tests to just have one per browser/platform combination, so four total. This will address https://github.com/flutter/flutter/issues/124682
2024-10-31 14:12:47 +00:00
Jackson Gardner
1a4f588e1f Skwasm single threaded (flutter/engine#56206)
This PR creates a single-threaded version of the skwasm renderer, appropriate for non-crossOriginIsolated browsing contexts.
* The single threaded renderer is essentially the same as the multi-threaded renderer, except instead of spawning a web worker and posting messages to it, it simply schedules microtasks on the main thread in their place.
* The new renderer is vended as `skwasm_st.js` and `skwasm_st.wasm` in the same location as multithreaded skwasm. In order to properly build and function, we needed some fixes I put into emscripten that landed in version 3.1.70. That version also changed some behavior that required a few fixes to the CanvasKit build files.
* The skwasm loader in flutter.js has been modified to use the skwasm_st variants when encountering a non-crossOriginIsolated context but a browser and configuration that otherwise would allow the use of skwasm. I also added a new `forceSingleThreadedSkwasm` option to the flutter configuration so that we can override this behavior, especially so that we can accurately benchmark the single threaded renderer in a crossOriginIsolated environment.
* I also consolidated a bunch of our shards that run tests to just have one per browser/platform combination, so four total. This will address https://github.com/flutter/flutter/issues/124682
2024-10-31 00:42:07 +00:00
Mouad Debbar
2af8c83f84 [web] Support woff2 fonts (flutter/engine#55908)
- Enable support for WOFF2 fonts.
- Add Brotli depndency (increases CK size by ~53KB compressed, including the Brotli dictionary).
- Use split WOFF2 fonts for Emoji.
- Remove the `useColorEmoji` runtime config flag.

Partially based off of https://github.com/flutter/engine/pull/41282
Fixes https://github.com/flutter/flutter/issues/119536
Contributes to https://github.com/flutter/flutter/issues/153974 and opens the door for moving more fonts to WOFF2.
2024-10-21 13:38:22 +00:00
Chinmay Garde
592c393867 [Impeller] A text layout and shaping API for the standalone library. (flutter/engine#55598)
This uses the same shaper as the rest of Flutter. The minimal ICU data configuration comes embedded in the dylib so there are no out-of-band packaging concerns.

<img width="1136" alt="Screenshot 2024-10-02 at 4 11 17 PM" src="https://github.com/user-attachments/assets/ce63dc99-7c3d-4b71-ac5d-926dffa5269b">

Fixes https://github.com/flutter/flutter/issues/156015
2024-10-03 19:36:02 +00:00
Jim Graham
bc69788f05 [DisplayList] DlPath object provides auto-conversion from Skia to Impeller (flutter/engine#55055)
Switch from using the clumsy manual CacheablePath object to a more automatic DlPath object for holding paths in DisplayLists and dispatching them to either Skia or Impeller with auto-conversion.

For now DlPath is just a wrapper around SkPath with an auto-generating Impeller Path object which is very similar in design from what was done with the CacheablePath object except that it manages the caching of the Impeller path internally without extra burden on Impeller or Skia. There is also no need to communicate with the Dispatch method as to which type of path you prefer, they're all "auto-converting" DlPath objects now.

For now, ui.Path still generates an SkPath and so we wrap it when we record it into a DisplayList, just like the former CacheablePath mechanism. It will be a simple conversion to create the DlPath wrapper in ui.Path, though, so as to maintain the cached Impeller paths across frames even if the DisplayList itself is not preserved.

Eventually DlPath will take on more of a role of hiding the construction and internal representation of the paths so that we could be using SkPath, impeller::Path, or some other internal storage. For now, SkPath will likely remain primary storage for a while so that we can deal with PathOps.
2024-09-12 01:20:59 +00:00
Jim Graham
6d0f7279e2 [DisplayList] use DlScalar, DlPoint, DlRect exclusively in DlOpReceiver methods (flutter/engine#54982)
Wean the DlOpReceiver interface and implementations off of using the SkScalar, Sk[I]Rect, and SkPoint objects in favor of our own DL/Impeller versions.

The start of an ongoing effort to eventually compartmentalize all use of Skia interfaces into a single backend rendering module that is one of 2 semi-pluggable renderers.
2024-09-06 22:16:05 +00:00
Jonah Williams
62541b1434 [Impeller] fall back to path rendering on thick paths. (flutter/engine#54822)
For very thin stroked text we switch to skia font rasterization for higher fidelity. However and very large stroke widths, the fidelity loss doesn't matter and may be much slower due to software rasterization.

As several users have noticed, there is a maximum size limit of skia stroked text that we hit as well. This only seems to happen on large stroke widths.

Fixes https://github.com/flutter/flutter/issues/153784
2024-08-28 16:13:22 +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
Jim Graham
c9b612ff9a [DisplayList] Create DrawDashedLine for paragraph code (flutter/engine#53411)
With this minor addition to the DlCanvas/DisplayList API the code in the paragraph builder no longer needs to worry about PathEffect objects and their varying support on the backends.

At this point all PathEffect code in the engine is obsolete and can be deleted, but I'll leave that for a follow-on PR.

The only PathEffect related thing I did delete was support for rendering primitives with a PathEffect in the DL Rendering tests, both because it is a vestigial attribute and also because it would interfere with the new DrawDashedLine rendering test (a PathEffect on top of a PathEffect...).
2024-06-17 22:50:20 +00:00
Jonah Williams
e0c56ae81b [Impeller] Reland Use Skia software renderer to draw stroked text. (flutter/engine#53238)
We need to match the rounding of glyphs to fix https://github.com/flutter/flutter/issues/138670 . We also don't have sufficient AA quality with 4x MSAA for high quality strokes.

Fixes https://github.com/flutter/flutter/issues/138670
Fixes https://github.com/flutter/flutter/issues/136688
2024-06-06 02:16:52 +00:00
auto-submit[bot]
50421b59ad Reverts "[Impeller] Use Skia software renderer to draw stroked text. (#53198)" (flutter/engine#53237)
Reverts: flutter/engine#53198
Initiated by: jonahwilliams
Reason for reverting: oops.
Original PR Author: jonahwilliams

Reviewed By: {chinmaygarde}

This change reverts the following previous change:
We need to match the rounding of glyphs to fix https://github.com/flutter/flutter/issues/138670 . We also don't have sufficient AA quality with 4x MSAA for high quality strokes.

Fixes https://github.com/flutter/flutter/issues/138670
Fixes https://github.com/flutter/flutter/issues/136688
2024-06-06 01:03:29 +00:00
Jonah Williams
ee3a8d0775 [Impeller] Use Skia software renderer to draw stroked text. (flutter/engine#53198)
We need to match the rounding of glyphs to fix https://github.com/flutter/flutter/issues/138670 . We also don't have sufficient AA quality with 4x MSAA for high quality strokes.

Fixes https://github.com/flutter/flutter/issues/138670
Fixes https://github.com/flutter/flutter/issues/136688
2024-06-05 23:54:48 +00:00
Jonah Williams
8d062af40c [Impeller] fix emojis with non-solid color sources. (flutter/engine#53229)
Fixes https://github.com/flutter/flutter/issues/142974

If a text is drawn with a color source but lacks a path, just draw the original text. This ensures emojis render like Skia.
2024-06-05 23:24:14 +00:00
Jonah Williams
c670f5191f [Impeller] Use scaled font to determine bounds, match Skia position rounding behavior, add subpixel X/Y/All/None positioning. (flutter/engine#53042)
Multiple fixes to text rendering that match skia behavior on almost all bugs I've found, except for the glyphs are still _slightly_ too fine for some CJK text. The fixes are:

1. Compute the gylph size in the typographer context, using text size * scale factor text, instead of computing smaller bounds and scaling it up. This was not accurate and as a result we would positon glyphs incorrect by multiple pixels sometimes, causing uneven rows.

2. Match Skia's rounding behavior. previously we were rounding in multiple places, Skia rounds once. This is important to prevent jumping.

3. Use 4 subpixel X positions for rendering. This is the big one that ensures the visible layout matches exactly. Adds support for Y, both, and none positioning too. I couldn't find any examples of just Y or both. Some fonts may specify that have no subpixel positioning. So we don't bother to compute it for those.

Fixes https://github.com/flutter/flutter/issues/138386 / mostly, except slightly not bold enough.
Fixes https://github.com/flutter/flutter/issues/147577 / mostly, except slightly not bold enough.
Fixes https://github.com/flutter/flutter/issues/140475
Fixes https://github.com/flutter/flutter/issues/141467 
Fixes https://github.com/flutter/flutter/issues/135523
Fixes https://github.com/flutter/flutter/issues/127815
2024-05-28 06:08:05 +00:00
Jonah Williams
6bfd7c1895 [Impeller] fix colr/bitmap font color drawing. (flutter/engine#52871)
Fixes https://github.com/flutter/flutter/issues/126546

Track the paint color used by Bitmap/Emoji/COLR fonts and use it as a cache key. This allows non-COLR glyphs in a COLR font to get the correct text color. For other kinds of fonts, we always record the color as black so there are no cache efficiency hits in general.
2024-05-17 19:29:06 +00:00
Kaylee Lubick
b763678f03 Make SkUnicode explicitly instead of relying on SkParagraph to make it for us (flutter/engine#52086)
In https://skia-review.googlesource.com/c/skia/+/838417 Skia staged the
removal of automatically creating an SkUnicode as part of the effort to
make Skia more modular. Clients will now have to construct and SkUnicode
and pass it to SkParagraph to provide the appropriate data. Flutter
sometimes uses ICU and sometimes uses a "client" SkUnicode which makes
use of the browser APIs to get the data.

We should come back to the skwasm code especially, because right now
skwasm gets the data necessary to make an SkUnicode::Client, but stores
it in the ParagraphBuilder, just to take it out again later to make the
SkUnicode::Client and pass that back into the ParagraphBuilder. skwasm
should just create the SkUnicode::Client directly and pass it to the
ParagraphBuilder::make().

## 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 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
[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-04-29 11:59:33 -04:00
Jason Simmons
50771f3ad4 Roll reclient, libpng, and zlib (flutter/engine#52072)
Based on https://github.com/flutter/engine/pull/52067
2024-04-16 18:31:30 +00:00
Kallen Tu
86f00c760a Add missing_code_block_language_in_doc_comment lint to flutter/engine. (flutter/engine#51944)
Adds this Dartdoc-related lint to the flutter repository, in replacement
of the Dartdoc warning (`missingCodeBlockLanguage`) because it will be
deprecated and removed soon.

flutter/flutter already has this lint as well.

Lint Proposal: https://github.com/dart-lang/linter/issues/4904

## 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-04-08 11:57:12 -07:00
zijiehe@
fb4d1819e7 [Fuchsia] Remove the use of //build/ in fuchsia (flutter/engine#51072)
### Motivation of the change:

Both dart and flutter are using fairly outdated gn-sdk without properly maintained. Currently @hjfreyer is working on version'ed IDK / SDK libs which requires changes in gn-sdk to use the right version of the libs in fuchsia/sdk/obj/{arch}-api-{level} rather than the one in the fuchsia/sdk/arch. But current implementation does not support choosing the right version.

### Blocking issue:

The new gn-sdk (in flutter/tools/fuchsia/gn-sdk) generates multiple BUILD.gn files rather than a large BUILD.gn the previous version created. So most of the build rules need to switch from the old `fidl:{api}` build rule to `fidl/{api}` rule. The same change will happen in the dart/sdk, i.e. http://go/dart-reviews/356924. But since the two repos cannot have one single atomic change, changing either side first will cause flutter to break. E.g. the linkage error caused by duplicated symbols will happen if we change the dart/sdk first, since in flutter, it will still refer to the old build rules in the middle.

### Solutions:

Ideally we can create redirect rules in the current `build/fuchsia` buildroot tree to redirect the old rules into the new one, so we can make the change in the flutter first then dart/sdk. But creating the rules is not trivial and will only be used once.

So an alternative solution is

- pause the dart/sdk -> flutter roll
- submit dart/sdk change (http://go/dart-reviews/356924)
- update this change to manually bring the dart/sdk change, namely the `dart_revision` in the DEPS file and signatures in the ci/licences.
- resume the dart/sdk -> flutter roll.

But it requires this change itself to be reviewed first, and I'd like to know your opinion before moving forward.

See corresponding dart/sdk change at http://go/dart-reviews/356924.

### //build/fuchsia/ from buildroot should be removed after this change.

Bug: [b/40935282](https://issues.chromium.org/issues/40935282?pli=1&authuser=0)

FYI: @hjfreyer 

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-03-15 02:52:21 +00:00
LongCatIsLooong
8fd9bbee17 Reland "Remove migration flag and unused header files #50216" (flutter/engine#50259)
Forgot to update a pinned dependency in the previous attempt: https://github.com/flutter/tests/pull/340

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-03-05 02:17:05 +00:00
Liam Appelbe
27ca389132 Experimental platform isolates API (flutter/engine#48551)
This is a prototype of the [PlatformIsolate
API](https://github.com/flutter/flutter/issues/136314).

**UPDATE (Jan 25):** The PR is ready for review. PTAL.

The `PlatformIsolate` creation flow is:

1. `PlatformIsolate.spawn` running on parent isolate
(platform_isolate.dart)
    a. Create `isolateReadyPort`
    b. `PlatformIsolateNativeApi::Spawn` (platform_isolate.cc)
    c. `DartIsolate::CreatePlatformIsolate` (dart_isolate.cc)
d. Isolate created. Entry point invocation task dispatched to platform
thread
    e. `PlatformIsolate.spawn` returns a `Future<Isolate>`
2. On the platform thread, `_platformIsolateMain` is invoked in the
platform isolate
    a. Create `entryPointPort`
b. Send `Isolate.current` metadata and `entryPointPort` back to the
parent isolate via `isolateReadyPort`
3. Back in the parent isolate, `isolateReadyPort.handler` is invoked
a. Send the user's `entryPoint` and `message` to the platform isolate
via `entryPointPort`
b. Use received isolate metadata to create a new `Isolate` representing
the platform isolate and complete the `Future<Isolate>`
4. In the platform isolate, `entryPointPort.handler` is invoked
    a. Run the user's `entryPoint(message)`

The engine shutdown flow is handled by `PlatformIsolateManager`, which
maintains a set of running platform isolates.
2024-03-04 16:47:41 +13:00
Zachary Anderson
9f1ed38ee0 Shift //third_party/icu to //flutter/third_party (flutter/engine#50924)
For https://github.com/flutter/flutter/issues/67373
2024-02-23 23:23:27 +00:00
LongCatIsLooong
69b76b7e38 Pass the missing strut half leading flag over to skia paragraph builder (flutter/engine#50385)
Not sure how this can be tested. Part of https://github.com/flutter/flutter/issues/142969

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-02-22 19:52:46 +00:00