Bug 1257641 - Replace the mUpdateScrollOffset bool with an enum, needed in the next patch. r?botond
MozReview-Commit-ID: Lm9spN2rwof
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -669,16 +669,24 @@ struct ParamTraits<nsRect>
}
};
template<>
struct ParamTraits<nsRegion>
: RegionParamTraits<nsRegion, nsRect, nsRegion::RectIterator>
{};
+template<>
+struct ParamTraits<mozilla::layers::FrameMetrics::ScrollOffsetUpdateType>
+ : public ContiguousEnumSerializer<
+ mozilla::layers::FrameMetrics::ScrollOffsetUpdateType,
+ mozilla::layers::FrameMetrics::ScrollOffsetUpdateType::eNone,
+ mozilla::layers::FrameMetrics::ScrollOffsetUpdateType::eSentinel>
+{};
+
template <>
struct ParamTraits<mozilla::layers::FrameMetrics>
{
typedef mozilla::layers::FrameMetrics paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, aParam.mScrollId);
@@ -699,19 +707,19 @@ struct ParamTraits<mozilla::layers::Fram
WriteParam(aMsg, aParam.mPresShellId);
WriteParam(aMsg, aParam.mViewport);
WriteParam(aMsg, aParam.mExtraResolution);
WriteParam(aMsg, aParam.mBackgroundColor);
WriteParam(aMsg, aParam.GetContentDescription());
WriteParam(aMsg, aParam.mLineScrollAmount);
WriteParam(aMsg, aParam.mPageScrollAmount);
WriteParam(aMsg, aParam.mPaintRequestTime);
+ WriteParam(aMsg, aParam.mScrollUpdateType);
WriteParam(aMsg, aParam.mIsRootContent);
WriteParam(aMsg, aParam.mHasScrollgrab);
- WriteParam(aMsg, aParam.mUpdateScrollOffset);
WriteParam(aMsg, aParam.mDoSmoothScroll);
WriteParam(aMsg, aParam.mUseDisplayPortMargins);
WriteParam(aMsg, aParam.mAllowVerticalScrollWithWheel);
WriteParam(aMsg, aParam.mIsLayersIdRoot);
WriteParam(aMsg, aParam.mUsesContainerScrolling);
WriteParam(aMsg, aParam.mIsScrollInfoLayer);
WriteParam(aMsg, aParam.mForceDisableApz);
}
@@ -760,19 +768,19 @@ struct ParamTraits<mozilla::layers::Fram
ReadParam(aMsg, aIter, &aResult->mPresShellId) &&
ReadParam(aMsg, aIter, &aResult->mViewport) &&
ReadParam(aMsg, aIter, &aResult->mExtraResolution) &&
ReadParam(aMsg, aIter, &aResult->mBackgroundColor) &&
ReadContentDescription(aMsg, aIter, aResult) &&
ReadParam(aMsg, aIter, &aResult->mLineScrollAmount) &&
ReadParam(aMsg, aIter, &aResult->mPageScrollAmount) &&
ReadParam(aMsg, aIter, &aResult->mPaintRequestTime) &&
+ ReadParam(aMsg, aIter, &aResult->mScrollUpdateType) &&
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetIsRootContent) &&
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetHasScrollgrab) &&
- ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetUpdateScrollOffset) &&
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetDoSmoothScroll) &&
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetUseDisplayPortMargins) &&
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetAllowVerticalScrollWithWheel) &&
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetIsLayersIdRoot) &&
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetUsesContainerScrolling) &&
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetIsScrollInfoLayer) &&
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetForceDisableApz));
}
--- a/gfx/layers/FrameMetrics.h
+++ b/gfx/layers/FrameMetrics.h
@@ -36,16 +36,23 @@ struct FrameMetrics {
friend struct IPC::ParamTraits<mozilla::layers::FrameMetrics>;
public:
// We use IDs to identify frames across processes.
typedef uint64_t ViewID;
static const ViewID NULL_SCROLL_ID; // This container layer does not scroll.
static const ViewID START_SCROLL_ID = 2; // This is the ID that scrolling subframes
// will begin at.
+ enum ScrollOffsetUpdateType : uint8_t {
+ eNone, // The default; the scroll offset was not updated
+ eMainThread, // The scroll offset was updated by the main thread.
+
+ eSentinel // For IPC use only
+ };
+
FrameMetrics()
: mScrollId(NULL_SCROLL_ID)
, mScrollParentId(NULL_SCROLL_ID)
, mPresShellResolution(1)
, mCompositionBounds(0, 0, 0, 0)
, mDisplayPort(0, 0, 0, 0)
, mCriticalDisplayPort(0, 0, 0, 0)
, mScrollableRect(0, 0, 0, 0)
@@ -60,19 +67,19 @@ public:
, mPresShellId(-1)
, mViewport(0, 0, 0, 0)
, mExtraResolution()
, mBackgroundColor()
, mContentDescription()
, mLineScrollAmount(0, 0)
, mPageScrollAmount(0, 0)
, mPaintRequestTime()
+ , mScrollUpdateType(eNone)
, mIsRootContent(false)
, mHasScrollgrab(false)
- , mUpdateScrollOffset(false)
, mDoSmoothScroll(false)
, mUseDisplayPortMargins(false)
, mAllowVerticalScrollWithWheel(false)
, mIsLayersIdRoot(false)
, mUsesContainerScrolling(false)
, mIsScrollInfoLayer(false)
, mForceDisableApz(false)
{
@@ -101,19 +108,19 @@ public:
mPresShellId == aOther.mPresShellId &&
mViewport.IsEqualEdges(aOther.mViewport) &&
mExtraResolution == aOther.mExtraResolution &&
mBackgroundColor == aOther.mBackgroundColor &&
// don't compare mContentDescription
mLineScrollAmount == aOther.mLineScrollAmount &&
mPageScrollAmount == aOther.mPageScrollAmount &&
mPaintRequestTime == aOther.mPaintRequestTime &&
+ mScrollUpdateType == aOther.mScrollUpdateType &&
mIsRootContent == aOther.mIsRootContent &&
mHasScrollgrab == aOther.mHasScrollgrab &&
- mUpdateScrollOffset == aOther.mUpdateScrollOffset &&
mDoSmoothScroll == aOther.mDoSmoothScroll &&
mUseDisplayPortMargins == aOther.mUseDisplayPortMargins &&
mAllowVerticalScrollWithWheel == aOther.mAllowVerticalScrollWithWheel &&
mIsLayersIdRoot == aOther.mIsLayersIdRoot &&
mUsesContainerScrolling == aOther.mUsesContainerScrolling &&
mIsScrollInfoLayer == aOther.mIsScrollInfoLayer &&
mForceDisableApz == aOther.mForceDisableApz;
}
@@ -358,29 +365,29 @@ public:
const CSSToParentLayerScale2D& GetZoom() const
{
return mZoom;
}
void SetScrollOffsetUpdated(uint32_t aScrollGeneration)
{
- mUpdateScrollOffset = true;
+ mScrollUpdateType = eMainThread;
mScrollGeneration = aScrollGeneration;
}
void SetSmoothScrollOffsetUpdated(int32_t aScrollGeneration)
{
mDoSmoothScroll = true;
mScrollGeneration = aScrollGeneration;
}
bool GetScrollOffsetUpdated() const
{
- return mUpdateScrollOffset;
+ return mScrollUpdateType != eNone;
}
bool GetDoSmoothScroll() const
{
return mDoSmoothScroll;
}
uint32_t GetScrollGeneration() const
@@ -714,26 +721,26 @@ private:
LayoutDeviceIntSize mLineScrollAmount;
// The value of GetPageScrollAmount(), for scroll frames.
LayoutDeviceIntSize mPageScrollAmount;
// The time at which the APZC last requested a repaint for this scrollframe.
TimeStamp mPaintRequestTime;
+ // Whether mScrollOffset was updated by something other than the APZ code, and
+ // if the APZC receiving this metrics should update its local copy.
+ ScrollOffsetUpdateType mScrollUpdateType;
+
// Whether or not this is the root scroll frame for the root content document.
bool mIsRootContent:1;
// Whether or not this frame is for an element marked 'scrollgrab'.
bool mHasScrollgrab:1;
- // Whether mScrollOffset was updated by something other than the APZ code, and
- // if the APZC receiving this metrics should update its local copy.
- bool mUpdateScrollOffset:1;
-
// When mDoSmoothScroll, the scroll offset should be animated to
// smoothly transition to mScrollOffset rather than be updated instantly.
bool mDoSmoothScroll:1;
// If this is true then we use the display port margins on this metrics,
// otherwise use the display port rect.
bool mUseDisplayPortMargins:1;
@@ -762,19 +769,16 @@ private:
// FrameMetrics::operator ==
// AsyncPanZoomController::NotifyLayersUpdated
// The ParamTraits specialization in GfxMessageUtils.h
//
// Please add new fields above this comment.
// Private helpers for IPC purposes
- void SetUpdateScrollOffset(bool aValue) {
- mUpdateScrollOffset = aValue;
- }
void SetDoSmoothScroll(bool aValue) {
mDoSmoothScroll = aValue;
}
};
struct ScrollSnapInfo {
ScrollSnapInfo()
: mScrollSnapTypeX(NS_STYLE_SCROLL_SNAP_TYPE_NONE)