|
|
Created:
3 years, 6 months ago by yoichio Modified:
3 years, 5 months ago Reviewers:
yosin_UTC9 CC:
blink-reviews, chromium-reviews Target Ref:
refs/heads/master Project:
chromium Visibility:
Public. |
DescriptionSimplify LayoutSelection::CalcSelection()
This CL changes
- Unify code whether selection is inside TextControl or not
- Split block cursor logic.
Then CalcSelection does
- return FrameSelection.VSinFlat if no block cursor
- if block cursor, extending selection with NextPositionOf(kGrapheme);
BUG=708453
Review-Url: https://codereview.chromium.org/2953743002
Cr-Commit-Position: refs/heads/master@{#482194}
Committed: https://chromium.googlesource.com/chromium/src/+/80471d8d1cbf8b08eaa893832f4d735765881a02
Patch Set 1 #
Total comments: 7
Patch Set 2 : update #Patch Set 3 : update #Messages
Total messages: 31 (20 generated)
The CQ bit was checked by yoichio@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Description was changed from ========== Simplify CalcSelection BUG=708453 ========== to ========== Simplify CalcSelection This CL changes - Unify code whether selection is inside TextControl or not - Split block cursor logic. Then CalcSelection does - return FrameSelection.VSinFlat if no block cursor - if block cursor, extending selection with NextPositionOf(kGrapheme); BUG=708453 ==========
yoichio@chromium.org changed reviewers: + yosin@chromium.org
Bot failure looks not related this change.
Description was changed from ========== Simplify CalcSelection This CL changes - Unify code whether selection is inside TextControl or not - Split block cursor logic. Then CalcSelection does - return FrameSelection.VSinFlat if no block cursor - if block cursor, extending selection with NextPositionOf(kGrapheme); BUG=708453 ========== to ========== Simplify LayoutSelection::CalcSelection() This CL changes - Unify code whether selection is inside TextControl or not - Split block cursor logic. Then CalcSelection does - return FrameSelection.VSinFlat if no block cursor - if block cursor, extending selection with NextPositionOf(kGrapheme); BUG=708453 ==========
https://codereview.chromium.org/2953743002/diff/1/third_party/WebKit/Source/c... File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2953743002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:117: const bool paint_block_cursor = Could you move this expression into function? https://codereview.chromium.org/2953743002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:125: // TODO(editing-dev): We should consider BIDI. Could you explain more about this? NextPositionOf() can work bidi, it returns logical next position.
The CQ bit was checked by yoichio@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2953743002/diff/1/third_party/WebKit/Source/c... File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2953743002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:117: const bool paint_block_cursor = On 2017/06/23 03:53:50, yosin_UTC9 wrote: > Could you move this expression into function? I don't understand. This expression is used only here and enough short to understand. https://codereview.chromium.org/2953743002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:125: // TODO(editing-dev): We should consider BIDI. On 2017/06/23 03:53:50, yosin_UTC9 wrote: > Could you explain more about this? > NextPositionOf() can work bidi, it returns logical next position. Understood. This works already.
On 2017/06/23 04:27:16, yoichio wrote: > https://codereview.chromium.org/2953743002/diff/1/third_party/WebKit/Source/c... > File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): > > https://codereview.chromium.org/2953743002/diff/1/third_party/WebKit/Source/c... > third_party/WebKit/Source/core/editing/LayoutSelection.cpp:117: const bool > paint_block_cursor = > On 2017/06/23 03:53:50, yosin_UTC9 wrote: > > Could you move this expression into function? > I don't understand. This expression is used only here and > enough short to understand. Plus, |const bool paint_block_cursor| describes well and even we need not to read the expression to understand CalcSelection code.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_arm64_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_arm6...)
https://codereview.chromium.org/2953743002/diff/1/third_party/WebKit/Source/c... File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2953743002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:117: const bool paint_block_cursor = On 2017/06/23 at 04:27:15, yoichio wrote: > On 2017/06/23 03:53:50, yosin_UTC9 wrote: > > Could you move this expression into function? > I don't understand. This expression is used only here and > enough short to understand. It is noisy for reading code focusing CalcSelection(). In that time, we don't care about details of ShouldShowBlockCursor(). Multiple lines of conditional expression is good candidate of introducing function. ShouldShowBlockCursor() could be written as bool ShouldShowBlockCursor(const FrameSelection& frame_selection, const VisibleSelectionInFlatTree& visible_selection) { if (!frame_selection.ShouldShowBLockCursor()) return false; if (!visible_selection.IsCaret()) return false; return !IsLogicalEndOfLine(CreateVisiblePosition(visible_selection.Start(), visible_selection.Affinity())); } https://codereview.chromium.org/2953743002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:119: original_selection.GetSelectionType() == SelectionType::kCaretSelection && original_selection.IsCaret()
The CQ bit was checked by yoichio@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2953743002/diff/1/third_party/WebKit/Source/c... File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2953743002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:117: const bool paint_block_cursor = On 2017/06/23 04:46:11, yosin_UTC9 wrote: > On 2017/06/23 at 04:27:15, yoichio wrote: > > On 2017/06/23 03:53:50, yosin_UTC9 wrote: > > > Could you move this expression into function? > > I don't understand. This expression is used only here and > > enough short to understand. > > It is noisy for reading code focusing CalcSelection(). > In that time, we don't care about details of ShouldShowBlockCursor(). > Multiple lines of conditional expression is good candidate of introducing > function. > ShouldShowBlockCursor() could be written as > > bool ShouldShowBlockCursor(const FrameSelection& frame_selection, const > VisibleSelectionInFlatTree& visible_selection) { > if (!frame_selection.ShouldShowBLockCursor()) > return false; > if (!visible_selection.IsCaret()) > return false; > return !IsLogicalEndOfLine(CreateVisiblePosition(visible_selection.Start(), > visible_selection.Affinity())); > } > O.K. Done.
lgtm Thanks!
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_arm64_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_arm6...)
The CQ bit was checked by yoichio@chromium.org
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_arm64_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_arm6...)
The CQ bit was checked by yoichio@chromium.org
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 40001, "attempt_start_ts": 1498442019958830, "parent_rev": "4ce716d53ef2929a0515d2b12aea0b786b4024eb", "commit_rev": "80471d8d1cbf8b08eaa893832f4d735765881a02"}
Message was sent while issue was closed.
Description was changed from ========== Simplify LayoutSelection::CalcSelection() This CL changes - Unify code whether selection is inside TextControl or not - Split block cursor logic. Then CalcSelection does - return FrameSelection.VSinFlat if no block cursor - if block cursor, extending selection with NextPositionOf(kGrapheme); BUG=708453 ========== to ========== Simplify LayoutSelection::CalcSelection() This CL changes - Unify code whether selection is inside TextControl or not - Split block cursor logic. Then CalcSelection does - return FrameSelection.VSinFlat if no block cursor - if block cursor, extending selection with NextPositionOf(kGrapheme); BUG=708453 Review-Url: https://codereview.chromium.org/2953743002 Cr-Commit-Position: refs/heads/master@{#482194} Committed: https://chromium.googlesource.com/chromium/src/+/80471d8d1cbf8b08eaa893832f4d... ==========
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as https://chromium.googlesource.com/chromium/src/+/80471d8d1cbf8b08eaa893832f4d... |