Skip to content

Conversation

@dnfield
Copy link
Contributor

@dnfield dnfield commented May 12, 2022

This helps make the planned refactor of visibility_detector work, and is just more correct.
We use this technique elsewhere, e.g. in RenderSliverMultiBoxAdaptor, where there's explicit comments stating that in a case where nothing is drawn we set the transform to zero.

If Matrix4 had a fast memoization for whether it's the zero matrix, we could bail out of some algorithms more quickly in this case.

There's a carve out for if you say to always include semantics. This is kind of a weird case, but in this case the "paint" isn't visible but your child still is providing visible information into the semantics tree. This would mean that something that's visually invisible would not get marked as invisible if it's semantically visible. That seems like an acceptable compromise to me.

@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label May 12, 2022
@dnfield
Copy link
Contributor Author

dnfield commented May 12, 2022

(Or if we gave a decorated matrix that override setZero...)

@dnfield
Copy link
Contributor Author

dnfield commented May 12, 2022

Tests aren't happy because we're now trying to hit test things that are invisible....

@jonahwilliams
Copy link
Contributor

Instead of re-using paintTransform and clip, we could add a new property that describes the accumulated opacity?

@dnfield
Copy link
Contributor Author

dnfield commented May 12, 2022

I talked with @goderbauer about that. We'd like to try to avoid adding a new method to the interface if possible, since it's already a difficult interface to implement correctly. But maybe that doesn't matter if you have to do some magic around clipping or transforming...

@dnfield
Copy link
Contributor Author

dnfield commented May 12, 2022

So at least one failure is trying to tap a button that is invisible. That seems like a bogus test to me.

@dnfield
Copy link
Contributor Author

dnfield commented May 13, 2022

I started going through and looking at tests. In general, the problem is that tests are asserting that ROs that are not visible have certain paint bounds (usually via doing a hit test on them). Very often, it's enough to add a pumpAndSettle or move a Key object from something that's offstage to its parent.

Sometimes it's harder - a duration has to be modified or a pumpAndSettle added, and that will slightly change some hard coded value. In some cases, it also seems like the test was just relying on the ability to get paint bounds for something that has a zero valued opacity.

Rather than fix up all these callsites, I'm adding a flag so that tests are still allowed to hit test/get paint bounds for things that are transparent.

@dnfield
Copy link
Contributor Author

dnfield commented May 13, 2022

In particular, some callsites are concerning because they explicitly say "I don't want the animation to finish", but finding the exact point where the opacity is no longer zero but the animation isn't finished is hard.

@dnfield
Copy link
Contributor Author

dnfield commented May 13, 2022

I'm going to conver this to a debug flag.

@dnfield dnfield force-pushed the paint_xform branch 2 times, most recently from 239e6cc to 0f8ec62 Compare May 13, 2022 05:54
@dnfield
Copy link
Contributor Author

dnfield commented May 13, 2022

Ok. the cupertino context menu failure seems like a real break. I'm going to close this until I figure out how to either fix that or a better approach for this entirely.

An internal global presubmit is suggesting ~200 test failures.

@dnfield dnfield closed this May 13, 2022
@dnfield
Copy link
Contributor Author

dnfield commented May 13, 2022

This doesn't work because Offstage needs to be able to measure where offstage things would paint if they were visible - this is used in several places in the framework, and is documented behavior:

Offstage can be used to measure the dimensions of a widget without bringing it on screen (yet). To hide a widget from view while it is not needed, prefer removing the widget from the tree entirely rather than keeping it alive in an Offstage subtree.

It deals with semantics for this by returning early if you try to visit its children for semantics.

I think the only way forward for this is to have a separate method on RO called something like bool paintsChild(covariant RenderObject child), and considering updating the existing ROs that zero out the transform to instead return true in that method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants