Skip to content

Fix bugs in contrast guideline and improve heuristic#31000

Merged
jonahwilliams merged 3 commits intoflutter:masterfrom
jonahwilliams:fix_contrast_tests
Apr 15, 2019
Merged

Fix bugs in contrast guideline and improve heuristic#31000
jonahwilliams merged 3 commits intoflutter:masterfrom
jonahwilliams:fix_contrast_tests

Conversation

@jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Apr 13, 2019

Description

Instead of using the pixels under the entire semantics node, use the renderbox of the text widget. This shrinks the number of pixels considered and makes it less likely that background colors are assumed to be part of the text contrast.

Related Issues

Replace this paragraph with a list of issues related to this PR from our issue database. Indicate, which of these issues are resolved or fixed by this PR.

Tests

I added the following tests:

  • regression test for material widget

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@jonahwilliams
Copy link
Contributor Author

cc @johnsonmh

Copy link
Contributor

@johnsonmh johnsonmh 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 Jonah!

// Needs to be the same pixel ratio otherwise our dimensions won't match the
// last transform layer.
image = await layer.toImage(renderView.paintBounds, pixelRatio: 1.0);
image = await layer.toImage(renderView.paintBounds, pixelRatio: 1 / 3);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, why the 1/3 change? It seems like the comment above this line no longer fully holds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I used the semantics node, we ended up including the dpr transform. Now that I'm using the rect from the render box, this doesn't include the dpr transform

@jonahwilliams
Copy link
Contributor Author

Submitting, build is currently green but dashboard may be unable to update older PRs

@jonahwilliams jonahwilliams merged commit 715cb51 into flutter:master Apr 15, 2019
@jonahwilliams jonahwilliams deleted the fix_contrast_tests branch April 15, 2019 16:01
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants