[LayoutNG] Avoid creating ShapeResult when collapsing trailing spaces

This patch changes |TruncateLineEndResult| to create truncated
|ShapeResultView| from the original |ShapeResult| in
|NGInlineItem|, not from |ShapeResultView|. Doing so avoids
creating intermediate |ShapeResult|, which saves CPU time and
memory consumed by |RunInfo|.

r632350 (CL:1469846) avoided reshaping when possible, but
|TruncateLineEndResult| needs to create new results even when
reshaping is not needed. This patch should improve both cases,
when reshaping is needed and not needed.

blink_perf.layout:
https://pinpoint-dot-chromeperf.appspot.com/job/139c2aaa340000

Bug: 636993, 931668
Change-Id: Ia60b6c25d52d9999813ef9b37d2f4f38c61ad26a
Reviewed-on: https://chromium-review.googlesource.com/c/1475327
Reviewed-by: Emil A Eklund <eae@chromium.org>
Commit-Queue: Emil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#633215}
1 file changed