Skip to content

Do not paint a RenderFittedBox with an empty size - #7489

Merged
jason-simmons merged 1 commit into
flutter:masterfrom
jason-simmons:bug_7431_proxy_box
Jan 13, 2017
Merged

jason-simmons merged 1 commit into
flutter:masterfrom
jason-simmons:bug_7431_proxy_box

Conversation

@jason-simmons

Copy link
Copy Markdown
Member

If the size is empty, then _updatePaintData will produce an invalid transform
that yields a NaN canvas bounds rectangle

Fixes #7431

@jason-simmons

Copy link
Copy Markdown
Member Author

@abarth

@abarth

abarth commented Jan 13, 2017

Copy link
Copy Markdown
Contributor

LGTM

@abarth

abarth commented Jan 13, 2017

Copy link
Copy Markdown
Contributor

Test?

@abarth

abarth commented Jan 13, 2017

Copy link
Copy Markdown
Contributor

You can build it with a custom painter inside and check that hte custom painter doesn't paint.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't seem right. Surely if the size is empty you're more likely to have overflow.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In particular I suspect this will break localToGlobal for things inside a zero-size RenderFittedBox.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We skip painting the child entirely, so there's no chance of visual overflow.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's true. Maybe we should skip this part of the change and only to the part in the paint function.

If the size is empty, then _updatePaintData will produce an invalid transform
that yields a NaN canvas bounds rectangle

Fixes flutter#7431
@jason-simmons

Copy link
Copy Markdown
Member Author

Removed the change to _updatePaintData and added a test

@abarth

abarth commented Jan 13, 2017

Copy link
Copy Markdown
Contributor

LGTM

@jason-simmons
jason-simmons merged commit 3b70244 into flutter:master Jan 13, 2017
@liyuqian liyuqian mentioned this pull request May 3, 2019
8 of 9 tasks
liyuqian added a commit to liyuqian/flutter that referenced this pull request May 3, 2019
Update the test accordingly

See flutter#7489 and flutter#7431 for the original purpose of the test.
liyuqian added a commit that referenced this pull request May 10, 2019
## Description

These will help identify where the matrix starts to get wrong. 

Also fixed `RenderFittexBox` to no longer paint with empty child which previously triggered invalid matrix computations (NaN with dividing by 0). See also #7489

## Related Issues

#31650
#31700
#7431

## Tests

* RenderFittedBox does not paint with empty sizes
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 14, 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.

An assert in a flutter app can hang the engine

4 participants