5567 Commits

Author SHA1 Message Date
Bruno Leroux
2a59992ea5 [Android] Add support for the PlatformChannel "Share.invoke" command (flutter/engine#48265)
## Description

This PR adds support for the PlatformChannel `Share.invoke` message on Android (before this PR it is only supported on iOS).

## Related Issue

Engine side for https://github.com/flutter/flutter/issues/138728

## Tests

Adds 2 tests.
2023-11-30 06:12:11 +00:00
Gray Mackall
b9b16eab3c Fix new lint from android 14 upgrade, and remove it from the baseline (flutter/engine#47817)
See https://github.com/flutter/engine/pull/47609#discussion_r1385803721 for context.

It isn't clear to me what the file descriptor here is actually doing, so I'm not actually too sure about this fix. Can it just be deleted?

Update: it seems to me that the motivation here is that `ClipData.Item.coerceToText` [consumes a `SecurityException` here](https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/content/ClipData.java;l=411;bpv=0;bpt=1), with just a log line that isn't particularly descriptive. And basically we want to run into that same exception so we can [provide a more helpful log line](e5da8d9a87/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java (L525)), so we do the same thing that the underlying `coerceToText` method does?

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-29 16:04:20 +00:00
auto-submit[bot]
8c6313074f Reverts "binary_messenger missing cstdint" (flutter/engine#48483)
Reverts flutter/engine#48481
Initiated by: matanlurey
This change reverts the following previous change:
Original Description:
This PR adds cstdint to binary_messenger.h.  Without this building plugin support for generic Linux fails.  Not related to the GTK source tree.

*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-11-29 02:25:18 +00:00
Joel Winarske
26853f24e2 binary_messenger missing cstdint (flutter/engine#48481)
This PR adds cstdint to binary_messenger.h.  Without this building plugin support for generic Linux fails.  Not related to the GTK source tree.

*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-11-29 02:17:22 +00:00
Robert Ancell
297a817fc9 Fix the application not disposing by breaking circular references on quit (flutter/engine#47684)
GtkApplication windows contain a reference back to the application. This
means the MyApplication object in the Flutter application never
disposes. We workaround this by removing these references before we
quit. This occurs for all GTK applications that quit using this method,
see https://gitlab.gnome.org/GNOME/gtk/-/issues/6190. This may be fixed
upstream at some point but the proposed workaround should solve the
problem for all versions and not conflict with any upstream solution.

Fixes https://github.com/flutter/flutter/issues/136582
2023-11-29 14:01:53 +13:00
Matan Lurey
92a2b041fb Update HeaderFilterRegex once and for all. (flutter/engine#48145)
Includes a test (`header_filter_regex_test.dart`) that hopefully keeps
us on rails going forward.
2023-11-27 15:30:18 -08:00
hangyu
4f5a0eef4c [ios] Send " did gain focus" message from engine to framework (flutter/engine#48252)
issue: https://github.com/flutter/flutter/issues/97747

framework pr :https://github.com/flutter/flutter/pull/135771 
android pr: https://github.com/flutter/engine/pull/47114

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-27 20:22:53 +00:00
Matej Knopp
9a823f7768 Reduce number of surfaces required when presenting platform views (flutter/engine#43301)
Fixes https://github.com/flutter/flutter/issues/129710
Fixes https://github.com/flutter/flutter/issues/138936

Implements https://flutter.dev/go/optimized-platform-view-layers

## Example

This scene would normally require 5 surfaces, but with the PR it comes
down to 2 (when drawing over platform views) and 1 when all drawing is
outside of platform views).


https://github.com/flutter/flutter/assets/96958/091da832-bfbc-44a2-8da5-d55d84024c96

*If you had to change anything in the [flutter/tests] repo, include a
link to the migration guide as per the [breaking change policy].*

## 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.

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-11-27 14:07:43 +01:00
林洵锋
23ed0d9d6a Fix not being able to hide iOS status bar via setEnabledSystemUIMode (flutter/engine#48271)
Fix https://github.com/flutter/flutter/issues/138604 and https://github.com/flutter/flutter/issues/138671

Related PR https://github.com/flutter/engine/pull/45351

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-23 00:49:13 +00:00
LouiseHsu
faa3e610ac Fix Share Screen Crash on iPad (flutter/engine#48220)
Fixes https://github.com/flutter/flutter/issues/138550

![Simulator Screenshot - iPad Air (5th generation) - 2023-11-21 at 03 33 37](https://github.com/flutter/engine/assets/36148254/15e10e43-816b-43b1-a5ab-75c8add90899)
2023-11-22 20:49:58 +00:00
Dan Field
28fbba2098 Delete unused/test only code from FML (flutter/engine#48327)
This is more-or-less a revert of https://github.com/flutter/engine/pull/14011

This code never ended up being used outside of tests, and it's not how we handle asset loading at this point anyway.

I was hopeful we could kill off all runtime dependencies on Dart in `FML` when looking at this, but it looks like trace_event.h still wants to import dart_api_tools.h for some Dart enum types. This may or may not matter if we ever want to build FML for web/wasm. /cc @eyebrowsoffire. If we really need to do that, we can refactor the trace event stuff so that it has a web and Dart implementation that's selected at build time.
2023-11-22 20:49:56 +00:00
Matan Lurey
d5b171165f Finish making shell/platform/linux/... compatible with .clang-tidy. (flutter/engine#48297) 2023-11-21 15:35:36 -08:00
Matan Lurey
aa6fdad4cd Finish making shell/platform/android/... compatible with .clang-tidy. (flutter/engine#48296) 2023-11-21 15:34:06 -08:00
Matan Lurey
b6f162e8b3 Finish making shell/common/... compatible with .clang-tidy. (flutter/engine#48295) 2023-11-21 15:33:43 -08:00
gaaclarke
e80ecd9194 [Impeller] Switched to static linked libc++ in vulkan validation layers. (flutter/engine#48290)
fixes https://github.com/flutter/flutter/issues/138535
test coverage: existing integration tests in flutter repo which look for validation layers

I also verified locally that the `libc++.so` is no longer present and that it runs correctly.

```
$ find lib/arm64-v8a/
lib/arm64-v8a/
lib/arm64-v8a//libflutter.so
lib/arm64-v8a//libVkLayer_khronos_validation.so
```

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-21 22:06:05 +00:00
Matan Lurey
0b7f44c8c4 Yet more compliance with .clang_tidy, stragglers edition. (flutter/engine#48291)
Based off the
[failures](https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8763786250936903249/+/u/test:_test:_lint_host_debug/stdout)
in https://github.com/flutter/engine/pull/48145.

Nothing particularly interesting.
2023-11-21 13:39:18 -08:00
Matan Lurey
edb665c82d Make {shell|lib/ui}/... compatible with .clang_tidy. (flutter/engine#48242)
This is mostly just rename `ThreadHost::Type::{IDENTIFIER}` to
`kIdentifier`.

I also ignored some enum violations that are in public APIs.
2023-11-21 12:29:14 -08:00
Jonah Williams
753e9e6ac7 [Impeller] Ensure that overlay surfaces are constructed with wide gamut settings. (flutter/engine#48190)
Fixes https://github.com/flutter/flutter/issues/138373

When constructing overlay layers when there are platform views, make sure the same pixel format and color space as the main view is used.

Add validation to impeller HAL about blitting different pixel formats.
2023-11-21 20:29:05 +00:00
YaTang
950ec4aed6 [PlatformView][Android]VirtualDisplay resize on Android31 and above (flutter/engine#47946)
Resolves: https://github.com/flutter/flutter/issues/128920
2023-11-20 19:16:02 -08:00
Matan Lurey
f9adfbc62c Make runtime/... and shell/common/... compatible with .clang-tidy. (flutter/engine#48158) 2023-11-20 14:31:49 -08:00
Kevin Lubick
0d0d4db144 Replace calls to SkFontMgr::RefDefault (flutter/engine#48179)
Skia is removing this API, so clients must track a default FontMgr if
they want one. See https://issues.skia.org/issues/305780908

## 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
2023-11-20 07:57:02 -05:00
Zachary Anderson
aa3f8e61c1 Moves expat, ocmock, libjpeg-turbo, libwebp, and wuffs to //flutter/third_party (flutter/engine#48193)
As part of eliminating the Flutter buildroot
(https://github.com/flutter/flutter/issues/67373), we are moving all
third-party dependencies from //third_party to //flutter/third_party.

Once all third-party dependencies have been migrated, tooling and config
will be moved and the buildroot will be eliminated altogether.

No tests changed because there is no semantic change to this PR. This is
simply relocating a dependency.

This PR moves expat, ocmock, libjpeg-turbo, libwebp, and wuffs to
//flutter/third_party.

It also deletes //third_party/fontconfig, which was unused.
2023-11-19 22:53:29 -08:00
Matan Lurey
2b34bf3fe2 Make shell/platform/{darwin|embedder}/... compatible with .clang-tidy. (flutter/engine#48160) 2023-11-18 01:06:05 +00:00
Bartek Pacia
2168e305d1 Fix a few typos (flutter/engine#47960)
I found 3 small typos :)

Supersedes #47929

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-17 22:46:51 +00:00
hangyu
cd4c07d7a2 [Android] Send " did gain focus" message from engine to framework (flutter/engine#47114)
issue:https://github.com/flutter/flutter/issues/97747

framework pr:https://github.com/flutter/flutter/pull/135771

## 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 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
[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

---------

Co-authored-by: Reid Baker <reidbaker@google.com>
2023-11-17 13:31:33 -08:00
Chris Yang
e7f47ca25d [Ios] move flutter_test_ios_mrc unittests to arc (flutter/engine#48162)
Move all tests in flutter_test_ios_mrc to arc

Part of https://github.com/flutter/flutter/issues/137801

Changes mostly involves trivial mrc to arc changes. non-trivial changes are commented inline. 

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-17 20:26:16 +00:00
Dan Field
21b2df9815 Reland "[Impeller] Fail if software backend is chosen and Impeller is enabled on iOS." (flutter/engine#46275)
Reverts flutter/engine#46217

cl/568091248 makes this safe to land again.

fyi @jonahwilliams @chinmaygarde
2023-11-17 20:12:48 +00:00
yaakovschectman
bb97ac1d3b Assign mojom kSwitch role to switches (flutter/engine#48146)
We have previously been using the `kToggleButton` role for any widget
that has a toggled state. Our AX library does not expect this role to be
used for switches, and so would not assign the checked state to switches
for MSAA. As far as I can tell, the `Switch` is the only widget that
uses the `toggled` semantic property (`ToggleButtons`, ironically, does
not), so we ought to be able to swap in the `kSwitch` role, for which
the proper states are presented. This will allow screen readers to
announce the state of a switch.

https://github.com/flutter/flutter/issues/138500

## 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 `///`).
- [ ] 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
2023-11-17 14:21:23 -05:00
Matan Lurey
56fc8315cc Re-land "Make flow/embedded_views.h compatible with .clang_tidy." (flutter/engine#48137)
Reverts flutter/engine#48130.

Now that the `runIf` clauses are omitted, CI should be a reliable source
of truth.
2023-11-16 13:05:13 -08:00
Chris Bracken
ee4fcf69da [macOS] Replace pasteboard mock with fake (flutter/engine#48110)
Also replaces the use of OCMock with a fake for tests involving the use of NSPasteboard. This avoids unnecessary use of OCMock in the tests, which has been responsible for flakiness in some tests, in particular where the mock is used across threads. This test was not problematic, but the fake makes the tests more readable.

Issue: https://github.com/flutter/flutter/issues/104789
Issue: https://github.com/flutter/flutter/issues/127441
Issue: https://github.com/flutter/flutter/issues/124840

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-16 18:13:50 +00:00
auto-submit[bot]
74d08febd7 Reverts "Make flow/embedded_views.h compatible with .clang_tidy." (flutter/engine#48130)
Reverts flutter/engine#47994
Initiated by: jonahwilliams
This change reverts the following previous change:
Original Description:
Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
2023-11-16 17:18:18 +00:00
Chris Bracken
87e57d7e14 [macOS] Replace fixture subclasses with usings (flutter/engine#48111)
In cases where we subclassed gtest fixtures purely to get better naming for test output (i.e. displaying/filtering on AccessibilityBridgeMacTest instead of AutoreleasePoolTest, replace these with `using` declarations, which is equally effective and avoids actually subclassing.

This applies no semantic changes to the code or tests.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-16 16:55:27 +00:00
Matan Lurey
b741431a73 Make flow/embedded_views.h compatible with .clang_tidy. (flutter/engine#47994)
Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
2023-11-16 08:47:54 -08:00
Matan Lurey
933bd94016 Make flow/... compatible with .clang_tidy. (flutter/engine#47995)
Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
2023-11-16 08:41:10 -08:00
Dan Field
d38b0967a0 [Impeller] Gate Vulkan selection on API 29 (flutter/engine#48089)
Platform Views on Android require API 29 when using Vulkan.

~~I'm not sure if I did the CI changes right, want to run it here and see. The added test needs to run on a device or emulator with API 29 or above and API 28 or below to be valid.~~

Makes the following changes to CI:

- Runs the emulator tests on presubmit, but only if `shell/platform/android/**` or `lib/ui/**` or `.ci.yaml` changes.
- Changes the emulator tests to be a regular engine_v2 test that spawns an x86 build. Unfortunately, the older API level emulators are only available for x86, not x86_64, and you cannot run the binary we create unless it matches the ABI.
- Runs the new test on both API 28 and API 34.

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

/cc @johnmccutchan fyi
2023-11-16 02:04:41 +00:00
Chris Bracken
17d7e20c16 [macOS] Clean up allocations in menu plugin test (flutter/engine#48093)
Runs all FlutterMenuPlugin tests in an AutoReleasepoolTest, which                   
ensures all allocations are cleaned up.                                             
                                                                                    
Also extracts out some hackery into the FlutterMenuPluginTest fixture to            
ensure that NSApplication instantiates everything necessary to do menu              
bar manipulation.                                                                   
                                                                                    
Also replaces the use of OCMock in FlutterMenuPluginTest.mm with a fake             
FakePluginRegistrar class. This avoids unnecessary use of OCMock in the             
tests, which has been responsible for flakiness in some tests, in                   
particular where the mock is used across threads. This test was not                 
problematic, but the fake makes the tests more readable.                            
                                                                                    
Also fixes linter warnings about using NSLocalizedString for user-facing            
strings.

Issue: https://github.com/flutter/flutter/issues/104789
Issue: https://github.com/flutter/flutter/issues/127441
Issue: https://github.com/flutter/flutter/issues/124840
2023-11-15 16:40:39 -08:00
Chris Yang
c07e3193e7 [ios] introduce weak_nsobject (flutter/engine#47947)
Introduce weak_nsobject from chromium. 

There are some usages of weak_ptr wrapping Objective-C ids, weak_ptr is not really designed for ids and such usages are blocking the arc migration. 

This PR mostly copies the weak_nsobject from chromium, at the same hash that we copied the ARC/MRC compatible scoped_nsobject: fd625125b8

To match how we used weak_ptr for those ids, I made some changes to the weak_nsobject:
- WeakNSObjects needs to be generated by a WeakNSObjectFactory. The WeakNSObjectFactory is owned by the objc class and acts as the generator of the WeakNSObjects. All the WeakNSObjects' derefing thread should be the same of the WeakNSObjectFactory's creation thread.
- chromuim's WeakNSObjects can be detached from the thread and re-attached to a new thread. To match our weak_ptr behavior, I changed WeakNSObjects to be only accessed from a single thread, the same as weak_ptr

This PR also moves the FlutterEngine to use WeakNSObject and updated related classes.

part of https://github.com/flutter/flutter/issues/137801

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-15 23:43:24 +00:00
hellohuanlin
058ffbe73f [ios]fix ios 16 auto correction highlight showing on top left corner (flutter/engine#47279)
This PR hides the system highlights in iOS 16 (except when scribble is enabled). 

Note that auto correction highlight is still drawn by flutter, so it still works. 

I don't think we need to CP this, since it's iOS 16 only, and iOS 17 is already out. 

## Why not use system highlight? 

Unlike iOS 17, the iOS 16 system highlight only respect the width provided by `firstRectForRange`, but not the height. I have audited all sizing related APIs in UITextInput (doc [here](https://developer.apple.com/documentation/uikit/uitextinput#1653155)), specifically, `firstRect(for:)`, `caretRect(for:)` and `selectionRects(for:)`, and they all return the correct height. 

## About scribble
The initial implementation of `firstRectForRange` (that returns the first selection rect) was introduced for the scribble feature on iPad (code [here](1d3165a31c (diff-4c7b102c0690b8ec5e2212b079f5d69fe3f816c84e47ce94bc7bc89312f39e40R1487-R1505))). 

It turns out that a non-zero rect is required for scribble's advanced feature to work (e.g. inserting a space with a vertical bar). So we can't apply this fix for scribble. 

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

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

*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-11-15 19:37:22 +00:00
Greg Spencer
28d807f326 Update keycode output (flutter/engine#47988)
## Description

This updates the keycode definitions to match what the keycode generator produces, to keep them in sync.
2023-11-15 17:29:34 +00:00
Chris Bracken
ce85176a4e [macOS] Clean up allocations in key responder tests (flutter/engine#48048)
Runs all FlutterChannelKeyResponderTest tests in an AutoReleasepoolTest, which ensures all allocations are cleaned up.

Also replaces the use of OCMock in FlutterChannelKeyResponderTest with a fake FlutterBasicMessageChannel subclass. This avoids unnecessary use of OCMock in the tests, which has been responsible for flakiness in some tests, in particular where the mock is used across threads. This test was not problematic, but the fake makes the tests more readable.

Issue: https://github.com/flutter/flutter/issues/104789
Issue: https://github.com/flutter/flutter/issues/127441
Issue: https://github.com/flutter/flutter/issues/124840

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-15 02:19:12 +00:00
Chris Bracken
50979ef389 [macOS] Eliminate unused OCMock includes (flutter/engine#48031)
As part of the broader quest to reduce our dependence on OCMock in macOS
embedder tests, this removes #includes of OCMock into files where OCMock
is not actually used.

## 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.
- [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
2023-11-14 12:12:53 -08:00
hellohuanlin
28fc24fd05 [ios17][text_input]fix ios 17.0 keyboard freeze when switching languages (without relying on text affinity) (flutter/engine#47566)
After close examination of the UIKit's default string tokenizer, when querying the line enclosing the end of doc position **in forward direction**, we should return nil (regardless whether the position is forward or backward affinity). 

This aligns with the [API doc](https://developer.apple.com/documentation/uikit/uitextinputtokenizer/1614464-rangeenclosingposition?language=objc): 

> If the text position is at a text-unit boundary, it is considered enclosed only if the next position in the given direction is entirely enclosed.

Will cherry pick this soon. Otherwise it will be less and less important as users upgrade to iOS 17.1. 

### Why my previous workaround also works? 

It turns out my previous workaround PR https://github.com/flutter/engine/pull/46591 works only because our misuse of text affinity in our text input. Specifically, when adding text affinity support, we only added it to `FlutterTextPosition`, but not `FlutterTextRange`. So when getting the beginning/end position from the range, we assign arbitrary affinities. 

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

https://github.com/flutter/engine/pull/46591

*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-11-14 19:58:06 +00:00
John McCutchan
4a2f6eacfa Revert "Add an AndroidManifest.xml flag to disable ImageReader backend Platform Views (#46430)" (flutter/engine#48024)
This reverts commit af107ceba5d188019df780e0be192dd7092ea35a. It is no
longer needed as we have resolved the flickering issue in the
ImageReader backend.
2023-11-14 10:26:39 -08:00
Zachary Anderson
ef11fee4ed Move Skia to //flutter/third_party/skia (flutter/engine#47913)
As part of eliminating the Flutter buildroot
(https://github.com/flutter/flutter/issues/67373), we are moving all
third-party dependencies from //third_party to //flutter/third_party.

Once all third-party dependencies have been migrated, tooling and config
will be moved and the buildroot will be eliminated altogether.

To land this PR, we'll need to:
1. Stop the Skia -> Engine autoroller
1. Update the license goldens in this PR.
1. Update
https://skia.googlesource.com/skia-autoroll-internal-config/+/refs/heads/main/skia-infra-public/skia-flutter.cfg#55
1. Land this PR.
1. Re-start the Skia -> Engine autoroller
2023-11-13 20:04:35 -08:00
auto-submit[bot]
e5da8d9a87 Reverts "Bump minSdk to 19 for Android tests" (flutter/engine#47935)
Reverts flutter/engine#47686
Initiated by: zanderso
This change reverts the following previous change:
Original Description:
The latest Robolectric version, 4.11.x, removed the support for SDKs < 19 by following AndroidX strategy. Also following https://github.com/flutter/buildroot/pull/750, and removing obsolete SDK checking in code to pass android_lint checking after bumping minSdk to 19 for testing target.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-10 23:06:18 +00:00
utzcoz
1e558fcece Bump minSdk to 19 for Android tests (flutter/engine#47686)
The latest Robolectric version, 4.11.x, removed the support for SDKs < 19 by following AndroidX strategy. Also following https://github.com/flutter/buildroot/pull/750, and removing obsolete SDK checking in code to pass android_lint checking after bumping minSdk to 19 for testing target.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-10 21:35:57 +00:00
Camille Simon
809cc6c652 [Android] Bump robolectric version to support unit testing on Android 34 (flutter/engine#47768)
Bumps robolectric version from 4.10.3 --> 4.11 to support unit testing on Android 34!

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-10 16:54:16 +00:00
gaaclarke
002ab77448 Expanded the performance lints (flutter/engine#47868)
fixes https://github.com/flutter/flutter/issues/137372

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-09 23:54:01 +00:00
Michael Goderbauer
ba990078f8 Reland "Remove physical geometry" (flutter/engine#47872)
Relands #47825 with a doc fix (see second commit).
2023-11-09 19:39:20 +00:00
Gray Mackall
1dc6423dac [Re-land] Upgrade Android SDK to 34 "UpsideDownCake" (flutter/engine#47839)
The difference between this PR and the original is the change to the `AndroidManifest.xml`. For context, right before the original PR landed, [a change to upgrade the target sdk](https://github.com/flutter/engine/pull/47683) in the manifest from 31 to 33 landed. It also removed the lint complaining about using an old target sdk version from the baseline lint file. So this change upgrading the sdk, but not the target sdk in the manifest, triggered the lint again.

For the rest of the PR, [see the description of the original PR](https://github.com/flutter/engine/pull/47609).

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-09 18:02:18 +00:00