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

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

Issue 23717008: Remove useless null checks from Node::document() call sites (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 235
236 if (!m_frame) { 236 if (!m_frame) {
237 m_selection = s; 237 m_selection = s;
238 return; 238 return;
239 } 239 }
240 240
241 // <http://bugs.webkit.org/show_bug.cgi?id=23464>: Infinite recursion at Fra meSelection::setSelection 241 // <http://bugs.webkit.org/show_bug.cgi?id=23464>: Infinite recursion at Fra meSelection::setSelection
242 // if document->frame() == m_frame we can get into an infinite loop 242 // if document->frame() == m_frame we can get into an infinite loop
243 if (s.base().anchorNode()) { 243 if (s.base().anchorNode()) {
244 Document* document = s.base().anchorNode()->document(); 244 Document* document = s.base().anchorNode()->document();
245 if (document && document->frame() && document->frame() != m_frame && doc ument != m_frame->document()) { 245 if (document->frame() && document->frame() != m_frame && document != m_f rame->document()) {
246 RefPtr<Frame> guard = document->frame(); 246 RefPtr<Frame> guard = document->frame();
247 document->frame()->selection()->setSelection(s, options, align, gran ularity); 247 document->frame()->selection()->setSelection(s, options, align, gran ularity);
248 // It's possible that during the above set selection, this FrameSele ction has been modified by 248 // It's possible that during the above set selection, this FrameSele ction has been modified by
249 // selectFrameElementInParentIfFullySelected, but that the selection is no longer valid since 249 // selectFrameElementInParentIfFullySelected, but that the selection is no longer valid since
250 // the frame is about to be destroyed. If this is the case, clear ou r selection. 250 // the frame is about to be destroyed. If this is the case, clear ou r selection.
251 if (guard->hasOneRef() && !m_selection.isNonOrphanedCaretOrRange()) 251 if (guard->hasOneRef() && !m_selection.isNonOrphanedCaretOrRange())
252 clear(); 252 clear();
253 return; 253 return;
254 } 254 }
255 } 255 }
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 sel.showTreeForThis(); 1931 sel.showTreeForThis();
1932 } 1932 }
1933 1933
1934 void showTree(const WebCore::FrameSelection* sel) 1934 void showTree(const WebCore::FrameSelection* sel)
1935 { 1935 {
1936 if (sel) 1936 if (sel)
1937 sel->showTreeForThis(); 1937 sel->showTreeForThis();
1938 } 1938 }
1939 1939
1940 #endif 1940 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698