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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Loading... | |
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 |
OLD | NEW |