Reverts flutter/engine#44301
```
Traceback (most recent call last):
File "/Volumes/Work/s/w/ir/cache/builder/src/flutter/testing/run_tests.py", line 1286, in <module>
sys.exit(main())
File "/Volumes/Work/s/w/ir/cache/builder/src/flutter/testing/run_tests.py", line 1269, in main
run_objc_tests(args.ios_variant, args.objc_filter)
File "/Volumes/Work/s/w/ir/cache/builder/src/flutter/testing/run_tests.py", line 721, in run_objc_tests
ensure_ios_tests_are_built(ios_out_dir)
File "/Volumes/Work/s/w/ir/cache/builder/src/flutter/testing/run_tests.py", line 625, in ensure_ios_tests_are_built
assert flutter_dylib_time <= ios_test_lib_time, final_message
AssertionError: /Volumes/Work/s/w/ir/cache/builder/src/out/ios_debug_sim_arm64_extension_safe/libios_test_flutter.dylib is older than /Volumes/Work/s/w/ir/cache/builder/src/out/ios_debug_sim_arm64_extension_safe/libFlutter.dylib. Please run the following commands:
gn --ios --unoptimized --runtime-mode=debug --no-lto --simulator
ninja -C /Volumes/Work/s/w/ir/cache/builder/src/out/ios_debug_sim_arm64_extension_safe ios_test_flutter
```
It failed we in run_test.py we check if the ios_test is built after the framework, which is not true anymore after moving the test inside the build target.
We have tests today that are trying to testwith impeller but using software rendering, so they're not actually testing with impeller.
In an unrelated patch, I'm causing the request to enable impeller to have additional checks that Impeller related objects/configurations are set when using Impeller, which isn't true if software rendering is enabled, and is causing the tests getting disabled here to fail.
The tests are not actually testing Impeller and thus are getting added to the skip list (they now crash with this change). https://github.com/flutter/flutter/issues/131888 tracks re-enabling them. They will almost certainly need different golden files than the Skia ones.
Fixes https://github.com/flutter/flutter/issues/131887
Many `#include`s, particularly in the `impeller/renderer/backend/vulkan/...` directory, had existing `clangd` lint violations.
The most frequent and easiest to fix appears to be https://clangd.llvm.org/guides/include-cleaner.
---
Note that I used `// IWYU pragma: keep.` in two places where `clangd` wasn't able to tell something was in use. In other cases you'll see additions because files were relying on transitive includes that are removed in this PR, but there should be 0 behavioral changes!
This should significantly improve the situation described in https://github.com/flutter/flutter/issues/130162.
When the framework merges semantics trees of multiple widgets into a single node, it can expand the tap area of one of the descendants to the size of the combined node as follows:
<img width="865" alt="Screenshot 2023-07-07 at 4 11 30 PM" src="https://github.com/flutter/flutter/assets/211513/50e4f9f2-d36b-4820-93d2-c53714f33b08">
When a screen reader taps on the combined node, the pointer events and the click all land in the center. This produces a stalemate resulting in the user action never producing a tap/click gesture in the framework:
* The web engine, seeing `pointerdown`/`pointerup`, switches to the gesture mode ignores the `click`, believing that the framework will interpret the pointer events as one.
* The framework, seeing pointer events landing outside the checkbox, never reacts to the pointer events.
This PR mostly solves the issue by delaying event sequences starting with pointerdown for up to 200ms. If within those 200ms a click is observed, `SemanticsAction.tap` is sent to the framework. Otherwise, the pointer events are sent to the framework and the DOM `click` event is dropped. The tradeoff is that even when the drag gesture detector is the only one present, there's a 200ms delay before dragging can start. However, it seems to be a better trade-off than missing clicks entirely.
Previously, some common Darwin framework targets existed in:
//flutter/shell/platform/darwin/BUILD.gn
This moves all targets into:
//flutter/shell/platform/darwin/common/BUILD.gn
The framework_shared target has been renamed framework_common for consistency with the directory name, and flutter_channels_unittests has been renamed framework_common_unittests since it's a reasonable target for adding other tests of common framework code.
We also de-duplicate targets with existing targets.
* The `flutter_channels` target duplicates the existing
`framework_shared` target.
* The `common` target already includes the buffer conversions
translation units,
which are only used by the iOS embedder.
No test changes since there are no semantic changes, just a
restructuring of build targets.
## Pre-launch Checklist
- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [ ] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [X] I signed the [CLA].
- [X] All existing and new tests are passing.
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
The existing `screenIfViewLoaded` and `windowSceneIfLoaded` functions are private helpers of `FlutterViewController` class. This PR moves the logic to a category of the `UIViewController`, so it can be reused for any `UIViewController`s.
*List which issues are fixed by this PR. You must list at least one issue.*
https://github.com/flutter/engine/pull/43972#discussion_r1282214557
*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
Introduce TextureRegistry.ImageTexture and related machinery.
Introduce ImageReaderPlatformViewRenderTarget.
Introduce HardwareBufferExternalTextureGL and related machinery.
NOTE: ImageReaderPlatformViewRenderTarget requires Android 26.
NOTE: This CL does not enable using ImageReaderPlatformViewRenderTarget
yet.
Related https://github.com/flutter/flutter/issues/130892
---------
Co-authored-by: Jason Simmons <jsimmons@google.com>
Part of https://github.com/flutter/flutter/issues/131346
Stubs a minimal test of the FFI utilities that `dart:ui` uses, but using
public symbols exported from the engine library. If this goes well, I'll
move the stuff from `dart:ui` into here and begin landing parts of the
API with test coverage.
Previously, when setting the binary messenger to the current binary messenger, we were freeing the current binary messenger before setting the new (current) binary messenger, triggering a use after free.
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
In native iOS, users are able to select text and initiate a web search on the selected text. Specifically, this will launch a search using the users selected default search engine. Apple provides a custom url scheme in the form of "x-web-search://?[term]" which will automatically launch a search using the user's preferred browser in Safari. Additionally, this also correctly handles the country code top level domain eg. a user with a selected region in the UK with a preferred Google search engine will automatically have the .co.uk domain appended to the end of the search.
This PR is the engine portion of the changes that will allow Search Web to be implemented
This PR addresses https://github.com/flutter/flutter/issues/82907
More details are available in this [design doc](https://github.com/flutter/engine/pull/flutter.dev/go/add-missing-features-to-selection-controls)
This PR disables the "auto-correction highlight" feature in iOS 17.
This feature was introduced in https://github.com/flutter/flutter/pull/45354 and https://github.com/flutter/engine/pull/13959/ (CC: @LongCatIsLooong who was the original author)
I have created [a new issue](https://github.com/flutter/flutter/issues/131622) to find other approaches to re-enable this feature.
**Note that "auto-correction" itself still works, it's only the "highlight" part is disabled:**
- iOS 16 with highlight:
https://github.com/flutter/engine/assets/41930132/2fe7bbf6-f2db-4212-a020-e420ad8dd5e6
- iOS 17 without highlight:
https://github.com/flutter/engine/assets/41930132/34f34743-6bef-4e93-80d2-d04c92ba59bf
## Why disable this feature?
The original PR uses `UITextInput::firstRectForRange` API for auto-correction, since Apple does not provide any other API when auto-correction should show up, so the original PR used this API as a workaround.
In iOS 17, Apple changed a few `UITextInput` behaviors:
- UIKit does not query `UITextInput::firstRectForRange` for text range of the auto-corrected word any more.
- But instead, it repeatedly queries every single character of the current word (after entering or deleting a character), regardless whether the word should be auto-corrected or not.
I have tried all other `UITextInput` APIs that takes a text range, and none are suitable for auto-correction feature. As a result, I have to disable this feature for iOS 17 for now.
*List which issues are fixed by this PR. You must list at least one issue.*
Fixes https://github.com/flutter/flutter/issues/128406
*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
Introduce TextureRegistry.ImageTexture and
HardwareBufferExternalTextureGL
- Introduce TextureRegistry.ImageTexture and related machinery.
- Introduce HardwareBufferExternalTextureGL and related machinery.
- Introduce ImageReaderPlatformViewRenderTarget.
NOTE: ImageReaderPlatformViewRenderTarget requires Android 26.
NOTE: This CL does not enable using ImageReaderPlatformViewRenderTarget
yet.
Additional fixes:
- Relax JNI lookup for classes and methods that aren't available in API
22
- Add @Keep annotations on code that is only referenced by JNI