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

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

Issue 105483003: Editing - Code refactoring to avoid redundant function calls (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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 | « Source/core/editing/ApplyBlockElementCommand.cpp ('k') | 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) 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 setSelection(newSelection, granularity); 218 setSelection(newSelection, granularity);
219 } 219 }
220 220
221 void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelec tionOptions options, CursorAlignOnScroll align, TextGranularity granularity) 221 void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelec tionOptions options, CursorAlignOnScroll align, TextGranularity granularity)
222 { 222 {
223 bool closeTyping = options & CloseTyping; 223 bool closeTyping = options & CloseTyping;
224 bool shouldClearTypingStyle = options & ClearTypingStyle; 224 bool shouldClearTypingStyle = options & ClearTypingStyle;
225 EUserTriggered userTriggered = selectionOptionsToUserTriggered(options); 225 EUserTriggered userTriggered = selectionOptionsToUserTriggered(options);
226 226
227 VisibleSelection s = newSelection; 227 VisibleSelection s = newSelection;
228 if (shouldAlwaysUseDirectionalSelection(m_frame))
229 s.setIsDirectional(true);
230
231 if (!m_frame) { 228 if (!m_frame) {
232 m_selection = s; 229 m_selection = s;
233 return; 230 return;
234 } 231 }
235 232
233 if (shouldAlwaysUseDirectionalSelection(m_frame))
ojan 2013/12/09 23:09:57 Doesn't moving this change behavior since it affec
234 s.setIsDirectional(true);
235
236 // <http://bugs.webkit.org/show_bug.cgi?id=23464>: Infinite recursion at Fra meSelection::setSelection 236 // <http://bugs.webkit.org/show_bug.cgi?id=23464>: Infinite recursion at Fra meSelection::setSelection
237 // if document->frame() == m_frame we can get into an infinite loop 237 // if document->frame() == m_frame we can get into an infinite loop
238 if (s.base().anchorNode()) { 238 if (s.base().anchorNode()) {
239 Document& document = *s.base().document(); 239 Document& document = *s.base().document();
240 if (document.frame() && document.frame() != m_frame && document != m_fra me->document()) { 240 if (document.frame() && document.frame() != m_frame && document != m_fra me->document()) {
241 RefPtr<Frame> guard = document.frame(); 241 RefPtr<Frame> guard = document.frame();
242 document.frame()->selection().setSelection(s, options, align, granul arity); 242 document.frame()->selection().setSelection(s, options, align, granul arity);
243 // It's possible that during the above set selection, this FrameSele ction has been modified by 243 // It's possible that during the above set selection, this FrameSele ction has been modified by
244 // selectFrameElementInParentIfFullySelected, but that the selection is no longer valid since 244 // selectFrameElementInParentIfFullySelected, but that the selection is no longer valid since
245 // the frame is about to be destroyed. If this is the case, clear ou r selection. 245 // the frame is about to be destroyed. If this is the case, clear ou r selection.
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 sel.showTreeForThis(); 1855 sel.showTreeForThis();
1856 } 1856 }
1857 1857
1858 void showTree(const WebCore::FrameSelection* sel) 1858 void showTree(const WebCore::FrameSelection* sel)
1859 { 1859 {
1860 if (sel) 1860 if (sel)
1861 sel->showTreeForThis(); 1861 sel->showTreeForThis();
1862 } 1862 }
1863 1863
1864 #endif 1864 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/ApplyBlockElementCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698