boundingClientRect property

BoundingClientRect get boundingClientRect

Implementation

BoundingClientRect get boundingClientRect {
  BoundingClientRect boundingClientRect = BoundingClientRect(0, 0, 0, 0, 0, 0, 0, 0);
  if (isRendererAttached) {
    flushLayout();
    RenderBox sizedBox = renderBoxModel!;
    // Force flush layout.
    if (!sizedBox.hasSize) {
      sizedBox.markNeedsLayout();
      sizedBox.owner!.flushLayout();
    }

    if (sizedBox.hasSize) {
      Offset offset = _getOffset(sizedBox, ancestor: ownerDocument.documentElement);
      Size size = sizedBox.size;
      boundingClientRect = BoundingClientRect(
        offset.dx,
        offset.dy,
        size.width,
        size.height,
        offset.dy,
        offset.dx + size.width,
        offset.dy + size.height,
        offset.dx);
    }
  }

  return boundingClientRect;
}