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

Side by Side Diff: third_party/WebKit/Source/core/page/FocusController.cpp

Issue 2153063003: Should not call FocusController::setFocusedFrame() for detached frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for comment #26 Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/Selection/selection-crash.html ('k') | no next file » | 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) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nuanti Ltd. 3 * Copyright (C) 2008 Nuanti Ltd.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 } 765 }
766 766
767 LocalFrame* newFocusedFrame = (frame && frame->isLocalFrame()) ? toLocalFram e(frame) : nullptr; 767 LocalFrame* newFocusedFrame = (frame && frame->isLocalFrame()) ? toLocalFram e(frame) : nullptr;
768 if (newFocusedFrame && newFocusedFrame->view()) { 768 if (newFocusedFrame && newFocusedFrame->view()) {
769 Document* document = newFocusedFrame->document(); 769 Document* document = newFocusedFrame->document();
770 Element* focusedElement = document ? document->focusedElement() : nullpt r; 770 Element* focusedElement = document ? document->focusedElement() : nullpt r;
771 if (focusedElement) 771 if (focusedElement)
772 dispatchFocusEvent(*document, *focusedElement); 772 dispatchFocusEvent(*document, *focusedElement);
773 } 773 }
774 774
775 // dispatchBlurEvent/dispatchFocusEvent could have changed the focused frame , or
776 // detached the frame.
777 if (newFocusedFrame && !newFocusedFrame->view())
778 return;
779
775 setFocusedFrame(frame, notifyEmbedder); 780 setFocusedFrame(frame, notifyEmbedder);
776 } 781 }
777 782
778 LocalFrame* FocusController::focusedFrame() const 783 LocalFrame* FocusController::focusedFrame() const
779 { 784 {
780 // TODO(alexmos): Strengthen this to DCHECK that whoever called this really 785 // TODO(alexmos): Strengthen this to DCHECK that whoever called this really
781 // expected a LocalFrame. Refactor call sites so that the rare cases that 786 // expected a LocalFrame. Refactor call sites so that the rare cases that
782 // need to know about focused RemoteFrames use a separate accessor (to be 787 // need to know about focused RemoteFrames use a separate accessor (to be
783 // added). 788 // added).
784 if (m_focusedFrame && m_focusedFrame->isRemoteFrame()) 789 if (m_focusedFrame && m_focusedFrame->isRemoteFrame())
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 return consumed; 1313 return consumed;
1309 } 1314 }
1310 1315
1311 DEFINE_TRACE(FocusController) 1316 DEFINE_TRACE(FocusController)
1312 { 1317 {
1313 visitor->trace(m_page); 1318 visitor->trace(m_page);
1314 visitor->trace(m_focusedFrame); 1319 visitor->trace(m_focusedFrame);
1315 } 1320 }
1316 1321
1317 } // namespace blink 1322 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/Selection/selection-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698