DescriptionBrush up localSelectionRectOfPositionTemplate
This CL does:
1. Import |localCaretRectOfPositionTemplate()| partially to avoid calling
|computeInlineBox()| twice(L2562-L2586).
In |localCaretRectOfPositionTemplate()|, we call |computeInlineBox()|, which already
called at L2568. Unified it.
Lines from 2562 to 2586 is virtually localCaretRectOfPositionTemplate except
|boxPosition.inlineBox| null-nonnull condition because we need non-null inlineBox
to get valid LayoutRect.
2. Get rid of redundant and unsafe cast(L2586).
We cast InlineBoxPosition.inlineBox to InlineTextBox at L2570.
However, computeInlineBoxPosition returns InlineBoxPosition which inlineBox
is not InlineTextBox when position.node.layoutObject is not Text and under few
conditions.
Thus the cast at L2570 fails.
BTW, we don't need to use InlineTextBox following lines because no special
functions on InlineTextBox but only InlineBox are used.
Then we can use boxPosition.inlineBox just as InlineBox.
BUG=680428
TEST=run_webkit_unittests
--gtest_filter=VisibleUnitsTest.localSelectionRectOfPositionTemplateNotCrash
Review-Url: https://codereview.chromium.org/2641053005
Cr-Commit-Position: refs/heads/master@{#445026}
(cherry picked from commit 2ac0c19603e70ef75f156ee8409162bbff94de74)
Review-Url: https://codereview.chromium.org/2653493012 .
Cr-Commit-Position: refs/branch-heads/2987@{#81}
Cr-Branched-From: ad51088c0e8776e8dcd963dbe752c4035ba6dab6-refs/heads/master@{#444943}
Committed: https://chromium.googlesource.com/chromium/src/+/559d6398923277e0dfc5a65636bf5d0d907aee89
Patch Set 1 #
Messages
Total messages: 2 (1 generated)
|