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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 776 DCHECK(!frame || frame->page() == m_page); | 776 DCHECK(!frame || frame->page() == m_page); |
| 777 if (m_focusedFrame == frame) | 777 if (m_focusedFrame == frame) |
| 778 return; | 778 return; |
| 779 | 779 |
| 780 LocalFrame* focusedFrame = (m_focusedFrame && m_focusedFrame->isLocalFrame()) | 780 LocalFrame* focusedFrame = (m_focusedFrame && m_focusedFrame->isLocalFrame()) |
| 781 ? toLocalFrame(m_focusedFrame.get()) | 781 ? toLocalFrame(m_focusedFrame.get()) |
| 782 : nullptr; | 782 : nullptr; |
| 783 if (focusedFrame && focusedFrame->view()) { | 783 if (focusedFrame && focusedFrame->view()) { |
| 784 Document* document = focusedFrame->document(); | 784 Document* document = focusedFrame->document(); |
| 785 Element* focusedElement = document ? document->focusedElement() : nullptr; | 785 Element* focusedElement = document ? document->focusedElement() : nullptr; |
| 786 if (focusedElement) | 786 if (focusedElement) { |
| 787 dispatchBlurEvent(*document, *focusedElement); | 787 bool focusedFrameIsAncestor = false; |
|
alexmos
2017/03/16 17:37:11
I think this is really newFocusedFrameIsDescendant
| |
| 788 for (Frame* newFrame = frame; newFrame; | |
| 789 newFrame = newFrame->client()->parent()) { | |
|
alexmos
2017/03/10 07:08:33
Why do we need to walk up the ancestor chain? Is
avallee
2017/03/13 19:18:10
I'm not sure how exiting a frame works. In the top
alexmos
2017/03/16 17:37:11
I was really confused here and what this has to do
alexmos
2017/03/16 17:59:47
I'll also note that at some point, when replicatin
| |
| 790 if (newFrame == m_focusedFrame.get()) { | |
| 791 focusedFrameIsAncestor = true; | |
| 792 break; | |
| 793 } | |
| 794 } | |
| 795 if (focusedFrameIsAncestor) | |
|
alexmos
2017/03/10 07:08:33
What about the reverse case, where an <input> that
avallee
2017/03/13 19:18:10
This was doing the wrong thing when the browser no
alexmos
2017/03/16 17:37:11
I'm not sure I followed your explanation, but I th
| |
| 796 document->clearFocusedElement(); | |
|
alexmos
2017/03/10 07:08:33
Will |frame| always be a RemoteFrame when this is
avallee
2017/03/13 19:18:10
I think the issue would only happen with remote fr
alexmos
2017/03/16 17:37:11
See the big comment above regarding this.
| |
| 797 else | |
| 798 dispatchBlurEvent(*document, *focusedElement); | |
|
alexmos
2017/03/10 07:08:33
Just to check, does clearFocusedElement also dispa
avallee
2017/03/13 19:18:10
Yes, it calls setFocusedElement(nullptr, /*some ot
alexmos
2017/03/16 17:37:11
Acknowledged.
| |
| 799 } | |
| 788 } | 800 } |
| 789 | 801 |
| 790 LocalFrame* newFocusedFrame = | 802 LocalFrame* newFocusedFrame = |
| 791 (frame && frame->isLocalFrame()) ? toLocalFrame(frame) : nullptr; | 803 (frame && frame->isLocalFrame()) ? toLocalFrame(frame) : nullptr; |
| 792 if (newFocusedFrame && newFocusedFrame->view()) { | 804 if (newFocusedFrame && newFocusedFrame->view()) { |
| 793 Document* document = newFocusedFrame->document(); | 805 Document* document = newFocusedFrame->document(); |
| 794 Element* focusedElement = document ? document->focusedElement() : nullptr; | 806 Element* focusedElement = document ? document->focusedElement() : nullptr; |
| 795 if (focusedElement) | 807 if (focusedElement) |
| 796 dispatchFocusEvent(*document, *focusedElement); | 808 dispatchFocusEvent(*document, *focusedElement); |
| 797 } | 809 } |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1415 it->focusedFrameChanged(); | 1427 it->focusedFrameChanged(); |
| 1416 } | 1428 } |
| 1417 | 1429 |
| 1418 DEFINE_TRACE(FocusController) { | 1430 DEFINE_TRACE(FocusController) { |
| 1419 visitor->trace(m_page); | 1431 visitor->trace(m_page); |
| 1420 visitor->trace(m_focusedFrame); | 1432 visitor->trace(m_focusedFrame); |
| 1421 visitor->trace(m_focusChangedObservers); | 1433 visitor->trace(m_focusChangedObservers); |
| 1422 } | 1434 } |
| 1423 | 1435 |
| 1424 } // namespace blink | 1436 } // namespace blink |
| OLD | NEW |