5161 Commits

Author SHA1 Message Date
Tamir Duberstein
75da76c7cd Add missing includes (flutter/engine#42812)
See https://fxrev.dev/869997.
2023-06-13 19:34:06 +00:00
luckysmg
948e1fa81a [iOS][Keyboard] Wait vsync on UI thread and update viewport inset to avoid jitter. (flutter/engine#42312)
Video for after and before this patch:
[videos.zip](https://github.com/flutter/engine/files/11231756/videos.zip)

- https://github.com/flutter/flutter/issues/120555

The technical problem is: if setViewportMetrics called **before** framework's vsync process callback (rebuild & layout & paint), will cause jitter keyboard animation.So this PR is to keep the time when updateViewportMetrics call to framework side legal.

### Before
![2](https://github.com/flutter/engine/assets/49340347/71198a08-b139-4d6d-87e1-37e536f5d34b)

### After
![1](https://github.com/flutter/engine/assets/49340347/5c9df757-7e39-4855-8c3a-009f5d6438b2)
2023-06-13 17:40:05 +00:00
gmackall
04786833e9 Capture additional final inset states in ImeSyncDeferringInsetsCallback (flutter/engine#42700)
Fixes https://github.com/flutter/flutter/issues/118761.

For some context: ImeSyncDeferringInsetsCallback extends [WindowInsetsAnimation.Callback](https://developer.android.com/reference/android/view/WindowInsetsAnimation.Callback) specifically to handle insets related to keyboard animations.

When a keyboard animation happens, we get a call to onPrepare with the animation, and then to onApplyWindowInsets with [WindowInsets](https://developer.android.com/reference/android/view/WindowInsets) that represent the post animation state. For example, for hiding the keyboard, we would get WindowInsets with height of 0 for insets of type WindowInsets.Type.ime() (input method editor). We save these post-animation insets. 

We then get calls to onProgress for each frame of the animation, and use the WindowInsets passed to onProgress to build new WindowInsets based on the saved post-animation insets, but with the keyboard insets overridden by the WindowInsets passed to onProgress.

Finally, we get a call to onEnd, where we apply the saved insets.

However, there can be multiple animation running at the same time. For example, dismissing the keyboard can result in an animation associated solely with the keyboard happening, as well as an animation associated only with the navigation bar happening. And they can start at slightly different times. This can result in the situation described in this comment: https://github.com/flutter/flutter/issues/118761#issuecomment-1574284505

Re-setting needsSave to false ensures we don't ignore any updates to the final state, ensuring correct insets in onProgress and onEnd.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-06-13 17:10:33 +00:00
Justin McCandless
7ffe595a77 Predictive back breakage fix (flutter/engine#42789)
Fixes breakages related to setFrameworkHandlesBack, for the Predictive Back feature for Android.
2023-06-12 16:19:30 -07:00
Jonah Williams
260d931b1c [Impeller] allowing enabling Impeller on macOS. (flutter/engine#42639)
Ship it?
2023-06-12 20:02:46 +00:00
hellohuanlin
ab09f653a6 [floating_cursor_selection] a somewhat "design doc" for floating cursor feature (flutter/engine#42173)
This PR gives an overview of how floating cursor feature works (including the new floating cursor selection gesture, and the existing floating cursor move gesture). It can serve as the missing design doc. 

I put it in the engine rather than the framework, since all logics are in one place, and it's closer to the UIKit behavior that I want to cover. 

Thanks @moffatman for helping me understanding it. 

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

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

*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-06-12 19:19:54 +00:00
Callum Moffat
641003fc6d Fix crash with CJK keyboard with emoji at end of text field (flutter/engine#42540)
The `isRTLAtPosition` method had a bug, it used `NSInteger max = [_selectionRects count]` instead of `NSInteger max = [_selectionRects count] - 1`. But I realized we don't even need the function any more, it was used in a few places in previous iterations of #36643, but in the only place remaining, we actually already have the selection rect and don't need to search for it by position.

Btw as an explanation of the crash, I guess there is some mismatch between code point and character count somewhere. UIKit was asking for `caretRectForPosition:2` when we only had 1 character. This could have only crashed when floating cursor selection was used, but actually when switching to CJK keyboard, UIKit turns out to use `caretRectForPosition` to calculate something about the composing rect.

Fixes https://github.com/flutter/flutter/issues/128031
2023-06-12 18:13:03 +00:00
Tamir Duberstein
0984c52a8f Remove dependency on memfs (flutter/engine#42773)
See individual commits.
2023-06-12 17:14:35 +00:00
Jim Graham
0b6d9a337c Reland "add non-rendering operation culling to DisplayListBuilder" (#41463) (flutter/engine#42584)
This reverts commit 01aeff259aa37b93304d5dea20e38302e79bf84a.

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

This PR should fix the blendmode/color analysis that caused failures for https://github.com/flutter/engine/pull/41463 as well as the bounds failures for inverted rectangles that caused failures for https://github.com/flutter/engine/pull/42330 (incorporating the fix from https://github.com/flutter/engine/pull/42556).

The description from the [previous PR](https://github.com/flutter/engine/pull/41463) updated with the new name of the DL property:

---------------------------------
This optimization avoids recording unnecessary render operations that will not affect the output and also eliminates the need for "draw detection" mechanisms like `DlOpSpy` and `CanvasSpy` by remembering if any non-transparent operations were included. The `DlOpSpy` unit tests were updated to check if the results from that object match the new `DisplayList::modifies_transparent_black()` method.

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

In addition, this change will unblock some other Issues:

- https://github.com/flutter/flutter/issues/125318
- https://github.com/flutter/flutter/issues/125403
2023-06-11 21:14:24 +00:00
Tong Mu
57758b70c8 Use ShellTest::Config struct to create Shell (flutter/engine#42332) 2023-06-11 10:38:17 -07:00
Dan Field
d33b2d4288 Delete WeakPtrFactory from GPUSurfaceVulkanImpeller (flutter/engine#42710)
Should fix https://github.com/flutter/flutter/issues/128618.

This is unused - if it were used we'd have to be careful about deleting the object on the same thread it's created on.
2023-06-09 22:27:46 +00:00
gaaclarke
bf5c52d8af [Impeller] Reland: Added a switch to turn on vulkan (flutter/engine#42669)
relands https://github.com/flutter/engine/pull/42585

## 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.
- [ ] 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-06-09 11:35:29 -07:00
gaaclarke
2097506136 [Impeller] Makes validation layers flag work for android (flutter/engine#42625)
This builds and links in the validation layers for android. They then
can be turned on or off with a manifest field.

fixes https://github.com/flutter/flutter/issues/123788
depends on https://github.com/flutter/buildroot/pull/741

## 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.
- [ ] 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
2023-06-09 10:22:21 -07:00
Justin McCandless
986c173094 Platform channel for predictive back (flutter/engine#39208)
Adds a platform channel method for enabling/disabling Android's predictive back feature.
2023-06-09 10:06:33 -07:00
Bruno Leroux
0445311a23 [Linux] Return keyboard pressed state (flutter/engine#42346)
## Description

This PR updates the Linux engine in order to answer to keyboard pressed state queries from the framework (as implemented in https://github.com/flutter/flutter/pull/122885).

## Related Issue

Linux engine implementation for https://github.com/flutter/flutter/issues/87391

## Tests

Adds 2 tests.
2023-06-09 11:28:15 +00:00
Renzo Olivares
8b7818b946 [Linux] composing delta fixes (flutter/engine#42648)
Fixes a few issues with the Linux text editing delta implementation that was causing some issues when composing CJK text.

`im_preedit_changed_cb` dispatches a delta with the delta range set as the current composing region causing a crash when composing because the new composing region range might not yet exist in the `oldText` that the delta is applied to. We should instead send the composing region before the change to the text as that will be the correct range that is being modified in the `oldText`.

`im_preedit_end_cb` dispatches a delta with an empty `oldText`, a not empty `deltaText`, and a delta range of `(-1,-1)` causing a crash when composing ends because the delta range will never be within the range of the text. We should instead send the current text value as the `oldText` and not send a `deltaRange` or `deltaText` since a `(-1,-1)` range essentially means nothing in the text changed.

`im_commit_cb` does not account for the case when we were previously composing when the text was committed. This causes the dispatched delta to have a delta range that always inserts at the current the selection, when it should instead replace the previous composing range. We should account for the case when we are previously composing before committing the text, and dispatch a delta with the previous composing region.

Fixes https://github.com/flutter/flutter/issues/113909
2023-06-08 21:14:01 +00:00
toneyzeng
c659b9a590 Fix: invalid time-point comparison between each from different clock source (flutter/engine#42409)
Sometimes the time point created late will less than the time point create earlier since the CLOCK SOURCE has changed.

We must make sure the  CLOCK SOURCE (fml::TimePoint) is always keep the same while we are testing. 
Corrects the test case is needed before we fix the problem completely.
2023-06-08 21:12:12 +00:00
Zachary Anderson
8e7fbbb8a7 Revert "[Impeller] Added a switch to turn on vulkan" (flutter/engine#42660)
Reverts flutter/engine#42585

Reverting to investigate
https://github.com/flutter/flutter/issues/128484
2023-06-08 09:04:17 -07:00
Bruno Leroux
a3843d747d [iOS] Fix TextInputAction.continueAction sends wrong action to framework (flutter/engine#42615)
## Description

This PR fixes an issue related to text input plugin, on IOS, sending a wrong action string to the engine for `FlutterTextInputActionContinue`.

## Related Issue

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

## Tests

Adds 1 test.
2023-06-07 20:11:47 +00:00
Jonah Williams
02591dca4d [Impeller] fix missing assignment of embedder render target. (flutter/engine#42630)
Otherwise we can't render 😄
2023-06-07 19:57:57 +00:00
Chris Bracken
e7a44a64a7 [macOS] Add platformview creation parameter support (flutter/engine#42607)
Previously, when creating native platform views on macOS, we ignored any parameters passed via the framework side "params" argument in the "create" method call, and instead always passed a nil value to the FlutterPlatformViewFactory. This made it impossible for users of macOS platform views to pass constructor arguments to the NSView subclass implementing the platform view.

We now decode the arguments data using the codec specified by the `FlutterPlatformViewFactory` and pass them through to the `[FlutterPlatformViewFactory createWithIdentifier:arguments:]` method where the platform view author can make use of them.

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

This is a part of the broader macOS platform view support effort: https://github.com/flutter/flutter/issues/41722

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-06-07 19:16:56 +00:00
gaaclarke
01f6db8882 [Impeller] Added a switch to turn on vulkan (flutter/engine#42585)
fixes https://github.com/flutter/flutter/issues/128286

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-06-07 19:08:04 +00:00
J-P Nurmi
42b7de838e [Linux][a11y] implement AtkText::get_text/string_at_offset() (flutter/engine#38144)
This PR implements `AtkText::get_string_at_offset()` (and the deprecated `AtkText::get_text_at_offset()` still used by e.g. Orca) for `FlAccessibleTextField` to allow Orca to read out loud the current character while moving the text cursor around.

### Before (unmute to hear the screen reader)

[textfield-a11y-before.webm](https://user-images.githubusercontent.com/140617/206556644-fb4f4df8-acca-4d97-86d5-7120f0a4871d.webm)

### After (unmute to hear the screen reader)

[textfield-a11y-after.webm](https://user-images.githubusercontent.com/140617/206556678-4fbf9112-291e-4518-a258-e9ca33469430.webm)

Fixes: flutter/flutter#113049

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-06-07 17:18:04 +00:00
Tong Mu
fdadd4c99e Revert "[Android] Return keyboard pressed state" (flutter/engine#42616)
Reverts flutter/engine#41695 due to internal bug report b/284945818.

cc @bleroux let's investigate some day.
2023-06-07 01:38:45 -07:00
Brandon DeRosier
72a1fea6e2 [Impeller] Reland 2: Add Impeller Metal support in the embedder API (#42411) (flutter/engine#42597)
This reverts commit
8d6f091751
+ fixes bugs.

Reworked the surface wrapping to use a valid descriptor when wrapping
the drawable.
2023-06-06 23:02:02 -07:00
Zachary Anderson
8d6f091751 Revert "[Impeller] Reland: Add Impeller Metal support in the embedder API (#42411)" (flutter/engine#42593)
Reverts flutter/engine#42545

Not sure if this is needed, but getting a revert started for the
regression noted here:
https://github.com/flutter/engine/pull/42545#issuecomment-1579034704.
2023-06-06 10:57:57 -07:00
Matej Knopp
5ef190cc5c [macOS] Force clipping to path when platform view clip rect is rotated (flutter/engine#42539)
Normally when platform view is clipped to a simple rect we rely on
clipping to container layer bounds. However when the clip rect is
rotated the container layer is expanded accordingly and clipping to path
must be used instead.

Fixes https://github.com/flutter/flutter/issues/128175
2023-06-05 18:14:16 -07:00
Brandon DeRosier
fba5e2b514 [Impeller] Reland: Add Impeller Metal support in the embedder API (#42411) (flutter/engine#42545)
This reverts commit
45dd178414.

Original PR: https://github.com/flutter/engine/pull/42411

Part of https://github.com/flutter/flutter/issues/112230.
2023-06-05 14:51:43 -07:00
Kevin Lubick
0f09000dea Add missing #include of SkCFObject.h (flutter/engine#42573)
Another follow-on to http://review.skia.org/704942 which removed some
#includes that Flutter had been transitively depending on.

Note that SkCFObject is mac-only, so I included it the appropriate
#ifdef in embedder.cc, but the other two files are already mac-only so
they do not need that guard.

## 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 Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [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-06-05 14:44:46 -04:00
Zachary Anderson
af94169054 Check more optional accesses (flutter/engine#42528)
Related https://github.com/flutter/flutter/issues/127701
2023-06-05 08:38:32 -07:00
Kevin Lubick
14d8bae027 Add missing includes of GrBackendSurface.h (flutter/engine#42563)
In https://skia-review.googlesource.com/c/skia/+/704942, Skia removed
some unnecessary #includes which parts of Flutter had been depending on
implicitly. This adds those includes in explicitly.

## 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 Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [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-06-05 10:32:41 -04:00
Brandon DeRosier
45dd178414 Revert "[Impeller] Add Impeller Metal support in the embedder API (#42411)" (flutter/engine#42532)
This reverts commit 666563a5544cf2a98a51c6b24e7bc03e265eedb0.

Expected to resolve https://github.com/flutter/flutter/issues/128145
2023-06-02 18:11:00 -07:00
Chris Bracken
49e25a2dee [macOS] Top-left origin for PlatformView container (flutter/engine#42523)
For consistency with Flutter (and all other platforms), Flutter views in the macOS embedder set `isFlipped` to ensure a co-ordinate system with the origin in the top-left, with y co-ordinates increasing towards the bottom edge of the view.

Previously, we were using a stock NSView as the container, which uses a bottom-left origin by default. Instead we extract the PlatformView container view as its own class with `isFlipped` true.

This doesn't correct the issue of the view anchorpoint/position but does correct rotation direction.

This also applies the transform back to origin prior to other transforms when adjusting the platformview position rather than after.

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-06-02 23:35:43 +00:00
Jim Graham
01aeff259a Revert "Reland "add non-rendering operation culling to DisplayListBuilder" (#41463)" (flutter/engine#42525)
Reverts flutter/engine#42330

Some golden failures down the line were discovered in internal testing. See b/285539451
2023-06-02 21:59:50 +00:00
Michael Goderbauer
298dad2e13 MultiView changes for dart:ui (flutter/engine#42493)
Fixes https://github.com/flutter/flutter/issues/124991.

Framework tests are failing because I need to do a pre-migration of `flutter_test` for the Object -> int change of viewId. That's in https://github.com/flutter/flutter/pull/128092.
2023-06-02 21:29:48 +00:00
Camille Simon
3a156b7a42 [Android] Bump unit test robolectric version to 4.10.3 (flutter/engine#42454)
Bumps robolectric version for unit tests to [4.10.3](https://github.com/robolectric/robolectric/releases/tag/robolectric-4.10.3), the latest and greatest. Should support running unit tests with API 33.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-06-02 19:45:21 +00:00
Tong Mu
dc666a37db Revert "[Rasterizer] Make resubmit information temporary" (flutter/engine#42455)
Reverts flutter/engine#42001 due to being the likely culprit to
flakiness https://github.com/flutter/flutter/issues/127936 .
2023-06-01 21:50:47 -07:00
John McCutchan
d72aace3ef Ensure PlatformView engine life cycle callbacks are invoked (flutter/engine#42491)
- Move some code off of the message handler onto the parent class.
- Call the engine life cycle callbacks on PlatformView regardless of
which mode is used.
- Re-enable and fix test that these callbacks are invoked.

Fixes [#120329](https://github.com/flutter/flutter/issues/120329)

*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-06-01 14:51:25 -07:00
Bruno Leroux
849e5fb2f6 [Windows - TextInput] Insert new line only when TextInputAction.newline (flutter/engine#42244)
## Description

This PR updates the Windows text input plugin to avoid adding a new line on a multiline text field when action is not set to `TextInputAction.newline`.

## Related Issue

Fixes https://github.com/flutter/flutter/issues/125879 as Linux and macOS implementations are merged.
Linux PR: https://github.com/flutter/engine/pull/41895
macOS PR: https://github.com/flutter/engine/pull/41977

## Tests

Adds 2 tests.
2023-06-01 20:59:13 +00:00
Brandon DeRosier
666563a554 [Impeller] Add Impeller Metal support in the embedder API (flutter/engine#42411)
Part of https://github.com/flutter/flutter/issues/112230.

Now seemed like the right time to sneak this in:
* We have large desktop refactors on the horizon (multi-window).
* We're starting to land optimizations that complicate the surface behavior such as wide gamut and dirty regions.
* We have plans to migrate the iOS embedder to use the embedder API (https://github.com/flutter/flutter/issues/112232).

![Screenshot 2023-05-30 at 6 59 48 PM](https://github.com/flutter/engine/assets/919017/16616be8-f94e-42ba-8a97-4ce4aa29e662)
2023-06-01 20:10:58 +00:00
Callum Moffat
7daf5e001c Fix crash getting spell-check suggestions (flutter/engine#42466)
On some Samsung devices Flutter with spell-check enabled will crash when typing/moving near the ">" character. 

Stack trace is

```
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.textservice.SentenceSuggestionsInfo.getSuggestionsCount()' on a null object reference
       at io.flutter.plugin.editing.SpellCheckPlugin.onGetSentenceSuggestions(SpellCheckPlugin.java:26)
       at android.view.textservice.SpellCheckerSession.lambda$handleOnGetSentenceSuggestionsMultiple$1$android-view-textservice-SpellCheckerSession(SpellCheckerSession.java:224)
       at android.view.textservice.SpellCheckerSession$$ExternalSyntheticLambda0.run(:4)
       at android.os.Handler.handleCallback(Handler.java:942)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8747)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
```
2023-06-01 19:37:16 +00:00
Jason Simmons
d473f0d24d Wait for GL command completion in the ExternalTextureGLRefreshedTooOften test (flutter/engine#42438)
This test sometimes caused assertion failures when running on Windows with ANGLE.  The process may be unable to safely clean up global objects if GL commands are pending when the test exits.
2023-06-01 18:46:16 +00:00
Kevin Lubick
1df7a98848 Clean up Skia includes around SkSurfaceCharacterization (flutter/engine#42485)
While contemplating a change to SkSurfaceCharacterization, I was curious
who was using this. Flutter #included it, but never actually seemed to
use it. Thus, I removed includes of it and other unnecessary #includes
in those same files, as well as addressing follow-on compile errors.

## 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 Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [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-06-01 14:08:46 -04:00
Jim Graham
a98c1eb274 Reland "add non-rendering operation culling to DisplayListBuilder" (#41463) (flutter/engine#42330)
The original PR caused some golden test failures down the line, likely due to bad analysis of when the combined BlendMode and color would result in a NOP situation.

This PR adds tests that go through every BlandMode and pair it with a variety of colors and Color/ImageFilters to verify that the operations are only omitted when they actually produce no change in the output. It also checks the validity of the "modifies_transparent_black" property of DisplayLists which can be used in place of the current CanvasSpy/DlOpSpy classes.

The description from the [previous PR](https://github.com/flutter/engine/pull/41463) updated with the new name of the DL property:

---------------------------------
This optimization avoids recording unnecessary render operations that will not affect the output and also eliminates the need for "draw detection" mechanisms like `DlOpSpy` and `CanvasSpy` by remembering if any non-transparent operations were included. The `DlOpSpy` unit tests were updated to check if the results from that object match the new `DisplayList::modifies_transparent_black()` method.

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

In addition, this change will unblock some other Issues:

- https://github.com/flutter/flutter/issues/125318
- https://github.com/flutter/flutter/issues/125403
2023-06-01 17:44:04 +00:00
Kevin Lubick
8666e1af8f Register codecs with Skia explicitly (flutter/engine#42320)
In http://review.skia.org/689016, Skia added an option to explicitly
register codecs to use (instead of relying on #defines set by BUILD.gn
rules.

This uses that mechanism to explicitly register all the codecs that
Flutter was currently using from Skia (at least by my read of
[tools/gn](fee0534882/tools/gn (L292)).

I'm not sure if there is another place I need to put this sort of code,
e.g. for Fuchsia things.

To really test this out, we would want to add a define of
SK_DISABLE_LEGACY_INIT_DECODERS when compiling Skia, but I'm not sure
the best place to do this.

## 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.
- [ ] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [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-05-31 14:15:18 -04:00
Zachary Anderson
9022cac6f8 Enables bugprone-unchecked-optional-access for some files (flutter/engine#42428) 2023-05-30 16:52:58 -07:00
hangyu
ab43a145cf Handle a11y focus event on Ios and android (flutter/engine#41777)
framework change:https://github.com/flutter/flutter/pull/126171
issue: https://github.com/flutter/flutter/issues/94523

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-05-30 21:50:56 +00:00
Matej Knopp
821bb52e38 Fix unitialized SkRect (flutter/engine#42403)
Empty SkRect needs to be created with `SkRect::MakeEmpty()` otherwise the default value is undefined (and possibly garbage).

*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-05-30 21:37:12 +00:00
Greg Spencer
a1b365111f Reland: "Adding app lifecycle notification for macOS and Linux, add hidden state." (#40542) (flutter/engine#42418)
## Description

This reverts commit 879917b to re-land #40542 to fix the lint warning which caused the original PR to be reverted (the lint warnings were turned on after the original was landed, which is why it wasn't caught earlier).
2023-05-30 20:45:46 +00:00
Zachary Anderson
879917b1e6 Revert "Adding app lifecycle notification for macOS and Linux, add hidden state." (flutter/engine#42384) 2023-05-28 00:02:58 -07:00