Index: third_party/WebKit/Source/core/editing/LayoutSelection.cpp |
diff --git a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp |
index 18d0e963d0a9c0c2d80541816017da63886c492c..e2a51edfbb253adb701458218185833a125c95a6 100644 |
--- a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp |
+++ b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp |
@@ -210,11 +210,6 @@ void LayoutSelection::SetSelection( |
DCHECK(frame_selection_->GetDocument().GetLayoutView()->GetFrameView()); |
- // Record the old selected objects. These will be used later when we compare |
- // against the new selected objects. |
- int old_start_pos = selection_start_pos_; |
- int old_end_pos = selection_end_pos_; |
- |
SelectedMap old_selected_map = |
CollectSelectedMap(selection_start_, selection_end_, selection_end_pos_, |
block_paint_invalidation_mode); |
@@ -223,12 +218,6 @@ void LayoutSelection::SetSelection( |
for (auto layout_object : old_selected_map.object_map.Keys()) |
layout_object->SetSelectionStateIfNeeded(SelectionNone); |
- // set selection start and end |
- selection_start_ = start; |
- selection_start_pos_ = start_pos; |
- selection_end_ = end; |
- selection_end_pos_ = end_pos; |
- |
// Update the selection status of all objects between m_selectionStart and |
// m_selectionEnd |
if (start && start == end) { |
@@ -263,8 +252,8 @@ void LayoutSelection::SetSelection( |
SelectionState new_selection_state = obj->GetSelectionState(); |
SelectionState old_selection_state = pair.value; |
if (new_selection_state != old_selection_state || |
- (selection_start_ == obj && old_start_pos != selection_start_pos_) || |
- (selection_end_ == obj && old_end_pos != selection_end_pos_)) { |
+ (start == obj && start_pos != selection_start_pos_) || |
+ (end == obj && end_pos != selection_end_pos_)) { |
obj->SetShouldInvalidateSelection(); |
new_selected_map.object_map.erase(obj); |
} |
@@ -290,6 +279,12 @@ void LayoutSelection::SetSelection( |
// they need to be updated. |
for (auto layout_object : new_selected_map.block_map.Keys()) |
layout_object->SetShouldInvalidateSelection(); |
+ |
+ // set selection start and end |
+ selection_start_ = start; |
+ selection_start_pos_ = start_pos; |
+ selection_end_ = end; |
+ selection_end_pos_ = end_pos; |
} |
std::pair<int, int> LayoutSelection::SelectionStartEnd() { |