Pre-compute start/end index for ShapeResult

The methods for computing start and end index for a shape result compute
the values on demand, while not too expensive these methods are called a
lot during both layout and paint. By pre-computing the values text paint
performance is improved by about 10% for LayoutNG & about 2% for legacy.

Bug: 714962
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: Ib652b947d6cc670e657d72d753e96ecb4e2aa85d
Commit-Queue: Emil A Eklund <>
Reviewed-by: Koji Ishii <>
Cr-Commit-Position: refs/heads/master@{#584335}
2 files changed