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

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

Issue 2972863003: Introduce CreateVisibleSelectionWithGranularity() (Closed)
Patch Set: 2017-07-06T16:26:15 Created 3 years, 5 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 | third_party/WebKit/Source/core/editing/SelectionController.cpp » ('j') | 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) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 // two |IntPoint| instead of two |VisiblePosition| like 1121 // two |IntPoint| instead of two |VisiblePosition| like
1122 // |moveRangeSelectionExtent()|. 1122 // |moveRangeSelectionExtent()|.
1123 void FrameSelection::MoveRangeSelection(const VisiblePosition& base_position, 1123 void FrameSelection::MoveRangeSelection(const VisiblePosition& base_position,
1124 const VisiblePosition& extent_position, 1124 const VisiblePosition& extent_position,
1125 TextGranularity granularity) { 1125 TextGranularity granularity) {
1126 SelectionInDOMTree new_selection = 1126 SelectionInDOMTree new_selection =
1127 SelectionInDOMTree::Builder() 1127 SelectionInDOMTree::Builder()
1128 .SetBaseAndExtentDeprecated(base_position.DeepEquivalent(), 1128 .SetBaseAndExtentDeprecated(base_position.DeepEquivalent(),
1129 extent_position.DeepEquivalent()) 1129 extent_position.DeepEquivalent())
1130 .SetAffinity(base_position.Affinity()) 1130 .SetAffinity(base_position.Affinity())
1131 .SetGranularity(granularity)
1132 .SetIsHandleVisible(IsHandleVisible()) 1131 .SetIsHandleVisible(IsHandleVisible())
1133 .Build(); 1132 .Build();
1134 1133
1135 if (new_selection.IsNone()) 1134 if (new_selection.IsNone())
1136 return; 1135 return;
1137 1136
1138 const VisibleSelection visible_selection = 1137 const VisibleSelection& visible_selection =
1139 CreateVisibleSelection(new_selection); 1138 CreateVisibleSelectionWithGranularity(new_selection, granularity);
1140 if (visible_selection.IsNone()) 1139 if (visible_selection.IsNone())
1141 return; 1140 return;
1142 1141
1143 SelectionInDOMTree::Builder builder; 1142 SelectionInDOMTree::Builder builder;
1144 if (visible_selection.IsBaseFirst()) { 1143 if (visible_selection.IsBaseFirst()) {
1145 builder.SetBaseAndExtent(visible_selection.Start(), 1144 builder.SetBaseAndExtent(visible_selection.Start(),
1146 visible_selection.End()); 1145 visible_selection.End());
1147 } else { 1146 } else {
1148 builder.SetBaseAndExtent(visible_selection.End(), 1147 builder.SetBaseAndExtent(visible_selection.End(),
1149 visible_selection.Start()); 1148 visible_selection.Start());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 } 1195 }
1197 1196
1198 void showTree(const blink::FrameSelection* sel) { 1197 void showTree(const blink::FrameSelection* sel) {
1199 if (sel) 1198 if (sel)
1200 sel->ShowTreeForThis(); 1199 sel->ShowTreeForThis();
1201 else 1200 else
1202 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; 1201 LOG(INFO) << "Cannot showTree for <null> FrameSelection.";
1203 } 1202 }
1204 1203
1205 #endif 1204 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/SelectionController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698