Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Side by Side Diff: content/renderer/render_widget.cc

Issue 1521853002: Revert of Use Window coordinates for IME composition bounds, auto resize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 WebRect new_size_in_window(0, 0, new_size.width, new_size.height); 1428 // TODO(oshima): support UseZoomForDSFEnabled()
1429 convertViewportToWindow(&new_size_in_window); 1429 if (size_.width() != new_size.width || size_.height() != new_size.height) {
1430 if (size_.width() != new_size_in_window.width || 1430 size_ = new_size;
1431 size_.height() != new_size_in_window.height) {
1432 size_ = gfx::Size(new_size_in_window.width, new_size_in_window.height);
1433 1431
1434 if (resizing_mode_selector_->is_synchronous_mode()) { 1432 if (resizing_mode_selector_->is_synchronous_mode()) {
1435 gfx::Rect new_pos(rootWindowRect().x, 1433 WebRect new_pos(rootWindowRect().x,
1436 rootWindowRect().y, 1434 rootWindowRect().y,
1437 size_.width(), 1435 new_size.width,
1438 size_.height()); 1436 new_size.height);
1439 view_screen_rect_ = new_pos; 1437 view_screen_rect_ = new_pos;
1440 window_screen_rect_ = new_pos; 1438 window_screen_rect_ = new_pos;
1441 } 1439 }
1442 1440
1443 AutoResizeCompositor(); 1441 AutoResizeCompositor();
1444 1442
1445 if (!resizing_mode_selector_->is_synchronous_mode()) 1443 if (!resizing_mode_selector_->is_synchronous_mode())
1446 need_update_rect_for_auto_resize_ = true; 1444 need_update_rect_for_auto_resize_ = true;
1447 } 1445 }
1448 } 1446 }
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 return pending_window_rect_; 1705 return pending_window_rect_;
1708 1706
1709 return view_screen_rect_; 1707 return view_screen_rect_;
1710 } 1708 }
1711 1709
1712 void RenderWidget::setToolTipText(const blink::WebString& text, 1710 void RenderWidget::setToolTipText(const blink::WebString& text,
1713 WebTextDirection hint) { 1711 WebTextDirection hint) {
1714 Send(new ViewHostMsg_SetTooltipText(routing_id_, text, hint)); 1712 Send(new ViewHostMsg_SetTooltipText(routing_id_, text, hint));
1715 } 1713 }
1716 1714
1717 void RenderWidget::setWindowRect(const WebRect& rect_in_screen) { 1715 void RenderWidget::setWindowRect(const WebRect& rect) {
1718 WebRect window_rect = rect_in_screen; 1716 // TODO(oshima): Scale back to DIP coordinates.
1717 WebRect window_rect = rect;
1719 if (popup_origin_scale_for_emulation_) { 1718 if (popup_origin_scale_for_emulation_) {
1720 float scale = popup_origin_scale_for_emulation_; 1719 float scale = popup_origin_scale_for_emulation_;
1721 window_rect.x = popup_screen_origin_for_emulation_.x() + 1720 window_rect.x = popup_screen_origin_for_emulation_.x() +
1722 (window_rect.x - popup_view_origin_for_emulation_.x()) * scale; 1721 (window_rect.x - popup_view_origin_for_emulation_.x()) * scale;
1723 window_rect.y = popup_screen_origin_for_emulation_.y() + 1722 window_rect.y = popup_screen_origin_for_emulation_.y() +
1724 (window_rect.y - popup_view_origin_for_emulation_.y()) * scale; 1723 (window_rect.y - popup_view_origin_for_emulation_.y()) * scale;
1725 } 1724 }
1726 1725
1727 if (!resizing_mode_selector_->is_synchronous_mode()) { 1726 if (!resizing_mode_selector_->is_synchronous_mode()) {
1728 if (did_show_) { 1727 if (did_show_) {
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 text_input_mode_ = new_mode; 2096 text_input_mode_ = new_mode;
2098 can_compose_inline_ = new_can_compose_inline; 2097 can_compose_inline_ = new_can_compose_inline;
2099 text_input_flags_ = new_info.flags; 2098 text_input_flags_ = new_info.flags;
2100 } 2099 }
2101 } 2100 }
2102 2101
2103 void RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) { 2102 void RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) {
2104 WebRect focus_webrect; 2103 WebRect focus_webrect;
2105 WebRect anchor_webrect; 2104 WebRect anchor_webrect;
2106 webwidget_->selectionBounds(focus_webrect, anchor_webrect); 2105 webwidget_->selectionBounds(focus_webrect, anchor_webrect);
2107 convertViewportToWindow(&focus_webrect); 2106 if (IsUseZoomForDSFEnabled()) {
2108 convertViewportToWindow(&anchor_webrect); 2107 float inverse_scale = 1.f / device_scale_factor_;
2109 *focus = focus_webrect; 2108 gfx::RectF focus_rect(focus_webrect);
2110 *anchor = anchor_webrect; 2109 *focus = gfx::ToEnclosingRect(gfx::ScaleRect(focus_rect, inverse_scale));
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 }
2111 } 2116 }
2112 2117
2113 void RenderWidget::UpdateSelectionBounds() { 2118 void RenderWidget::UpdateSelectionBounds() {
2114 TRACE_EVENT0("renderer", "RenderWidget::UpdateSelectionBounds"); 2119 TRACE_EVENT0("renderer", "RenderWidget::UpdateSelectionBounds");
2115 if (!webwidget_) 2120 if (!webwidget_)
2116 return; 2121 return;
2117 if (ime_event_guard_) 2122 if (ime_event_guard_)
2118 return; 2123 return;
2119 2124
2120 #if defined(USE_AURA) 2125 #if defined(USE_AURA)
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2538 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2543 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2539 video_hole_frames_.AddObserver(frame); 2544 video_hole_frames_.AddObserver(frame);
2540 } 2545 }
2541 2546
2542 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2547 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2543 video_hole_frames_.RemoveObserver(frame); 2548 video_hole_frames_.RemoveObserver(frame);
2544 } 2549 }
2545 #endif // defined(VIDEO_HOLE) 2550 #endif // defined(VIDEO_HOLE)
2546 2551
2547 } // namespace content 2552 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698