Reland "[CompositeAfterPaint] Invalidate chrome client when needed"

This is a reland of crrev.com/618316 which was reverted in
crrev.com/619326 because of performance regression. This patch
changed the condition in PrePaintTreeWalk::WalkTree() from
 if (root_frame_view.GetLayoutView()->Layer()->NeedsRepaint())
to
 if (needs_invalidate_chrome_client_).
needs_invalidate_chrome_client_ is set by PaintInvalidator.

The problem of previous code was that NeedsRepaint() is always
true if the document doesn't update lifecycle to paint which is
the case for the subdocument of SVGImage, causing infinite
invalidation of the chrome client.

Original change's description:
> Revert "[CompositeAfterPaint] Invalidate chrome client when needed"
>
> This reverts commit 29021ede403d79c59ed4016b5f5fa9ef765b62b6.
>
> Reason for revert: Suspect performance regression
>
> Bug: 918276
>
> Original change's description:
> > [CompositeAfterPaint] Invalidate chrome client when needed
> >
> > For pre-CompositeAfterPaint, we call InvalidateChromeClient()
> > when an object is invalidated in a view referenced from a plugin or
> > an svg-image.
> >
> > Now let the path also work for CompositeAfterPaint.
> >
> > This fixes several web plugin tests for CompositeAfterPaint.
> >
> > Bug: 524134
> > Change-Id: Ia4c3ccba4632ddcdfdfdfec299fb7a68440a1419
> > Reviewed-on: https://chromium-review.googlesource.com/c/1385112
> > Reviewed-by: Philip Rogers <pdr@chromium.org>
> > Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#618316}
>
> TBR=wangxianzhu@chromium.org,pdr@chromium.org
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Bug: 524134
> Change-Id: I9b4f67a74732919ba23acc00fd501d45baa498e6
> Reviewed-on: https://chromium-review.googlesource.com/c/1392439
> Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#619326}

Bug: 918276, 524134
Change-Id: Ifad1c2eb8bdddcceea26a286c3309665f6d94c1a
Reviewed-on: https://chromium-review.googlesource.com/c/1393558
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619733}
6 files changed