| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2069 } | 2070 } |
| 2070 | 2071 |
| 2071 ui::TextInputType RenderWidget::GetTextInputType() { | 2072 ui::TextInputType RenderWidget::GetTextInputType() { |
| 2072 if (webwidget_) | 2073 if (webwidget_) |
| 2073 return WebKitToUiTextInputType(webwidget_->textInputInfo().type); | 2074 return WebKitToUiTextInputType(webwidget_->textInputInfo().type); |
| 2074 return ui::TEXT_INPUT_TYPE_NONE; | 2075 return ui::TEXT_INPUT_TYPE_NONE; |
| 2075 } | 2076 } |
| 2076 | 2077 |
| 2077 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { | 2078 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { |
| 2078 #if defined(OS_ANDROID) | 2079 #if defined(OS_ANDROID) |
| 2079 // TODO(yukawa): Start sending character bounds when the browser side | 2080 const static bool is_cursor_anchor_info_supported = |
| 2080 // implementation becomes ready (crbug.com/424866). | 2081 base::android::BuildInfo::GetInstance()->sdk_int() >= 21 && |
| 2081 #else | 2082 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2083 switches::kEnableCursorAnchorInfo); |
| 2084 if (!is_cursor_anchor_info_supported) |
| 2085 return; |
| 2086 #endif |
| 2082 gfx::Range range = gfx::Range(); | 2087 gfx::Range range = gfx::Range(); |
| 2083 if (should_update_range) { | 2088 if (should_update_range) { |
| 2084 GetCompositionRange(&range); | 2089 GetCompositionRange(&range); |
| 2085 } else { | 2090 } else { |
| 2086 range = composition_range_; | 2091 range = composition_range_; |
| 2087 } | 2092 } |
| 2088 std::vector<gfx::Rect> character_bounds; | 2093 std::vector<gfx::Rect> character_bounds; |
| 2089 GetCompositionCharacterBounds(&character_bounds); | 2094 GetCompositionCharacterBounds(&character_bounds); |
| 2090 | 2095 |
| 2091 if (!ShouldUpdateCompositionInfo(range, character_bounds)) | 2096 if (!ShouldUpdateCompositionInfo(range, character_bounds)) |
| 2092 return; | 2097 return; |
| 2093 composition_character_bounds_ = character_bounds; | 2098 composition_character_bounds_ = character_bounds; |
| 2094 composition_range_ = range; | 2099 composition_range_ = range; |
| 2095 Send(new InputHostMsg_ImeCompositionRangeChanged( | 2100 Send(new InputHostMsg_ImeCompositionRangeChanged( |
| 2096 routing_id(), composition_range_, composition_character_bounds_)); | 2101 routing_id(), composition_range_, composition_character_bounds_)); |
| 2097 #endif | |
| 2098 } | 2102 } |
| 2099 | 2103 |
| 2100 void RenderWidget::GetCompositionCharacterBounds( | 2104 void RenderWidget::GetCompositionCharacterBounds( |
| 2101 std::vector<gfx::Rect>* bounds) { | 2105 std::vector<gfx::Rect>* bounds) { |
| 2102 DCHECK(bounds); | 2106 DCHECK(bounds); |
| 2103 bounds->clear(); | 2107 bounds->clear(); |
| 2104 } | 2108 } |
| 2105 | 2109 |
| 2106 void RenderWidget::GetCompositionRange(gfx::Range* range) { | 2110 void RenderWidget::GetCompositionRange(gfx::Range* range) { |
| 2107 size_t location, length; | 2111 size_t location, length; |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2428 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2432 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2429 video_hole_frames_.AddObserver(frame); | 2433 video_hole_frames_.AddObserver(frame); |
| 2430 } | 2434 } |
| 2431 | 2435 |
| 2432 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2436 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2433 video_hole_frames_.RemoveObserver(frame); | 2437 video_hole_frames_.RemoveObserver(frame); |
| 2434 } | 2438 } |
| 2435 #endif // defined(VIDEO_HOLE) | 2439 #endif // defined(VIDEO_HOLE) |
| 2436 | 2440 |
| 2437 } // namespace content | 2441 } // namespace content |
| OLD | NEW |