Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2894 | 2894 |
| 2895 void WebViewImpl::focusDocumentView(WebFrame* frame) | 2895 void WebViewImpl::focusDocumentView(WebFrame* frame) |
| 2896 { | 2896 { |
| 2897 // This is currently only used when replicating focus changes for | 2897 // This is currently only used when replicating focus changes for |
| 2898 // cross-process frames, and |notifyEmbedder| is disabled to avoid sending | 2898 // cross-process frames, and |notifyEmbedder| is disabled to avoid sending |
| 2899 // duplicate frameFocused updates from FocusController to the browser | 2899 // duplicate frameFocused updates from FocusController to the browser |
| 2900 // process, which already knows the latest focused frame. | 2900 // process, which already knows the latest focused frame. |
| 2901 page()->focusController().focusDocumentView(frame->toImplBase()->frame(), fa lse /* notifyEmbedder */); | 2901 page()->focusController().focusDocumentView(frame->toImplBase()->frame(), fa lse /* notifyEmbedder */); |
| 2902 } | 2902 } |
| 2903 | 2903 |
| 2904 void WebViewImpl::unfocusDocumentView(WebFrame* frame) | |
| 2905 { | |
| 2906 if (page()->focusController().focusedFrame() == frame->toImplBase()->frame() ) { | |
| 2907 page()->focusController().focusDocumentView(nullptr /* frame */, false / * notifyEmbedder */); | |
| 2908 } | |
| 2909 // TODO(avallee): else NOTREACHED() ? | |
|
lfg
2016/05/06 21:23:33
No need for this.
dcheng
2016/05/09 18:25:08
Is there ever a case where we'll legitimately call
avallee
2016/05/11 18:26:11
I don't think so, unless the browser and renderer
avallee
2016/05/11 18:26:11
Done.
dcheng
2016/05/11 18:46:58
If this can never happen, why do we need the if (.
| |
| 2910 } | |
| 2911 | |
| 2904 void WebViewImpl::setInitialFocus(bool reverse) | 2912 void WebViewImpl::setInitialFocus(bool reverse) |
| 2905 { | 2913 { |
| 2906 if (!m_page) | 2914 if (!m_page) |
| 2907 return; | 2915 return; |
| 2908 Frame* frame = page()->focusController().focusedOrMainFrame(); | 2916 Frame* frame = page()->focusController().focusedOrMainFrame(); |
| 2909 if (frame->isLocalFrame()) { | 2917 if (frame->isLocalFrame()) { |
| 2910 if (Document* document = toLocalFrame(frame)->document()) | 2918 if (Document* document = toLocalFrame(frame)->document()) |
| 2911 document->clearFocusedElement(); | 2919 document->clearFocusedElement(); |
| 2912 } | 2920 } |
| 2913 page()->focusController().setInitialFocus(reverse ? WebFocusTypeBackward : W ebFocusTypeForward); | 2921 page()->focusController().setInitialFocus(reverse ? WebFocusTypeBackward : W ebFocusTypeForward); |
| (...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4524 { | 4532 { |
| 4525 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than | 4533 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than |
| 4526 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4534 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
| 4527 if (!page()) | 4535 if (!page()) |
| 4528 return 1; | 4536 return 1; |
| 4529 | 4537 |
| 4530 return page()->deviceScaleFactor(); | 4538 return page()->deviceScaleFactor(); |
| 4531 } | 4539 } |
| 4532 | 4540 |
| 4533 } // namespace blink | 4541 } // namespace blink |
| OLD | NEW |