This implements font loading for the skwasm renderer.
In addition, it does some pretty major refactors:
1) Simplified the font collection interface to just have a single `loadAssetFonts` call, without the separate registration and debug fonts loading stuff
2) Debug fonts load now through http/asset mocking mechanisms instead of having a separate `downloadDebugTestFonts` call
3) Consolidated a few of our different unit test setup functions into a single `setUpUnitTests` function
The artifacts generated by legacy and engine v2 are identical. This PR is moving linux host engine to staging and starts uploading engine v2 artifacts to production.
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This fixes https://github.com/flutter/flutter/issues/85793
The script that generates the font fallback data also rolls a package to CIPD with these files and updates the DEPS to download those files from CIPD. This makes sure that these tests are hermetic.
Fixes https://github.com/flutter/flutter/issues/125906.
Fixes https://github.com/flutter/flutter/issues/125908.
Going to add this back once I'm able to work out why the clear colors
aren't working on GL/Vulkan. Stepping though with a debugger for both
GLES and Vulkan, the clear colors seems to be getting piped through as
expected. But the frame captures reveal that they're actually not.
Removes the physical model layer and associated engine code. This was already deprecated and removed in the framework. By removing it in the engine, we can also remove the need for layer tree diff/paint/preroll to have the device pixel ratio. This will simplify some of the multi-view work
Fixes https://github.com/flutter/flutter/issues/125720
## Description
This reverts commit e49577708d9d5315fa6c001d7dc20ee80d04cd35 to re-land #41094 because the Google test failures have been fixed. There are no changes to the original PR, since the fixes were in the Google code.
## Description
This PR fixes cursor jump on Chrome for Android when the user taps in a multiline `TextField`.
Using the following code sample:
<details><summary>Code sample</summary>
```dart
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Text Field Focus',
home: MyCustomForm(),
);
}
}
// Define a custom Form widget.
class MyCustomForm extends StatelessWidget {
const MyCustomForm({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Text Field Focus'),
),
backgroundColor: Colors.amber,
body: Padding(
padding: const EdgeInsets.all(16.0),
child: TextField(
decoration: const InputDecoration(
fillColor: Colors.white,
filled: true
),
autofocus: true,
maxLines: 3,
controller: TextEditingController(text: '1\n2\n3\n4\n'),
),
),// This trailing comma makes auto-formatting nicer for build methods.
);
}
}
```
</details>
On a mobile browser, once the page is loaded, tap after the number 3:
- Before this PR: the TextField content is automaticaly scrolled and the selection is set after number 1.
https://user-images.githubusercontent.com/840911/232051413-b913f890-6cb1-4c60-92d0-7a3bf74cc688.mov
## Implementation
A multiline `TextField` relies on an HTML `<textarea>` elements. When a tap occurs the selection should be updated from Flutter not by the HTML element itself.
This PR prevents mouse events on Chrome for Android. Those events conflicts with Flutter selection changes.
Previously, mouse events were only prevented on desktop but they are also emitted on mobile, see https://bugs.chromium.org/p/chromium/issues/detail?id=119216#c11.
## Related Issue
Related to https://github.com/flutter/flutter/issues/124483 (partial fix because the issue is also reproducible on iOS/Safari).
## Tests
Adds 1 test.
As of https://github.com/flutter/engine/pull/41219 all the .ci.yaml builders will run on either Macmini8,1 (x64) or Macmini9,1 (arm). Stop specifying `Macmini8,1` on individual builders and let the specified architecture be the deciding factor.
Reverts #41203
The legacy and engine v2 builds are generating the artifacts in the same way and have been validated over a 1+ months. This PR is moving the legacy build to staging and starts uploading engine v2 artifacts to production.
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Typically the AndroidShellHolder's apk_asset_provider_ is set by AndroidShellHolder::Launch when the DartExecutor runs the engine's entrypoint.
But if the engine was started by Spawn, then the apk_asset_provider_ was not being set. This would cause a crash if the resulting engine was later used to spawn another engine.
Fixes https://github.com/flutter/flutter/issues/122364
Switching the calls to dispatch into an Impeller Dispatcher to use a cull rect to enable pre-culling of the out-of-bounds ops.
This change showed an improvement of around 2x on the rendering performance of the non-intersecting platform view benchmark, but that was measured without the recent changes to the destructive blend modes in Impeller renderer.
Dimensions are now used to detect the drone to use. Framework tests are using shard_util_v2 but not engine v2 builds and require to pass the drone dimension from the .ci.yaml file.
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
@staticInterop members will start disallowing tear-offs, so this member
should turn into a closure.
Unblocks a roll in the SDK that disallows tear-offs.
## 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 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.
For extremely large RegExp's that are used in flutter license script, running interpreter-based implementation is faster than running generated unoptimized code. For normal-sized RegExp's optimized code is expected to be faster.
Local testing shows 5x speed up on full license script run (311s vs 1430s).
Should help with https://github.com/flutter/flutter/issues/118193
This PR fixes font-subset to check to see if a font is a variable font
with variable font axes before additionally dropping the GSUB/GPOS/GDEF
tables. These tables were being forced dropped in all cases (even though
harfbuzz had been modified to always keep them). I made the change only
drop the tables for variable fonts to preserve the previous behavior in
the most possible cases.
This PR fixes
[#125704](https://github.com/flutter/flutter/issues/125704).
To see the bug (or verify it is fixed) in the live web examples below
you must select the font variations Fill->1 and Weight->100.
(See issue [#125704](https://github.com/flutter/flutter/issues/125704)
for more details).
The issue [#125704](https://github.com/flutter/flutter/issues/125704)
includes examples of the font-subset being used (and breaking) the
variable fonts, as well as example of the `--no-tree-shake-icons` being
used where the fonts do not break.
Additionally, I have created an additional [live
example](https://timmaffett.github.io/material_symbols_icons_showing_tree_shake_fixed/)
where this PR has been applied to font-subset and icon tree shaking is
still taking place.
(Example w/ icon tree-shaking using the broken font-subset for icon tree
shaking is found
[here](https://timmaffett.github.io/material_symbols_icons_showing_tree_shake_bug/)
).
In the example build output below note that the non-variable fonts
"CupertinoIcons.ttf" and "MaterialIcons-Regular.otf" have the same size
savings as before the change, but the variable fonts
"MaterialSymbolsSharp[FILL,GRAD,opsz,wght].ttf",
"MaterialSymbolsOutlined[FILL,GRAD,opsz,wght].ttf", and
"MaterialSymbolsRounded[FILL,GRAD,opsz,wght].ttf" now have a much more
reasonable saving of ~2% because every icon in the font is included in
the example. The previous extra ~30% savings was from having the GSUB
table removed. The 30% size savings for a tree-shaking for a case where
*every* icon is used in the example probably should have been suspect..
lol.
Output of build using fixed font-subset.exe [live fix
example](https://timmaffett.github.io/material_symbols_icons_showing_tree_shake_fixed/)
:
```console
flutter build web --release --web-renderer canvaskit --base-href "/material_symbols_icons_showing_tree_shake_fixed/"
Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 283452 to 1236 bytes (99.6% reduction). Tree-shaking can be disabled by providing the
--no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 10808 bytes (99.3% reduction). Tree-shaking can be disabled by providing the
--no-tree-shake-icons flag when building your app.
Font asset "MaterialSymbolsSharp[FILL,GRAD,opsz,wght].ttf" was tree-shaken, reducing it from 5848492 to 5683212 bytes (2.8% reduction). Tree-shaking can be disabled by
providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialSymbolsOutlined[FILL,GRAD,opsz,wght].ttf" was tree-shaken, reducing it from 6944756 to 6779476 bytes (2.4% reduction). Tree-shaking can be disabled
by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialSymbolsRounded[FILL,GRAD,opsz,wght].ttf" was tree-shaken, reducing it from 9361824 to 9196544 bytes (1.8% reduction). Tree-shaking can be disabled
by providing the --no-tree-shake-icons flag when building your app.
Compiling lib\main.dart for the Web... 79.5s
```
BEFORE font-subset fix [live bug example
here](https://timmaffett.github.io/material_symbols_icons_showing_tree_shake_bug/):
```console
flutter build web --release --web-renderer canvaskit --base-href "/material_symbols_icons_showing_tree_shake_bug/"
Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 283452 to 1236 bytes (99.6% reduction). Tree-shaking
can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialSymbolsSharp[FILL,GRAD,opsz,wght].ttf" was tree-shaken, reducing it from 5848492 to 4079548 bytes
(30.2% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialSymbolsOutlined[FILL,GRAD,opsz,wght].ttf" was tree-shaken, reducing it from 6944756 to 4781576 bytes(31.1% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 10808 bytes (99.3% reduction).
Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialSymbolsRounded[FILL,GRAD,opsz,wght].ttf" was tree-shaken, reducing it from 9361824 to 6397020 bytes
(31.7% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Compiling lib\main.dart for the Web... 63.8s
```