Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: content/renderer/render_widget.cc

Issue 757233003: Do not provisionally send ImeCompositionRangeChanged IPC on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comment from jdduke Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #include "ui/gfx/frame_time.h" 70 #include "ui/gfx/frame_time.h"
71 #include "ui/gfx/point_conversions.h" 71 #include "ui/gfx/point_conversions.h"
72 #include "ui/gfx/rect_conversions.h" 72 #include "ui/gfx/rect_conversions.h"
73 #include "ui/gfx/size_conversions.h" 73 #include "ui/gfx/size_conversions.h"
74 #include "ui/gfx/skia_util.h" 74 #include "ui/gfx/skia_util.h"
75 #include "ui/gl/gl_switches.h" 75 #include "ui/gl/gl_switches.h"
76 #include "ui/surface/transport_dib.h" 76 #include "ui/surface/transport_dib.h"
77 77
78 #if defined(OS_ANDROID) 78 #if defined(OS_ANDROID)
79 #include <android/keycodes.h> 79 #include <android/keycodes.h>
80 #include "base/android/build_info.h"
81 #include "content/renderer/android/synchronous_compositor_factory.h" 80 #include "content/renderer/android/synchronous_compositor_factory.h"
82 #endif 81 #endif
83 82
84 #if defined(OS_POSIX) 83 #if defined(OS_POSIX)
85 #include "ipc/ipc_channel_posix.h" 84 #include "ipc/ipc_channel_posix.h"
86 #include "third_party/skia/include/core/SkMallocPixelRef.h" 85 #include "third_party/skia/include/core/SkMallocPixelRef.h"
87 #include "third_party/skia/include/core/SkPixelRef.h" 86 #include "third_party/skia/include/core/SkPixelRef.h"
88 #endif // defined(OS_POSIX) 87 #endif // defined(OS_POSIX)
89 88
90 #include "third_party/WebKit/public/web/WebWidget.h" 89 #include "third_party/WebKit/public/web/WebWidget.h"
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 } 2009 }
2011 2010
2012 ui::TextInputType RenderWidget::GetTextInputType() { 2011 ui::TextInputType RenderWidget::GetTextInputType() {
2013 if (webwidget_) 2012 if (webwidget_)
2014 return WebKitToUiTextInputType(webwidget_->textInputInfo().type); 2013 return WebKitToUiTextInputType(webwidget_->textInputInfo().type);
2015 return ui::TEXT_INPUT_TYPE_NONE; 2014 return ui::TEXT_INPUT_TYPE_NONE;
2016 } 2015 }
2017 2016
2018 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { 2017 void RenderWidget::UpdateCompositionInfo(bool should_update_range) {
2019 #if defined(OS_ANDROID) 2018 #if defined(OS_ANDROID)
2020 // Sending composition info makes sense only in Lollipop (API level 21) 2019 // TODO(yukawa): Start sending character bounds when the browser side
2021 // and above due to the API availability. 2020 // implementation becomes ready (crbug.com/424866).
2022 if (base::android::BuildInfo::GetInstance()->sdk_int() < 21) 2021 #else
2023 return;
2024 #endif
2025
2026 gfx::Range range = gfx::Range(); 2022 gfx::Range range = gfx::Range();
2027 if (should_update_range) { 2023 if (should_update_range) {
2028 GetCompositionRange(&range); 2024 GetCompositionRange(&range);
2029 } else { 2025 } else {
2030 range = composition_range_; 2026 range = composition_range_;
2031 } 2027 }
2032 std::vector<gfx::Rect> character_bounds; 2028 std::vector<gfx::Rect> character_bounds;
2033 GetCompositionCharacterBounds(&character_bounds); 2029 GetCompositionCharacterBounds(&character_bounds);
2034 2030
2035 if (!ShouldUpdateCompositionInfo(range, character_bounds)) 2031 if (!ShouldUpdateCompositionInfo(range, character_bounds))
2036 return; 2032 return;
2037 composition_character_bounds_ = character_bounds; 2033 composition_character_bounds_ = character_bounds;
2038 composition_range_ = range; 2034 composition_range_ = range;
2039 Send(new InputHostMsg_ImeCompositionRangeChanged( 2035 Send(new InputHostMsg_ImeCompositionRangeChanged(
2040 routing_id(), composition_range_, composition_character_bounds_)); 2036 routing_id(), composition_range_, composition_character_bounds_));
2037 #endif
2041 } 2038 }
2042 2039
2043 void RenderWidget::GetCompositionCharacterBounds( 2040 void RenderWidget::GetCompositionCharacterBounds(
2044 std::vector<gfx::Rect>* bounds) { 2041 std::vector<gfx::Rect>* bounds) {
2045 DCHECK(bounds); 2042 DCHECK(bounds);
2046 bounds->clear(); 2043 bounds->clear();
2047 } 2044 }
2048 2045
2049 void RenderWidget::GetCompositionRange(gfx::Range* range) { 2046 void RenderWidget::GetCompositionRange(gfx::Range* range) {
2050 size_t location, length; 2047 size_t location, length;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
2329 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2326 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2330 video_hole_frames_.AddObserver(frame); 2327 video_hole_frames_.AddObserver(frame);
2331 } 2328 }
2332 2329
2333 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2330 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2334 video_hole_frames_.RemoveObserver(frame); 2331 video_hole_frames_.RemoveObserver(frame);
2335 } 2332 }
2336 #endif // defined(VIDEO_HOLE) 2333 #endif // defined(VIDEO_HOLE)
2337 2334
2338 } // namespace content 2335 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698