Skip to content

Conversation

@dnfield
Copy link
Contributor

@dnfield dnfield commented May 13, 2022

#103638 was an alternative attempt at this, but doesn't work:

  • Some ROs cannot set the transform to zero because they explicitly are implemented such that you can use them to figure out where a RO would paint if it was visible
  • Some ROs don't want to set it to zero because they haven't historically and getting an animation just right for an AnimatedOpacity may ruin some other timing in your test.

Adds an optimization to InkFeature so that it avoids painting entirely if something between the target and feature stops painting.

Part of the visibility_detector refactor.

@gspencergoog @chunhtai might find this interesting since I'm touching some code you last modified.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. labels May 13, 2022
@override
void applyPaintTransform(RenderBox child, Matrix4 transform) {
if (size.isEmpty || child.size.isEmpty) {
if (!paintsChild(child)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this remove accessibility transform as well? I remember widget like Opacity can still include in semantics when opacity in zero. The semantics transform is calculate using this method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is existing behavior for this widget. Yes, this means the a11y transform will be zeroed out. If we want to change that I think it should be done in a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh nvm, this is RenderFittedBox, I thought it was RenderProxyBox

/// supply a zeroed out matrix if it would not otherwise be able to determine
/// a valid matrix for the child and thus cannot meaningfully determine where
/// the child would paint.
bool paintsChild(covariant RenderObject child) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there an easy way to check whether the layout will be offscreen? or if there is a parent with clip that clipped the whole renderobject? it may be a good default implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No.

RenderOffstage and RenderOpacity, for example, return the same exact transform/clip whether they are going to paint their children or not.

Offstage does not really mean the same as offscreen - it's not as if you're getting laid out or painted in some coordinates that are outside of the current viewport. It's just that you will never get paint called after being laid out.

/// one render object into coordinates local to another render object.
///
/// Some RenderObjects will provide a zeroed out matrix in this method,
/// indicating that even though
Copy link
Contributor

Choose a reason for hiding this comment

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

indicating that even though ....?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hah. I got halfway through writing this and thought of what I should say in paintsChild and forgot to come back. Updated.

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

Seems like a reasonable approach

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

I am not super-exited about adding another method to RenderObject, but I also don't see another approach for this, so reluctantly

LGTM.

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@dnfield
Copy link
Contributor Author

dnfield commented May 16, 2022

I only see scuba chagnes that look expected and/or unrelated to this patch.

@fluttergithubbot fluttergithubbot merged commit fe87538 into flutter:master May 16, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 16, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request May 16, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request May 17, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 30, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants