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/browser/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 774 if (!content_view_core_) | 774 if (!content_view_core_) |
| 775 return; | 775 return; |
| 776 | 776 |
| 777 content_view_core_->UpdateImeAdapter( | 777 content_view_core_->UpdateImeAdapter( |
| 778 GetNativeImeAdapter(), static_cast<int>(state.type), state.flags, | 778 GetNativeImeAdapter(), static_cast<int>(state.type), state.flags, |
| 779 state.mode, state.value, state.selection_start, state.selection_end, | 779 state.mode, state.value, state.selection_start, state.selection_end, |
| 780 state.composition_start, state.composition_end, state.show_ime_if_needed, | 780 state.composition_start, state.composition_end, state.show_ime_if_needed, |
| 781 state.is_non_ime_change); | 781 state.is_non_ime_change); |
| 782 } | 782 } |
| 783 | 783 |
| 784 void RenderWidgetHostViewAndroid::OnImeCompositionRangeChanged( | |
| 785 TextInputManager* text_input_manager, | |
| 786 RenderWidgetHostViewBase* updated_view) { | |
| 787 DCHECK_EQ(text_input_manager_, text_input_manager); | |
| 788 const TextInputManager::CompositionRangeInfo* info = | |
| 789 text_input_manager_->GetCompositionRangeInfo(); | |
| 790 if (!info) | |
| 791 return; | |
| 792 | |
| 793 std::vector<gfx::RectF> character_bounds_float; | |
|
Charlie Reis
2017/01/06 22:22:39
nit: character_bounds
EhsanK
2017/01/06 22:37:16
Acknowledged.
| |
| 794 for (const gfx::Rect& rect : info->character_bounds) { | |
|
Charlie Reis
2017/01/06 22:22:40
nit: No braces needed.
EhsanK
2017/01/06 22:37:16
Acknowledged.
| |
| 795 character_bounds_float.emplace_back(rect); | |
| 796 } | |
| 797 ime_adapter_android_.SetCharacterBounds(character_bounds_float); | |
| 798 } | |
| 799 | |
| 784 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) { | 800 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) { |
| 785 if (cached_background_color_ == color) | 801 if (cached_background_color_ == color) |
| 786 return; | 802 return; |
| 787 | 803 |
| 788 cached_background_color_ = color; | 804 cached_background_color_ = color; |
| 789 | 805 |
| 790 if (delegated_frame_host_) | 806 if (delegated_frame_host_) |
| 791 delegated_frame_host_->UpdateBackgroundColor(color); | 807 delegated_frame_host_->UpdateBackgroundColor(color); |
| 792 | 808 |
| 793 if (content_view_core_) | 809 if (content_view_core_) |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 901 | 917 |
| 902 void RenderWidgetHostViewAndroid::SetMultiTouchZoomSupportEnabled( | 918 void RenderWidgetHostViewAndroid::SetMultiTouchZoomSupportEnabled( |
| 903 bool enabled) { | 919 bool enabled) { |
| 904 gesture_provider_.SetMultiTouchZoomSupportEnabled(enabled); | 920 gesture_provider_.SetMultiTouchZoomSupportEnabled(enabled); |
| 905 } | 921 } |
| 906 | 922 |
| 907 void RenderWidgetHostViewAndroid::ImeCancelComposition() { | 923 void RenderWidgetHostViewAndroid::ImeCancelComposition() { |
| 908 ime_adapter_android_.CancelComposition(); | 924 ime_adapter_android_.CancelComposition(); |
| 909 } | 925 } |
| 910 | 926 |
| 911 void RenderWidgetHostViewAndroid::ImeCompositionRangeChanged( | |
| 912 const gfx::Range& range, | |
| 913 const std::vector<gfx::Rect>& character_bounds) { | |
| 914 std::vector<gfx::RectF> character_bounds_float; | |
| 915 for (const gfx::Rect& rect : character_bounds) { | |
| 916 character_bounds_float.emplace_back(rect); | |
| 917 } | |
| 918 ime_adapter_android_.SetCharacterBounds(character_bounds_float); | |
| 919 } | |
| 920 | 927 |
| 921 void RenderWidgetHostViewAndroid::FocusedNodeChanged( | 928 void RenderWidgetHostViewAndroid::FocusedNodeChanged( |
| 922 bool is_editable_node, | 929 bool is_editable_node, |
| 923 const gfx::Rect& node_bounds_in_screen) { | 930 const gfx::Rect& node_bounds_in_screen) { |
| 924 ime_adapter_android_.FocusedNodeChanged(is_editable_node); | 931 ime_adapter_android_.FocusedNodeChanged(is_editable_node); |
| 925 } | 932 } |
| 926 | 933 |
| 927 void RenderWidgetHostViewAndroid::RenderProcessGone( | 934 void RenderWidgetHostViewAndroid::RenderProcessGone( |
| 928 base::TerminationStatus status, int error_code) { | 935 base::TerminationStatus status, int error_code) { |
| 929 Destroy(); | 936 Destroy(); |
| (...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2072 if (!compositor) | 2079 if (!compositor) |
| 2073 return; | 2080 return; |
| 2074 | 2081 |
| 2075 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2082 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2076 overscroll_refresh_handler, compositor, | 2083 overscroll_refresh_handler, compositor, |
| 2077 ui::GetScaleFactorForNativeView(GetNativeView())); | 2084 ui::GetScaleFactorForNativeView(GetNativeView())); |
| 2078 is_showing_overscroll_glow_ = true; | 2085 is_showing_overscroll_glow_ = true; |
| 2079 } | 2086 } |
| 2080 | 2087 |
| 2081 } // namespace content | 2088 } // namespace content |
| OLD | NEW |