handleGetComputedStyleForNode method

void handleGetComputedStyleForNode(
  1. int? id,
  2. Map<String, dynamic> params
)

Implementation

void handleGetComputedStyleForNode(int? id, Map<String, dynamic> params) {
  final ctx = dbgContext;
  if (ctx == null) {
    sendToFrontend(id, null);
    return;
  }
  int? targetId = ctx.getTargetIdByNodeId(params['nodeId']);
  if (targetId == null) {
    sendToFrontend(id, null);
    return;
  }
  BindingObject? element = ctx.getBindingObject(Pointer.fromAddress(targetId));

  if (element is Element) {
    ComputedStyle computedStyle = ComputedStyle(
      computedStyle: buildComputedStyle(element),
    );
    sendToFrontend(id, computedStyle);
  }
}