function insideRect (parent, child, margin) {
  const _margin = margin !== undefined ? margin : 0
  return child.left - _margin >= parent.left &&
      child.right + _margin <= parent.right &&
      child.top - _margin >= parent.top &&
      child.bottom + _margin <= parent.bottom
}
Test whether the child rect fits completely inside the parent rect.
@param {ClientRect} parent
@param {ClientRect} child
@param {number} margin