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 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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) { |
1750 #if defined(OS_ANDROID) | 1751 #if defined(OS_ANDROID) |
1751 // TODO(yukawa): Start sending character bounds when the browser side | 1752 const static bool is_cursor_anchor_info_supported = |
1752 // implementation becomes ready (crbug.com/424866). | 1753 base::android::BuildInfo::GetInstance()->sdk_int() >= 21 && |
aelias_OOO_until_Jul13
2016/02/10 08:23:42
We shouldn't add an SDK version level check in the
kinaba
2016/02/19 12:44:08
I guess devices stuck at K or below tends to be ol
jdduke (slow)
2016/02/19 16:28:07
Seems reasonable. I suppose you could gait the fla
aelias_OOO_until_Jul13
2016/02/24 03:16:39
Regardless of the history, I stand by what I said
| |
1753 #else | 1754 base::CommandLine::ForCurrentProcess()->HasSwitch( |
1755 switches::kEnableCursorAnchorInfo); | |
1756 if (!is_cursor_anchor_info_supported) | |
1757 return; | |
1758 #endif | |
1754 TRACE_EVENT0("renderer", "RenderWidget::UpdateCompositionInfo"); | 1759 TRACE_EVENT0("renderer", "RenderWidget::UpdateCompositionInfo"); |
1755 gfx::Range range = gfx::Range(); | 1760 gfx::Range range = gfx::Range(); |
1756 if (should_update_range) { | 1761 if (should_update_range) { |
1757 GetCompositionRange(&range); | 1762 GetCompositionRange(&range); |
1758 } else { | 1763 } else { |
1759 range = composition_range_; | 1764 range = composition_range_; |
1760 } | 1765 } |
1761 std::vector<gfx::Rect> character_bounds; | 1766 std::vector<gfx::Rect> character_bounds; |
1762 GetCompositionCharacterBounds(&character_bounds); | 1767 GetCompositionCharacterBounds(&character_bounds); |
1763 | 1768 |
1764 if (!ShouldUpdateCompositionInfo(range, character_bounds)) | 1769 if (!ShouldUpdateCompositionInfo(range, character_bounds)) |
1765 return; | 1770 return; |
1766 composition_character_bounds_ = character_bounds; | 1771 composition_character_bounds_ = character_bounds; |
1767 composition_range_ = range; | 1772 composition_range_ = range; |
1768 Send(new InputHostMsg_ImeCompositionRangeChanged( | 1773 Send(new InputHostMsg_ImeCompositionRangeChanged( |
1769 routing_id(), composition_range_, composition_character_bounds_)); | 1774 routing_id(), composition_range_, composition_character_bounds_)); |
1770 #endif | |
1771 } | 1775 } |
1772 | 1776 |
1773 void RenderWidget::convertViewportToWindow(blink::WebRect* rect) { | 1777 void RenderWidget::convertViewportToWindow(blink::WebRect* rect) { |
1774 if (IsUseZoomForDSFEnabled()) { | 1778 if (IsUseZoomForDSFEnabled()) { |
1775 float reverse = 1 / device_scale_factor_; | 1779 float reverse = 1 / device_scale_factor_; |
1776 // TODO(oshima): We may need to allow pixel precision here as the the | 1780 // TODO(oshima): We may need to allow pixel precision here as the the |
1777 // anchor element can be placed at half pixel. | 1781 // anchor element can be placed at half pixel. |
1778 gfx::Rect window_rect = | 1782 gfx::Rect window_rect = |
1779 gfx::ScaleToEnclosedRect(gfx::Rect(*rect), reverse); | 1783 gfx::ScaleToEnclosedRect(gfx::Rect(*rect), reverse); |
1780 rect->x = window_rect.x(); | 1784 rect->x = window_rect.x(); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2294 video_hole_frames_.RemoveObserver(frame); | 2298 video_hole_frames_.RemoveObserver(frame); |
2295 } | 2299 } |
2296 #endif // defined(VIDEO_HOLE) | 2300 #endif // defined(VIDEO_HOLE) |
2297 | 2301 |
2298 void RenderWidget::OnWaitNextFrameForTests(int routing_id) { | 2302 void RenderWidget::OnWaitNextFrameForTests(int routing_id) { |
2299 QueueMessage(new ViewHostMsg_WaitForNextFrameForTests_ACK(routing_id), | 2303 QueueMessage(new ViewHostMsg_WaitForNextFrameForTests_ACK(routing_id), |
2300 MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE); | 2304 MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE); |
2301 } | 2305 } |
2302 | 2306 |
2303 } // namespace content | 2307 } // namespace content |
OLD | NEW |