Merge check for visibility method from upstream.