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

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: Rebase ToT Created 4 years, 6 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 2885 matching lines...) Expand 10 before | Expand all | Expand 10 after
2896 2896
2897 void WebViewImpl::focusDocumentView(WebFrame* frame) 2897 void WebViewImpl::focusDocumentView(WebFrame* frame)
2898 { 2898 {
2899 // This is currently only used when replicating focus changes for 2899 // This is currently only used when replicating focus changes for
2900 // cross-process frames, and |notifyEmbedder| is disabled to avoid sending 2900 // cross-process frames, and |notifyEmbedder| is disabled to avoid sending
2901 // duplicate frameFocused updates from FocusController to the browser 2901 // duplicate frameFocused updates from FocusController to the browser
2902 // process, which already knows the latest focused frame. 2902 // process, which already knows the latest focused frame.
2903 page()->focusController().focusDocumentView(frame->toImplBase()->frame(), fa lse /* notifyEmbedder */); 2903 page()->focusController().focusDocumentView(frame->toImplBase()->frame(), fa lse /* notifyEmbedder */);
2904 } 2904 }
2905 2905
2906 void WebViewImpl::unfocusDocumentView(WebFrame* frame)
2907 {
2908 LocalFrame* focusedFrame = page()->focusController().focusedFrame();
2909 DCHECK(!focusedFrame || focusedFrame == frame->toImplBase()->frame());
2910 page()->focusController().focusDocumentView(nullptr /* frame */, false /* no tifyEmbedder */);
2911 }
2912
2906 void WebViewImpl::setInitialFocus(bool reverse) 2913 void WebViewImpl::setInitialFocus(bool reverse)
2907 { 2914 {
2908 if (!m_page) 2915 if (!m_page)
2909 return; 2916 return;
2910 Frame* frame = page()->focusController().focusedOrMainFrame(); 2917 Frame* frame = page()->focusController().focusedOrMainFrame();
2911 if (frame->isLocalFrame()) { 2918 if (frame->isLocalFrame()) {
2912 if (Document* document = toLocalFrame(frame)->document()) 2919 if (Document* document = toLocalFrame(frame)->document())
2913 document->clearFocusedElement(); 2920 document->clearFocusedElement();
2914 } 2921 }
2915 page()->focusController().setInitialFocus(reverse ? WebFocusTypeBackward : W ebFocusTypeForward); 2922 page()->focusController().setInitialFocus(reverse ? WebFocusTypeBackward : W ebFocusTypeForward);
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after
4553 { 4560 {
4554 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than 4561 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than
4555 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. 4562 // page's scale factor, which can be 1 in use-zoom-for-dsf mode.
4556 if (!page()) 4563 if (!page())
4557 return 1; 4564 return 1;
4558 4565
4559 return page()->deviceScaleFactor(); 4566 return page()->deviceScaleFactor();
4560 } 4567 }
4561 4568
4562 } // namespace blink 4569 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698