coversPath method

bool coversPath(
  1. Iterable<RenderObject> path
)

Whether any node in path is a marker render object or a descendant of a registered root — that is, whether an event hitting path must be excluded from recording.

Every path entry's parent chain is walked to the render-tree root, so exclusion also holds for partial paths that omit an ancestor. The walk is deliberately unbounded: parent chains terminate at the root render object by construction, while a depth cap could silently miss an exclusion and record host chrome.

Implementation

bool coversPath(Iterable<RenderObject> path) {
  for (final node in path) {
    for (
      RenderObject? current = node;
      current != null;
      current = current.parent
    ) {
      if (current is CockpitRecorderExcludeRenderObject ||
          _roots.contains(current)) {
        return true;
      }
    }
  }
  return false;
}