Modify LocalCaretRectOfPositionTemplate for line break.
This patch modifies the function so that it returns valid LayoutRect for line break. The function didn't work if (LayoutObject, offset) points after line break: 1. (LayoutBR, 1) 2. ("foo\n", 4) on white-space: pre. Because ComputeInlineBoxPositionForTextNode didn't receive such position. Historically, VisualPosition canonicalization updated Position not to point end of Node and LocalCaretRectOfPosition and ComputeInlineBoxPosition assumed that. This patch updates LocalCaretRectOfPositionTemplate to check if Position is after line break(NeedsLineEndAdjustment) and return the first InlineBoxPosition of next line(NextLinePositionOf). * Notes: This kind of adjustment should be done inside ComputeInlineBoxPosition. However, SelectionModifierCharacter and SelectionModifierWord depend on the current behavior of ComputeInlineBoxPosition that it returns null InlineBoxPosition for such position of line end (see L261 and L332 for each function). Since regression is about LocalCaretRectOfPositionTemplate, this patch only fixes the function. Bug: 807930 Change-Id: I46630d86401c165e0bb908d748adc069e03a5374 Reviewed-on: https://chromium-review.googlesource.com/906263 Commit-Queue: Yoichi Osato <yoichio@chromium.org> Reviewed-by:Yoshifumi Inoue <yosin@chromium.org> Reviewed-by:
Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/master@{#547639}
Showing
Please register or sign in to comment