Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 setFocusedFrame(frame, notifyEmbedder); | 775 if (newFocusedFrame && newFocusedFrame->selection().isAvailable()) |
| 776 setFocusedFrame(frame, notifyEmbedder); | |
|
yosin_UTC9
2016/07/19 01:44:46
I think we should check |LocalFrame::selection().i
kochi
2016/07/20 08:05:27
The original test case fails after dispatching eve
| |
| 776 } | 777 } |
| 777 | 778 |
| 778 LocalFrame* FocusController::focusedFrame() const | 779 LocalFrame* FocusController::focusedFrame() const |
| 779 { | 780 { |
| 780 // TODO(alexmos): Strengthen this to DCHECK that whoever called this really | 781 // TODO(alexmos): Strengthen this to DCHECK that whoever called this really |
| 781 // expected a LocalFrame. Refactor call sites so that the rare cases that | 782 // 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 | 783 // need to know about focused RemoteFrames use a separate accessor (to be |
| 783 // added). | 784 // added). |
| 784 if (m_focusedFrame && m_focusedFrame->isRemoteFrame()) | 785 if (m_focusedFrame && m_focusedFrame->isRemoteFrame()) |
| 785 return nullptr; | 786 return nullptr; |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1308 return consumed; | 1309 return consumed; |
| 1309 } | 1310 } |
| 1310 | 1311 |
| 1311 DEFINE_TRACE(FocusController) | 1312 DEFINE_TRACE(FocusController) |
| 1312 { | 1313 { |
| 1313 visitor->trace(m_page); | 1314 visitor->trace(m_page); |
| 1314 visitor->trace(m_focusedFrame); | 1315 visitor->trace(m_focusedFrame); |
| 1315 } | 1316 } |
| 1316 | 1317 |
| 1317 } // namespace blink | 1318 } // namespace blink |
| OLD | NEW |