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

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 1934703002: Fix keyboard focus for OOPIF-<webview>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed WebViewTests/WebViewTest.SelectShowHide/1 browser_test Created 4 years, 4 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
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 2946 matching lines...) Expand 10 before | Expand all | Expand 10 after
2957 2957
2958 void WebViewImpl::focusDocumentView(WebFrame* frame) 2958 void WebViewImpl::focusDocumentView(WebFrame* frame)
2959 { 2959 {
2960 // This is currently only used when replicating focus changes for 2960 // This is currently only used when replicating focus changes for
2961 // cross-process frames, and |notifyEmbedder| is disabled to avoid sending 2961 // cross-process frames, and |notifyEmbedder| is disabled to avoid sending
2962 // duplicate frameFocused updates from FocusController to the browser 2962 // duplicate frameFocused updates from FocusController to the browser
2963 // process, which already knows the latest focused frame. 2963 // process, which already knows the latest focused frame.
2964 page()->focusController().focusDocumentView(frame->toImplBase()->frame(), fa lse /* notifyEmbedder */); 2964 page()->focusController().focusDocumentView(frame->toImplBase()->frame(), fa lse /* notifyEmbedder */);
2965 } 2965 }
2966 2966
2967 void WebViewImpl::unfocusDocumentView(WebFrame* frame)
2968 {
2969 LocalFrame* focusedFrame = page()->focusController().focusedFrame();
2970 DCHECK(!focusedFrame || focusedFrame == frame->toImplBase()->frame());
2971 page()->focusController().focusDocumentView(nullptr /* frame */, false /* no tifyEmbedder */);
2972 }
2973
2967 void WebViewImpl::setInitialFocus(bool reverse) 2974 void WebViewImpl::setInitialFocus(bool reverse)
2968 { 2975 {
2969 if (!m_page) 2976 if (!m_page)
2970 return; 2977 return;
2971 Frame* frame = page()->focusController().focusedOrMainFrame(); 2978 Frame* frame = page()->focusController().focusedOrMainFrame();
2972 if (frame->isLocalFrame()) { 2979 if (frame->isLocalFrame()) {
2973 if (Document* document = toLocalFrame(frame)->document()) 2980 if (Document* document = toLocalFrame(frame)->document())
2974 document->clearFocusedElement(); 2981 document->clearFocusedElement();
2975 } 2982 }
2976 page()->focusController().setInitialFocus(reverse ? WebFocusTypeBackward : W ebFocusTypeForward); 2983 page()->focusController().setInitialFocus(reverse ? WebFocusTypeBackward : W ebFocusTypeForward);
(...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after
4616 return nullptr; 4623 return nullptr;
4617 return focusedFrame; 4624 return focusedFrame;
4618 } 4625 }
4619 4626
4620 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const 4627 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const
4621 { 4628 {
4622 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4629 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4623 } 4630 }
4624 4631
4625 } // namespace blink 4632 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698