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

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

Issue 699333003: Support InputMethodManager#updateCursorAnchorInfo for Android 5.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase before splitting this CL. Created 5 years, 8 months 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
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/logging.h" 10 #include "base/logging.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "ui/gfx/frame_time.h" 75 #include "ui/gfx/frame_time.h"
76 #include "ui/gfx/geometry/point_conversions.h" 76 #include "ui/gfx/geometry/point_conversions.h"
77 #include "ui/gfx/geometry/rect_conversions.h" 77 #include "ui/gfx/geometry/rect_conversions.h"
78 #include "ui/gfx/geometry/size_conversions.h" 78 #include "ui/gfx/geometry/size_conversions.h"
79 #include "ui/gfx/skia_util.h" 79 #include "ui/gfx/skia_util.h"
80 #include "ui/gl/gl_switches.h" 80 #include "ui/gl/gl_switches.h"
81 #include "ui/surface/transport_dib.h" 81 #include "ui/surface/transport_dib.h"
82 82
83 #if defined(OS_ANDROID) 83 #if defined(OS_ANDROID)
84 #include <android/keycodes.h> 84 #include <android/keycodes.h>
85 #include "base/android/build_info.h"
85 #include "content/renderer/android/synchronous_compositor_factory.h" 86 #include "content/renderer/android/synchronous_compositor_factory.h"
86 #endif 87 #endif
87 88
88 #if defined(OS_POSIX) 89 #if defined(OS_POSIX)
89 #include "ipc/ipc_channel_posix.h" 90 #include "ipc/ipc_channel_posix.h"
90 #include "third_party/skia/include/core/SkMallocPixelRef.h" 91 #include "third_party/skia/include/core/SkMallocPixelRef.h"
91 #include "third_party/skia/include/core/SkPixelRef.h" 92 #include "third_party/skia/include/core/SkPixelRef.h"
92 #endif // defined(OS_POSIX) 93 #endif // defined(OS_POSIX)
93 94
94 #include "third_party/WebKit/public/web/WebWidget.h" 95 #include "third_party/WebKit/public/web/WebWidget.h"
(...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 } 2081 }
2081 2082
2082 ui::TextInputType RenderWidget::GetTextInputType() { 2083 ui::TextInputType RenderWidget::GetTextInputType() {
2083 if (webwidget_) 2084 if (webwidget_)
2084 return WebKitToUiTextInputType(webwidget_->textInputInfo().type); 2085 return WebKitToUiTextInputType(webwidget_->textInputInfo().type);
2085 return ui::TEXT_INPUT_TYPE_NONE; 2086 return ui::TEXT_INPUT_TYPE_NONE;
2086 } 2087 }
2087 2088
2088 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { 2089 void RenderWidget::UpdateCompositionInfo(bool should_update_range) {
2089 #if defined(OS_ANDROID) 2090 #if defined(OS_ANDROID)
2090 // TODO(yukawa): Start sending character bounds when the browser side 2091 const static bool is_cursor_anchor_info_supported =
2091 // implementation becomes ready (crbug.com/424866). 2092 base::android::BuildInfo::GetInstance()->sdk_int() >= 21 &&
2092 #else 2093 base::CommandLine::ForCurrentProcess()->HasSwitch(
2094 switches::kEnableCursorAnchorInfo);
2095 if (!is_cursor_anchor_info_supported)
2096 return;
2097 #endif
2093 gfx::Range range = gfx::Range(); 2098 gfx::Range range = gfx::Range();
2094 if (should_update_range) { 2099 if (should_update_range) {
2095 GetCompositionRange(&range); 2100 GetCompositionRange(&range);
2096 } else { 2101 } else {
2097 range = composition_range_; 2102 range = composition_range_;
2098 } 2103 }
2099 std::vector<gfx::Rect> character_bounds; 2104 std::vector<gfx::Rect> character_bounds;
2100 GetCompositionCharacterBounds(&character_bounds); 2105 GetCompositionCharacterBounds(&character_bounds);
2101 2106
2102 if (!ShouldUpdateCompositionInfo(range, character_bounds)) 2107 if (!ShouldUpdateCompositionInfo(range, character_bounds))
2103 return; 2108 return;
2104 composition_character_bounds_ = character_bounds; 2109 composition_character_bounds_ = character_bounds;
2105 composition_range_ = range; 2110 composition_range_ = range;
2106 Send(new InputHostMsg_ImeCompositionRangeChanged( 2111 Send(new InputHostMsg_ImeCompositionRangeChanged(
2107 routing_id(), composition_range_, composition_character_bounds_)); 2112 routing_id(), composition_range_, composition_character_bounds_));
2108 #endif
2109 } 2113 }
2110 2114
2111 void RenderWidget::GetCompositionCharacterBounds( 2115 void RenderWidget::GetCompositionCharacterBounds(
2112 std::vector<gfx::Rect>* bounds) { 2116 std::vector<gfx::Rect>* bounds) {
2113 DCHECK(bounds); 2117 DCHECK(bounds);
2114 bounds->clear(); 2118 bounds->clear();
2115 } 2119 }
2116 2120
2117 void RenderWidget::GetCompositionRange(gfx::Range* range) { 2121 void RenderWidget::GetCompositionRange(gfx::Range* range) {
2118 size_t location, length; 2122 size_t location, length;
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2444 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2441 video_hole_frames_.AddObserver(frame); 2445 video_hole_frames_.AddObserver(frame);
2442 } 2446 }
2443 2447
2444 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2448 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2445 video_hole_frames_.RemoveObserver(frame); 2449 video_hole_frames_.RemoveObserver(frame);
2446 } 2450 }
2447 #endif // defined(VIDEO_HOLE) 2451 #endif // defined(VIDEO_HOLE)
2448 2452
2449 } // namespace content 2453 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698