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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 0ae49932d567d50b95b55d2fee27299e6aea046e..cb0944417a612a42d4176a4e3642d324ebeeec02 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -1425,17 +1425,15 @@
// WebWidgetClient
void RenderWidget::didAutoResize(const WebSize& new_size) {
- WebRect new_size_in_window(0, 0, new_size.width, new_size.height);
- convertViewportToWindow(&new_size_in_window);
- if (size_.width() != new_size_in_window.width ||
- size_.height() != new_size_in_window.height) {
- size_ = gfx::Size(new_size_in_window.width, new_size_in_window.height);
+ // TODO(oshima): support UseZoomForDSFEnabled()
+ if (size_.width() != new_size.width || size_.height() != new_size.height) {
+ size_ = new_size;
if (resizing_mode_selector_->is_synchronous_mode()) {
- gfx::Rect new_pos(rootWindowRect().x,
- rootWindowRect().y,
- size_.width(),
- size_.height());
+ WebRect new_pos(rootWindowRect().x,
+ rootWindowRect().y,
+ new_size.width,
+ new_size.height);
view_screen_rect_ = new_pos;
window_screen_rect_ = new_pos;
}
@@ -1714,8 +1712,9 @@
Send(new ViewHostMsg_SetTooltipText(routing_id_, text, hint));
}
-void RenderWidget::setWindowRect(const WebRect& rect_in_screen) {
- WebRect window_rect = rect_in_screen;
+void RenderWidget::setWindowRect(const WebRect& rect) {
+ // TODO(oshima): Scale back to DIP coordinates.
+ WebRect window_rect = rect;
if (popup_origin_scale_for_emulation_) {
float scale = popup_origin_scale_for_emulation_;
window_rect.x = popup_screen_origin_for_emulation_.x() +
@@ -2104,10 +2103,16 @@
WebRect focus_webrect;
WebRect anchor_webrect;
webwidget_->selectionBounds(focus_webrect, anchor_webrect);
- convertViewportToWindow(&focus_webrect);
- convertViewportToWindow(&anchor_webrect);
- *focus = focus_webrect;
- *anchor = anchor_webrect;
+ if (IsUseZoomForDSFEnabled()) {
+ float inverse_scale = 1.f / device_scale_factor_;
+ gfx::RectF focus_rect(focus_webrect);
+ *focus = gfx::ToEnclosingRect(gfx::ScaleRect(focus_rect, inverse_scale));
+ gfx::RectF anchor_rect(anchor_webrect);
+ *anchor = gfx::ToEnclosingRect(gfx::ScaleRect(anchor_rect, inverse_scale));
+ } else {
+ *focus = focus_webrect;
+ *anchor = anchor_webrect;
+ }
}
void RenderWidget::UpdateSelectionBounds() {
« 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