markNeedsCompositingBitsUpdate method

void markNeedsCompositingBitsUpdate()

Mark the compositing state for this render object as dirty.

This is called to indicate that the value for needsCompositing needs to be recomputed during the next PipelineOwner.flushCompositingBits engine phase.

When the subtree is mutated, we need to recompute our needsCompositing bit, and some of our ancestors need to do the same (in case ours changed in a way that will change theirs). To this end, adoptChild and dropChild call this method, and, as necessary, this method calls the parent's, etc, walking up the tree to mark all the nodes that need updating.

This method does not schedule a rendering frame, because since it cannot be the case that only the compositing bits changed, something else will have scheduled a frame for us.

Implementation

void markNeedsCompositingBitsUpdate() {
  assert(!_debugDisposed);
  if (_needsCompositingBitsUpdate) {
    return;
  }
  _needsCompositingBitsUpdate = true;
  if (parent is RenderObject) {
    final RenderObject parent = this.parent!;
    if (parent._needsCompositingBitsUpdate) {
      return;
    }

    if ((!_wasRepaintBoundary || !isRepaintBoundary) && !parent.isRepaintBoundary) {
      parent.markNeedsCompositingBitsUpdate();
      return;
    }
  }
  // parent is fine (or there isn't one), but we are dirty
  if (owner != null) {
    owner!._nodesNeedingCompositingBitsUpdate.add(this);
  }
}