| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 2842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2853 RenderWidget::OnImeSetComposition(text, | 2853 RenderWidget::OnImeSetComposition(text, |
| 2854 underlines, | 2854 underlines, |
| 2855 replacement_range, | 2855 replacement_range, |
| 2856 selection_start, | 2856 selection_start, |
| 2857 selection_end); | 2857 selection_end); |
| 2858 } | 2858 } |
| 2859 | 2859 |
| 2860 void RenderViewImpl::OnImeConfirmComposition( | 2860 void RenderViewImpl::OnImeConfirmComposition( |
| 2861 const base::string16& text, | 2861 const base::string16& text, |
| 2862 const gfx::Range& replacement_range, | 2862 const gfx::Range& replacement_range, |
| 2863 bool keep_selection) { | 2863 bool keep_selection, |
| 2864 int newCursorPosition) { |
| 2864 #if defined(ENABLE_PLUGINS) | 2865 #if defined(ENABLE_PLUGINS) |
| 2865 PepperPluginInstanceImpl* focused_pepper_plugin = GetFocusedPepperPlugin(); | 2866 PepperPluginInstanceImpl* focused_pepper_plugin = GetFocusedPepperPlugin(); |
| 2866 if (focused_pepper_plugin) { | 2867 if (focused_pepper_plugin) { |
| 2867 focused_pepper_plugin->render_frame()->OnImeConfirmComposition( | 2868 focused_pepper_plugin->render_frame()->OnImeConfirmComposition( |
| 2868 text, replacement_range, keep_selection); | 2869 text, replacement_range, keep_selection, newCursorPosition); |
| 2869 return; | 2870 return; |
| 2870 } | 2871 } |
| 2871 #endif // ENABLE_PLUGINS | 2872 #endif // ENABLE_PLUGINS |
| 2872 if (replacement_range.IsValid() && webview()) { | 2873 if (replacement_range.IsValid() && webview()) { |
| 2873 // Select the text in |replacement_range|, it will then be replaced by | 2874 // Select the text in |replacement_range|, it will then be replaced by |
| 2874 // text added by the call to RenderWidget::OnImeConfirmComposition(). | 2875 // text added by the call to RenderWidget::OnImeConfirmComposition(). |
| 2875 if (WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame()) { | 2876 if (WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame()) { |
| 2876 WebRange webrange = WebRange::fromDocumentRange( | 2877 WebRange webrange = WebRange::fromDocumentRange( |
| 2877 frame, replacement_range.start(), replacement_range.length()); | 2878 frame, replacement_range.start(), replacement_range.length()); |
| 2878 if (!webrange.isNull()) | 2879 if (!webrange.isNull()) |
| 2879 frame->selectRange(webrange); | 2880 frame->selectRange(webrange); |
| 2880 } | 2881 } |
| 2881 } | 2882 } |
| 2882 RenderWidget::OnImeConfirmComposition(text, | 2883 RenderWidget::OnImeConfirmComposition(text, |
| 2883 replacement_range, | 2884 replacement_range, |
| 2884 keep_selection); | 2885 keep_selection, |
| 2886 newCursorPosition); |
| 2885 } | 2887 } |
| 2886 | 2888 |
| 2887 void RenderViewImpl::RenderWidgetDidSetColorProfile( | 2889 void RenderViewImpl::RenderWidgetDidSetColorProfile( |
| 2888 const std::vector<char>& profile) { | 2890 const std::vector<char>& profile) { |
| 2889 if (webview()) { | 2891 if (webview()) { |
| 2890 bool was_reset = (profile.size() == 1 && profile[0] == '0'); | 2892 bool was_reset = (profile.size() == 1 && profile[0] == '0'); |
| 2891 | 2893 |
| 2892 if (was_reset) { | 2894 if (was_reset) { |
| 2893 webview()->resetDeviceColorProfileForTesting(); | 2895 webview()->resetDeviceColorProfileForTesting(); |
| 2894 } else { | 2896 } else { |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3385 return render_frame->focused_pepper_plugin(); | 3387 return render_frame->focused_pepper_plugin(); |
| 3386 } | 3388 } |
| 3387 frame = frame->traverseNext(false); | 3389 frame = frame->traverseNext(false); |
| 3388 } | 3390 } |
| 3389 | 3391 |
| 3390 return nullptr; | 3392 return nullptr; |
| 3391 } | 3393 } |
| 3392 #endif | 3394 #endif |
| 3393 | 3395 |
| 3394 } // namespace content | 3396 } // namespace content |
| OLD | NEW |