Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1129 .SetBaseAndExtentDeprecated(base_position.DeepEquivalent(), | 1129 .SetBaseAndExtentDeprecated(base_position.DeepEquivalent(), |
| 1130 extent_position.DeepEquivalent()) | 1130 extent_position.DeepEquivalent()) |
| 1131 .SetAffinity(base_position.Affinity()) | 1131 .SetAffinity(base_position.Affinity()) |
| 1132 .SetGranularity(granularity) | 1132 .SetGranularity(granularity) |
| 1133 .SetIsHandleVisible(IsHandleVisible()) | 1133 .SetIsHandleVisible(IsHandleVisible()) |
| 1134 .Build(); | 1134 .Build(); |
| 1135 | 1135 |
| 1136 if (new_selection.IsNone()) | 1136 if (new_selection.IsNone()) |
| 1137 return; | 1137 return; |
| 1138 | 1138 |
| 1139 SetSelection(new_selection, kCloseTyping | kClearTypingStyle, | 1139 const VisibleSelection visible_selection = |
| 1140 CreateVisibleSelection(new_selection); | |
| 1141 if (visible_selection.IsNone()) { | |
| 1142 SetSelection(new_selection, kCloseTyping | kClearTypingStyle, | |
|
yoichio
2017/07/05 06:56:40
Why don't you set selection even VS is none?
yosin_UTC9
2017/07/05 07:14:16
Good catch!
We don't need to set selection if expa
| |
| 1143 CursorAlignOnScroll::kIfNeeded, granularity); | |
| 1144 return; | |
| 1145 } | |
| 1146 | |
| 1147 SelectionInDOMTree::Builder builder; | |
| 1148 if (visible_selection.IsBaseFirst()) { | |
| 1149 builder.SetBaseAndExtent(visible_selection.Start(), | |
| 1150 visible_selection.End()); | |
| 1151 } else { | |
| 1152 builder.SetBaseAndExtent(visible_selection.End(), | |
| 1153 visible_selection.Start()); | |
| 1154 } | |
| 1155 builder.SetAffinity(visible_selection.Affinity()); | |
| 1156 builder.SetIsHandleVisible(IsHandleVisible()); | |
| 1157 SetSelection(builder.Build(), kCloseTyping | kClearTypingStyle, | |
| 1140 CursorAlignOnScroll::kIfNeeded, granularity); | 1158 CursorAlignOnScroll::kIfNeeded, granularity); |
| 1141 } | 1159 } |
| 1142 | 1160 |
| 1143 void FrameSelection::SetCaretVisible(bool caret_is_visible) { | 1161 void FrameSelection::SetCaretVisible(bool caret_is_visible) { |
| 1144 frame_caret_->SetCaretVisibility(caret_is_visible ? CaretVisibility::kVisible | 1162 frame_caret_->SetCaretVisibility(caret_is_visible ? CaretVisibility::kVisible |
| 1145 : CaretVisibility::kHidden); | 1163 : CaretVisibility::kHidden); |
| 1146 } | 1164 } |
| 1147 | 1165 |
| 1148 void FrameSelection::SetCaretBlinkingSuspended(bool suspended) { | 1166 void FrameSelection::SetCaretBlinkingSuspended(bool suspended) { |
| 1149 frame_caret_->SetCaretBlinkingSuspended(suspended); | 1167 frame_caret_->SetCaretBlinkingSuspended(suspended); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1182 } | 1200 } |
| 1183 | 1201 |
| 1184 void showTree(const blink::FrameSelection* sel) { | 1202 void showTree(const blink::FrameSelection* sel) { |
| 1185 if (sel) | 1203 if (sel) |
| 1186 sel->ShowTreeForThis(); | 1204 sel->ShowTreeForThis(); |
| 1187 else | 1205 else |
| 1188 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; | 1206 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; |
| 1189 } | 1207 } |
| 1190 | 1208 |
| 1191 #endif | 1209 #endif |
| OLD | NEW |