| 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_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2021 return static_cast<ui::TextInputType>(type); | 2021 return static_cast<ui::TextInputType>(type); |
| 2022 } | 2022 } |
| 2023 | 2023 |
| 2024 ui::TextInputType RenderWidget::GetTextInputType() { | 2024 ui::TextInputType RenderWidget::GetTextInputType() { |
| 2025 if (webwidget_) | 2025 if (webwidget_) |
| 2026 return WebKitToUiTextInputType(webwidget_->textInputInfo().type); | 2026 return WebKitToUiTextInputType(webwidget_->textInputInfo().type); |
| 2027 return ui::TEXT_INPUT_TYPE_NONE; | 2027 return ui::TEXT_INPUT_TYPE_NONE; |
| 2028 } | 2028 } |
| 2029 | 2029 |
| 2030 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { | 2030 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { |
| 2031 #if defined(OS_ANDROID) | |
| 2032 // TODO(yukawa): Start sending character bounds when the browser side | |
| 2033 // implementation becomes ready (crbug.com/424866). | |
| 2034 #else | |
| 2035 gfx::Range range = gfx::Range(); | 2031 gfx::Range range = gfx::Range(); |
| 2036 if (should_update_range) { | 2032 if (should_update_range) { |
| 2037 GetCompositionRange(&range); | 2033 GetCompositionRange(&range); |
| 2038 } else { | 2034 } else { |
| 2039 range = composition_range_; | 2035 range = composition_range_; |
| 2040 } | 2036 } |
| 2041 std::vector<gfx::Rect> character_bounds; | 2037 std::vector<gfx::Rect> character_bounds; |
| 2042 GetCompositionCharacterBounds(&character_bounds); | 2038 GetCompositionCharacterBounds(&character_bounds); |
| 2043 | 2039 |
| 2044 if (!ShouldUpdateCompositionInfo(range, character_bounds)) | 2040 if (!ShouldUpdateCompositionInfo(range, character_bounds)) |
| 2045 return; | 2041 return; |
| 2046 composition_character_bounds_ = character_bounds; | 2042 composition_character_bounds_ = character_bounds; |
| 2047 composition_range_ = range; | 2043 composition_range_ = range; |
| 2048 Send(new InputHostMsg_ImeCompositionRangeChanged( | 2044 Send(new InputHostMsg_ImeCompositionRangeChanged( |
| 2049 routing_id(), composition_range_, composition_character_bounds_)); | 2045 routing_id(), composition_range_, composition_character_bounds_)); |
| 2050 #endif | |
| 2051 } | 2046 } |
| 2052 | 2047 |
| 2053 void RenderWidget::GetCompositionCharacterBounds( | 2048 void RenderWidget::GetCompositionCharacterBounds( |
| 2054 std::vector<gfx::Rect>* bounds) { | 2049 std::vector<gfx::Rect>* bounds) { |
| 2055 DCHECK(bounds); | 2050 DCHECK(bounds); |
| 2056 bounds->clear(); | 2051 bounds->clear(); |
| 2057 } | 2052 } |
| 2058 | 2053 |
| 2059 void RenderWidget::GetCompositionRange(gfx::Range* range) { | 2054 void RenderWidget::GetCompositionRange(gfx::Range* range) { |
| 2060 size_t location, length; | 2055 size_t location, length; |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2367 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2373 video_hole_frames_.AddObserver(frame); | 2368 video_hole_frames_.AddObserver(frame); |
| 2374 } | 2369 } |
| 2375 | 2370 |
| 2376 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2371 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2377 video_hole_frames_.RemoveObserver(frame); | 2372 video_hole_frames_.RemoveObserver(frame); |
| 2378 } | 2373 } |
| 2379 #endif // defined(VIDEO_HOLE) | 2374 #endif // defined(VIDEO_HOLE) |
| 2380 | 2375 |
| 2381 } // namespace content | 2376 } // namespace content |
| OLD | NEW |