Chromium Code Reviews| 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 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2009 return static_cast<ui::TextInputType>(type); | 2009 return static_cast<ui::TextInputType>(type); |
| 2010 } | 2010 } |
| 2011 | 2011 |
| 2012 ui::TextInputType RenderWidget::GetTextInputType() { | 2012 ui::TextInputType RenderWidget::GetTextInputType() { |
| 2013 if (webwidget_) | 2013 if (webwidget_) |
| 2014 return WebKitToUiTextInputType(webwidget_->textInputInfo().type); | 2014 return WebKitToUiTextInputType(webwidget_->textInputInfo().type); |
| 2015 return ui::TEXT_INPUT_TYPE_NONE; | 2015 return ui::TEXT_INPUT_TYPE_NONE; |
| 2016 } | 2016 } |
| 2017 | 2017 |
| 2018 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { | 2018 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { |
| 2019 #if defined(OS_ANDROID) | |
| 2020 // TODO(yukawa): Start sending character bounds when the browser side | |
| 2021 // implementation becomes ready (crbug.com/424866). | |
| 2022 #else | |
| 2023 gfx::Range range = gfx::Range(); | 2019 gfx::Range range = gfx::Range(); |
|
jdduke (slow)
2015/01/20 21:17:33
We still need guards here, don't we? For < L, or w
| |
| 2024 if (should_update_range) { | 2020 if (should_update_range) { |
| 2025 GetCompositionRange(&range); | 2021 GetCompositionRange(&range); |
| 2026 } else { | 2022 } else { |
| 2027 range = composition_range_; | 2023 range = composition_range_; |
| 2028 } | 2024 } |
| 2029 std::vector<gfx::Rect> character_bounds; | 2025 std::vector<gfx::Rect> character_bounds; |
| 2030 GetCompositionCharacterBounds(&character_bounds); | 2026 GetCompositionCharacterBounds(&character_bounds); |
| 2031 | 2027 |
| 2032 if (!ShouldUpdateCompositionInfo(range, character_bounds)) | 2028 if (!ShouldUpdateCompositionInfo(range, character_bounds)) |
| 2033 return; | 2029 return; |
| 2034 composition_character_bounds_ = character_bounds; | 2030 composition_character_bounds_ = character_bounds; |
| 2035 composition_range_ = range; | 2031 composition_range_ = range; |
| 2036 Send(new InputHostMsg_ImeCompositionRangeChanged( | 2032 Send(new InputHostMsg_ImeCompositionRangeChanged( |
| 2037 routing_id(), composition_range_, composition_character_bounds_)); | 2033 routing_id(), composition_range_, composition_character_bounds_)); |
| 2038 #endif | |
| 2039 } | 2034 } |
| 2040 | 2035 |
| 2041 void RenderWidget::GetCompositionCharacterBounds( | 2036 void RenderWidget::GetCompositionCharacterBounds( |
| 2042 std::vector<gfx::Rect>* bounds) { | 2037 std::vector<gfx::Rect>* bounds) { |
| 2043 DCHECK(bounds); | 2038 DCHECK(bounds); |
| 2044 bounds->clear(); | 2039 bounds->clear(); |
| 2045 } | 2040 } |
| 2046 | 2041 |
| 2047 void RenderWidget::GetCompositionRange(gfx::Range* range) { | 2042 void RenderWidget::GetCompositionRange(gfx::Range* range) { |
| 2048 size_t location, length; | 2043 size_t location, length; |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2354 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2349 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2355 video_hole_frames_.AddObserver(frame); | 2350 video_hole_frames_.AddObserver(frame); |
| 2356 } | 2351 } |
| 2357 | 2352 |
| 2358 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2353 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2359 video_hole_frames_.RemoveObserver(frame); | 2354 video_hole_frames_.RemoveObserver(frame); |
| 2360 } | 2355 } |
| 2361 #endif // defined(VIDEO_HOLE) | 2356 #endif // defined(VIDEO_HOLE) |
| 2362 | 2357 |
| 2363 } // namespace content | 2358 } // namespace content |
| OLD | NEW |