| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/input/frame_input_handler_impl.h" | 5 #include "content/renderer/input/frame_input_handler_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "content/renderer/gpu/render_widget_compositor.h" | 12 #include "content/renderer/gpu/render_widget_compositor.h" |
| 13 #include "content/renderer/ime_event_guard.h" | 13 #include "content/renderer/ime_event_guard.h" |
| 14 #include "content/renderer/input/widget_input_handler_manager.h" | 14 #include "content/renderer/input/widget_input_handler_manager.h" |
| 15 #include "content/renderer/render_thread_impl.h" | 15 #include "content/renderer/render_thread_impl.h" |
| 16 #include "content/renderer/render_view_impl.h" | 16 #include "content/renderer/render_view_impl.h" |
| 17 #include "content/renderer/render_widget.h" | 17 #include "content/renderer/render_widget.h" |
| 18 #include "third_party/WebKit/public/web/WebInputMethodController.h" | 18 #include "third_party/WebKit/public/web/WebInputMethodController.h" |
| 19 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 19 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 // Identical function in widget_input_handler_impl.cc |
| 25 blink::WebImeTextSpan::Type ConvertUiImeTextSpanTypeToBlinkType( | 25 blink::WebImeTextSpan::Type FrameConvertUiImeTextSpanTypeToBlinkType( |
| 26 ui::ImeTextSpan::Type type) { | 26 ui::ImeTextSpan::Type type) { |
| 27 switch (type) { | 27 switch (type) { |
| 28 case ui::ImeTextSpan::Type::kComposition: | 28 case ui::ImeTextSpan::Type::kComposition: |
| 29 return blink::WebImeTextSpan::Type::kComposition; | 29 return blink::WebImeTextSpan::Type::kComposition; |
| 30 case ui::ImeTextSpan::Type::kSuggestion: | 30 case ui::ImeTextSpan::Type::kSuggestion: |
| 31 return blink::WebImeTextSpan::Type::kSuggestion; | 31 return blink::WebImeTextSpan::Type::kSuggestion; |
| 32 } | 32 } |
| 33 | 33 |
| 34 NOTREACHED(); | 34 NOTREACHED(); |
| 35 return blink::WebImeTextSpan::Type::kComposition; | 35 return blink::WebImeTextSpan::Type::kComposition; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return; | 92 return; |
| 93 } | 93 } |
| 94 | 94 |
| 95 if (!render_frame_) | 95 if (!render_frame_) |
| 96 return; | 96 return; |
| 97 | 97 |
| 98 ImeEventGuard guard(render_frame_->GetRenderWidget()); | 98 ImeEventGuard guard(render_frame_->GetRenderWidget()); |
| 99 std::vector<blink::WebImeTextSpan> ime_text_spans; | 99 std::vector<blink::WebImeTextSpan> ime_text_spans; |
| 100 for (const auto& ime_text_span : ui_ime_text_spans) { | 100 for (const auto& ime_text_span : ui_ime_text_spans) { |
| 101 blink::WebImeTextSpan blink_ime_text_span( | 101 blink::WebImeTextSpan blink_ime_text_span( |
| 102 ConvertUiImeTextSpanTypeToBlinkType(ime_text_span.type), | 102 FrameConvertUiImeTextSpanTypeToBlinkType(ime_text_span.type), |
| 103 ime_text_span.start_offset, ime_text_span.end_offset, | 103 ime_text_span.start_offset, ime_text_span.end_offset, |
| 104 ime_text_span.underline_color, ime_text_span.thick, | 104 ime_text_span.underline_color, ime_text_span.thick, |
| 105 ime_text_span.background_color, | 105 ime_text_span.background_color, |
| 106 ime_text_span.suggestion_highlight_color, ime_text_span.suggestions); | 106 ime_text_span.suggestion_highlight_color, ime_text_span.suggestions); |
| 107 ime_text_spans.push_back(blink_ime_text_span); | 107 ime_text_spans.push_back(blink_ime_text_span); |
| 108 } | 108 } |
| 109 | 109 |
| 110 render_frame_->GetWebFrame()->SetCompositionFromExistingText(start, end, | 110 render_frame_->GetWebFrame()->SetCompositionFromExistingText(start, end, |
| 111 ime_text_spans); | 111 ime_text_spans); |
| 112 } | 112 } |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 break; | 452 break; |
| 453 } | 453 } |
| 454 } | 454 } |
| 455 | 455 |
| 456 FrameInputHandlerImpl::HandlingState::~HandlingState() { | 456 FrameInputHandlerImpl::HandlingState::~HandlingState() { |
| 457 render_frame_->set_handling_select_range(original_select_range_value_); | 457 render_frame_->set_handling_select_range(original_select_range_value_); |
| 458 render_frame_->set_is_pasting(original_pasting_value_); | 458 render_frame_->set_is_pasting(original_pasting_value_); |
| 459 } | 459 } |
| 460 | 460 |
| 461 } // namespace content | 461 } // namespace content |
| OLD | NEW |