New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SuperEditor][Mobile] Fix downstream image caret position (Resolves #1959) #1967
Conversation
@matthew-carroll Can you do a first pass review? I still don't know what to do with this assertion failure, but it should impact the fix. |
@matthew-carroll We had the golden test issue on the past on linux and worked around that with the following code: @override
void markNeedsPaint() {
super.markNeedsPaint();
if (kDebugMode &&
!kIsWeb &&
Platform.isLinux &&
Platform.environment.containsKey('FLUTTER_TEST') &&
!WidgetsBinding.instance.hasScheduledFrame) {
// We are running on a linux test and we don't have a scheduled frame.
//
// We ran into an issue in some golden tests, on linux only, where `debugNeedsPaint`
// is `true` after the build/layout/phase pipeline. This causes the tests to fail,
// because trying to capture the image of a `RenderObject` throws an assertion failure
// if `debugNeedsPaint` is `true`. To avoid that, immediately schedule a new frame,
// so Flutter pipeline runs again before we try to capture the image.
WidgetsBinding.instance.scheduleFrame();
}
} Should we also check for Android? |
@angelosilvestre I think we mentioned it on our call, but you can go ahead and let that particular check run for all platforms. |
CC @BazinC |
@matthew-carroll I'm getting a failure on the new goldens on CI only that seems related to some antialiasing on the drag handle. Test image: Master image: Isolate diff: Any ideas? |
@angelosilvestre can you just regenerate that golden? |
@matthew-carroll Locally, the regenerated golden is identical to the previous one... |
@angelosilvestre if your local Flutter version is identical to the CI Flutter version, then I'm not sure why we're seeing different results. If that's truly the case, then consider using the tooling that we created, which allows a certain number of pixels to be different before failing the test. |
2f42f3a
to
fc4665f
Compare
This reverts commit fc4665f.
After using our tooling that tolerates small differences, I got back to the infamous |
@angelosilvestre are the goldens the only remaining problem? If so, let's file an issue to look into it and get this fix merged. |
@matthew-carroll Yes, the only problem is the failing goldens on Android. I modified these tests to be skipped so we can try to find out the reason. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@angelosilvestre please be sure to file an issue, if you haven't already |
Resolves superlistapp#1959) (superlistapp#1995) [SuperEditor][Mobile] Fix downstream image caret position (Resolves superlistapp#1959) (superlistapp#1967) Co-authored-by: Angelo Silvestre <angelosilvestre.ccp@gmail.com>
[SuperEditor][Mobile] Fix downstream image caret position. Resolves #1959
Tapping close to the trailing edge of an image places the selection correctly, but the caret isn't displayed. We had the same issue in the past on desktop. It was fixed by #1820, but mobile doesn't use the same caret layer that desktop uses, so the issue is still present on mobile.
The root cause is the same of the desktop issue:
The downstream caret is positioned at (right, 0), so when the image takes all the available screen width (like in the demo app), the caret is positioned off-screen. Block level elements that have padding don't have this issue, because there is room to render the caret.
The same solution was applied:
This PR changes the caret overlay to check whether the caret rect is placed outside of its bounds at the right side. If it is, the caret position is adjusted.
The golden tests for Android are still failing due to this exception:
It seems to be caused by the
Follower
used by the Android collapsed handle.