Refactor OffsetForPosition and add a variation for ellipsis
This patch refactors ShapeResult::OffsetForPosition in: 1. Make the underlying function common, without "mode". 2. Unify LTR and RTL code path in lower-layer functions. 3. Add a variation OffsetToFit for 'text-overflow: ellipsis' that computes offset that can fit to the specified width. While implementing 'text-overflow: ellipsis', which is more sensitive to how many characters can fit, existing functions turned out not to be accurate enough for the requirement. The current code uses OffsetForPosition then +1 or -1, which is not accurate when ligature/ joining occurs. Maybe ShapingLineBreaker should move to the OffsetToFit function but I have not done enough verifications yet. Bug: 636993 Change-Id: Ic9a1865d4b772fc7ce5cf94424a0aa3f9e9af332 Reviewed-on: https://chromium-review.googlesource.com/1020760Reviewed-by:Dominik Röttsches <drott@chromium.org> Commit-Queue: Koji Ishii <kojii@chromium.org> Cr-Commit-Position: refs/heads/master@{#553982}
Showing
Please register or sign in to comment