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

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.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: Change plumbing a bit: use focusDocumentView on WebView and remove clearFocus from WebLocalFrame 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2768 matching lines...) Expand 10 before | Expand all | Expand 10 after
2779 // Clears the focused frame if any. 2779 // Clears the focused frame if any.
2780 Frame* focusedFrame = focusedCoreFrame(); 2780 Frame* focusedFrame = focusedCoreFrame();
2781 if (focusedFrame && focusedFrame->isLocalFrame()) 2781 if (focusedFrame && focusedFrame->isLocalFrame())
2782 toLocalFrame(focusedFrame)->selection().setFocused(false); 2782 toLocalFrame(focusedFrame)->selection().setFocused(false);
2783 return; 2783 return;
2784 } 2784 }
2785 LocalFrame* coreFrame = toWebLocalFrameImpl(frame)->frame(); 2785 LocalFrame* coreFrame = toWebLocalFrameImpl(frame)->frame();
2786 coreFrame->page()->focusController().setFocusedFrame(coreFrame); 2786 coreFrame->page()->focusController().setFocusedFrame(coreFrame);
2787 } 2787 }
2788 2788
2789 void WebViewImpl::focusDocumentView(WebFrame* frame)
2790 {
2791 page()->focusController().focusDocumentView(toCoreFrame(frame));
2792 }
2793
2789 void WebViewImpl::setInitialFocus(bool reverse) 2794 void WebViewImpl::setInitialFocus(bool reverse)
2790 { 2795 {
2791 if (!m_page) 2796 if (!m_page)
2792 return; 2797 return;
2793 Frame* frame = page()->focusController().focusedOrMainFrame(); 2798 Frame* frame = page()->focusController().focusedOrMainFrame();
2794 if (frame->isLocalFrame()) { 2799 if (frame->isLocalFrame()) {
2795 if (Document* document = toLocalFrame(frame)->document()) 2800 if (Document* document = toLocalFrame(frame)->document())
2796 document->setFocusedElement(nullptr); 2801 document->setFocusedElement(nullptr);
2797 } 2802 }
2798 page()->focusController().setInitialFocus(reverse ? WebFocusTypeBackward : W ebFocusTypeForward); 2803 page()->focusController().setInitialFocus(reverse ? WebFocusTypeBackward : W ebFocusTypeForward);
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
4433 if (m_pageColorOverlay) 4438 if (m_pageColorOverlay)
4434 m_pageColorOverlay->update(); 4439 m_pageColorOverlay->update();
4435 if (InspectorOverlay* overlay = inspectorOverlay()) { 4440 if (InspectorOverlay* overlay = inspectorOverlay()) {
4436 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); 4441 PageOverlay* inspectorPageOverlay = overlay->pageOverlay();
4437 if (inspectorPageOverlay) 4442 if (inspectorPageOverlay)
4438 inspectorPageOverlay->update(); 4443 inspectorPageOverlay->update();
4439 } 4444 }
4440 } 4445 }
4441 4446
4442 } // namespace blink 4447 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698