Revert "Plumb proper OOPIF compositor viewport rect."

This reverts commit 4a10b100d48705d18521f424dd40baf9393d831e.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Plumb proper OOPIF compositor viewport rect.
> 
> This CL converts OOPIFs from using a compositor viewport that is the
> entire size of the content layer, to a much smaller one based on the
> visible intersection of the OOPIF's content with its parent's viewport.
> 
> This should decrease compositor resources used by the OOPIF, and
> prevent excessively large tiles being produced.
> 
> Bug: 852348
> Change-Id: I27977e2513d727bc6ba1a414504157cef3436a03
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1778362
> Commit-Queue: Alex Moshchuk <[email protected]>
> Reviewed-by: Alex Moshchuk <[email protected]>
> Reviewed-by: Philip Rogers <[email protected]>
> Reviewed-by: Mike West <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#694066}

[email protected],[email protected],[email protected],[email protected]

Change-Id: Id0cdb4c77487861f8da76dd9de44768097bf480a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 852348
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1789687
Reviewed-by: Tao Bai <[email protected]>
Commit-Queue: Tao Bai <[email protected]>
Cr-Commit-Position: refs/heads/master@{#694257}
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 01ecce0..1598494e 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -765,10 +765,9 @@
   if (device_scale_factor_for_testing_) {
     visual_properties.screen_info.device_scale_factor =
         device_scale_factor_for_testing_;
-    visual_properties.compositor_viewport_pixel_rect =
-        gfx::Rect(gfx::ScaleToCeiledSize(
-            visual_properties.new_size,
-            visual_properties.screen_info.device_scale_factor));
+    visual_properties.compositor_viewport_pixel_size = gfx::ScaleToCeiledSize(
+        visual_properties.new_size,
+        visual_properties.screen_info.device_scale_factor);
   }
 
   // Inform the rendering thread of the color space indicating the presence of
@@ -921,7 +920,8 @@
     VisualProperties visual_properties;
     visual_properties.screen_info = screen_info_;
     visual_properties.new_size = size_;
-    visual_properties.compositor_viewport_pixel_rect = CompositorViewportRect();
+    visual_properties.compositor_viewport_pixel_size =
+        CompositorViewportRect().size();
     visual_properties.local_surface_id_allocation =
         local_surface_id_allocation_from_parent_;
     visual_properties.visible_viewport_size = visible_viewport_size_;
@@ -1650,15 +1650,16 @@
 
 void RenderWidget::SynchronizeVisualProperties(
     const VisualProperties& visual_properties) {
-  gfx::Rect new_compositor_viewport_pixel_rect =
+  gfx::Size new_compositor_viewport_pixel_size =
       visual_properties.auto_resize_enabled
-          ? gfx::Rect(gfx::ScaleToCeiledSize(
-                size_, visual_properties.screen_info.device_scale_factor))
-          : visual_properties.compositor_viewport_pixel_rect;
+          ? gfx::ScaleToCeiledSize(
+                size_, visual_properties.screen_info.device_scale_factor)
+          : visual_properties.compositor_viewport_pixel_size;
   UpdateSurfaceAndScreenInfo(
       visual_properties.local_surface_id_allocation.value_or(
           viz::LocalSurfaceIdAllocation()),
-      new_compositor_viewport_pixel_rect, visual_properties.screen_info);
+      gfx::Rect(new_compositor_viewport_pixel_size),
+      visual_properties.screen_info);
   UpdateCaptureSequenceNumber(visual_properties.capture_sequence_number);
   layer_tree_view_->layer_tree_host()->SetBrowserControlsHeight(
       visual_properties.top_controls_height,
@@ -2217,15 +2218,15 @@
   local_surface_id_allocation_from_parent_ = new_local_surface_id_allocation;
   screen_info_ = new_screen_info;
 
-  // The ViewportVisibleRect derives from the LayerTreeView's viewport size,
-  // which is set above.
-  layer_tree_view_->SetViewportVisibleRect(ViewportVisibleRect());
   // Note carefully that the DSF specified in |new_screen_info| is not the
   // DSF used by the compositor during device emulation!
   layer_tree_view_->SetViewportRectAndScale(
       compositor_viewport_pixel_rect,
       GetOriginalScreenInfo().device_scale_factor,
       local_surface_id_allocation_from_parent_);
+  // The ViewportVisibleRect derives from the LayerTreeView's viewport size,
+  // which is set above.
+  layer_tree_view_->SetViewportVisibleRect(ViewportVisibleRect());
   layer_tree_view_->SetRasterColorSpace(
       screen_info_.color_space.GetRasterColorSpace());
 
@@ -2250,9 +2251,8 @@
   VisualProperties visual_properties;
   visual_properties.screen_info = screen_info_;
   visual_properties.new_size = new_window_rect.size();
-  visual_properties.compositor_viewport_pixel_rect =
-      gfx::Rect(gfx::ScaleToCeiledSize(new_window_rect.size(),
-                                       GetWebScreenInfo().device_scale_factor));
+  visual_properties.compositor_viewport_pixel_size = gfx::ScaleToCeiledSize(
+      new_window_rect.size(), GetWebScreenInfo().device_scale_factor);
   visual_properties.visible_viewport_size = new_window_rect.size();
   visual_properties.is_fullscreen_granted = is_fullscreen_granted_;
   visual_properties.display_mode = display_mode_;
@@ -2681,13 +2681,13 @@
 
     // TODO(ccameron): Note that this destroys any information differentiating
     // |size_| from the compositor's viewport size. Also note that the
-    // calculation of |new_compositor_viewport_pixel_rect| does not appear to
+    // calculation of |new_compositor_viewport_pixel_size| does not appear to
     // take into account device emulation.
     layer_tree_view_->RequestNewLocalSurfaceId();
-    gfx::Rect new_compositor_viewport_pixel_rect = gfx::Rect(
-        gfx::ScaleToCeiledSize(size_, GetWebScreenInfo().device_scale_factor));
+    gfx::Size new_compositor_viewport_pixel_size =
+        gfx::ScaleToCeiledSize(size_, GetWebScreenInfo().device_scale_factor);
     UpdateSurfaceAndScreenInfo(local_surface_id_allocation_from_parent_,
-                               new_compositor_viewport_pixel_rect,
+                               gfx::Rect(new_compositor_viewport_pixel_size),
                                screen_info_);
   }
 }
@@ -3767,7 +3767,7 @@
 
   // Make sure the DSF override stays for future VisualProperties updates, and
   // that includes overriding the VisualProperties'
-  // compositor_viewport_pixel_rect with size * this for-testing DSF.
+  // compositor_viewport_pixel_size with size * this for-testing DSF.
   device_scale_factor_for_testing_ = factor;
 }
 
@@ -3810,7 +3810,8 @@
   visual_properties.auto_resize_enabled = false;
   visual_properties.screen_info = screen_info_;
   visual_properties.new_size = new_size;
-  visual_properties.compositor_viewport_pixel_rect = CompositorViewportRect();
+  visual_properties.compositor_viewport_pixel_size =
+      CompositorViewportRect().size();
   visual_properties.browser_controls_shrink_blink_size =
       browser_controls_shrink_blink_size_;
   visual_properties.top_controls_height = top_controls_height_;