Commit e15ff1b5 authored by xiaochengh's avatar xiaochengh Committed by Commit bot

Prune ComputeVisibleSelectionInDOMTree from Editor::Cut/Copy/Paste

This patch prunes some call sites of the deprecated function to improve
code health. The change is safe because layout has been updated a few
lines before each call site.

BUG=698633
TEST=n/a; no behavioral change

Review-Url: https://codereview.chromium.org/2847813005
Cr-Commit-Position: refs/heads/master@{#468277}
parent 0b70e87e
...@@ -1145,7 +1145,7 @@ void Editor::Cut(EditorCommandSource source) { ...@@ -1145,7 +1145,7 @@ void Editor::Cut(EditorCommandSource source) {
GetSpellChecker().UpdateMarkersForWordsAffectedByEditing(true); GetSpellChecker().UpdateMarkersForWordsAffectedByEditing(true);
if (EnclosingTextControl(GetFrame() if (EnclosingTextControl(GetFrame()
.Selection() .Selection()
.ComputeVisibleSelectionInDOMTreeDeprecated() .ComputeVisibleSelectionInDOMTree()
.Start())) { .Start())) {
String plain_text = GetFrame().SelectedTextForClipboard(); String plain_text = GetFrame().SelectedTextForClipboard();
Pasteboard::GeneralPasteboard()->WritePlainText( Pasteboard::GeneralPasteboard()->WritePlainText(
...@@ -1183,10 +1183,8 @@ void Editor::Copy() { ...@@ -1183,10 +1183,8 @@ void Editor::Copy() {
// we need clean layout to obtain the selected content. // we need clean layout to obtain the selected content.
GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
if (EnclosingTextControl(GetFrame() if (EnclosingTextControl(
.Selection() GetFrame().Selection().ComputeVisibleSelectionInDOMTree().Start())) {
.ComputeVisibleSelectionInDOMTreeDeprecated()
.Start())) {
Pasteboard::GeneralPasteboard()->WritePlainText( Pasteboard::GeneralPasteboard()->WritePlainText(
GetFrame().SelectedTextForClipboard(), GetFrame().SelectedTextForClipboard(),
CanSmartCopyOrDelete() ? Pasteboard::kCanSmartReplace CanSmartCopyOrDelete() ? Pasteboard::kCanSmartReplace
...@@ -1214,7 +1212,7 @@ void Editor::Paste(EditorCommandSource source) { ...@@ -1214,7 +1212,7 @@ void Editor::Paste(EditorCommandSource source) {
PasteMode paste_mode = GetFrame() PasteMode paste_mode = GetFrame()
.Selection() .Selection()
.ComputeVisibleSelectionInDOMTreeDeprecated() .ComputeVisibleSelectionInDOMTree()
.IsContentRichlyEditable() .IsContentRichlyEditable()
? kAllMimeTypes ? kAllMimeTypes
: kPlainTextOnly; : kPlainTextOnly;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment