diff options
author | dgozman <dgozman@chromium.org> | 2016-03-22 14:33:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-22 21:35:23 +0000 |
commit | c2ec05d98bce21ef672e6775e6f682d41f945f4e (patch) | |
tree | 860bb5126b4461f9f7a4d8fb0b3b5d34a6b378d7 /content/renderer/render_view_impl.cc | |
parent | 1e6a2bc451904125ced0e829f030056b8e2bd8e2 (diff) | |
download | chromium_src-c2ec05d98bce21ef672e6775e6f682d41f945f4e.zip chromium_src-c2ec05d98bce21ef672e6775e6f682d41f945f4e.tar.gz chromium_src-c2ec05d98bce21ef672e6775e6f682d41f945f4e.tar.bz2 |
Revert of Remove a bunch of NPAPI quirks and related support code (patchset #1 id:80001 of https://codereview.chromium.org/1813143002/ )
Reason for revert:
Speculative revert: could have broken Win8 GN build. See crbug.com/597032
Original issue's description:
> Remove a bunch of NPAPI quirks and related support code
>
> BUG=493212
> CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation
>
> Committed: https://crrev.com/f8396023a9e38d3ec249cdf1f730e4b79cebbc7e
> Cr-Commit-Position: refs/heads/master@{#382642}
TBR=dcheng@chromium.org,jam@chromium.org,piman@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=493212
Review URL: https://codereview.chromium.org/1825253002
Cr-Commit-Position: refs/heads/master@{#382684}
Diffstat (limited to 'content/renderer/render_view_impl.cc')
-rw-r--r-- | content/renderer/render_view_impl.cc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index a88549a..e5052e8 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -638,6 +638,9 @@ RenderViewImpl::RenderViewImpl(CompositorDependencies* compositor_deps, #if defined(OS_ANDROID) expected_content_intent_id_(0), #endif +#if defined(OS_WIN) + focused_plugin_id_(-1), +#endif #if defined(ENABLE_PLUGINS) focused_pepper_plugin_(NULL), pepper_last_mouse_event_target_(NULL), @@ -1207,6 +1210,15 @@ void RenderViewImpl::UnregisterPluginDelegate( plugin_delegates_.erase(delegate); } +#if defined(OS_WIN) +void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) { + if (focused) + focused_plugin_id_ = plugin_id; + else + focused_plugin_id_ = -1; +} +#endif + #if defined(OS_MACOSX) void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) { Send(new ViewHostMsg_PluginFocusChanged(GetRoutingID(), focused, plugin_id)); @@ -2914,6 +2926,32 @@ void RenderViewImpl::OnImeSetComposition( text, underlines, selection_start, selection_end); return; } + +#if defined(OS_WIN) + // When a plugin has focus, we create platform-specific IME data used by + // our IME emulator and send it directly to the focused plugin, i.e. we + // bypass WebKit. (WebPluginDelegate dispatches this IME data only when its + // instance ID is the same one as the specified ID.) + if (focused_plugin_id_ >= 0) { + std::vector<int> clauses; + std::vector<int> target; + for (size_t i = 0; i < underlines.size(); ++i) { + clauses.push_back(underlines[i].startOffset); + clauses.push_back(underlines[i].endOffset); + if (underlines[i].thick) { + target.clear(); + target.push_back(underlines[i].startOffset); + target.push_back(underlines[i].endOffset); + } + } + std::set<WebPluginDelegateProxy*>::iterator it; + for (it = plugin_delegates_.begin(); it != plugin_delegates_.end(); ++it) { + (*it)->ImeCompositionUpdated(text, clauses, target, selection_end, + focused_plugin_id_); + } + return; + } +#endif // OS_WIN #endif // ENABLE_PLUGINS if (replacement_range.IsValid() && webview()) { // Select the text in |replacement_range|, it will then be replaced by @@ -2942,6 +2980,20 @@ void RenderViewImpl::OnImeConfirmComposition( text, replacement_range, keep_selection); return; } +#if defined(OS_WIN) + // Same as OnImeSetComposition(), we send the text from IMEs directly to + // plugins. When we send IME text directly to plugins, we should not send + // it to WebKit to prevent WebKit from controlling IMEs. + // TODO(thakis): Honor |replacement_range| for plugins? + if (focused_plugin_id_ >= 0) { + std::set<WebPluginDelegateProxy*>::iterator it; + for (it = plugin_delegates_.begin(); + it != plugin_delegates_.end(); ++it) { + (*it)->ImeCompositionCompleted(text, focused_plugin_id_); + } + return; + } +#endif // OS_WIN #endif // ENABLE_PLUGINS if (replacement_range.IsValid() && webview()) { // Select the text in |replacement_range|, it will then be replaced by |