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

Unified Diff: third_party/WebKit/Source/core/editing/LayoutSelection.cpp

Issue 2935253002: Remove redundant arg of LayoutSelection::CollectSelectedMap(). (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 986e97df0c2613582a2d3b8e73da0690fe6a1cc3..39c940b8c118bd147f519ad317dee8c11e496837 100644
--- a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
@@ -186,13 +186,7 @@ struct SelectedMap {
DISALLOW_COPY_AND_ASSIGN(SelectedMap);
};
-enum class CollectSelectedMapOption {
- kCollectBlock,
- kNotCollectBlock,
-};
-
-static SelectedMap CollectSelectedMap(const SelectionPaintRange& range,
- CollectSelectedMapOption option) {
+static SelectedMap CollectSelectedMap(const SelectionPaintRange& range) {
if (range.IsNull())
return SelectedMap();
@@ -205,15 +199,13 @@ static SelectedMap CollectSelectedMap(const SelectionPaintRange& range,
// Blocks are responsible for painting line gaps and margin gaps. They
// must be examined as well.
selected_map.object_map.Set(runner, runner->GetSelectionState());
- if (option == CollectSelectedMapOption::kCollectBlock) {
- LayoutBlock* containing_block = runner->ContainingBlock();
- while (containing_block && !containing_block->IsLayoutView()) {
- SelectedBlockMap::AddResult result = selected_map.block_map.insert(
- containing_block, containing_block->GetSelectionState());
- if (!result.is_new_entry)
- break;
- containing_block = containing_block->ContainingBlock();
- }
+ for (LayoutBlock* containing_block = runner->ContainingBlock();
+ containing_block && !containing_block->IsLayoutView();
+ containing_block = containing_block->ContainingBlock()) {
+ SelectedBlockMap::AddResult result = selected_map.block_map.insert(
+ containing_block, containing_block->GetSelectionState());
+ if (!result.is_new_entry)
+ break;
}
}
return selected_map;
@@ -244,8 +236,7 @@ static void SetSelectionState(const SelectionPaintRange& range) {
// comparing them in |new_range| and |old_range|.
static void UpdateLayoutObjectState(const SelectionPaintRange& new_range,
const SelectionPaintRange& old_range) {
- SelectedMap old_selected_map =
- CollectSelectedMap(old_range, CollectSelectedMapOption::kCollectBlock);
+ const SelectedMap& old_selected_map = CollectSelectedMap(old_range);
// Now clear the selection.
for (auto layout_object : old_selected_map.object_map.Keys())
@@ -258,8 +249,7 @@ static void UpdateLayoutObjectState(const SelectionPaintRange& new_range,
// TODO(editing-dev): |new_selected_map| doesn't really need to store the
// SelectionState, it's just more convenient to have it use the same data
// structure as |old_selected_map|.
- SelectedMap new_selected_map =
- CollectSelectedMap(new_range, CollectSelectedMapOption::kCollectBlock);
+ SelectedMap new_selected_map = CollectSelectedMap(new_range);
// Have any of the old selected objects changed compared to the new selection?
for (const auto& pair : old_selected_map.object_map) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698