Skip to content

Clear _scribbleCacheKey when connection closes#122145

Merged
auto-submit[bot] merged 1 commit intoflutter:masterfrom
moffatman:selection_rects_cache
Mar 8, 2023
Merged

Clear _scribbleCacheKey when connection closes#122145
auto-submit[bot] merged 1 commit intoflutter:masterfrom
moffatman:selection_rects_cache

Conversation

@moffatman
Copy link
Contributor

When a TextInputConnection is recreated in the engine, it won't have its previous selectionRects remembered. But the framework still thinks it does, as _scribbleCacheKey isn't changed. The effect of this is that when refocusing a text field, the selectionRects will be missing until the text is changed. By clearing the cache-key, they will be properly re-sent when the TextInputConnection is re-opened.

Part of #30476

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], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. labels Mar 7, 2023
@moffatman moffatman force-pushed the selection_rects_cache branch from fbfca25 to 5927d4c Compare March 7, 2023 23:35
Copy link
Contributor

@LongCatIsLooong LongCatIsLooong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the fix!

@moffatman moffatman added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 8, 2023
@moffatman moffatman force-pushed the selection_rects_cache branch from 5927d4c to 236c7bb Compare March 8, 2023 13:40
@auto-submit auto-submit bot merged commit 1ab3cb9 into flutter:master Mar 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 9, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 10, 2023
hannah-hyj pushed a commit to hannah-hyj/flutter that referenced this pull request Mar 11, 2023
Clear _scribbleCacheKey when connection closes
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 11, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 12, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
@hellohuanlin
Copy link
Contributor

When a TextInputConnection is recreated in the engine, it won't have its previous selectionRects remembered.

Noob question: Is the connection created every time a text input is focused? @moffatman

@moffatman
Copy link
Contributor Author

@hellohuanlin It might be, not actually sure. This fixes the issue observed when you tested in the dev/integration_tests/ios_platform_view_tests. So it is at minimum re-created when switching from a non-flutter UITextField. I didn't notice it myself in my own tests, but I can't remember if I tried switching between multiple fields before this fix.

@hellohuanlin
Copy link
Contributor

^ @LongCatIsLooong i'm wondering if you have context on question? Thanks!

@LongCatIsLooong
Copy link
Contributor

Yeah whenever an input field gains focus it creates a connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants