Chromium Code Reviews| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 if (!m_frame) { | 230 if (!m_frame) { |
| 231 m_selection = s; | 231 m_selection = s; |
| 232 return; | 232 return; |
| 233 } | 233 } |
| 234 | 234 |
| 235 // <http://bugs.webkit.org/show_bug.cgi?id=23464>: Infinite recursion at Fra meSelection::setSelection | 235 // <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 | 236 // if document->frame() == m_frame we can get into an infinite loop |
| 237 if (s.base().anchorNode()) { | 237 if (s.base().anchorNode()) { |
| 238 Document& document = *s.base().document(); | 238 Document& document = *s.base().document(); |
| 239 if (document.frame() && document.frame() != m_frame && document != m_fra me->document()) { | 239 if (document.frame() && document.frame() != m_frame && document != m_fra me->document()) { |
| 240 RefPtr<LocalFrame> guard = document.frame(); | 240 RefPtrWillBeRawPtr<LocalFrame> guard(document.frame()); |
| 241 document.frame()->selection().setSelection(s, options, align, granul arity); | 241 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 | 242 // 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 | 243 // 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. | 244 // the frame is about to be destroyed. If this is the case, clear ou r selection. |
| 245 #if ENABLE(OILPAN) | |
| 246 if (guard->hasBeenClosed() && !m_selection.isNonOrphanedCaretOrRange ()) | |
| 247 #else | |
| 245 if (guard->hasOneRef() && !m_selection.isNonOrphanedCaretOrRange()) | 248 if (guard->hasOneRef() && !m_selection.isNonOrphanedCaretOrRange()) |
|
haraken
2014/09/08 07:25:57
Would it be possible to use guard->hasBeenClosed()
sof
2014/09/11 13:27:05
Overloooked previously; now done.
| |
| 249 #endif | |
| 246 clear(); | 250 clear(); |
| 247 return; | 251 return; |
| 248 } | 252 } |
| 249 } | 253 } |
| 250 | 254 |
| 251 m_granularity = granularity; | 255 m_granularity = granularity; |
| 252 | 256 |
| 253 if (closeTyping) | 257 if (closeTyping) |
| 254 TypingCommand::closeTyping(m_frame); | 258 TypingCommand::closeTyping(m_frame); |
| 255 | 259 |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1167 m_granularity = CharacterGranularity; | 1171 m_granularity = CharacterGranularity; |
| 1168 setSelection(VisibleSelection()); | 1172 setSelection(VisibleSelection()); |
| 1169 } | 1173 } |
| 1170 | 1174 |
| 1171 void FrameSelection::prepareForDestruction() | 1175 void FrameSelection::prepareForDestruction() |
| 1172 { | 1176 { |
| 1173 m_granularity = CharacterGranularity; | 1177 m_granularity = CharacterGranularity; |
| 1174 | 1178 |
| 1175 m_caretBlinkTimer.stop(); | 1179 m_caretBlinkTimer.stop(); |
| 1176 | 1180 |
| 1177 RenderView* view = m_frame->contentRenderer(); | 1181 if (FrameView* view = m_frame->view()) |
| 1178 if (view) | 1182 view->clear(); |
|
haraken
2014/09/08 07:25:57
What is this change for?
sof
2014/09/08 21:17:45
It does not belong here; reverted.
| |
| 1179 view->clearSelection(); | |
| 1180 | 1183 |
| 1181 setSelection(VisibleSelection(), CloseTyping | ClearTypingStyle | DoNotUpdat eAppearance); | 1184 setSelection(VisibleSelection(), CloseTyping | ClearTypingStyle | DoNotUpdat eAppearance); |
| 1182 m_previousCaretNode.clear(); | 1185 m_previousCaretNode.clear(); |
| 1183 } | 1186 } |
| 1184 | 1187 |
| 1185 void FrameSelection::setStart(const VisiblePosition &pos, EUserTriggered trigger ) | 1188 void FrameSelection::setStart(const VisiblePosition &pos, EUserTriggered trigger ) |
| 1186 { | 1189 { |
| 1187 if (m_selection.isBaseFirst()) | 1190 if (m_selection.isBaseFirst()) |
| 1188 setBase(pos, trigger); | 1191 setBase(pos, trigger); |
| 1189 else | 1192 else |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1891 | 1894 |
| 1892 void FrameSelection::showTreeForThis() const | 1895 void FrameSelection::showTreeForThis() const |
| 1893 { | 1896 { |
| 1894 m_selection.showTreeForThis(); | 1897 m_selection.showTreeForThis(); |
| 1895 } | 1898 } |
| 1896 | 1899 |
| 1897 #endif | 1900 #endif |
| 1898 | 1901 |
| 1899 void FrameSelection::trace(Visitor* visitor) | 1902 void FrameSelection::trace(Visitor* visitor) |
| 1900 { | 1903 { |
| 1904 visitor->trace(m_frame); | |
| 1901 visitor->trace(m_selection); | 1905 visitor->trace(m_selection); |
| 1902 visitor->trace(m_originalBase); | 1906 visitor->trace(m_originalBase); |
| 1903 visitor->trace(m_logicalRange); | 1907 visitor->trace(m_logicalRange); |
| 1904 visitor->trace(m_previousCaretNode); | 1908 visitor->trace(m_previousCaretNode); |
| 1905 visitor->trace(m_typingStyle); | 1909 visitor->trace(m_typingStyle); |
| 1906 VisibleSelection::ChangeObserver::trace(visitor); | 1910 VisibleSelection::ChangeObserver::trace(visitor); |
| 1907 } | 1911 } |
| 1908 | 1912 |
| 1909 void FrameSelection::setCaretRectNeedsUpdate() | 1913 void FrameSelection::setCaretRectNeedsUpdate() |
| 1910 { | 1914 { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1930 sel.showTreeForThis(); | 1934 sel.showTreeForThis(); |
| 1931 } | 1935 } |
| 1932 | 1936 |
| 1933 void showTree(const blink::FrameSelection* sel) | 1937 void showTree(const blink::FrameSelection* sel) |
| 1934 { | 1938 { |
| 1935 if (sel) | 1939 if (sel) |
| 1936 sel->showTreeForThis(); | 1940 sel->showTreeForThis(); |
| 1937 } | 1941 } |
| 1938 | 1942 |
| 1939 #endif | 1943 #endif |
| OLD | NEW |