resolveVisibility method

Node resolveVisibility (
  1. Node node,
  2. List<Node> originalRules
)

Implementation

Node resolveVisibility(Node node, List<Node> originalRules) {
  if (!node.blocksVisibility()) {
    if (isEmpty(node) && !containsSilentNonBlockedChild(originalRules)) {
      return null;
    }
    return node;
  }

  //TODO
  // final Node compiledRulesBody = node.rules[0];
  final compiledRulesBody =
      (node.rules != null && node.rules.isNotEmpty) ? node.rules[0] : null;
  keepOnlyVisibleChilds(compiledRulesBody);

  if (isEmpty(compiledRulesBody)) return null;

  return node
    ..ensureVisibility()
    ..removeVisibilityBlock();

//2.5.3 20151120
// resolveVisibility: function (node, originalRules) {
//     if (!node.blocksVisibility()) {
//         if (this.isEmpty(node) && !this.containsSilentNonBlockedChild(originalRules)) {
//             return ;
//         }
//
//         return node;
//     }
//
//     var compiledRulesBody = node.rules[0];
//     this.keepOnlyVisibleChilds(compiledRulesBody);
//
//     if (this.isEmpty(compiledRulesBody)) {
//         return ;
//     }
//
//     node.ensureVisibility();
//     node.removeVisibilityBlock();
//
//     return node;
// },
}