Skip to content

Refactor RenderObject/PaintingContext to allow for more asserts/restrictions around errors/inefficiencies #103951

Open

Description

@dnfield

Today, [RenderObject] is a relatively challenging protocol to implement, and it is relatively easy to make multiple mistakes that cannot be statically or dynamcially detected by the framework.

For example, there's currently no good way to validate the implementation of describeApproximatePaintClip to make sure that it does not provide a clip for a child that is painted with clipBehavior = Clip.none. Another example is that there is no way to make sure it disposes of its layers if it doesn't use the layer property, and that in some cases it is expected to not touch the layer (which is used by the framework to make it a repaint boundary). Yet another example are methods like the newly added paintsChild compared to applyPaintTransform.

RenderObjects rarely seem to use all of the complexity available to them, and many of the ones that do more work in paint could (and perhaps should) be refactored into smaller, simpler objects.

Activity

  1. added
    c: new feature
    framework
    P3
    on May 17, 2022
  2. added
    team-framework
    triaged-framework
    on Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3c: new featureframeworkteam-frameworktriaged-framework

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions