Bug 1732600. Update a comment on FrameMetrics::mCumulativeResolution. r=botond
authorTimothy Nikkel <tnikkel@gmail.com>
Tue, 05 Oct 2021 09:28:56 +0000
changeset 594573 832e46a8892203ca4775e98d55d6c744d8953160
parent 594572 97e9af4c41f02629a0defaefa6d9049847432fe6
child 594574 fcba9b3345131a80dd5ef7e3299250bf34b6d355
push id38849
push usernerli@mozilla.com
push dateTue, 05 Oct 2021 15:48:45 +0000
treeherdermozilla-central@04a3446f3ae3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1732600
milestone95.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1732600. Update a comment on FrameMetrics::mCumulativeResolution. r=botond This is the conclusion we came to after some discussion. Differential Revision: https://phabricator.services.mozilla.com/D126628
gfx/layers/FrameMetrics.h
gfx/layers/RepaintRequest.h
--- a/gfx/layers/FrameMetrics.h
+++ b/gfx/layers/FrameMetrics.h
@@ -567,23 +567,33 @@ struct FrameMetrics {
   // will match the composition bounds width and height. In effect this reduces
   // the scrollable range to 0.
   //
   // This is in the same coordinate space as |mScrollOffset|, but a different
   // coordinate space than |mDisplayPort|. Note also that this coordinate
   // system is understood by window.scrollTo().
   CSSRect mScrollableRect;
 
-  // The cumulative resolution that the current frame has been painted at.
-  // This is the product of the pres-shell resolutions of the document
-  // containing this scroll frame and its ancestors, and any css-driven
-  // resolution. This information is provided by Gecko at layout/paint time.
-  // Note that this is allowed to have different x- and y-scales, but only
-  // for subframes (mIsRootContent = false). (The same applies to other scales
-  // that "inherit" the 2D-ness of this one, such as mZoom.)
+  // The cumulative resolution of the current frame. This is the product of the
+  // pres-shell resolutions of the document containing this scroll frame and its
+  // in-process ancestors. This information is provided by Gecko at layout/paint
+  // time. Notably, for out of process iframes cumulative resolution will be 1.
+  // The reason for this is that AsyncPanZoomController::GetTransformToThis does
+  // not contain the resolution in the process of the root content document, but
+  // in oop iframes AsyncPanZoomController::GetTransformToThis does contain the
+  // resolution. This makes coordinate math work out in APZ code because in the
+  // old layers backend GetTransformToThis was a transform of rendered pixels,
+  // and the pixels were rendered with the scale applied already. The reason
+  // that AsyncPanZoomController::GetTransformToThis contains the scale in oop
+  // iframes is because we include the resolution in the transform that includes
+  // the iframe via this call
+  // https://searchfox.org/mozilla-central/rev/2eebd6e256fa0355e08421265e57ee1307836d92/layout/generic/nsSubDocumentFrame.cpp#1404
+  // So when coordinates are passed to the process of the oop iframe they have
+  // the resolution removed by unapplying that transform which includes the
+  // resolution.
   LayoutDeviceToLayerScale2D mCumulativeResolution;
 
   // The conversion factor between CSS pixels and device pixels for this frame.
   // This can vary based on a variety of things, such as reflowing-zoom.
   CSSToLayoutDeviceScale mDevPixelsPerCSSPixel;
 
   // The position of the top-left of the scroll frame's scroll port, relative
   // to the scrollable content's origin.
--- a/gfx/layers/RepaintRequest.h
+++ b/gfx/layers/RepaintRequest.h
@@ -223,23 +223,17 @@ struct RepaintRequest {
   // The origin of the composition bounds is relative to the layer tree origin.
   // Unlike the scroll port's origin, it does not change during scrolling of
   // the scrollable layer to which it is associated. However, it may change due
   // to scrolling of ancestor layers.
   //
   // This value is provided by Gecko at layout/paint time.
   ParentLayerRect mCompositionBounds;
 
-  // The cumulative resolution that the current frame has been painted at.
-  // This is the product of the pres-shell resolutions of the document
-  // containing this scroll frame and its ancestors, and any css-driven
-  // resolution. This information is provided by Gecko at layout/paint time.
-  // Note that this is allowed to have different x- and y-scales, but only
-  // for subframes (mIsRootContent = false). (The same applies to other scales
-  // that "inherit" the 2D-ness of this one, such as mZoom.)
+  // See FrameMetrics::mCumulativeResolution for description.
   LayoutDeviceToLayerScale2D mCumulativeResolution;
 
   // The conversion factor between CSS pixels and device pixels for this frame.
   // This can vary based on a variety of things, such as reflowing-zoom.
   CSSToLayoutDeviceScale mDevPixelsPerCSSPixel;
 
   // The position of the top-left of the scroll frame's scroll port, relative
   // to the scrollable content's origin.