Don't update viewport intersection for iframe in dirty parent

LocalFrameView::UpdateViewportIntersectionsForSubtree already has a
(!NeedsLayout()) check to prevent it from computing intersections if
layout is dirty. This patch uses the same logic to avoid recomputing
the intersection of an iframe with its embedding document if the
embedding document's layout is dirty.

It's not clear why NeedsLayout() would be true if the document
lifecycle is >= kLayoutClean, although I suspect it has something to
do with the way LocalFrameView::has_pending_layout_ is used. I've
been unable to construct a test case which reproduces the condition.
I added a TODO to figure out how this can happen.

BUG=989637
R=chrishtr@chromium.org

Change-Id: I3ed84f7ccc3736e495efcd4cf945d44379086d66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1732335
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684128}
2 files changed