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 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 OnShowImeIfNeeded(); | 1534 OnShowImeIfNeeded(); |
1535 } | 1535 } |
1536 | 1536 |
1537 ui::TextInputType RenderWidget::GetTextInputType() { | 1537 ui::TextInputType RenderWidget::GetTextInputType() { |
1538 if (webwidget_) | 1538 if (webwidget_) |
1539 return WebKitToUiTextInputType(webwidget_->textInputType()); | 1539 return WebKitToUiTextInputType(webwidget_->textInputType()); |
1540 return ui::TEXT_INPUT_TYPE_NONE; | 1540 return ui::TEXT_INPUT_TYPE_NONE; |
1541 } | 1541 } |
1542 | 1542 |
1543 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { | 1543 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { |
1544 #if defined(OS_ANDROID) | |
1545 // TODO(yukawa): Start sending character bounds when the browser side | |
1546 // implementation becomes ready (crbug.com/424866). | |
1547 #else | |
1548 TRACE_EVENT0("renderer", "RenderWidget::UpdateCompositionInfo"); | 1544 TRACE_EVENT0("renderer", "RenderWidget::UpdateCompositionInfo"); |
1549 gfx::Range range = gfx::Range(); | 1545 gfx::Range range = gfx::Range(); |
1550 if (should_update_range) { | 1546 if (should_update_range) { |
1551 GetCompositionRange(&range); | 1547 GetCompositionRange(&range); |
1552 } else { | 1548 } else { |
1553 range = composition_range_; | 1549 range = composition_range_; |
1554 } | 1550 } |
1555 std::vector<gfx::Rect> character_bounds; | 1551 std::vector<gfx::Rect> character_bounds; |
1556 GetCompositionCharacterBounds(&character_bounds); | 1552 GetCompositionCharacterBounds(&character_bounds); |
1557 | 1553 |
1558 if (!ShouldUpdateCompositionInfo(range, character_bounds)) | 1554 if (!ShouldUpdateCompositionInfo(range, character_bounds)) |
1559 return; | 1555 return; |
1560 composition_character_bounds_ = character_bounds; | 1556 composition_character_bounds_ = character_bounds; |
1561 composition_range_ = range; | 1557 composition_range_ = range; |
1562 Send(new InputHostMsg_ImeCompositionRangeChanged( | 1558 Send(new InputHostMsg_ImeCompositionRangeChanged( |
1563 routing_id(), composition_range_, composition_character_bounds_)); | 1559 routing_id(), composition_range_, composition_character_bounds_)); |
1564 #endif | |
1565 } | 1560 } |
1566 | 1561 |
1567 void RenderWidget::convertViewportToWindow(blink::WebRect* rect) { | 1562 void RenderWidget::convertViewportToWindow(blink::WebRect* rect) { |
1568 if (IsUseZoomForDSFEnabled()) { | 1563 if (IsUseZoomForDSFEnabled()) { |
1569 float reverse = 1 / device_scale_factor_; | 1564 float reverse = 1 / device_scale_factor_; |
1570 // TODO(oshima): We may need to allow pixel precision here as the the | 1565 // TODO(oshima): We may need to allow pixel precision here as the the |
1571 // anchor element can be placed at half pixel. | 1566 // anchor element can be placed at half pixel. |
1572 gfx::Rect window_rect = | 1567 gfx::Rect window_rect = |
1573 gfx::ScaleToEnclosedRect(gfx::Rect(*rect), reverse); | 1568 gfx::ScaleToEnclosedRect(gfx::Rect(*rect), reverse); |
1574 rect->x = window_rect.x(); | 1569 rect->x = window_rect.x(); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 video_hole_frames_.RemoveObserver(frame); | 2083 video_hole_frames_.RemoveObserver(frame); |
2089 } | 2084 } |
2090 #endif // defined(VIDEO_HOLE) | 2085 #endif // defined(VIDEO_HOLE) |
2091 | 2086 |
2092 void RenderWidget::OnWaitNextFrameForTests(int routing_id) { | 2087 void RenderWidget::OnWaitNextFrameForTests(int routing_id) { |
2093 QueueMessage(new ViewHostMsg_WaitForNextFrameForTests_ACK(routing_id), | 2088 QueueMessage(new ViewHostMsg_WaitForNextFrameForTests_ACK(routing_id), |
2094 MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE); | 2089 MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE); |
2095 } | 2090 } |
2096 | 2091 |
2097 } // namespace content | 2092 } // namespace content |
OLD | NEW |