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 27 matching lines...) Expand all Loading... |
38 #include "core/dom/Text.h" | 38 #include "core/dom/Text.h" |
39 #include "core/editing/Editor.h" | 39 #include "core/editing/Editor.h" |
40 #include "core/editing/InputMethodController.h" | 40 #include "core/editing/InputMethodController.h" |
41 #include "core/editing/RenderedPosition.h" | 41 #include "core/editing/RenderedPosition.h" |
42 #include "core/editing/SpellChecker.h" | 42 #include "core/editing/SpellChecker.h" |
43 #include "core/editing/TextIterator.h" | 43 #include "core/editing/TextIterator.h" |
44 #include "core/editing/TypingCommand.h" | 44 #include "core/editing/TypingCommand.h" |
45 #include "core/editing/VisibleUnits.h" | 45 #include "core/editing/VisibleUnits.h" |
46 #include "core/editing/htmlediting.h" | 46 #include "core/editing/htmlediting.h" |
47 #include "core/events/Event.h" | 47 #include "core/events/Event.h" |
| 48 #include "core/frame/FrameProtector.h" |
48 #include "core/frame/LocalDOMWindow.h" | 49 #include "core/frame/LocalDOMWindow.h" |
49 #include "core/frame/LocalFrame.h" | 50 #include "core/frame/LocalFrame.h" |
50 #include "core/html/HTMLBodyElement.h" | 51 #include "core/html/HTMLBodyElement.h" |
51 #include "core/html/HTMLFormElement.h" | 52 #include "core/html/HTMLFormElement.h" |
52 #include "core/html/HTMLFrameElementBase.h" | 53 #include "core/html/HTMLFrameElementBase.h" |
53 #include "core/html/HTMLInputElement.h" | 54 #include "core/html/HTMLInputElement.h" |
54 #include "core/html/HTMLSelectElement.h" | 55 #include "core/html/HTMLSelectElement.h" |
55 #include "core/page/EditorClient.h" | 56 #include "core/page/EditorClient.h" |
56 #include "core/page/EventHandler.h" | 57 #include "core/page/EventHandler.h" |
57 #include "core/page/FocusController.h" | 58 #include "core/page/FocusController.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 if (!m_frame) { | 231 if (!m_frame) { |
231 m_selection = s; | 232 m_selection = s; |
232 return; | 233 return; |
233 } | 234 } |
234 | 235 |
235 // <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 |
236 // 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 |
237 if (s.base().anchorNode()) { | 238 if (s.base().anchorNode()) { |
238 Document& document = *s.base().document(); | 239 Document& document = *s.base().document(); |
239 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()) { |
240 RefPtr<LocalFrame> guard = document.frame(); | 241 FrameProtector guard(document.frame()); |
241 document.frame()->selection().setSelection(s, options, align, granul
arity); | 242 document.frame()->selection().setSelection(s, options, align, granul
arity); |
242 // 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 |
243 // selectFrameElementInParentIfFullySelected, but that the selection
is no longer valid since | 244 // selectFrameElementInParentIfFullySelected, but that the selection
is no longer valid since |
244 // 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. |
245 if (guard->hasOneRef() && !m_selection.isNonOrphanedCaretOrRange()) | 246 if (guard.willDispose() && !m_selection.isNonOrphanedCaretOrRange()) |
246 clear(); | 247 clear(); |
247 return; | 248 return; |
248 } | 249 } |
249 } | 250 } |
250 | 251 |
251 m_granularity = granularity; | 252 m_granularity = granularity; |
252 | 253 |
253 if (closeTyping) | 254 if (closeTyping) |
254 TypingCommand::closeTyping(m_frame); | 255 TypingCommand::closeTyping(m_frame); |
255 | 256 |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 sel.showTreeForThis(); | 1929 sel.showTreeForThis(); |
1929 } | 1930 } |
1930 | 1931 |
1931 void showTree(const blink::FrameSelection* sel) | 1932 void showTree(const blink::FrameSelection* sel) |
1932 { | 1933 { |
1933 if (sel) | 1934 if (sel) |
1934 sel->showTreeForThis(); | 1935 sel->showTreeForThis(); |
1935 } | 1936 } |
1936 | 1937 |
1937 #endif | 1938 #endif |
OLD | NEW |