Bug 1662014 - Remove unused fields/APIs. r=botond,tnikkel

These things are all unused now.

Differential Revision: https://phabricator.services.mozilla.com/D88750
This commit is contained in:
Kartikaya Gupta 2020-09-12 13:06:39 +00:00
Родитель 97dbe7a253
Коммит 8b10d15d15
6 изменённых файлов: 5 добавлений и 159 удалений

Просмотреть файл

@ -89,10 +89,8 @@ struct FrameMetrics {
mCumulativeResolution(),
mDevPixelsPerCSSPixel(1),
mScrollOffset(0, 0),
mBaseScrollOffset(0, 0),
mZoom(),
mScrollGeneration(0),
mSmoothScrollOffset(0, 0),
mRootCompositionSize(0, 0),
mDisplayPortMargins(0, 0, 0, 0),
mPresShellId(-1),
@ -103,8 +101,6 @@ struct FrameMetrics {
mVisualDestination(0, 0),
mVisualScrollUpdateType(eNone),
mIsRootContent(false),
mIsRelative(false),
mDoSmoothScroll(false),
mIsScrollInfoLayer(false) {}
// Default copy ctor and operator= are fine
@ -120,10 +116,8 @@ struct FrameMetrics {
mCumulativeResolution == aOther.mCumulativeResolution &&
mDevPixelsPerCSSPixel == aOther.mDevPixelsPerCSSPixel &&
mScrollOffset == aOther.mScrollOffset &&
mBaseScrollOffset == aOther.mBaseScrollOffset &&
// don't compare mZoom
mScrollGeneration == aOther.mScrollGeneration &&
mSmoothScrollOffset == aOther.mSmoothScrollOffset &&
mRootCompositionSize == aOther.mRootCompositionSize &&
mDisplayPortMargins == aOther.mDisplayPortMargins &&
mPresShellId == aOther.mPresShellId &&
@ -134,11 +128,8 @@ struct FrameMetrics {
mVisualDestination == aOther.mVisualDestination &&
mVisualScrollUpdateType == aOther.mVisualScrollUpdateType &&
mIsRootContent == aOther.mIsRootContent &&
mIsRelative == aOther.mIsRelative &&
mDoSmoothScroll == aOther.mDoSmoothScroll &&
mIsScrollInfoLayer == aOther.mIsScrollInfoLayer &&
mFixedLayerMargins == aOther.mFixedLayerMargins &&
mPureRelativeOffset == aOther.mPureRelativeOffset;
mFixedLayerMargins == aOther.mFixedLayerMargins;
}
bool operator!=(const FrameMetrics& aOther) const {
@ -277,10 +268,6 @@ struct FrameMetrics {
SetLayoutScrollOffset(aInfo.GetDestination());
mScrollGeneration = aInfo.GetGeneration();
mScrollUpdateType = ePending;
mIsRelative = aInfo.GetType() == ScrollUpdateType::Relative;
if (mIsRelative) {
mBaseScrollOffset = aInfo.GetSource();
}
}
public:
@ -334,17 +321,11 @@ struct FrameMetrics {
bool IsRootContent() const { return mIsRootContent; }
void SetBaseScrollOffset(const CSSPoint& aScrollOffset) {
mBaseScrollOffset = aScrollOffset;
}
// Set scroll offset, first clamping to the scroll range.
void ClampAndSetVisualScrollOffset(const CSSPoint& aScrollOffset) {
SetVisualScrollOffset(CalculateScrollRange().ClampPoint(aScrollOffset));
}
const CSSPoint& GetBaseScrollOffset() const { return mBaseScrollOffset; }
CSSPoint GetLayoutScrollOffset() const { return mLayoutViewport.TopLeft(); }
void SetLayoutScrollOffset(const CSSPoint& aLayoutScrollOffset) {
mLayoutViewport.MoveTo(aLayoutScrollOffset);
@ -355,17 +336,6 @@ struct FrameMetrics {
mScrollOffset = aVisualScrollOffset;
}
void SetSmoothScrollOffset(const CSSPoint& aSmoothScrollDestination) {
mSmoothScrollOffset = aSmoothScrollDestination;
}
void ClampAndSetSmoothScrollOffset(const CSSPoint& aSmoothScrollOffset) {
SetSmoothScrollOffset(
CalculateScrollRange().ClampPoint(aSmoothScrollOffset));
}
const CSSPoint& GetSmoothScrollOffset() const { return mSmoothScrollOffset; }
void SetZoom(const CSSToParentLayerScale2D& aZoom) { mZoom = aZoom; }
const CSSToParentLayerScale2D& GetZoom() const { return mZoom; }
@ -378,25 +348,10 @@ struct FrameMetrics {
mScrollUpdateType = aScrollUpdateType;
}
void SetSmoothScrollOffsetUpdated(int32_t aScrollGeneration) {
mDoSmoothScroll = true;
mScrollGeneration = aScrollGeneration;
}
ScrollOffsetUpdateType GetScrollUpdateType() const {
return mScrollUpdateType;
}
bool GetScrollOffsetUpdated() const { return mScrollUpdateType != eNone; }
void SetIsRelative(bool aIsRelative) { mIsRelative = aIsRelative; }
bool IsRelative() const { return mIsRelative; }
bool IsPureRelative() const { return mPureRelativeOffset.isSome(); }
bool GetDoSmoothScroll() const { return mDoSmoothScroll; }
uint32_t GetScrollGeneration() const { return mScrollGeneration; }
ViewID GetScrollId() const { return mScrollId; }
@ -491,10 +446,6 @@ struct FrameMetrics {
return mFixedLayerMargins;
}
void SetPureRelativeOffset(const Maybe<CSSPoint>& aPureRelativeOffset) {
mPureRelativeOffset = aPureRelativeOffset;
}
// Helper function for RecalculateViewportOffset(). Exposed so that
// APZC can perform the operation on other copies of the layout
// and visual viewport rects (e.g. the "effective" ones used to implement
@ -598,10 +549,6 @@ struct FrameMetrics {
// be within |mScrollableRect|.
CSSPoint mScrollOffset;
// The base scroll offset to use for calculating a relative update to a
// scroll offset.
CSSPoint mBaseScrollOffset;
// The "user zoom". Content is painted by gecko at mCumulativeResolution *
// mDevPixelsPerCSSPixel, but will be drawn to the screen at mZoom. In the
// steady state, the two will be the same, but during an async zoom action the
@ -612,10 +559,6 @@ struct FrameMetrics {
// The scroll generation counter used to acknowledge the scroll offset update.
uint32_t mScrollGeneration;
// If mDoSmoothScroll is true, the scroll offset will be animated smoothly
// to this value.
CSSPoint mSmoothScrollOffset;
// The size of the root scrollable's composition bounds, but in local CSS
// pixels.
CSSSize mRootCompositionSize;
@ -666,21 +609,9 @@ struct FrameMetrics {
// root-content scroll frame.
ScreenMargin mFixedLayerMargins;
// When this is Some it means a smooth scroll is requested with the
// destination being the current scroll offset plus this relative offset.
Maybe<CSSPoint> mPureRelativeOffset;
// Whether or not this is the root scroll frame for the root content document.
bool mIsRootContent : 1;
// When mIsRelative, the scroll offset was updated using a relative API,
// such as `ScrollBy`, and can combined with an async scroll.
bool mIsRelative : 1;
// When mDoSmoothScroll, the scroll offset should be animated to
// smoothly transition to mScrollOffset rather than be updated instantly.
bool mDoSmoothScroll : 1;
// True if this scroll frame is a scroll info layer. A scroll info layer is
// not layerized and its content cannot be truly async-scrolled, but its
// metrics are still sent to and updated by the compositor, with the updates
@ -701,9 +632,6 @@ struct FrameMetrics {
// The ParamTraits specialization in LayersMessageUtils.h
//
// Please add new fields above this comment.
// Private helpers for IPC purposes
void SetDoSmoothScroll(bool aValue) { mDoSmoothScroll = aValue; }
};
struct ScrollSnapInfo {

Просмотреть файл

@ -228,9 +228,6 @@ void AppendToString(std::stringstream& aStream, const FrameMetrics& m,
if (m.GetVisualScrollUpdateType() != FrameMetrics::eNone) {
AppendToString(aStream, m.GetVisualDestination(), "] [vd=");
}
if (m.GetDoSmoothScroll()) {
AppendToString(aStream, m.GetSmoothScrollOffset(), "] [ss=");
}
AppendToString(aStream, m.GetDisplayPort(), "] [dp=");
AppendToString(aStream, m.GetCriticalDisplayPort(), "] [cdp=");
if (!detailed) {
@ -250,10 +247,9 @@ void AppendToString(std::stringstream& aStream, const FrameMetrics& m,
AppendToString(aStream, m.GetCumulativeResolution(), " cr=");
AppendToString(aStream, m.GetZoom(), " z=");
AppendToString(aStream, m.GetExtraResolution(), " er=");
aStream << nsPrintfCString(")] [u=(%d %d %d %" PRIu32 ")",
m.GetScrollUpdateType(),
m.GetVisualScrollUpdateType(),
m.GetDoSmoothScroll(), m.GetScrollGeneration())
aStream << nsPrintfCString(
")] [u=(%d %d %" PRIu32 ")", m.GetScrollUpdateType(),
m.GetVisualScrollUpdateType(), m.GetScrollGeneration())
.get();
aStream << nsPrintfCString("] [i=(%" PRIu32 " %" PRIu64 " %d)] }",
m.GetPresShellId(), m.GetScrollId(),

Просмотреть файл

@ -199,10 +199,8 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
WriteParam(aMsg, aParam.mCumulativeResolution);
WriteParam(aMsg, aParam.mDevPixelsPerCSSPixel);
WriteParam(aMsg, aParam.mScrollOffset);
WriteParam(aMsg, aParam.mBaseScrollOffset);
WriteParam(aMsg, aParam.mZoom);
WriteParam(aMsg, aParam.mScrollGeneration);
WriteParam(aMsg, aParam.mSmoothScrollOffset);
WriteParam(aMsg, aParam.mRootCompositionSize);
WriteParam(aMsg, aParam.mDisplayPortMargins);
WriteParam(aMsg, aParam.mPresShellId);
@ -213,10 +211,7 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
WriteParam(aMsg, aParam.mVisualDestination);
WriteParam(aMsg, aParam.mVisualScrollUpdateType);
WriteParam(aMsg, aParam.mFixedLayerMargins);
WriteParam(aMsg, aParam.mPureRelativeOffset);
WriteParam(aMsg, aParam.mIsRootContent);
WriteParam(aMsg, aParam.mIsRelative);
WriteParam(aMsg, aParam.mDoSmoothScroll);
WriteParam(aMsg, aParam.mIsScrollInfoLayer);
}
@ -232,10 +227,8 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
ReadParam(aMsg, aIter, &aResult->mCumulativeResolution) &&
ReadParam(aMsg, aIter, &aResult->mDevPixelsPerCSSPixel) &&
ReadParam(aMsg, aIter, &aResult->mScrollOffset) &&
ReadParam(aMsg, aIter, &aResult->mBaseScrollOffset) &&
ReadParam(aMsg, aIter, &aResult->mZoom) &&
ReadParam(aMsg, aIter, &aResult->mScrollGeneration) &&
ReadParam(aMsg, aIter, &aResult->mSmoothScrollOffset) &&
ReadParam(aMsg, aIter, &aResult->mRootCompositionSize) &&
ReadParam(aMsg, aIter, &aResult->mDisplayPortMargins) &&
ReadParam(aMsg, aIter, &aResult->mPresShellId) &&
@ -246,12 +239,8 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
ReadParam(aMsg, aIter, &aResult->mVisualDestination) &&
ReadParam(aMsg, aIter, &aResult->mVisualScrollUpdateType) &&
ReadParam(aMsg, aIter, &aResult->mFixedLayerMargins) &&
ReadParam(aMsg, aIter, &aResult->mPureRelativeOffset) &&
ReadBoolForBitfield(aMsg, aIter, aResult,
&paramType::SetIsRootContent) &&
ReadBoolForBitfield(aMsg, aIter, aResult, &paramType::SetIsRelative) &&
ReadBoolForBitfield(aMsg, aIter, aResult,
&paramType::SetDoSmoothScroll) &&
ReadBoolForBitfield(aMsg, aIter, aResult,
&paramType::SetIsScrollInfoLayer));
}

Просмотреть файл

@ -9275,14 +9275,11 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
if (scrollableFrame) {
CSSPoint layoutScrollOffset =
CSSPoint::FromAppUnits(scrollableFrame->GetScrollPosition());
CSSPoint apzScrollPosition =
CSSPoint::FromAppUnits(scrollableFrame->GetApzScrollPosition());
CSSPoint visualScrollOffset =
aIsRootContent && presShell->IsVisualViewportOffsetSet()
? CSSPoint::FromAppUnits(presShell->GetVisualViewportOffset())
: layoutScrollOffset;
metrics.SetVisualScrollOffset(visualScrollOffset);
metrics.SetBaseScrollOffset(apzScrollPosition);
// APZ sometimes reads this even if we haven't set a visual scroll
// update type (specifically, in the isFirstPaint case), so always
// set it.
@ -9338,20 +9335,12 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
}
}
Maybe<nsPoint> relativeOffset = scrollableFrame->GetRelativeOffset();
if (relativeOffset.isSome()) {
metrics.SetScrollGeneration(scrollableFrame->CurrentScrollGeneration());
metrics.SetPureRelativeOffset(
Some(CSSPoint::FromAppUnits(*relativeOffset)));
}
metrics.SetScrollGeneration(scrollableFrame->CurrentScrollGeneration());
CSSRect viewport = metrics.GetLayoutViewport();
viewport.MoveTo(layoutScrollOffset);
metrics.SetLayoutViewport(viewport);
nsPoint smoothScrollPosition = scrollableFrame->LastScrollDestination();
metrics.SetSmoothScrollOffset(CSSPoint::FromAppUnits(smoothScrollPosition));
// If the frame was scrolled since the last layers update, and by something
// that is higher priority than APZ, we want to tell the APZ to update
// its scroll offset. We want to distinguish the case where the scroll
@ -9359,23 +9348,11 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
// should not overwrite a user-driven scroll.
ScrollOrigin lastOrigin = scrollableFrame->LastScrollOrigin();
if (lastOrigin == ScrollOrigin::Restore) {
metrics.SetScrollGeneration(scrollableFrame->CurrentScrollGeneration());
metrics.SetScrollOffsetUpdateType(FrameMetrics::eRestore);
} else if (CanScrollOriginClobberApz(lastOrigin)) {
if (lastOrigin == ScrollOrigin::Relative) {
metrics.SetIsRelative(true);
}
metrics.SetScrollGeneration(scrollableFrame->CurrentScrollGeneration());
metrics.SetScrollOffsetUpdateType(FrameMetrics::eMainThread);
}
ScrollOrigin lastSmoothScrollOrigin =
scrollableFrame->LastSmoothScrollOrigin();
if (lastSmoothScrollOrigin != ScrollOrigin::None) {
metrics.SetSmoothScrollOffsetUpdated(
scrollableFrame->CurrentScrollGeneration());
}
nsSize lineScrollAmount = scrollableFrame->GetLineScrollAmount();
LayoutDeviceIntSize lineScrollAmountInDevPixels =
LayoutDeviceIntSize::FromAppUnitsRounded(

Просмотреть файл

@ -172,7 +172,6 @@ class ScrollFrameHelper : public nsIReflowCallback {
pt.y = mScrollPort.y - mScrolledFrame->GetPosition().y;
return pt;
}
nsPoint GetApzScrollPosition() const { return mApzScrollPos; }
nsRect GetLayoutScrollRange() const;
// Get the scroll range assuming the viewport has size (aWidth, aHeight).
nsRect GetScrollRange(nscoord aWidth, nscoord aHeight) const;
@ -467,7 +466,6 @@ class ScrollFrameHelper : public nsIReflowCallback {
void ResetScrollInfoIfNeeded(uint32_t aGeneration,
bool aApzAnimationInProgress);
Maybe<nsPoint> GetRelativeOffset() const { return mRelativeOffset; }
bool WantAsyncScroll() const;
Maybe<mozilla::layers::ScrollMetadata> ComputeScrollMetadata(
LayerManager* aLayerManager, const nsIFrame* aContainerReferenceFrame,
@ -927,9 +925,6 @@ class nsHTMLScrollFrame : public nsContainerFrame,
nsPoint GetLogicalScrollPosition() const final {
return mHelper.GetLogicalScrollPosition();
}
nsPoint GetApzScrollPosition() const final {
return mHelper.GetApzScrollPosition();
}
nsRect GetScrollRange() const final { return mHelper.GetLayoutScrollRange(); }
nsSize GetVisualViewportSize() const final {
return mHelper.GetVisualViewportSize();
@ -1046,9 +1041,6 @@ class nsHTMLScrollFrame : public nsContainerFrame,
return mHelper.ExpandRectToNearlyVisible(aRect);
}
ScrollOrigin LastScrollOrigin() final { return mHelper.LastScrollOrigin(); }
ScrollOrigin LastSmoothScrollOrigin() final {
return mHelper.LastSmoothScrollOrigin();
}
bool IsScrollAnimating(IncludeApzAnimation aIncludeApz) final {
return mHelper.IsScrollAnimating(aIncludeApz);
}
@ -1065,9 +1057,6 @@ class nsHTMLScrollFrame : public nsContainerFrame,
bool aApzAnimationInProgress) final {
mHelper.ResetScrollInfoIfNeeded(aGeneration, aApzAnimationInProgress);
}
Maybe<nsPoint> GetRelativeOffset() const final {
return mHelper.GetRelativeOffset();
}
bool WantAsyncScroll() const final { return mHelper.WantAsyncScroll(); }
mozilla::Maybe<mozilla::layers::ScrollMetadata> ComputeScrollMetadata(
LayerManager* aLayerManager, const nsIFrame* aContainerReferenceFrame,
@ -1412,9 +1401,6 @@ class nsXULScrollFrame final : public nsBoxFrame,
nsPoint GetLogicalScrollPosition() const final {
return mHelper.GetLogicalScrollPosition();
}
nsPoint GetApzScrollPosition() const final {
return mHelper.GetApzScrollPosition();
}
nsRect GetScrollRange() const final { return mHelper.GetLayoutScrollRange(); }
nsSize GetVisualViewportSize() const final {
return mHelper.GetVisualViewportSize();
@ -1527,9 +1513,6 @@ class nsXULScrollFrame final : public nsBoxFrame,
return mHelper.ExpandRectToNearlyVisible(aRect);
}
ScrollOrigin LastScrollOrigin() final { return mHelper.LastScrollOrigin(); }
ScrollOrigin LastSmoothScrollOrigin() final {
return mHelper.LastSmoothScrollOrigin();
}
bool IsScrollAnimating(IncludeApzAnimation aIncludeApz) final {
return mHelper.IsScrollAnimating(aIncludeApz);
}
@ -1546,9 +1529,6 @@ class nsXULScrollFrame final : public nsBoxFrame,
bool aApzAnimationInProgress) final {
mHelper.ResetScrollInfoIfNeeded(aGeneration, aApzAnimationInProgress);
}
Maybe<nsPoint> GetRelativeOffset() const final {
return mHelper.GetRelativeOffset();
}
bool WantAsyncScroll() const final { return mHelper.WantAsyncScroll(); }
mozilla::Maybe<mozilla::layers::ScrollMetadata> ComputeScrollMetadata(
LayerManager* aLayerManager, const nsIFrame* aContainerReferenceFrame,

Просмотреть файл

@ -182,11 +182,6 @@ class nsIScrollableFrame : public nsIScrollbarMediator {
* As GetScrollPosition(), but uses the top-right as origin for RTL frames.
*/
virtual nsPoint GetLogicalScrollPosition() const = 0;
/**
* Get the latest scroll position that the main thread has sent or received
* from APZ.
*/
virtual nsPoint GetApzScrollPosition() const = 0;
/**
* Get the area that must contain the scroll position. Typically
@ -423,21 +418,6 @@ class nsIScrollableFrame : public nsIScrollbarMediator {
* latest instant scroll.
*/
virtual ScrollOrigin LastScrollOrigin() = 0;
/**
* Returns the origin that triggered the last smooth scroll.
* Will equal ScrollOrigin::Apz when the compositor's replica frame
* metrics includes the latest smooth scroll. The compositor will always
* perform an instant scroll prior to instantiating any smooth scrolls
* if LastScrollOrigin and LastSmoothScrollOrigin indicate that
* an instant scroll and a smooth scroll have occurred since the last
* replication of the frame metrics.
*
* This is set to nullptr to when the compositor thread acknowledges that
* the smooth scroll has been started. If the smooth scroll has been stomped
* by an instant scroll before the smooth scroll could be started by the
* compositor, this is set to nullptr to clear the smooth scroll.
*/
virtual ScrollOrigin LastSmoothScrollOrigin() = 0;
/**
* Returns whether there's an async scroll going on.
@ -475,10 +455,6 @@ class nsIScrollableFrame : public nsIScrollbarMediator {
*/
virtual void ResetScrollInfoIfNeeded(uint32_t aGeneration,
bool aApzAnimationInProgress) = 0;
/**
* Relative scrolling offset to be requested of apz.
*/
virtual Maybe<nsPoint> GetRelativeOffset() const = 0;
/**
* Determine whether it is desirable to be able to asynchronously scroll this
* scroll frame.