Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

hellohuanlin
Copy link
Contributor

@hellohuanlin hellohuanlin commented Aug 30, 2023

Design doc with more details: https://docs.google.com/document/d/1sM3HMv-SQin39yX1aPUU7vtGv7Hcef1Quc3QhRXBl6A/edit?resourcekey=0-SFYD8vmOIkXiXCZvB1Wlcw#heading=h.tul5o3hopauh

Just to be safe, for now we only change for iOS 17. However, the same logic should apply to older iOS as well. So will update in a separate PR.

Basically we were using firstRectForRange incorrectly. According to the API doc, firstRectForRange should return the rect for the queried range, or a subrange through the end of line, if the range encompasses multiple lines.

For LTR language:

0,  1,  2,  3
4,  5,  6,  7

Query: [1, 2, 3, 4]
Returns the following rect denoted by [ ]:

0,  [1,  2,  3]
4,  5,   6,   7

Similarly, for RTL language (Arabic):

 3,   2,   1,   0
 7,    6,   5,   4

Query: [1, 2, 3, 4]
Returns the following rect denoted by [ ]:

[3,  2,  1],  0
 7,   6,  5,   4

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

flutter/flutter#131622

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

  • 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 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 ///).
  • 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.

@hellohuanlin hellohuanlin force-pushed the system_highlight_beta7 branch from 9b7de88 to a01f9b3 Compare August 30, 2023 21:34
@hellohuanlin hellohuanlin marked this pull request as ready for review August 30, 2023 21:35
@hellohuanlin hellohuanlin changed the title [ios][text_input_highlight]fix text input system highlight in iOS 17 Beta 7 with firstRectForRange [ios][ios 17][text_input_highlight]fix text input system highlight in iOS 17 Beta 7 with firstRectForRange Aug 30, 2023
@hellohuanlin hellohuanlin changed the title [ios][ios 17][text_input_highlight]fix text input system highlight in iOS 17 Beta 7 with firstRectForRange [ios][ios17][text_input]fix text input system highlight in iOS 17 Beta 7 with firstRectForRange Aug 30, 2023
}
}
// TODO(hellohaunlin): Remove iOS 17 check. The logic should also work for older versions.
if (@available(iOS 17, *)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove this one now; CGRectIsNull will always be true for <17 because of the check you already have above.

BOOL endsOnOrAfterEndOfRange = _selectionRects[i].position >= end - 1; // end is exclusive
BOOL nextSelectRectIsOnNextLine =
!isLastSelectionRect &&
_selectionRects[i + 1].rect.origin.y != _selectionRects[i].rect.origin.y;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is every character on the same line guaranteed to have the same y origin, or could this have false positives for unusual characters?

@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

Changes reported for pull request #45303 at sha d532b47

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM with typo fix. Thanks for adding all the additional test coverage for the differing height and overlapping line cases!

BOOL endsOnOrAfterEndOfRange = _selectionRects[i].position >= end - 1; // end is exclusive
BOOL nextSelectionRectIsOnNextLine =
!isLastSelectionRect &&
// Seleciton rects from different langauges in 2 lines may overlap with each other.
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: Selection

update for varying selection rect size
@hellohuanlin hellohuanlin force-pushed the system_highlight_beta7 branch from 8a4ce0f to d6b85f9 Compare September 1, 2023 17:21
@hellohuanlin
Copy link
Contributor Author

The golden file changes seem to be a false positive.

@hellohuanlin hellohuanlin added autosubmit Merge PR when tree becomes green via auto submit App and removed will affect goldens labels Sep 1, 2023
@auto-submit auto-submit bot merged commit 40fb92c into flutter:main Sep 1, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 2, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 2, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 2, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Sep 2, 2023
…sions) (#133924)

Manual roll requested by [email protected]

flutter/engine@489c399...e496eec

2023-09-02 [email protected] Roll Skia from 2d8849f9f0cc to 15f77147a3ec (1 revision) (flutter/engine#45414)
2023-09-02 [email protected] Roll Fuchsia Mac SDK from OF4TS05qlWCjukWw6... to MesZPNdj-uw8VdCyV... (flutter/engine#45413)
2023-09-02 [email protected] Remove --disable-service-auth-codes (flutter/engine#45356)
2023-09-02 [email protected] [Impeller] Import cstring for memcpy. (flutter/engine#45408)
2023-09-02 [email protected] Roll Dart SDK from cdf1ce0c6d7e to a5c7102af509 (1 revision) (flutter/engine#45412)
2023-09-02 [email protected] Roll ANGLE from 179bd7762ffa to ebf1e7163216 (1 revision) (flutter/engine#45411)
2023-09-02 [email protected] Remove deprecated MOCK_METHODx calls (flutter/engine#45307)
2023-09-02 [email protected] [Impeller] Better demonstrate blur and draw picture? (flutter/engine#45388)
2023-09-02 [email protected] [Impeller] Make paths externally immutable, update all tests to use PathBuilder to create Path. (flutter/engine#45393)
2023-09-02 [email protected] Roll ANGLE from 962fdf7b7882 to 179bd7762ffa (1 revision) (flutter/engine#45409)
2023-09-02 [email protected] Cull the RTree bounds when they are forwarded in DrawDisplayList (flutter/engine#45358)
2023-09-02 [email protected] Roll Skia from fedff79a6afc to 2d8849f9f0cc (3 revisions) (flutter/engine#45407)
2023-09-02 [email protected] [impeller] premultiply vertices colors. (flutter/engine#45406)
2023-09-01 [email protected] Roll ANGLE from 6a09e41ce6ea to 962fdf7b7882 (224 revisions) (flutter/engine#45400)
2023-09-01 [email protected] Roll Skia from 22ae23891e8e to fedff79a6afc (1 revision) (flutter/engine#45405)
2023-09-01 [email protected] [Impeller] turned on validations for all debug builds (flutter/engine#45350)
2023-09-01 [email protected] Roll Fuchsia Mac SDK from sk7JBGzW1Jw10Wy-T... to OF4TS05qlWCjukWw6... (flutter/engine#45403)
2023-09-01 [email protected] Roll Skia from 2c0405489966 to 22ae23891e8e (1 revision) (flutter/engine#45402)
2023-09-01 [email protected] [Windows] Update vsync on raster thread (flutter/engine#45310)
2023-09-01 [email protected] Roll Dart SDK from a2ea759c16cc to cdf1ce0c6d7e (1 revision) (flutter/engine#45397)
2023-09-01 [email protected] Roll Skia from f3f6c733c7e6 to 2c0405489966 (1 revision) (flutter/engine#45396)
2023-09-01 [email protected] Roll Skia from 02fa14799c6c to f3f6c733c7e6 (1 revision) (flutter/engine#45394)
2023-09-01 [email protected] Roll Skia from d5d3b0d4ee77 to 02fa14799c6c (2 revisions) (flutter/engine#45392)
2023-09-01 [email protected] [ios][ios17][text_input]fix text input system highlight in iOS 17 Beta 7 with firstRectForRange (flutter/engine#45303)
2023-09-01 [email protected] Roll Skia from d6266ef14a7e to d5d3b0d4ee77 (2 revisions) (flutter/engine#45389)
2023-09-01 [email protected] Roll Dart SDK from 0c121a6431cc to a2ea759c16cc (1 revision) (flutter/engine#45384)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from sk7JBGzW1Jw1 to MesZPNdj-uw8

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
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 Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
auto-submit bot pushed a commit that referenced this pull request Sep 12, 2023
… 17 Beta 7 with firstRectForRange (#45398)

original PR: #45303

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

flutter/flutter#131622

*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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-ios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants