From e4f0d8e0023ee07e9a98e9a3f6c934646974a3f9 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 13 Apr 2016 10:21:13 -0400 Subject: [PATCH] Bug 1257641 - Replace the mUpdateScrollOffset bool with an enum, needed in the next patch. r=botond MozReview-Commit-ID: AtmpQTAUH8L --- gfx/ipc/GfxMessageUtils.h | 12 ++++++++++-- gfx/layers/FrameMetrics.h | 26 +++++++++++++++----------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/gfx/ipc/GfxMessageUtils.h b/gfx/ipc/GfxMessageUtils.h index be42676c8259..2158b52cf9d2 100644 --- a/gfx/ipc/GfxMessageUtils.h +++ b/gfx/ipc/GfxMessageUtils.h @@ -674,6 +674,14 @@ struct ParamTraits : RegionParamTraits {}; +template<> +struct ParamTraits + : public ContiguousEnumSerializer< + mozilla::layers::FrameMetrics::ScrollOffsetUpdateType, + mozilla::layers::FrameMetrics::ScrollOffsetUpdateType::eNone, + mozilla::layers::FrameMetrics::ScrollOffsetUpdateType::eSentinel> +{}; + template <> struct ParamTraits { @@ -704,9 +712,9 @@ struct ParamTraits 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); @@ -765,9 +773,9 @@ struct ParamTraits 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) && diff --git a/gfx/layers/FrameMetrics.h b/gfx/layers/FrameMetrics.h index 234af27ad152..57eb566b8e28 100644 --- a/gfx/layers/FrameMetrics.h +++ b/gfx/layers/FrameMetrics.h @@ -41,6 +41,13 @@ public: 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) @@ -65,9 +72,9 @@ public: , mLineScrollAmount(0, 0) , mPageScrollAmount(0, 0) , mPaintRequestTime() + , mScrollUpdateType(eNone) , mIsRootContent(false) , mHasScrollgrab(false) - , mUpdateScrollOffset(false) , mDoSmoothScroll(false) , mUseDisplayPortMargins(false) , mAllowVerticalScrollWithWheel(false) @@ -106,9 +113,9 @@ public: 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 && @@ -363,7 +370,7 @@ public: void SetScrollOffsetUpdated(uint32_t aScrollGeneration) { - mUpdateScrollOffset = true; + mScrollUpdateType = eMainThread; mScrollGeneration = aScrollGeneration; } @@ -375,7 +382,7 @@ public: bool GetScrollOffsetUpdated() const { - return mUpdateScrollOffset; + return mScrollUpdateType != eNone; } bool GetDoSmoothScroll() const @@ -719,16 +726,16 @@ private: // 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; @@ -767,9 +774,6 @@ private: // Private helpers for IPC purposes - void SetUpdateScrollOffset(bool aValue) { - mUpdateScrollOffset = aValue; - } void SetDoSmoothScroll(bool aValue) { mDoSmoothScroll = aValue; }