Skip to content

Conversation

@auto-submit
Copy link
Contributor

@auto-submit auto-submit bot commented Dec 20, 2023

Reverts #139717
Initiated by: LongCatIsLooong
This change reverts the following previous change:
Original Description:
Fixes #131435, #104594, #43400
Needs flutter/engine#48774 (to fix the web test failure).

Currently the method we use for text span hit testing TextPainter.getPositionForOffset always returns the closest TextPosition, even when the given offset is far away from the text.

The new TextPaintes method tells you the layout bounds (width = letterspacing / 2 + x_advance + letterspacing / 2, height = font ascent + font descent) of a character, the PR changes the hit testing implementation such that a TextSpan is only considered hit if the point-down event landed in one of it's character's layout bounds.

Potential issues:

  1. In theory since the text is baseline aligned, we should use the max ascent and max descent of each character to calculate the height of the text span's hit-test region, in case some characters in the span have to fall back to a different font, but that will be slower and it typically doesn't make a huge difference.

This is a breaking change. It also introduces a new finder and a new method WidgetTester.tapOnText: await tester.tapOnText('string to match') for ease of migration.

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.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@auto-submit auto-submit bot added the revert of Bot Only: Tracking label for bot. Tracks new revert of pull requests. label Dec 20, 2023
@github-actions github-actions bot added a: tests "flutter test", flutter_test, or one of our tests a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. labels Dec 20, 2023
@auto-submit auto-submit bot merged commit 9003f13 into master Dec 20, 2023
@auto-submit auto-submit bot deleted the revert_ea5b97286e5347ec3f6adb32eb22256e7aa5bd5a branch December 20, 2023 19:32
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 21, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Dec 21, 2023
flutter/flutter@da0cd69...11def8e

2023-12-21 [email protected] Update README.md (flutter/flutter#140382)
2023-12-21 [email protected] Revert "Integrate testWidgets with leak tracking. (#138057)" (flutter/flutter#140502)
2023-12-21 [email protected] Integrate testWidgets with leak tracking. (flutter/flutter#138057)
2023-12-21 [email protected] Fix import pattern (flutter/flutter#140425)
2023-12-20 [email protected] Update job permissions (flutter/flutter#140476)
2023-12-20 [email protected] Roll pub packages (flutter/flutter#140472)
2023-12-20 [email protected] Remove outdated ignores from tool (flutter/flutter#140467)
2023-12-20 [email protected] Remove outdated ignores from framework (flutter/flutter#140465)
2023-12-20 [email protected] Reland `find.textRange.ofSubstring` changes (flutter/flutter#140469)
2023-12-20 [email protected] Part 1/n migration steps for kotlin migration (flutter/flutter#140452)
2023-12-20 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Make `TextSpan` hit testing precise." (flutter/flutter#140468)
2023-12-20 [email protected] [web] Re-enable test now that source of flakiness is fixed (flutter/flutter#140462)
2023-12-20 [email protected] Eliminate Cirrus build status badge (flutter/flutter#140461)
2023-12-20 [email protected] Move tests shifted to Pixel 7 from staging to prod (flutter/flutter#140438)
2023-12-20 [email protected] Roll Packages from be52ac8 to dc5b267 (5 revisions) (flutter/flutter#140450)
2023-12-20 [email protected] _TabBarViewState should not recreate page controller (flutter/flutter#135500)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
LongCatIsLooong added a commit to LongCatIsLooong/flutter that referenced this pull request Dec 26, 2023
CoderDake pushed a commit to CoderDake/flutter that referenced this pull request Dec 28, 2023
Reverts flutter#139717
Initiated by: LongCatIsLooong
This change reverts the following previous change:
Original Description:
Fixes flutter#131435, flutter#104594, flutter#43400
Needs flutter/engine#48774 (to fix the web test failure).

Currently the method we use for text span hit testing `TextPainter.getPositionForOffset` always returns the closest `TextPosition`, even when the given offset is far away from the text. 

The new TextPaintes method tells you the layout bounds (`width =  letterspacing / 2 + x_advance + letterspacing / 2`, `height = font ascent + font descent`) of a character, the PR changes the hit testing implementation such that a TextSpan is only considered hit if the point-down event landed in one of it's character's layout bounds.

Potential issues:

1. In theory since the text is baseline aligned, we should use the max ascent and max descent of each character to calculate the height of the text span's hit-test region, in case some characters in the span have to fall back to a different font, but that will be slower and it typically doesn't make a huge difference. 

This is a breaking change. It also introduces a new finder and a new method `WidgetTester.tapOnText`: `await tester.tapOnText('string to match')` for ease of migration.
auto-submit bot pushed a commit that referenced this pull request Jan 2, 2024
Fixes #131435, #104594, #43400

Currently the method we use for text span hit testing `TextPainter.getPositionForOffset` always returns the closest `TextPosition`, even when the given offset is far away from the text.

The new TextPaintes method tells you the layout bounds `(width =  letterspacing / 2 + x_advance + letterspacing / 2, height = font ascent + font descent)` of a character, the PR changes the hit testing implementation such that a TextSpan is only considered hit if the point-down event landed in one of its character's layout bounds.

Potential issues:

In theory since the text is baseline aligned, we should use the max ascent and max descent of each character to calculate the height of the text span's hit-test region, in case some characters in the span have to fall back to a different font, but that will be slower and it typically doesn't make a huge difference.
This is a breaking change.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: tests "flutter test", flutter_test, or one of our tests a: text input Entering text in a text field or keyboard related problems f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. revert of Bot Only: Tracking label for bot. Tracks new revert of pull requests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InlineText's GestureDetector is always full-width

2 participants