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

Unified Diff: content/browser/renderer_host/render_widget_host.cc

Issue 8704005: Add autoresize capability to chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Standardize on resize everywhere. Created 9 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/browser/renderer_host/render_widget_host.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host.cc
diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc
index f636de3c5543a3fa3ca036410b80edab1f99c169..295b90b79112dcca08cec272c42ecc8f7241db51 100644
--- a/content/browser/renderer_host/render_widget_host.cc
+++ b/content/browser/renderer_host/render_widget_host.cc
@@ -89,6 +89,7 @@ RenderWidgetHost::RenderWidgetHost(content::RenderProcessHost* process,
is_accelerated_compositing_active_(false),
repaint_ack_pending_(false),
resize_ack_pending_(false),
+ should_auto_resize_(false),
mouse_move_pending_(false),
mouse_wheel_pending_(false),
touch_move_pending_(false),
@@ -332,7 +333,7 @@ void RenderWidgetHost::WasRestored() {
void RenderWidgetHost::WasResized() {
if (resize_ack_pending_ || !process_->HasConnection() || !view_ ||
- !renderer_initialized_) {
+ !renderer_initialized_ || should_auto_resize_) {
return;
}
@@ -868,6 +869,20 @@ bool RenderWidgetHost::IsFullscreen() const {
return false;
}
+void RenderWidgetHost::SetShouldAutoResize(bool enable) {
+ // Note if this switches from true to false then one has to verify that the
+ // mechanics about all the messaging works. For example, what happens to a
+ // update message rect that was in progress from the render widget. Perhaps,
+ // on a transition to false, this should do a WasResized, but what if that
+ // will not trigger a resize message...etc. Due to these complications it is
+ // fitting that this method doesn't look like a simple set method.
+ DCHECK(enable);
+
+ // TODO: Change this to enable instead of true when this supports turning
+ // off auto-resize.
+ should_auto_resize_ = true;
+}
+
void RenderWidgetHost::Destroy() {
content::NotificationService::current()->Notify(
content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
@@ -991,11 +1006,13 @@ void RenderWidgetHost::OnMsgUpdateRect(
// resize_ack_pending_ needs to be cleared before we call DidPaintRect, since
// that will end up reaching GetBackingStore.
- if (is_resize_ack) {
- DCHECK(resize_ack_pending_);
- resize_ack_pending_ = false;
- in_flight_size_.SetSize(0, 0);
- in_flight_reserved_rect_.SetRect(0, 0, 0, 0);
+ if (is_resize_ack || should_auto_resize_) {
+ if (is_resize_ack) {
+ DCHECK(resize_ack_pending_);
+ resize_ack_pending_ = false;
+ in_flight_size_.SetSize(0, 0);
+ in_flight_reserved_rect_.SetRect(0, 0, 0, 0);
+ }
// Update our knowledge of the RenderWidget's resizer rect.
// ViewMsg_Resize is acknowledged only when view size is actually changed,
// otherwise current_reserved_rect_ is updated immediately after sending
@@ -1056,6 +1073,10 @@ void RenderWidgetHost::OnMsgUpdateRect(
DidUpdateBackingStore(params, paint_start);
}
+ if (should_auto_resize_) {
+ OnRenderAutoResized(params.view_size);
+ }
+
// Log the time delta for processing a paint message. On platforms that don't
// support asynchronous painting, this is equivalent to
// MPArch.RWH_TotalPaintTime.
« no previous file with comments | « content/browser/renderer_host/render_widget_host.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698