| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 if (!m_frame) { | 231 if (!m_frame) { |
| 232 m_selection = s; | 232 m_selection = s; |
| 233 return; | 233 return; |
| 234 } | 234 } |
| 235 | 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<LocalFrame> guard = document.frame(); | 241 RefPtrWillBeRawPtr<LocalFrame> 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. |
| 246 if (guard->hasOneRef() && !m_selection.isNonOrphanedCaretOrRange()) | 246 if (guard->hasBeenClosed() && !m_selection.isNonOrphanedCaretOrRange
()) |
| 247 clear(); | 247 clear(); |
| 248 return; | 248 return; |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 | 251 |
| 252 m_granularity = granularity; | 252 m_granularity = granularity; |
| 253 | 253 |
| 254 if (closeTyping) | 254 if (closeTyping) |
| 255 TypingCommand::closeTyping(m_frame); | 255 TypingCommand::closeTyping(m_frame); |
| 256 | 256 |
| (...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1892 | 1892 |
| 1893 void FrameSelection::showTreeForThis() const | 1893 void FrameSelection::showTreeForThis() const |
| 1894 { | 1894 { |
| 1895 m_selection.showTreeForThis(); | 1895 m_selection.showTreeForThis(); |
| 1896 } | 1896 } |
| 1897 | 1897 |
| 1898 #endif | 1898 #endif |
| 1899 | 1899 |
| 1900 void FrameSelection::trace(Visitor* visitor) | 1900 void FrameSelection::trace(Visitor* visitor) |
| 1901 { | 1901 { |
| 1902 visitor->trace(m_frame); |
| 1902 visitor->trace(m_selection); | 1903 visitor->trace(m_selection); |
| 1903 visitor->trace(m_originalBase); | 1904 visitor->trace(m_originalBase); |
| 1904 visitor->trace(m_logicalRange); | 1905 visitor->trace(m_logicalRange); |
| 1905 visitor->trace(m_previousCaretNode); | 1906 visitor->trace(m_previousCaretNode); |
| 1906 visitor->trace(m_typingStyle); | 1907 visitor->trace(m_typingStyle); |
| 1907 VisibleSelection::ChangeObserver::trace(visitor); | 1908 VisibleSelection::ChangeObserver::trace(visitor); |
| 1908 } | 1909 } |
| 1909 | 1910 |
| 1910 void FrameSelection::setCaretRectNeedsUpdate() | 1911 void FrameSelection::setCaretRectNeedsUpdate() |
| 1911 { | 1912 { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1931 sel.showTreeForThis(); | 1932 sel.showTreeForThis(); |
| 1932 } | 1933 } |
| 1933 | 1934 |
| 1934 void showTree(const blink::FrameSelection* sel) | 1935 void showTree(const blink::FrameSelection* sel) |
| 1935 { | 1936 { |
| 1936 if (sel) | 1937 if (sel) |
| 1937 sel->showTreeForThis(); | 1938 sel->showTreeForThis(); |
| 1938 } | 1939 } |
| 1939 | 1940 |
| 1940 #endif | 1941 #endif |
| OLD | NEW |