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

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

Issue 2143643002: Remove didAutoResize from WebWidgetClient and move it to WebViewClient.. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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
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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 1068
1069 void RenderWidget::SetScreenRects(const gfx::Rect& view_screen_rect, 1069 void RenderWidget::SetScreenRects(const gfx::Rect& view_screen_rect,
1070 const gfx::Rect& window_screen_rect) { 1070 const gfx::Rect& window_screen_rect) {
1071 view_screen_rect_ = view_screen_rect; 1071 view_screen_rect_ = view_screen_rect;
1072 window_screen_rect_ = window_screen_rect; 1072 window_screen_rect_ = window_screen_rect;
1073 } 1073 }
1074 1074
1075 /////////////////////////////////////////////////////////////////////////////// 1075 ///////////////////////////////////////////////////////////////////////////////
1076 // WebWidgetClient 1076 // WebWidgetClient
1077 1077
1078 void RenderWidget::didAutoResize(const WebSize& new_size) {
1079 WebRect new_size_in_window(0, 0, new_size.width, new_size.height);
1080 convertViewportToWindow(&new_size_in_window);
1081 if (size_.width() != new_size_in_window.width ||
1082 size_.height() != new_size_in_window.height) {
1083 size_ = gfx::Size(new_size_in_window.width, new_size_in_window.height);
1084
1085 if (resizing_mode_selector_->is_synchronous_mode()) {
1086 gfx::Rect new_pos(rootWindowRect().x,
1087 rootWindowRect().y,
1088 size_.width(),
1089 size_.height());
1090 view_screen_rect_ = new_pos;
1091 window_screen_rect_ = new_pos;
1092 }
1093
1094 AutoResizeCompositor();
1095
1096 if (!resizing_mode_selector_->is_synchronous_mode())
1097 need_update_rect_for_auto_resize_ = true;
1098 }
1099 }
1100
1101 void RenderWidget::AutoResizeCompositor() { 1078 void RenderWidget::AutoResizeCompositor() {
1102 physical_backing_size_ = gfx::ScaleToCeiledSize(size_, device_scale_factor_); 1079 physical_backing_size_ = gfx::ScaleToCeiledSize(size_, device_scale_factor_);
1103 if (compositor_) 1080 if (compositor_)
1104 compositor_->setViewportSize(physical_backing_size_); 1081 compositor_->setViewportSize(physical_backing_size_);
1105 } 1082 }
1106 1083
1107 void RenderWidget::initializeLayerTreeView() { 1084 void RenderWidget::initializeLayerTreeView() {
1108 DCHECK(!host_closing_); 1085 DCHECK(!host_closing_);
1109 1086
1110 compositor_ = RenderWidgetCompositor::Create(this, device_scale_factor_, 1087 compositor_ = RenderWidgetCompositor::Create(this, device_scale_factor_,
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 const std::vector<char>& color_profile) { 1702 const std::vector<char>& color_profile) {
1726 SetDeviceColorProfile(color_profile); 1703 SetDeviceColorProfile(color_profile);
1727 } 1704 }
1728 1705
1729 void RenderWidget::ResetDeviceColorProfileForTesting() { 1706 void RenderWidget::ResetDeviceColorProfileForTesting() {
1730 std::vector<char> color_profile; 1707 std::vector<char> color_profile;
1731 color_profile.push_back('0'); 1708 color_profile.push_back('0');
1732 SetDeviceColorProfile(color_profile); 1709 SetDeviceColorProfile(color_profile);
1733 } 1710 }
1734 1711
1712 void RenderWidget::DidAutoResize(const gfx::Size& new_size) {
1713 WebRect new_size_in_window(0, 0, new_size.width(), new_size.height());
1714 convertViewportToWindow(&new_size_in_window);
1715 if (size_.width() != new_size_in_window.width ||
1716 size_.height() != new_size_in_window.height) {
1717 size_ = gfx::Size(new_size_in_window.width, new_size_in_window.height);
1718
1719 if (resizing_mode_selector_->is_synchronous_mode()) {
1720 gfx::Rect new_pos(rootWindowRect().x, rootWindowRect().y, size_.width(),
1721 size_.height());
1722 view_screen_rect_ = new_pos;
1723 window_screen_rect_ = new_pos;
1724 }
1725
1726 AutoResizeCompositor();
1727
1728 if (!resizing_mode_selector_->is_synchronous_mode())
1729 need_update_rect_for_auto_resize_ = true;
1730 }
1731 }
1732
1735 // Check blink::WebTextInputType and ui::TextInputType is kept in sync. 1733 // Check blink::WebTextInputType and ui::TextInputType is kept in sync.
1736 STATIC_ASSERT_ENUM(blink::WebTextInputTypeNone, ui::TEXT_INPUT_TYPE_NONE); 1734 STATIC_ASSERT_ENUM(blink::WebTextInputTypeNone, ui::TEXT_INPUT_TYPE_NONE);
1737 STATIC_ASSERT_ENUM(blink::WebTextInputTypeText, ui::TEXT_INPUT_TYPE_TEXT); 1735 STATIC_ASSERT_ENUM(blink::WebTextInputTypeText, ui::TEXT_INPUT_TYPE_TEXT);
1738 STATIC_ASSERT_ENUM(blink::WebTextInputTypePassword, 1736 STATIC_ASSERT_ENUM(blink::WebTextInputTypePassword,
1739 ui::TEXT_INPUT_TYPE_PASSWORD); 1737 ui::TEXT_INPUT_TYPE_PASSWORD);
1740 STATIC_ASSERT_ENUM(blink::WebTextInputTypeSearch, ui::TEXT_INPUT_TYPE_SEARCH); 1738 STATIC_ASSERT_ENUM(blink::WebTextInputTypeSearch, ui::TEXT_INPUT_TYPE_SEARCH);
1741 STATIC_ASSERT_ENUM(blink::WebTextInputTypeEmail, ui::TEXT_INPUT_TYPE_EMAIL); 1739 STATIC_ASSERT_ENUM(blink::WebTextInputTypeEmail, ui::TEXT_INPUT_TYPE_EMAIL);
1742 STATIC_ASSERT_ENUM(blink::WebTextInputTypeNumber, ui::TEXT_INPUT_TYPE_NUMBER); 1740 STATIC_ASSERT_ENUM(blink::WebTextInputTypeNumber, ui::TEXT_INPUT_TYPE_NUMBER);
1743 STATIC_ASSERT_ENUM(blink::WebTextInputTypeTelephone, 1741 STATIC_ASSERT_ENUM(blink::WebTextInputTypeTelephone,
1744 ui::TEXT_INPUT_TYPE_TELEPHONE); 1742 ui::TEXT_INPUT_TYPE_TELEPHONE);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 void RenderWidget::requestPointerUnlock() { 1977 void RenderWidget::requestPointerUnlock() {
1980 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); 1978 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get());
1981 } 1979 }
1982 1980
1983 bool RenderWidget::isPointerLocked() { 1981 bool RenderWidget::isPointerLocked() {
1984 return mouse_lock_dispatcher_->IsMouseLockedTo( 1982 return mouse_lock_dispatcher_->IsMouseLockedTo(
1985 webwidget_mouse_lock_target_.get()); 1983 webwidget_mouse_lock_target_.get());
1986 } 1984 }
1987 1985
1988 } // namespace content 1986 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698