| 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 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 2889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2900 (*i)->SetContentAreaFocus(enable); | 2900 (*i)->SetContentAreaFocus(enable); |
| 2901 #endif | 2901 #endif |
| 2902 // Notify all BrowserPlugins of the RenderView's focus state. | 2902 // Notify all BrowserPlugins of the RenderView's focus state. |
| 2903 if (BrowserPluginManager::Get()) | 2903 if (BrowserPluginManager::Get()) |
| 2904 BrowserPluginManager::Get()->UpdateFocusState(); | 2904 BrowserPluginManager::Get()->UpdateFocusState(); |
| 2905 } | 2905 } |
| 2906 | 2906 |
| 2907 void RenderViewImpl::OnImeSetComposition( | 2907 void RenderViewImpl::OnImeSetComposition( |
| 2908 const base::string16& text, | 2908 const base::string16& text, |
| 2909 const std::vector<blink::WebCompositionUnderline>& underlines, | 2909 const std::vector<blink::WebCompositionUnderline>& underlines, |
| 2910 const gfx::Range& replacement_range, |
| 2910 int selection_start, | 2911 int selection_start, |
| 2911 int selection_end) { | 2912 int selection_end) { |
| 2912 #if defined(ENABLE_PLUGINS) | 2913 #if defined(ENABLE_PLUGINS) |
| 2913 if (focused_pepper_plugin_) { | 2914 if (focused_pepper_plugin_) { |
| 2914 focused_pepper_plugin_->render_frame()->OnImeSetComposition( | 2915 focused_pepper_plugin_->render_frame()->OnImeSetComposition( |
| 2915 text, underlines, selection_start, selection_end); | 2916 text, underlines, selection_start, selection_end); |
| 2916 return; | 2917 return; |
| 2917 } | 2918 } |
| 2918 | 2919 |
| 2919 #if defined(OS_WIN) | 2920 #if defined(OS_WIN) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2935 } | 2936 } |
| 2936 std::set<WebPluginDelegateProxy*>::iterator it; | 2937 std::set<WebPluginDelegateProxy*>::iterator it; |
| 2937 for (it = plugin_delegates_.begin(); it != plugin_delegates_.end(); ++it) { | 2938 for (it = plugin_delegates_.begin(); it != plugin_delegates_.end(); ++it) { |
| 2938 (*it)->ImeCompositionUpdated(text, clauses, target, selection_end, | 2939 (*it)->ImeCompositionUpdated(text, clauses, target, selection_end, |
| 2939 focused_plugin_id_); | 2940 focused_plugin_id_); |
| 2940 } | 2941 } |
| 2941 return; | 2942 return; |
| 2942 } | 2943 } |
| 2943 #endif // OS_WIN | 2944 #endif // OS_WIN |
| 2944 #endif // ENABLE_PLUGINS | 2945 #endif // ENABLE_PLUGINS |
| 2946 if (replacement_range.IsValid() && webview()) { |
| 2947 // Select the text in |replacement_range|, it will then be replaced by |
| 2948 // text added by the call to RenderWidget::OnImeSetComposition(). |
| 2949 if (WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame()) { |
| 2950 WebRange webrange = WebRange::fromDocumentRange( |
| 2951 frame, replacement_range.start(), replacement_range.length()); |
| 2952 if (!webrange.isNull()) |
| 2953 frame->selectRange(webrange); |
| 2954 } |
| 2955 } |
| 2945 RenderWidget::OnImeSetComposition(text, | 2956 RenderWidget::OnImeSetComposition(text, |
| 2946 underlines, | 2957 underlines, |
| 2958 replacement_range, |
| 2947 selection_start, | 2959 selection_start, |
| 2948 selection_end); | 2960 selection_end); |
| 2949 } | 2961 } |
| 2950 | 2962 |
| 2951 void RenderViewImpl::OnImeConfirmComposition( | 2963 void RenderViewImpl::OnImeConfirmComposition( |
| 2952 const base::string16& text, | 2964 const base::string16& text, |
| 2953 const gfx::Range& replacement_range, | 2965 const gfx::Range& replacement_range, |
| 2954 bool keep_selection) { | 2966 bool keep_selection) { |
| 2955 #if defined(ENABLE_PLUGINS) | 2967 #if defined(ENABLE_PLUGINS) |
| 2956 if (focused_pepper_plugin_) { | 2968 if (focused_pepper_plugin_) { |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3489 if (IsUseZoomForDSFEnabled()) { | 3501 if (IsUseZoomForDSFEnabled()) { |
| 3490 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3502 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
| 3491 } else { | 3503 } else { |
| 3492 webview()->setDeviceScaleFactor(device_scale_factor_); | 3504 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3493 } | 3505 } |
| 3494 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3506 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3495 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3507 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 3496 } | 3508 } |
| 3497 | 3509 |
| 3498 } // namespace content | 3510 } // namespace content |
| OLD | NEW |