Repository navigation
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Gold has detected about 11 new digest(s) on patchset 1. |
|
@JsouLiang 03:39 +5772 ~14 -4: /b/s/w/ir/x/w/flutter/packages/flutter/test/rendering/editable_test.dart: custom painters reusing the same painter [E]
Expected: Object or closure painting:
'a rectangle with Color(0x12345678), Rect.fromLTRB(1.0, 1.0, 1.0, 1.0)'
'drawParagraph(..., ...)'
'a rectangle with Color(0x12345678), Rect.fromLTRB(1.0, 1.0, 1.0, 1.0)'
Actual: <Closure: (Canvas) => void>
Which: did not match the pattern.
It called 1 other method on the canvas, the first of which was drawRect(Rect.fromLTRB(1.0, 1.0, 1.0, 1.0), Paint(Color(0x12345678))), but did not call drawParagraph() at the time where drawParagraph(..., ...) was expected.
The first method that was called when the call to drawParagraph() was expected, drawRect(Rect.fromLTRB(1.0, 1.0, 1.0, 1.0), Paint(Color(0x12345678))), was called with the following stack:
#0 TestRecordingCanvas.noSuchMethod (file:///b/s/w/ir/x/w/flutter/packages/flutter/test/rendering/recording_canvas.dart:87:70) |
OK, i will fix that |
68b0bed to
912f73f
Compare
|
I use an alternative implement: I change the |
|
@justinmc hey, I run the test, found some test generate image have some diff, please help me to check that image show which is right? |
|
(from triage): @JsouLiang looks like there are some failing tests on this one. Can you take a look at those? |
yeah, I had look at those, and I think I may be change the |
|
cc @Piinks |
|
Hi @JsouLiang it looks like there aren't any golden file changes here currently. The failing test is not a golden file test: |
|
@Piinks hey, for |
There was a problem hiding this comment.
Sorry for the slow response here. I hadn't noticed this problem before but it's an interesting idea.
Do you have screenshot you can post of the backgroundColor being covered by the selection highlight?
The test that is failing is this one. It looks like the autocorrect highlight isn't visible when it should be because of this change.
Edit: Can you get it to fail locally by using -d linux or -d chrome with your test command?
|
@justinmc hey, thank you for review my pr. I think the test failed is cause of the 'Selected highlight' is paint the topmost level. If you agree with my changes, I will try to modify the test. |
|
@JsouLiang Can you give me a screenshot or an app to reproduce the problem? At a high level it makes sense to move these painters to the foreground if it does fix the bug and doesn't break autocorrect or anything, but I want to make sure I understand what is being fixed. |
|
Sorry, I missed that this was a fix for #96112, I see the screenshots and example there. @LongCatIsLooong You mentioned that the solution for this problem was blocked on the SkParagraph migration at the time (here). Does that mean we need a deeper solution than this PR? |
912f73f to
6c9ab0c
Compare
|
Gold has detected about 8 new digest(s) on patchset 1. |
commented
Feb 9, 2022
6c9ab0c to
3ad856b
Compare
commented
Feb 10, 2022
commented
Feb 10, 2022
|
Gold has detected about 8 new digest(s) on patchset 1. |
3ad856b to
f298a9f
Compare
commented
Feb 10, 2022
|
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. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. Changes reported for pull request #96276 at sha f298a9f5f7cb70b335b8219a6856efb61719440f |
There was a problem hiding this comment.
Split to two lines:
/// If the cursor and the selection highlight should be painted on top
/// of the text or underneath it.
commented
Apr 29, 2022
|
@JsouLiang I want to try running this code, can you tell me how to reproduce the problem that this fixes? |
commented
Apr 29, 2022
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. Changes reported for pull request #96276 at sha 4e10bb15622064aa1b001b09bf74bbd912301e4e |
commented
Apr 29, 2022
|
@JsouLiang Taking a look at the most recent goldens failures, it looks like now the selection is being drawn in front of the text, and it has changed the color of the text slightly, which probably isn't what we want. |
commented
May 18, 2022
|
(from triage): @JsouLiang Do you still have plans to follow up on the feedback given above? |
4e10bb1 to
e4975ce
Compare
commented
May 19, 2022
Sorry, late reply. import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: TextField(
style: new TextStyle(backgroundColor: Colors.yellow),
),
),
);
}
}And I found the golden is has diff, but I don't know if we need to change the golden test in this scenario, or is there a problem with the code logic. You can reproduce this issue and check the selection paint logic. |
commented
May 19, 2022
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. Changes reported for pull request #96276 at sha 1be648de8f2853ac3aaf028a72452b5c49d37389 |
commented
Jun 8, 2022
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
commented
Jun 22, 2022
|
(Triage) @JsouLiang what is the status of this PR? |
commented
Jul 13, 2022
|
@JsouLiang Using the code you gave in #96276 (comment), I was able to reproduce the problem on master, but after checking out this branch, it doesn't seem to fix it! Can you take a look and see if it's working for you? |
1be648d to
2c59ead
Compare
commented
Jul 18, 2022
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
commented
Aug 1, 2022
|
Hello gentlemen, may I ask is there any progress on this issues? I have been waiting a long time to get a solution |
commented
Sep 14, 2022
|
I just pulled the branch and ran it locally and this still doesn't seem to fix the problem. Same result as before using the code in #96276 (comment): @JsouLiang Am I doing something wrong or is this not working? |
|
So sorry replay too late. I run this code #96276 (comment) on my branch and this is my behavior: |
commented
Oct 5, 2022
|
@JsouLiang It looks like you're on iOS, can you try on other platforms? I just tried the same code again on Linux and on an Android emulator, and both look wrong. The selection doesn't show above the yellow highlight. |
commented
Nov 1, 2022
|
(Triage) @JsouLiang Do you still have plans to come back to this PR and address the feedback from above? |
commented
Nov 15, 2022
|
Closing this as stale. If @JsouLiang or anyone else wants to work on this again, please let me know and I'm happy to keep helping with code review! |
commented
Mar 25, 2023
|
any updates on this? I am still facing this issue. |




A TextField is rendered by
_RenderDecoration, and the TextField content is painted inThe
inputis aRenderEditableclass instance. The text background color and section highlight is painted in_paintContents;So the whole flow of paint is:
_RenderDecoration.paint->RenderEditable._paintContents->textPainter paint text, _TextHighlightPainter paint selection highlightIn
_paintContentshas a logic:And I found in iOS platform

TextViewtext highlight view is paint above the text content:but in current Flutter the highlight is as background and it below the content.
We can find that we first paint selection highlight state then paint text but if the text has background color it will cover the selection highlight.
///).