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 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() {
  if (_needsCompositingBitsUpdate)
    return;
  _needsCompositingBitsUpdate = true;
  if (parent is RenderObject) {
    final RenderObject parent = this.parent;
    if (parent._needsCompositingBitsUpdate)
      return;
    if (!isRepaintBoundary && !parent.isRepaintBoundary) {
      parent.markNeedsCompositingBitsUpdate();
      return;
    }
  }
  assert(() {
    final AbstractNode parent = this.parent;
    if (parent is RenderObject)
      return parent._needsCompositing;
    return true;
  }());
  // parent is fine (or there isn't one), but we are dirty
  if (owner != null)
    owner._nodesNeedingCompositingBitsUpdate.add(this);
}