| Index: third_party/WebKit/Source/core/editing/SelectionEditor.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/SelectionEditor.cpp b/third_party/WebKit/Source/core/editing/SelectionEditor.cpp
|
| index 4f3e990c05ddbcf6000daecd9eb15164a07658af..fdf7cea3a9d9a492eb7d2e2d47b17408efdf6e86 100644
|
| --- a/third_party/WebKit/Source/core/editing/SelectionEditor.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/SelectionEditor.cpp
|
| @@ -277,8 +277,6 @@ void SelectionEditor::DidUpdateCharacterData(CharacterData* node,
|
| DidFinishTextChange(new_base, new_extent);
|
| }
|
|
|
| -// TODO(yosin): We should introduce |Position(const Text&, int)| to avoid
|
| -// |const_cast<Text*>|.
|
| static Position UpdatePostionAfterAdoptingTextNodesMerged(
|
| const Position& position,
|
| const Text& merged_node,
|
| @@ -292,21 +290,21 @@ static Position UpdatePostionAfterAdoptingTextNodesMerged(
|
| return position;
|
| case PositionAnchorType::kBeforeAnchor:
|
| if (anchor_node == node_to_be_removed)
|
| - return Position(const_cast<Text*>(&merged_node), merged_node.length());
|
| + return Position(merged_node, merged_node.length());
|
| return position;
|
| case PositionAnchorType::kAfterAnchor:
|
| if (anchor_node == node_to_be_removed)
|
| - return Position(const_cast<Text*>(&merged_node), merged_node.length());
|
| + return Position(merged_node, merged_node.length());
|
| if (anchor_node == merged_node)
|
| - return Position(const_cast<Text*>(&merged_node), old_length);
|
| + return Position(merged_node, old_length);
|
| return position;
|
| case PositionAnchorType::kOffsetInAnchor: {
|
| const int offset = position.OffsetInContainerNode();
|
| if (anchor_node == node_to_be_removed)
|
| - return Position(const_cast<Text*>(&merged_node), old_length + offset);
|
| + return Position(merged_node, old_length + offset);
|
| if (anchor_node == node_to_be_removed.parentNode() &&
|
| offset == node_to_be_removed_with_index.Index()) {
|
| - return Position(const_cast<Text*>(&merged_node), old_length);
|
| + return Position(merged_node, old_length);
|
| }
|
| return position;
|
| }
|
|
|