|
|
Created:
3 years, 7 months ago by yoichio Modified:
3 years, 7 months ago Reviewers:
yosin_UTC9 CC:
blink-reviews, chromium-reviews Target Ref:
refs/heads/master Project:
chromium Visibility:
Public. |
DescriptionIntroduce CollectSelectedMap() in LayoutSelection::SetSelection()
This CL introduces local static CollectSelectedMap() from big LayoutSelection::SetSelection()
and shares it to create |{new,old}_selected_map|.
TEST=No change in behavior.
BUG=708453
Review-Url: https://codereview.chromium.org/2874153002
Cr-Commit-Position: refs/heads/master@{#471247}
Committed: https://chromium.googlesource.com/chromium/src/+/18e6b4998b080ffe6c303c85a3498dab8f55f622
Patch Set 1 #Patch Set 2 : update #
Total comments: 14
Patch Set 3 : update #
Total comments: 8
Patch Set 4 : updat #
Total comments: 2
Messages
Total messages: 21 (12 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...
yoichio@chromium.org changed reviewers: + yosin@chromium.org
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
PTAL
https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:141: swap(first, other.first); nit: s/swap/std::swap/ or |first = std::move(other.first)| to avoid temporary variable in |std::swap()|, it is better to use |std::moved()| https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:142: swap(second, other.second); nit: s/swap/std::swap/ second = std::move(other.second) to avoid temporary variable in |std::swap()|, it is better to use |std::moved()| https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:144: SelectedObjectMap first; nit: s/first/object_map/ or another instead of |first|. Because |first| doesn't mean anything. https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:145: SelectedBlockMap second; nit: s/second/block_map/ or another instead of |second|. Because |second| doesn't mean anything. https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:159: LayoutObject* os = selection_start; nit: s/os/runner/ or another meaning full name. https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:173: LayoutBlock* cb = os->ContainingBlock(); nit: s/cb/containing_block/ https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:247: LayoutObject* stop = LayoutObjectAfterPosition(end, end_pos); Can we make |LayoutObject* stop|?
https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:141: swap(first, other.first); On 2017/05/12 02:09:45, yosin_UTC9 wrote: > nit: s/swap/std::swap/ > or > |first = std::move(other.first)| > > to avoid temporary variable in |std::swap()|, it is better to use |std::moved()| Done. https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:142: swap(second, other.second); On 2017/05/12 02:09:45, yosin_UTC9 wrote: > nit: s/swap/std::swap/ > second = std::move(other.second) > > to avoid temporary variable in |std::swap()|, it is better to use |std::moved()| Done. https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:144: SelectedObjectMap first; On 2017/05/12 02:09:45, yosin_UTC9 wrote: > nit: s/first/object_map/ or another instead of |first|. > Because |first| doesn't mean anything. Done. https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:145: SelectedBlockMap second; On 2017/05/12 02:09:45, yosin_UTC9 wrote: > nit: s/second/block_map/ or another instead of |second|. > Because |second| doesn't mean anything. Done. https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:159: LayoutObject* os = selection_start; On 2017/05/12 02:09:45, yosin_UTC9 wrote: > nit: s/os/runner/ or another meaning full name. Done. https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:173: LayoutBlock* cb = os->ContainingBlock(); On 2017/05/12 02:09:45, yosin_UTC9 wrote: > nit: s/cb/containing_block/ Done. https://codereview.chromium.org/2874153002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:247: LayoutObject* stop = LayoutObjectAfterPosition(end, end_pos); On 2017/05/12 02:09:45, yosin_UTC9 wrote: > Can we make |LayoutObject* stop|? Done.
https://codereview.chromium.org/2874153002/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2874153002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:139: SelectedMap() {} nit: s/{}/= default/ https://codereview.chromium.org/2874153002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:144: SelectedObjectMap object_map; Please move member variable declaration before ctor's. e.g. From "Node.h" struct AttachContext { STACK_ALLOCATED(); ComputedStyle* resolved_style = nullptr; bool performing_reattach = false; bool clear_invalidation = false; AttachContext() {} }; https://codereview.chromium.org/2874153002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:157: LayoutSelection::kPaintInvalidationNewXOROld) { Since |CollectSelectedMap()| is used in two places, please avoid to use default parameter for ease of reading e.g. when we see a call site using default parameter, we may not know |CollectSelectedMap()| does XOR. https://codereview.chromium.org/2874153002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:159: LayoutObject* iter = selection_start; nit: s/iter/runner/ or s/iter/layout_object/ Blink doesn't prefer abbreviation
https://codereview.chromium.org/2874153002/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2874153002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:139: SelectedMap() {} On 2017/05/12 05:16:11, yosin_UTC9 wrote: > nit: s/{}/= default/ Done. https://codereview.chromium.org/2874153002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:144: SelectedObjectMap object_map; On 2017/05/12 05:16:11, yosin_UTC9 wrote: > Please move member variable declaration before ctor's. > > e.g. From "Node.h" > > struct AttachContext { > STACK_ALLOCATED(); > ComputedStyle* resolved_style = nullptr; > bool performing_reattach = false; > bool clear_invalidation = false; > > AttachContext() {} > }; Done. https://codereview.chromium.org/2874153002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:157: LayoutSelection::kPaintInvalidationNewXOROld) { On 2017/05/12 05:16:11, yosin_UTC9 wrote: > Since |CollectSelectedMap()| is used in two places, > please avoid to use default parameter for ease of reading > e.g. when we see a call site using default parameter, we > may not know |CollectSelectedMap()| does XOR. Done. https://codereview.chromium.org/2874153002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:159: LayoutObject* iter = selection_start; On 2017/05/12 05:16:11, yosin_UTC9 wrote: > nit: s/iter/runner/ or s/iter/layout_object/ > Blink doesn't prefer abbreviation Done.
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...
lgtm This code still have room of improvement on readability... https://codereview.chromium.org/2874153002/diff/60001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2874153002/diff/60001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:163: while (continue_exploring) { Next patch suggestion: Could you change this to use for-statement and use early-continue style? We should rewrite GetNextOrPrevLayoutObjectBasedOnDirection() to return |nullptr| where it set |continue_exploring| to false. for (LayoutObject* runner = selection_start; runner && runner != stop; runner = GetNextOrPrevLayoutObjectBasedOn(runner, stop, exploaring_backwards)) { if (...) continue; if (...) continue; while (...) ... } It seems better to introduce Iterator class to hold |continue_exploring| and |explorer_backwards|. https://codereview.chromium.org/2874153002/diff/60001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/LayoutSelection.cpp:225: for (SelectedObjectMap::iterator i = old_selected_map.object_map.begin(); I hope following patch replaces this and others to range-for.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
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": 60001, "attempt_start_ts": 1494572322833140, "parent_rev": "7795bff0b81a0cd0a8f840357545f591d0cdf6b0", "commit_rev": "18e6b4998b080ffe6c303c85a3498dab8f55f622"}
Message was sent while issue was closed.
Description was changed from ========== Introduce CollectSelectedMap() in LayoutSelection::SetSelection() This CL introduces local static CollectSelectedMap() from big LayoutSelection::SetSelection() and shares it to create |{new,old}_selected_map|. TEST=No change in behavior. BUG=708453 ========== to ========== Introduce CollectSelectedMap() in LayoutSelection::SetSelection() This CL introduces local static CollectSelectedMap() from big LayoutSelection::SetSelection() and shares it to create |{new,old}_selected_map|. TEST=No change in behavior. BUG=708453 Review-Url: https://codereview.chromium.org/2874153002 Cr-Commit-Position: refs/heads/master@{#471247} Committed: https://chromium.googlesource.com/chromium/src/+/18e6b4998b080ffe6c303c85a349... ==========
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as https://chromium.googlesource.com/chromium/src/+/18e6b4998b080ffe6c303c85a349... |