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

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

Issue 2646963002: Stop dismissing selection handles when selection is kept (Closed)
Patch Set: Created 3 years, 11 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
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 template <typename Strategy> 176 template <typename Strategy>
177 void FrameSelection::setSelectionAlgorithm( 177 void FrameSelection::setSelectionAlgorithm(
178 const VisibleSelectionTemplate<Strategy>& newSelection, 178 const VisibleSelectionTemplate<Strategy>& newSelection,
179 SetSelectionOptions options, 179 SetSelectionOptions options,
180 CursorAlignOnScroll align, 180 CursorAlignOnScroll align,
181 TextGranularity granularity) { 181 TextGranularity granularity) {
182 DCHECK(isAvailable()); 182 DCHECK(isAvailable());
183 DCHECK(newSelection.isValidFor(document())); 183 DCHECK(newSelection.isValidFor(document()));
184 const Document& currentDocument = document(); 184 const Document& currentDocument = document();
185 // TODO(editing-dev): We should rename variable |s| to another name to avoid
186 // using one letter variable name.
187 VisibleSelectionTemplate<Strategy> s = newSelection;
188
185 if (m_granularityStrategy && 189 if (m_granularityStrategy &&
186 (options & FrameSelection::DoNotClearStrategy) == 0) 190 (options & FrameSelection::DoNotClearStrategy) == 0)
187 m_granularityStrategy->Clear(); 191 m_granularityStrategy->Clear();
188 bool closeTyping = options & CloseTyping; 192 bool closeTyping = options & CloseTyping;
189 bool shouldClearTypingStyle = options & ClearTypingStyle; 193 bool shouldClearTypingStyle = options & ClearTypingStyle;
190 const HandleVisibility handleVisibility = options & HandleVisible 194 const HandleVisibility handleVisibility =
191 ? HandleVisibility::Visible 195 (options & HandleVisible || s.isHandleVisible())
yosin_UTC9 2017/01/20 07:54:07 We don't need to have |SelectionOption::HandleVisi
Changwan Ryu 2017/01/24 06:38:45 I just wanted to minimize the scope of this CL to
amaralp 2017/01/25 03:48:35 I uploaded a patch crrev.com/2647283006.
192 : HandleVisibility::NotVisible; 196 ? HandleVisibility::Visible
197 : HandleVisibility::NotVisible;
193 EUserTriggered userTriggered = selectionOptionsToUserTriggered(options); 198 EUserTriggered userTriggered = selectionOptionsToUserTriggered(options);
194
195 // TODO(editing-dev): We should rename variable |s| to another name to avoid
196 // using one letter variable name.
197 VisibleSelectionTemplate<Strategy> s = newSelection;
198 if (shouldAlwaysUseDirectionalSelection(m_frame)) 199 if (shouldAlwaysUseDirectionalSelection(m_frame))
199 s.setIsDirectional(true); 200 s.setIsDirectional(true);
200 201
201 m_granularity = granularity; 202 m_granularity = granularity;
202 203
203 // TODO(yosin): We should move to call |TypingCommand::closeTyping()| to 204 // TODO(yosin): We should move to call |TypingCommand::closeTyping()| to
204 // |Editor| class. 205 // |Editor| class.
205 if (closeTyping) 206 if (closeTyping)
206 TypingCommand::closeTyping(m_frame); 207 TypingCommand::closeTyping(m_frame);
207 208
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 } 1422 }
1422 1423
1423 void showTree(const blink::FrameSelection* sel) { 1424 void showTree(const blink::FrameSelection* sel) {
1424 if (sel) 1425 if (sel)
1425 sel->showTreeForThis(); 1426 sel->showTreeForThis();
1426 else 1427 else
1427 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; 1428 LOG(INFO) << "Cannot showTree for <null> FrameSelection.";
1428 } 1429 }
1429 1430
1430 #endif 1431 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698