79523880

Date: 2025-03-20 19:08:04
Score: 0.5
Natty:
Report link

So it turns out my initial intuition about going through the children was correct. Something similar to this where you iterate on the child elements, while perhaps not performant in some cases, offers much better guarantees about redacting all related info.

        // redact any descendant Rects that are not fully contained within the parent
        Queue<Element> redactedChildrenQueue = Queue.from([currentElement]);
        while (redactedChildrenQueue.isNotEmpty) {
          final redactedChild = redactedChildrenQueue.removeFirst();
          final childRect = _getGlobalElementRect(redactedChild);

          if (!childRect.isEmpty && childRect.intersect(elementRect) != childRect) {
            redactionRects.add(childRect);
          }
          redactedChild.visitChildElements((child) {
            redactedChildrenQueue.add(child);
          });
        }

Result where label is redacted:

enter image description here

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Blasterdude8