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

Issue 2925063002: ALL-IN-ONE: Refactor ComputeInlineBoxPosition() (Closed)

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

Description

Refactor ComputeInlineBoxPosition() This patch splits |ComputeInlineBoxPositionTemplate()| into - processing Text node - processing InlineBox to reduce size of template with utilizing const-variable for improving code health. BUG=707656 TEST=n/a; no behavior changes

Patch Set 1 : 2017-06-08T19:15:47 #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+109 lines, -73 lines) Patch
M third_party/WebKit/Source/core/editing/VisibleUnits.cpp View 3 chunks +108 lines, -70 lines 3 comments Download
M third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp View 1 chunk +1 line, -3 lines 2 comments Download

Messages

Total messages: 32 (26 generated)
yosin_UTC9
PTAL https://codereview.chromium.org/2925063002/diff/60001/third_party/WebKit/Source/core/editing/VisibleUnits.cpp File third_party/WebKit/Source/core/editing/VisibleUnits.cpp (right): https://codereview.chromium.org/2925063002/diff/60001/third_party/WebKit/Source/core/editing/VisibleUnits.cpp#newcode1327 third_party/WebKit/Source/core/editing/VisibleUnits.cpp:1327: return layout_object->LocalCaretRect( Since ComputeInlineBoxPosition() returns offset zero when ...
3 years, 6 months ago (2017-06-08 10:17:53 UTC) #23
yosin_UTC9
PTAL https://codereview.chromium.org/2925063002/diff/80001/third_party/WebKit/Source/core/editing/VisibleUnits.cpp File third_party/WebKit/Source/core/editing/VisibleUnits.cpp (right): https://codereview.chromium.org/2925063002/diff/80001/third_party/WebKit/Source/core/editing/VisibleUnits.cpp#newcode1173 third_party/WebKit/Source/core/editing/VisibleUnits.cpp:1173: return layout_object->LocalCaretRect( Since ComputeInlineBoxPosition() returns offset zero when ...
3 years, 6 months ago (2017-06-08 10:19:25 UTC) #26
Xiaocheng
Sorry I don't understand this patch. The code flow in ComputeInlineBoxPositionTemplate is too complicated. Could ...
3 years, 6 months ago (2017-06-08 21:34:12 UTC) #29
yosin_UTC9
On 2017/06/08 at 21:34:12, xiaochengh wrote: > Sorry I don't understand this patch. > > ...
3 years, 6 months ago (2017-06-09 01:52:07 UTC) #30
yosin_UTC9
https://codereview.chromium.org/2925063002/diff/80001/third_party/WebKit/Source/core/editing/VisibleUnits.cpp File third_party/WebKit/Source/core/editing/VisibleUnits.cpp (left): https://codereview.chromium.org/2925063002/diff/80001/third_party/WebKit/Source/core/editing/VisibleUnits.cpp#oldcode958 third_party/WebKit/Source/core/editing/VisibleUnits.cpp:958: inline_box = SearchAheadForBetterMatch(text_layout_object); On 2017/06/08 at 21:34:12, Xiaocheng wrote: ...
3 years, 6 months ago (2017-06-09 01:55:55 UTC) #31
Xiaocheng
3 years, 6 months ago (2017-06-09 04:18:33 UTC) #32
On 2017/06/09 at 01:55:55, yosin wrote:
>
https://codereview.chromium.org/2925063002/diff/80001/third_party/WebKit/Sour...
> File third_party/WebKit/Source/core/editing/VisibleUnits.cpp (left):
> 
>
https://codereview.chromium.org/2925063002/diff/80001/third_party/WebKit/Sour...
> third_party/WebKit/Source/core/editing/VisibleUnits.cpp:958: inline_box =
SearchAheadForBetterMatch(text_layout_object);
> On 2017/06/08 at 21:34:12, Xiaocheng wrote:
> > I don't understand this part.
> > 
> > It seems to be setting the value of |inline_box| repeatedly in the loop
without returning. Why it can be changed to an early return?
> 
> Setting |inline_box| is one in the loop at L976. After setting |iline_box|, we
break loop.
> 
> This loop is can be represents as:
> 
> (is_early_return, inline_box, candidate) = this_loop(...);
> if (is_eraly_return)
>   return InlineBoxPosition(inline_box, caret_offset); // as L968
> ...
> 
>
https://codereview.chromium.org/2925063002/diff/80001/third_party/WebKit/Sour...
> File third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp (left):
> 
>
https://codereview.chromium.org/2925063002/diff/80001/third_party/WebKit/Sour...
> third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp:308: EXPECT_EQ(2,
actual.offset_in_box);
> On 2017/06/08 at 21:34:12, Xiaocheng wrote:
> > This is behavioral change.
> 
> This comes from here:
> 
> ORIGINAL:
>       inline_box = ToLayoutBox(layout_object)->InlineBoxWrapper();
>       if (!inline_box || (caret_offset > inline_box->CaretMinOffset() &&
>                           caret_offset < inline_box->CaretMaxOffset()))
>         return InlineBoxPosition(inline_box, caret_offset);
> 
>      if (!inline_box)
>         return InlineBoxPosition(inline_box, caret_offset);
> 
> Anyway, I'll move this change into another patch.

Thanks. I'll wait for the split patches.

Powered by Google App Engine
This is Rietveld 408576698