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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 #include "ui/base/ui_base_switches.h" | 80 #include "ui/base/ui_base_switches.h" |
81 #include "ui/gfx/geometry/point_conversions.h" | 81 #include "ui/gfx/geometry/point_conversions.h" |
82 #include "ui/gfx/geometry/rect_conversions.h" | 82 #include "ui/gfx/geometry/rect_conversions.h" |
83 #include "ui/gfx/geometry/size_conversions.h" | 83 #include "ui/gfx/geometry/size_conversions.h" |
84 #include "ui/gfx/skia_util.h" | 84 #include "ui/gfx/skia_util.h" |
85 #include "ui/gl/gl_switches.h" | 85 #include "ui/gl/gl_switches.h" |
86 #include "ui/surface/transport_dib.h" | 86 #include "ui/surface/transport_dib.h" |
87 | 87 |
88 #if defined(OS_ANDROID) | 88 #if defined(OS_ANDROID) |
89 #include <android/keycodes.h> | 89 #include <android/keycodes.h> |
90 #include "base/android/build_info.h" | |
90 #include "content/renderer/android/synchronous_compositor_factory.h" | 91 #include "content/renderer/android/synchronous_compositor_factory.h" |
91 #include "content/renderer/android/synchronous_compositor_filter.h" | 92 #include "content/renderer/android/synchronous_compositor_filter.h" |
92 #include "content/renderer/android/synchronous_compositor_output_surface.h" | 93 #include "content/renderer/android/synchronous_compositor_output_surface.h" |
93 #endif | 94 #endif |
94 | 95 |
95 #if defined(OS_POSIX) | 96 #if defined(OS_POSIX) |
96 #include "ipc/ipc_channel_posix.h" | 97 #include "ipc/ipc_channel_posix.h" |
97 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 98 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
98 #include "third_party/skia/include/core/SkPixelRef.h" | 99 #include "third_party/skia/include/core/SkPixelRef.h" |
99 #endif // defined(OS_POSIX) | 100 #endif // defined(OS_POSIX) |
(...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1739 void RenderWidget::showImeIfNeeded() { | 1740 void RenderWidget::showImeIfNeeded() { |
1740 OnShowImeIfNeeded(); | 1741 OnShowImeIfNeeded(); |
1741 } | 1742 } |
1742 | 1743 |
1743 ui::TextInputType RenderWidget::GetTextInputType() { | 1744 ui::TextInputType RenderWidget::GetTextInputType() { |
1744 if (webwidget_) | 1745 if (webwidget_) |
1745 return WebKitToUiTextInputType(webwidget_->textInputType()); | 1746 return WebKitToUiTextInputType(webwidget_->textInputType()); |
1746 return ui::TEXT_INPUT_TYPE_NONE; | 1747 return ui::TEXT_INPUT_TYPE_NONE; |
1747 } | 1748 } |
1748 | 1749 |
1749 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { | 1750 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { |
jdduke (slow)
2016/02/24 04:00:45
The problem is, this method isn't just called when
| |
1750 #if defined(OS_ANDROID) | 1751 #if defined(OS_ANDROID) |
1751 // TODO(yukawa): Start sending character bounds when the browser side | 1752 if (base::android::BuildInfo::GetInstance()->sdk_int() < 21) |
1752 // implementation becomes ready (crbug.com/424866). | 1753 return; |
1753 #else | 1754 #endif |
1754 TRACE_EVENT0("renderer", "RenderWidget::UpdateCompositionInfo"); | 1755 TRACE_EVENT0("renderer", "RenderWidget::UpdateCompositionInfo"); |
1755 gfx::Range range = gfx::Range(); | 1756 gfx::Range range = gfx::Range(); |
1756 if (should_update_range) { | 1757 if (should_update_range) { |
1757 GetCompositionRange(&range); | 1758 GetCompositionRange(&range); |
1758 } else { | 1759 } else { |
1759 range = composition_range_; | 1760 range = composition_range_; |
1760 } | 1761 } |
1761 std::vector<gfx::Rect> character_bounds; | 1762 std::vector<gfx::Rect> character_bounds; |
1762 GetCompositionCharacterBounds(&character_bounds); | 1763 GetCompositionCharacterBounds(&character_bounds); |
1763 | 1764 |
1764 if (!ShouldUpdateCompositionInfo(range, character_bounds)) | 1765 if (!ShouldUpdateCompositionInfo(range, character_bounds)) |
1765 return; | 1766 return; |
1766 composition_character_bounds_ = character_bounds; | 1767 composition_character_bounds_ = character_bounds; |
1767 composition_range_ = range; | 1768 composition_range_ = range; |
1768 Send(new InputHostMsg_ImeCompositionRangeChanged( | 1769 Send(new InputHostMsg_ImeCompositionRangeChanged( |
1769 routing_id(), composition_range_, composition_character_bounds_)); | 1770 routing_id(), composition_range_, composition_character_bounds_)); |
1770 #endif | |
1771 } | 1771 } |
1772 | 1772 |
1773 void RenderWidget::convertViewportToWindow(blink::WebRect* rect) { | 1773 void RenderWidget::convertViewportToWindow(blink::WebRect* rect) { |
1774 if (IsUseZoomForDSFEnabled()) { | 1774 if (IsUseZoomForDSFEnabled()) { |
1775 float reverse = 1 / device_scale_factor_; | 1775 float reverse = 1 / device_scale_factor_; |
1776 // TODO(oshima): We may need to allow pixel precision here as the the | 1776 // TODO(oshima): We may need to allow pixel precision here as the the |
1777 // anchor element can be placed at half pixel. | 1777 // anchor element can be placed at half pixel. |
1778 gfx::Rect window_rect = | 1778 gfx::Rect window_rect = |
1779 gfx::ScaleToEnclosedRect(gfx::Rect(*rect), reverse); | 1779 gfx::ScaleToEnclosedRect(gfx::Rect(*rect), reverse); |
1780 rect->x = window_rect.x(); | 1780 rect->x = window_rect.x(); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2294 video_hole_frames_.RemoveObserver(frame); | 2294 video_hole_frames_.RemoveObserver(frame); |
2295 } | 2295 } |
2296 #endif // defined(VIDEO_HOLE) | 2296 #endif // defined(VIDEO_HOLE) |
2297 | 2297 |
2298 void RenderWidget::OnWaitNextFrameForTests(int routing_id) { | 2298 void RenderWidget::OnWaitNextFrameForTests(int routing_id) { |
2299 QueueMessage(new ViewHostMsg_WaitForNextFrameForTests_ACK(routing_id), | 2299 QueueMessage(new ViewHostMsg_WaitForNextFrameForTests_ACK(routing_id), |
2300 MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE); | 2300 MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE); |
2301 } | 2301 } |
2302 | 2302 |
2303 } // namespace content | 2303 } // namespace content |
OLD | NEW |