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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 template <typename Strategy> | 177 template <typename Strategy> |
178 void FrameSelection::setSelectionAlgorithm( | 178 void FrameSelection::setSelectionAlgorithm( |
179 const VisibleSelectionTemplate<Strategy>& newSelection, | 179 const VisibleSelectionTemplate<Strategy>& newSelection, |
180 SetSelectionOptions options, | 180 SetSelectionOptions options, |
181 CursorAlignOnScroll align, | 181 CursorAlignOnScroll align, |
182 TextGranularity granularity) { | 182 TextGranularity granularity) { |
183 DCHECK(isAvailable()); | 183 DCHECK(isAvailable()); |
184 DCHECK(newSelection.isValidFor(document())); | 184 DCHECK(newSelection.isValidFor(document())); |
185 const Document& currentDocument = document(); | 185 const Document& currentDocument = document(); |
| 186 // TODO(editing-dev): We should rename variable |s| to another name to avoid |
| 187 // using one letter variable name. |
| 188 VisibleSelectionTemplate<Strategy> s = newSelection; |
| 189 |
186 if (m_granularityStrategy && | 190 if (m_granularityStrategy && |
187 (options & FrameSelection::DoNotClearStrategy) == 0) | 191 (options & FrameSelection::DoNotClearStrategy) == 0) |
188 m_granularityStrategy->Clear(); | 192 m_granularityStrategy->Clear(); |
189 bool closeTyping = options & CloseTyping; | 193 bool closeTyping = options & CloseTyping; |
190 bool shouldClearTypingStyle = options & ClearTypingStyle; | 194 bool shouldClearTypingStyle = options & ClearTypingStyle; |
191 const HandleVisibility handleVisibility = options & HandleVisible | 195 const HandleVisibility handleVisibility = |
192 ? HandleVisibility::Visible | 196 (options & HandleVisible || s.isHandleVisible()) |
193 : HandleVisibility::NotVisible; | 197 ? HandleVisibility::Visible |
| 198 : HandleVisibility::NotVisible; |
194 EUserTriggered userTriggered = selectionOptionsToUserTriggered(options); | 199 EUserTriggered userTriggered = selectionOptionsToUserTriggered(options); |
195 | |
196 // TODO(editing-dev): We should rename variable |s| to another name to avoid | |
197 // using one letter variable name. | |
198 VisibleSelectionTemplate<Strategy> s = newSelection; | |
199 if (shouldAlwaysUseDirectionalSelection(m_frame)) | 200 if (shouldAlwaysUseDirectionalSelection(m_frame)) |
200 s.setIsDirectional(true); | 201 s.setIsDirectional(true); |
201 | 202 |
202 m_granularity = granularity; | 203 m_granularity = granularity; |
203 | 204 |
204 // TODO(yosin): We should move to call |TypingCommand::closeTyping()| to | 205 // TODO(yosin): We should move to call |TypingCommand::closeTyping()| to |
205 // |Editor| class. | 206 // |Editor| class. |
206 if (closeTyping) | 207 if (closeTyping) |
207 TypingCommand::closeTyping(m_frame); | 208 TypingCommand::closeTyping(m_frame); |
208 | 209 |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 } | 1427 } |
1427 | 1428 |
1428 void showTree(const blink::FrameSelection* sel) { | 1429 void showTree(const blink::FrameSelection* sel) { |
1429 if (sel) | 1430 if (sel) |
1430 sel->showTreeForThis(); | 1431 sel->showTreeForThis(); |
1431 else | 1432 else |
1432 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; | 1433 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; |
1433 } | 1434 } |
1434 | 1435 |
1435 #endif | 1436 #endif |
OLD | NEW |