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 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1418 pending_input_event_ack_.get()); | 1418 pending_input_event_ack_.get()); |
1419 Send(pending_input_event_ack_.release()); | 1419 Send(pending_input_event_ack_.release()); |
1420 } | 1420 } |
1421 total_input_handling_time_this_frame_ = base::TimeDelta(); | 1421 total_input_handling_time_this_frame_ = base::TimeDelta(); |
1422 } | 1422 } |
1423 | 1423 |
1424 /////////////////////////////////////////////////////////////////////////////// | 1424 /////////////////////////////////////////////////////////////////////////////// |
1425 // WebWidgetClient | 1425 // WebWidgetClient |
1426 | 1426 |
1427 void RenderWidget::didAutoResize(const WebSize& new_size) { | 1427 void RenderWidget::didAutoResize(const WebSize& new_size) { |
1428 // TODO(oshima): support UseZoomForDSFEnabled() | 1428 WebRect new_size_in_window(0, 0, new_size.width, new_size.height); |
1429 if (size_.width() != new_size.width || size_.height() != new_size.height) { | 1429 convertViewportToWindow(&new_size_in_window); |
1430 size_ = new_size; | 1430 if (size_.width() != new_size_in_window.width || |
1431 size_.height() != new_size_in_window.height) { | |
1432 size_ = gfx::Size(new_size_in_window.width, new_size_in_window.height); | |
1431 | 1433 |
1432 if (resizing_mode_selector_->is_synchronous_mode()) { | 1434 if (resizing_mode_selector_->is_synchronous_mode()) { |
1433 WebRect new_pos(rootWindowRect().x, | 1435 gfx::Rect new_pos(rootWindowRect().x, |
1434 rootWindowRect().y, | 1436 rootWindowRect().y, |
1435 new_size.width, | 1437 size_.width(), |
1436 new_size.height); | 1438 size_.height()); |
1437 view_screen_rect_ = new_pos; | 1439 view_screen_rect_ = new_pos; |
1438 window_screen_rect_ = new_pos; | 1440 window_screen_rect_ = new_pos; |
1439 } | 1441 } |
1440 | 1442 |
1441 AutoResizeCompositor(); | 1443 AutoResizeCompositor(); |
1442 | 1444 |
1443 if (!resizing_mode_selector_->is_synchronous_mode()) | 1445 if (!resizing_mode_selector_->is_synchronous_mode()) |
1444 need_update_rect_for_auto_resize_ = true; | 1446 need_update_rect_for_auto_resize_ = true; |
1445 } | 1447 } |
1446 } | 1448 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1706 | 1708 |
1707 return view_screen_rect_; | 1709 return view_screen_rect_; |
1708 } | 1710 } |
1709 | 1711 |
1710 void RenderWidget::setToolTipText(const blink::WebString& text, | 1712 void RenderWidget::setToolTipText(const blink::WebString& text, |
1711 WebTextDirection hint) { | 1713 WebTextDirection hint) { |
1712 Send(new ViewHostMsg_SetTooltipText(routing_id_, text, hint)); | 1714 Send(new ViewHostMsg_SetTooltipText(routing_id_, text, hint)); |
1713 } | 1715 } |
1714 | 1716 |
1715 void RenderWidget::setWindowRect(const WebRect& rect) { | 1717 void RenderWidget::setWindowRect(const WebRect& rect) { |
1716 // TODO(oshima): Scale back to DIP coordinates. | |
1717 WebRect window_rect = rect; | 1718 WebRect window_rect = rect; |
bokan
2015/12/09 22:06:32
So is window_rect in DIPs? i.e. window coordinates
oshima
2015/12/09 22:20:15
|rect| is screen coordinates and my comment was wr
| |
1718 if (popup_origin_scale_for_emulation_) { | 1719 if (popup_origin_scale_for_emulation_) { |
1719 float scale = popup_origin_scale_for_emulation_; | 1720 float scale = popup_origin_scale_for_emulation_; |
1720 window_rect.x = popup_screen_origin_for_emulation_.x() + | 1721 window_rect.x = popup_screen_origin_for_emulation_.x() + |
1721 (window_rect.x - popup_view_origin_for_emulation_.x()) * scale; | 1722 (window_rect.x - popup_view_origin_for_emulation_.x()) * scale; |
1722 window_rect.y = popup_screen_origin_for_emulation_.y() + | 1723 window_rect.y = popup_screen_origin_for_emulation_.y() + |
1723 (window_rect.y - popup_view_origin_for_emulation_.y()) * scale; | 1724 (window_rect.y - popup_view_origin_for_emulation_.y()) * scale; |
1724 } | 1725 } |
1725 | 1726 |
1726 if (!resizing_mode_selector_->is_synchronous_mode()) { | 1727 if (!resizing_mode_selector_->is_synchronous_mode()) { |
1727 if (did_show_) { | 1728 if (did_show_) { |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2096 text_input_mode_ = new_mode; | 2097 text_input_mode_ = new_mode; |
2097 can_compose_inline_ = new_can_compose_inline; | 2098 can_compose_inline_ = new_can_compose_inline; |
2098 text_input_flags_ = new_info.flags; | 2099 text_input_flags_ = new_info.flags; |
2099 } | 2100 } |
2100 } | 2101 } |
2101 | 2102 |
2102 void RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) { | 2103 void RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) { |
2103 WebRect focus_webrect; | 2104 WebRect focus_webrect; |
2104 WebRect anchor_webrect; | 2105 WebRect anchor_webrect; |
2105 webwidget_->selectionBounds(focus_webrect, anchor_webrect); | 2106 webwidget_->selectionBounds(focus_webrect, anchor_webrect); |
2106 if (IsUseZoomForDSFEnabled()) { | 2107 convertViewportToWindow(&focus_webrect); |
2107 float inverse_scale = 1.f / device_scale_factor_; | 2108 convertViewportToWindow(&anchor_webrect); |
2108 gfx::RectF focus_rect(focus_webrect); | 2109 *focus = focus_webrect; |
2109 *focus = gfx::ToEnclosingRect(gfx::ScaleRect(focus_rect, inverse_scale)); | 2110 *anchor = anchor_webrect; |
2110 gfx::RectF anchor_rect(anchor_webrect); | |
2111 *anchor = gfx::ToEnclosingRect(gfx::ScaleRect(anchor_rect, inverse_scale)); | |
2112 } else { | |
2113 *focus = focus_webrect; | |
2114 *anchor = anchor_webrect; | |
2115 } | |
2116 } | 2111 } |
2117 | 2112 |
2118 void RenderWidget::UpdateSelectionBounds() { | 2113 void RenderWidget::UpdateSelectionBounds() { |
2119 TRACE_EVENT0("renderer", "RenderWidget::UpdateSelectionBounds"); | 2114 TRACE_EVENT0("renderer", "RenderWidget::UpdateSelectionBounds"); |
2120 if (!webwidget_) | 2115 if (!webwidget_) |
2121 return; | 2116 return; |
2122 if (ime_event_guard_) | 2117 if (ime_event_guard_) |
2123 return; | 2118 return; |
2124 | 2119 |
2125 #if defined(USE_AURA) | 2120 #if defined(USE_AURA) |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2543 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2538 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2544 video_hole_frames_.AddObserver(frame); | 2539 video_hole_frames_.AddObserver(frame); |
2545 } | 2540 } |
2546 | 2541 |
2547 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2542 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2548 video_hole_frames_.RemoveObserver(frame); | 2543 video_hole_frames_.RemoveObserver(frame); |
2549 } | 2544 } |
2550 #endif // defined(VIDEO_HOLE) | 2545 #endif // defined(VIDEO_HOLE) |
2551 | 2546 |
2552 } // namespace content | 2547 } // namespace content |
OLD | NEW |