Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Issue 2641053005: Brush up localSelectionRectOfPositionTemplate (Closed)

Created:
3 years, 11 months ago by yoichio
Modified:
3 years, 11 months ago
Reviewers:
yosin_UTC9, joone
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Brush 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} Committed: https://chromium.googlesource.com/chromium/src/+/2ac0c19603e70ef75f156ee8409162bbff94de74

Patch Set 1 #

Total comments: 6

Patch Set 2 : update #

Total comments: 4

Patch Set 3 : update #

Unified diffs Side-by-side diffs Delta from patch set Stats (+31 lines, -5 lines) Patch
M third_party/WebKit/Source/core/editing/VisibleUnits.cpp View 1 1 chunk +21 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp View 1 2 1 chunk +10 lines, -0 lines 0 comments Download

Messages

Total messages: 21 (14 generated)
yoichio
3 years, 11 months ago (2017-01-20 05:54:52 UTC) #6
yosin_UTC9
https://codereview.chromium.org/2641053005/diff/1/third_party/WebKit/Source/core/editing/VisibleUnits.cpp File third_party/WebKit/Source/core/editing/VisibleUnits.cpp (right): https://codereview.chromium.org/2641053005/diff/1/third_party/WebKit/Source/core/editing/VisibleUnits.cpp#newcode2570 third_party/WebKit/Source/core/editing/VisibleUnits.cpp:2570: InlineBox* const box = boxPosition.inlineBox; Please see also https://codereview.chromium.org/2636623002 ...
3 years, 11 months ago (2017-01-20 05:59:53 UTC) #9
yosin_UTC9
lgtm w/ nit Please add TEST=run_webkit_unittests --gtest_filter=VisibleUnitsTest.localSelectionRectOfPositionTemplateNotCrash https://codereview.chromium.org/2641053005/diff/20001/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp File third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp (right): https://codereview.chromium.org/2641053005/diff/20001/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp#newcode2002 third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp:2002: const char* ...
3 years, 11 months ago (2017-01-20 08:00:03 UTC) #10
yosin_UTC9
Title and description don't explain about this change. This change makes |localSelectionRectOfPositionTemplate()| 1. not to ...
3 years, 11 months ago (2017-01-20 08:03:57 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2641053005/40001
3 years, 11 months ago (2017-01-20 08:30:15 UTC) #17
yoichio
Update title and description. https://codereview.chromium.org/2641053005/diff/1/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp File third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp (right): https://codereview.chromium.org/2641053005/diff/1/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp#newcode2002 third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp:2002: const char* bodyContent = "<div>foo<img ...
3 years, 11 months ago (2017-01-20 08:30:41 UTC) #18
commit-bot: I haz the power
3 years, 11 months ago (2017-01-20 10:04:15 UTC) #21
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://chromium.googlesource.com/chromium/src/+/2ac0c19603e70ef75f156ee84091...

Powered by Google App Engine
This is Rietveld 408576698