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

Side by Side Diff: third_party/WebKit/Source/core/editing/Editor.cpp

Issue 2912233002: Prune ComputeVisibleSelectionInDOMTreeDeprecated from Editor::InsertLineBreak/ParagraphSeparator (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 } 1082 }
1083 } 1083 }
1084 1084
1085 return true; 1085 return true;
1086 } 1086 }
1087 1087
1088 bool Editor::InsertLineBreak() { 1088 bool Editor::InsertLineBreak() {
1089 if (!CanEdit()) 1089 if (!CanEdit())
1090 return false; 1090 return false;
1091 1091
1092 VisiblePosition caret = GetFrame() 1092 VisiblePosition caret =
1093 .Selection() 1093 GetFrame().Selection().ComputeVisibleSelectionInDOMTree().VisibleStart();
1094 .ComputeVisibleSelectionInDOMTreeDeprecated()
1095 .VisibleStart();
1096 bool align_to_edge = IsEndOfEditableOrNonEditableContent(caret); 1094 bool align_to_edge = IsEndOfEditableOrNonEditableContent(caret);
1097 DCHECK(GetFrame().GetDocument()); 1095 DCHECK(GetFrame().GetDocument());
1098 if (!TypingCommand::InsertLineBreak(*GetFrame().GetDocument())) 1096 if (!TypingCommand::InsertLineBreak(*GetFrame().GetDocument()))
1099 return false; 1097 return false;
1100 RevealSelectionAfterEditingOperation( 1098 RevealSelectionAfterEditingOperation(
1101 align_to_edge ? ScrollAlignment::kAlignToEdgeIfNeeded 1099 align_to_edge ? ScrollAlignment::kAlignToEdgeIfNeeded
1102 : ScrollAlignment::kAlignCenterIfNeeded); 1100 : ScrollAlignment::kAlignCenterIfNeeded);
1103 1101
1104 return true; 1102 return true;
1105 } 1103 }
1106 1104
1107 bool Editor::InsertParagraphSeparator() { 1105 bool Editor::InsertParagraphSeparator() {
1108 if (!CanEdit()) 1106 if (!CanEdit())
1109 return false; 1107 return false;
1110 1108
1111 if (!CanEditRichly()) 1109 if (!CanEditRichly())
1112 return InsertLineBreak(); 1110 return InsertLineBreak();
1113 1111
1114 VisiblePosition caret = GetFrame() 1112 VisiblePosition caret =
1115 .Selection() 1113 GetFrame().Selection().ComputeVisibleSelectionInDOMTree().VisibleStart();
1116 .ComputeVisibleSelectionInDOMTreeDeprecated()
1117 .VisibleStart();
1118 bool align_to_edge = IsEndOfEditableOrNonEditableContent(caret); 1114 bool align_to_edge = IsEndOfEditableOrNonEditableContent(caret);
1119 DCHECK(GetFrame().GetDocument()); 1115 DCHECK(GetFrame().GetDocument());
1120 EditingState editing_state; 1116 EditingState editing_state;
1121 if (!TypingCommand::InsertParagraphSeparator(*GetFrame().GetDocument())) 1117 if (!TypingCommand::InsertParagraphSeparator(*GetFrame().GetDocument()))
1122 return false; 1118 return false;
1123 RevealSelectionAfterEditingOperation( 1119 RevealSelectionAfterEditingOperation(
1124 align_to_edge ? ScrollAlignment::kAlignToEdgeIfNeeded 1120 align_to_edge ? ScrollAlignment::kAlignToEdgeIfNeeded
1125 : ScrollAlignment::kAlignCenterIfNeeded); 1121 : ScrollAlignment::kAlignCenterIfNeeded);
1126 1122
1127 return true; 1123 return true;
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 1843
1848 DEFINE_TRACE(Editor) { 1844 DEFINE_TRACE(Editor) {
1849 visitor->Trace(frame_); 1845 visitor->Trace(frame_);
1850 visitor->Trace(last_edit_command_); 1846 visitor->Trace(last_edit_command_);
1851 visitor->Trace(undo_stack_); 1847 visitor->Trace(undo_stack_);
1852 visitor->Trace(mark_); 1848 visitor->Trace(mark_);
1853 visitor->Trace(typing_style_); 1849 visitor->Trace(typing_style_);
1854 } 1850 }
1855 1851
1856 } // namespace blink 1852 } // namespace blink
OLDNEW
« 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