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

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

Issue 1423053002: Make document.activeElement work with OOPIF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@focus-preserve-page-focus-on-subframe-navigations
Patch Set: Created 5 years, 1 month 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
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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 825
826 RefPtrWillBeRawPtr<Document> newDocument = nullptr; 826 RefPtrWillBeRawPtr<Document> newDocument = nullptr;
827 if (element) 827 if (element)
828 newDocument = &element->document(); 828 newDocument = &element->document();
829 else if (newFocusedFrame && newFocusedFrame->isLocalFrame()) 829 else if (newFocusedFrame && newFocusedFrame->isLocalFrame())
830 newDocument = toLocalFrame(newFocusedFrame.get())->document(); 830 newDocument = toLocalFrame(newFocusedFrame.get())->document();
831 831
832 if (newDocument && oldDocument == newDocument && newDocument->focusedElement () == element) 832 if (newDocument && oldDocument == newDocument && newDocument->focusedElement () == element)
833 return true; 833 return true;
834 834
835 clearSelectionIfNeeded(oldFocusedFrame.get(), toLocalFrame(newFocusedFrame.g et()), element); 835 if (newFocusedFrame && newFocusedFrame->isLocalFrame())
836 clearSelectionIfNeeded(oldFocusedFrame.get(), toLocalFrame(newFocusedFra me.get()), element);
836 837
837 if (oldDocument && oldDocument != newDocument) 838 if (oldDocument && oldDocument != newDocument)
838 oldDocument->setFocusedElement(nullptr); 839 oldDocument->setFocusedElement(nullptr);
839 840
840 if (newFocusedFrame && !newFocusedFrame->page()) { 841 if (newFocusedFrame && !newFocusedFrame->page()) {
841 setFocusedFrame(nullptr); 842 setFocusedFrame(nullptr);
842 return false; 843 return false;
843 } 844 }
844 setFocusedFrame(newFocusedFrame); 845 setFocusedFrame(newFocusedFrame);
845 846
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 return consumed; 1061 return consumed;
1061 } 1062 }
1062 1063
1063 DEFINE_TRACE(FocusController) 1064 DEFINE_TRACE(FocusController)
1064 { 1065 {
1065 visitor->trace(m_page); 1066 visitor->trace(m_page);
1066 visitor->trace(m_focusedFrame); 1067 visitor->trace(m_focusedFrame);
1067 } 1068 }
1068 1069
1069 } // namespace blink 1070 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698