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

Issue 2843463006: Refactor LayoutSelection::SetSelection() (Closed)

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

Description

Refactor LayoutSelection::SetSelection() Refactor the 1 big function to several functions: CollectSelectedMap(), SetSelectionNone(), MarkSelection() and InvalidateLayoutObjects(). TEST=No change in behavior. BUG=708453

Patch Set 1 #

Total comments: 8

Patch Set 2 : update #

Total comments: 15

Patch Set 3 : update #

Total comments: 7

Patch Set 4 : update #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+129 lines, -125 lines) Patch
M third_party/WebKit/Source/core/editing/LayoutSelection.cpp View 1 2 3 5 chunks +129 lines, -125 lines 5 comments Download

Messages

Total messages: 30 (20 generated)
yoichio
MarkSelection() creates HashMap and return using std::forward_as_tuple, does this work well to avoid deep copy ...
3 years, 7 months ago (2017-04-27 07:36:49 UTC) #7
yoichio
3 years, 7 months ago (2017-04-27 07:36:54 UTC) #8
yosin_UTC9
https://codereview.chromium.org/2843463006/diff/1/third_party/WebKit/Source/core/editing/LayoutSelection.cpp File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2843463006/diff/1/third_party/WebKit/Source/core/editing/LayoutSelection.cpp#newcode183 third_party/WebKit/Source/core/editing/LayoutSelection.cpp:183: for (auto iterator : map) nit: s/auto/const auto&/ nit: ...
3 years, 7 months ago (2017-04-27 09:50:30 UTC) #9
yoichio
https://codereview.chromium.org/2843463006/diff/1/third_party/WebKit/Source/core/editing/LayoutSelection.cpp File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2843463006/diff/1/third_party/WebKit/Source/core/editing/LayoutSelection.cpp#newcode183 third_party/WebKit/Source/core/editing/LayoutSelection.cpp:183: for (auto iterator : map) On 2017/04/27 09:50:29, yosin_OOO_til_May_7 ...
3 years, 7 months ago (2017-04-28 02:16:26 UTC) #13
yosin_UTC9
https://codereview.chromium.org/2843463006/diff/40001/third_party/WebKit/Source/core/editing/LayoutSelection.cpp File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2843463006/diff/40001/third_party/WebKit/Source/core/editing/LayoutSelection.cpp#newcode134 third_party/WebKit/Source/core/editing/LayoutSelection.cpp:134: typedef HashMap<LayoutObject*, SelectionState> SelectedObjectMap; nit: better to use |using| ...
3 years, 7 months ago (2017-04-28 03:21:51 UTC) #14
yoichio
https://codereview.chromium.org/2843463006/diff/40001/third_party/WebKit/Source/core/editing/LayoutSelection.cpp File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2843463006/diff/40001/third_party/WebKit/Source/core/editing/LayoutSelection.cpp#newcode134 third_party/WebKit/Source/core/editing/LayoutSelection.cpp:134: typedef HashMap<LayoutObject*, SelectionState> SelectedObjectMap; On 2017/04/28 03:21:51, yosin_OOO_til_May_7 wrote: ...
3 years, 7 months ago (2017-04-28 08:00:34 UTC) #19
yosin_UTC9
+xiaochengh@ for second eye. https://codereview.chromium.org/2843463006/diff/60001/third_party/WebKit/Source/core/editing/LayoutSelection.cpp File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2843463006/diff/60001/third_party/WebKit/Source/core/editing/LayoutSelection.cpp#newcode180 third_party/WebKit/Source/core/editing/LayoutSelection.cpp:180: return std::make_pair(selected_objects, selected_blocks); On 2017/04/28 ...
3 years, 7 months ago (2017-04-28 09:05:07 UTC) #21
Xiaocheng
https://codereview.chromium.org/2843463006/diff/60001/third_party/WebKit/Source/core/editing/LayoutSelection.cpp File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2843463006/diff/60001/third_party/WebKit/Source/core/editing/LayoutSelection.cpp#newcode288 third_party/WebKit/Source/core/editing/LayoutSelection.cpp:288: if (!frame_selection_->GetDocument().GetLayoutView()->GetFrameView()) We shouldn't change the execution order in ...
3 years, 7 months ago (2017-04-28 22:07:44 UTC) #24
yoichio
PTAL https://codereview.chromium.org/2843463006/diff/60001/third_party/WebKit/Source/core/editing/LayoutSelection.cpp File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right): https://codereview.chromium.org/2843463006/diff/60001/third_party/WebKit/Source/core/editing/LayoutSelection.cpp#newcode180 third_party/WebKit/Source/core/editing/LayoutSelection.cpp:180: return std::make_pair(selected_objects, selected_blocks); RVO can be applied when ...
3 years, 7 months ago (2017-05-10 06:19:34 UTC) #25
yosin_UTC9
3 years, 7 months ago (2017-05-10 07:00:57 UTC) #28
https://codereview.chromium.org/2843463006/diff/80001/third_party/WebKit/Sour...
File third_party/WebKit/Source/core/editing/LayoutSelection.cpp (right):

https://codereview.chromium.org/2843463006/diff/80001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/editing/LayoutSelection.cpp:214: SelectedMap&
new_selected_map) {
s/SelectedMap&/SelectedMap*/
We use reference for output parameter.

https://codereview.chromium.org/2843463006/diff/80001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/editing/LayoutSelection.cpp:256: LayoutObject*
start,
Introducing |struct LayoutObjectWithOffset| before this patch is easier to read?

https://codereview.chromium.org/2843463006/diff/80001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/editing/LayoutSelection.cpp:301: if
(!frame_selection_->GetDocument().GetLayoutView()->GetFrameView())
Can we move this if-statement at start of function?
Since this function doesn't destroy FrameView.

https://codereview.chromium.org/2843463006/diff/80001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/editing/LayoutSelection.cpp:304:
InvalidateLayoutObjects(selection_start_, is_start_pos_changed,
It is better to pass old selection_{start,end}_pos_ instead of bool's.

https://codereview.chromium.org/2843463006/diff/80001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/editing/LayoutSelection.cpp:306:
new_selected_map);
Could you move |SelectedMap new_selected_map = CollectSelectedMap(start, end,
end_pos);|
into  InvalidateLayoutObjects()?
Since, we don't use |new_selected_map| after here.

Also, we don't need to pass |new_selected_map|.

Powered by Google App Engine
This is Rietveld 408576698