Bug 1540785 - Part 2: Devirtualize nsDisplayItemBase::GetPerFrameKey() r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D27580

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Miko Mynttinen 2019-04-22 19:58:01 +00:00
Родитель f579c8f5c5
Коммит 84624b4a42
6 изменённых файлов: 95 добавлений и 102 удалений

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

@ -153,7 +153,7 @@ class nsDisplayTextOverflowMarker final : public nsDisplayItem {
nsDisplayTextOverflowMarker(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayTextOverflowMarker(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aRect, nscoord aAscent, const nsRect& aRect, nscoord aAscent,
const nsStyleTextOverflowSide* aStyle, const nsStyleTextOverflowSide* aStyle,
uint32_t aLineNumber, uint32_t aIndex) uint32_t aLineNumber, uint16_t aIndex)
: nsDisplayItem(aBuilder, aFrame), : nsDisplayItem(aBuilder, aFrame),
mRect(aRect), mRect(aRect),
mStyle(*aStyle), mStyle(*aStyle),
@ -189,9 +189,8 @@ class nsDisplayTextOverflowMarker final : public nsDisplayItem {
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
virtual uint32_t GetPerFrameKey() const override { virtual uint16_t CalculatePerFrameKey() const override { return mIndex; }
return (mIndex << TYPE_BITS) | nsDisplayItem::GetPerFrameKey();
}
void PaintTextToContext(gfxContext* aCtx, nsPoint aOffsetFromRect); void PaintTextToContext(gfxContext* aCtx, nsPoint aOffsetFromRect);
virtual bool CreateWebRenderCommands( virtual bool CreateWebRenderCommands(
@ -206,7 +205,7 @@ class nsDisplayTextOverflowMarker final : public nsDisplayItem {
nsRect mRect; // in reference frame coordinates nsRect mRect; // in reference frame coordinates
const nsStyleTextOverflowSide mStyle; const nsStyleTextOverflowSide mStyle;
nscoord mAscent; // baseline for the marker text in mRect nscoord mAscent; // baseline for the marker text in mRect
uint32_t mIndex; uint16_t mIndex;
}; };
static void PaintTextShadowCallback(gfxContext* aCtx, nsPoint aShadowOffset, static void PaintTextShadowCallback(gfxContext* aCtx, nsPoint aShadowOffset,

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

@ -1717,7 +1717,7 @@ class nsDisplayMathMLCharForeground final : public nsDisplayItem {
public: public:
nsDisplayMathMLCharForeground(nsDisplayListBuilder* aBuilder, nsDisplayMathMLCharForeground(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsMathMLChar* aChar, nsIFrame* aFrame, nsMathMLChar* aChar,
uint32_t aIndex, bool aIsSelected) uint16_t aIndex, bool aIsSelected)
: nsDisplayItem(aBuilder, aFrame), : nsDisplayItem(aBuilder, aFrame),
mChar(aChar), mChar(aChar),
mIndex(aIndex), mIndex(aIndex),
@ -1758,13 +1758,11 @@ class nsDisplayMathMLCharForeground final : public nsDisplayItem {
return GetBounds(aBuilder, &snap); return GetBounds(aBuilder, &snap);
} }
virtual uint32_t GetPerFrameKey() const override { virtual uint16_t CalculatePerFrameKey() const override { return mIndex; }
return (mIndex << TYPE_BITS) | nsDisplayItem::GetPerFrameKey();
}
private: private:
nsMathMLChar* mChar; nsMathMLChar* mChar;
uint32_t mIndex; uint16_t mIndex;
bool mIsSelected; bool mIsSelected;
}; };

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

@ -303,7 +303,7 @@ void nsMathMLFrame::DisplayBoundingMetrics(nsDisplayListBuilder* aBuilder,
class nsDisplayMathMLBar final : public nsDisplayItem { class nsDisplayMathMLBar final : public nsDisplayItem {
public: public:
nsDisplayMathMLBar(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayMathMLBar(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aRect, uint32_t aIndex) const nsRect& aRect, uint16_t aIndex)
: nsDisplayItem(aBuilder, aFrame), mRect(aRect), mIndex(aIndex) { : nsDisplayItem(aBuilder, aFrame), mRect(aRect), mIndex(aIndex) {
MOZ_COUNT_CTOR(nsDisplayMathMLBar); MOZ_COUNT_CTOR(nsDisplayMathMLBar);
} }
@ -311,15 +311,13 @@ class nsDisplayMathMLBar final : public nsDisplayItem {
virtual ~nsDisplayMathMLBar() { MOZ_COUNT_DTOR(nsDisplayMathMLBar); } virtual ~nsDisplayMathMLBar() { MOZ_COUNT_DTOR(nsDisplayMathMLBar); }
#endif #endif
virtual uint32_t GetPerFrameKey() const override { virtual uint16_t CalculatePerFrameKey() const override { return mIndex; }
return (mIndex << TYPE_BITS) | nsDisplayItem::GetPerFrameKey();
}
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
NS_DISPLAY_DECL_NAME("MathMLBar", TYPE_MATHML_BAR) NS_DISPLAY_DECL_NAME("MathMLBar", TYPE_MATHML_BAR)
private: private:
nsRect mRect; nsRect mRect;
uint32_t mIndex; uint16_t mIndex;
}; };
void nsDisplayMathMLBar::Paint(nsDisplayListBuilder* aBuilder, void nsDisplayMathMLBar::Paint(nsDisplayListBuilder* aBuilder,

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

@ -716,9 +716,7 @@ class nsDisplayNotation final : public nsDisplayItem {
virtual ~nsDisplayNotation() { MOZ_COUNT_DTOR(nsDisplayNotation); } virtual ~nsDisplayNotation() { MOZ_COUNT_DTOR(nsDisplayNotation); }
#endif #endif
virtual uint32_t GetPerFrameKey() const override { virtual uint16_t CalculatePerFrameKey() const override { return mType; }
return (mType << TYPE_BITS) | nsDisplayItem::GetPerFrameKey();
}
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
NS_DISPLAY_DECL_NAME("MathMLMencloseNotation", TYPE_MATHML_MENCLOSE_NOTATION) NS_DISPLAY_DECL_NAME("MathMLMencloseNotation", TYPE_MATHML_MENCLOSE_NOTATION)

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

@ -3533,7 +3533,7 @@ static Maybe<nsRect> GetViewportRectRelativeToReferenceFrame(
/* static */ nsDisplayBackgroundImage::InitData /* static */ nsDisplayBackgroundImage::InitData
nsDisplayBackgroundImage::GetInitData(nsDisplayListBuilder* aBuilder, nsDisplayBackgroundImage::GetInitData(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, uint32_t aLayer, nsIFrame* aFrame, uint16_t aLayer,
const nsRect& aBackgroundRect, const nsRect& aBackgroundRect,
ComputedStyle* aBackgroundStyle) { ComputedStyle* aBackgroundStyle) {
nsPresContext* presContext = aFrame->PresContext(); nsPresContext* presContext = aFrame->PresContext();
@ -5029,7 +5029,7 @@ bool nsDisplayEventReceiver::CreateWebRenderCommands(
nsDisplayCompositorHitTestInfo::nsDisplayCompositorHitTestInfo( nsDisplayCompositorHitTestInfo::nsDisplayCompositorHitTestInfo(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const mozilla::gfx::CompositorHitTestInfo& aHitTestFlags, uint32_t aIndex, const mozilla::gfx::CompositorHitTestInfo& aHitTestFlags, uint16_t aIndex,
const mozilla::Maybe<nsRect>& aArea) const mozilla::Maybe<nsRect>& aArea)
: nsDisplayHitTestInfoItem(aBuilder, aFrame), : nsDisplayHitTestInfoItem(aBuilder, aFrame),
mIndex(aIndex), mIndex(aIndex),
@ -5114,8 +5114,8 @@ bool nsDisplayCompositorHitTestInfo::CreateWebRenderCommands(
return true; return true;
} }
uint32_t nsDisplayCompositorHitTestInfo::GetPerFrameKey() const { uint16_t nsDisplayCompositorHitTestInfo::CalculatePerFrameKey() const {
return (mIndex << TYPE_BITS) | nsDisplayItem::GetPerFrameKey(); return mIndex;
} }
int32_t nsDisplayCompositorHitTestInfo::ZIndex() const { int32_t nsDisplayCompositorHitTestInfo::ZIndex() const {
@ -5643,7 +5643,7 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,
nsDisplayWrapList::nsDisplayWrapList( nsDisplayWrapList::nsDisplayWrapList(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList,
const ActiveScrolledRoot* aActiveScrolledRoot, bool aClearClipChain, const ActiveScrolledRoot* aActiveScrolledRoot, bool aClearClipChain,
uint32_t aIndex) uint16_t aIndex)
: nsDisplayHitTestInfoItem(aBuilder, aFrame, aActiveScrolledRoot), : nsDisplayHitTestInfoItem(aBuilder, aFrame, aActiveScrolledRoot),
mFrameActiveScrolledRoot(aBuilder->CurrentActiveScrolledRoot()), mFrameActiveScrolledRoot(aBuilder->CurrentActiveScrolledRoot()),
mOverrideZIndex(0), mOverrideZIndex(0),
@ -6260,7 +6260,7 @@ bool nsDisplayOpacity::CreateWebRenderCommands(
nsDisplayBlendMode::nsDisplayBlendMode( nsDisplayBlendMode::nsDisplayBlendMode(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList,
uint8_t aBlendMode, const ActiveScrolledRoot* aActiveScrolledRoot, uint8_t aBlendMode, const ActiveScrolledRoot* aActiveScrolledRoot,
uint32_t aIndex) uint16_t aIndex)
: nsDisplayWrapList(aBuilder, aFrame, aList, aActiveScrolledRoot, true), : nsDisplayWrapList(aBuilder, aFrame, aList, aActiveScrolledRoot, true),
mBlendMode(aBlendMode), mBlendMode(aBlendMode),
mIndex(aIndex) { mIndex(aIndex) {
@ -6885,9 +6885,9 @@ nsDisplayFixedPosition::nsDisplayFixedPosition(
const ActiveScrolledRoot* aActiveScrolledRoot, const ActiveScrolledRoot* aActiveScrolledRoot,
const ActiveScrolledRoot* aContainerASR) const ActiveScrolledRoot* aContainerASR)
: nsDisplayOwnLayer(aBuilder, aFrame, aList, aActiveScrolledRoot), : nsDisplayOwnLayer(aBuilder, aFrame, aList, aActiveScrolledRoot),
mContainerASR(aContainerASR),
mIndex(0), mIndex(0),
mIsFixedBackground(false), mIsFixedBackground(false) {
mContainerASR(aContainerASR) {
MOZ_COUNT_CTOR(nsDisplayFixedPosition); MOZ_COUNT_CTOR(nsDisplayFixedPosition);
Init(aBuilder); Init(aBuilder);
} }
@ -6895,13 +6895,12 @@ nsDisplayFixedPosition::nsDisplayFixedPosition(
nsDisplayFixedPosition::nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder, nsDisplayFixedPosition::nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsIFrame* aFrame,
nsDisplayList* aList, nsDisplayList* aList,
uint32_t aIndex) uint16_t aIndex)
: nsDisplayOwnLayer(aBuilder, aFrame, aList, : nsDisplayOwnLayer(aBuilder, aFrame, aList,
aBuilder->CurrentActiveScrolledRoot()), aBuilder->CurrentActiveScrolledRoot()),
mContainerASR(nullptr), // XXX maybe this should be something?
mIndex(aIndex), mIndex(aIndex),
mIsFixedBackground(true), mIsFixedBackground(true) {
mContainerASR(nullptr) // XXX maybe this should be something?
{
MOZ_COUNT_CTOR(nsDisplayFixedPosition); MOZ_COUNT_CTOR(nsDisplayFixedPosition);
Init(aBuilder); Init(aBuilder);
} }
@ -6916,7 +6915,7 @@ void nsDisplayFixedPosition::Init(nsDisplayListBuilder* aBuilder) {
/* static */ /* static */
nsDisplayFixedPosition* nsDisplayFixedPosition::CreateForFixedBackground( nsDisplayFixedPosition* nsDisplayFixedPosition::CreateForFixedBackground(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayBackgroundImage* aImage, uint32_t aIndex) { nsDisplayBackgroundImage* aImage, uint16_t aIndex) {
nsDisplayList temp; nsDisplayList temp;
temp.AppendToTop(aImage); temp.AppendToTop(aImage);
@ -7041,7 +7040,7 @@ TableType GetTableTypeFromFrame(nsIFrame* aFrame) {
nsDisplayTableFixedPosition::nsDisplayTableFixedPosition( nsDisplayTableFixedPosition::nsDisplayTableFixedPosition(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList,
uint32_t aIndex, nsIFrame* aAncestorFrame) uint16_t aIndex, nsIFrame* aAncestorFrame)
: nsDisplayFixedPosition(aBuilder, aFrame, aList, aIndex), : nsDisplayFixedPosition(aBuilder, aFrame, aList, aIndex),
mAncestorFrame(aAncestorFrame), mAncestorFrame(aAncestorFrame),
mTableType(GetTableTypeFromFrame(aAncestorFrame)) { mTableType(GetTableTypeFromFrame(aAncestorFrame)) {
@ -7054,7 +7053,7 @@ nsDisplayTableFixedPosition::nsDisplayTableFixedPosition(
nsDisplayTableFixedPosition* nsDisplayTableFixedPosition*
nsDisplayTableFixedPosition::CreateForFixedBackground( nsDisplayTableFixedPosition::CreateForFixedBackground(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayBackgroundImage* aImage, uint32_t aIndex, nsDisplayBackgroundImage* aImage, uint16_t aIndex,
nsIFrame* aAncestorFrame) { nsIFrame* aAncestorFrame) {
nsDisplayList temp; nsDisplayList temp;
temp.AppendToTop(aImage); temp.AppendToTop(aImage);
@ -7508,7 +7507,7 @@ static_assert(sizeof(nsDisplayTransform) < 512, "nsDisplayTransform has grown");
nsDisplayTransform::nsDisplayTransform(nsDisplayListBuilder* aBuilder, nsDisplayTransform::nsDisplayTransform(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsDisplayList* aList, nsIFrame* aFrame, nsDisplayList* aList,
const nsRect& aChildrenBuildingRect, const nsRect& aChildrenBuildingRect,
uint32_t aIndex) uint16_t aIndex)
: nsDisplayHitTestInfoItem(aBuilder, aFrame), : nsDisplayHitTestInfoItem(aBuilder, aFrame),
mTransform(Some(Matrix4x4())), mTransform(Some(Matrix4x4())),
mTransformGetter(nullptr), mTransformGetter(nullptr),
@ -7526,7 +7525,7 @@ nsDisplayTransform::nsDisplayTransform(nsDisplayListBuilder* aBuilder,
nsDisplayTransform::nsDisplayTransform(nsDisplayListBuilder* aBuilder, nsDisplayTransform::nsDisplayTransform(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsDisplayList* aList, nsIFrame* aFrame, nsDisplayList* aList,
const nsRect& aChildrenBuildingRect, const nsRect& aChildrenBuildingRect,
uint32_t aIndex, uint16_t aIndex,
bool aAllowAsyncAnimation) bool aAllowAsyncAnimation)
: nsDisplayHitTestInfoItem(aBuilder, aFrame), : nsDisplayHitTestInfoItem(aBuilder, aFrame),
mTransformGetter(nullptr), mTransformGetter(nullptr),
@ -7544,7 +7543,7 @@ nsDisplayTransform::nsDisplayTransform(nsDisplayListBuilder* aBuilder,
nsDisplayTransform::nsDisplayTransform( nsDisplayTransform::nsDisplayTransform(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList,
const nsRect& aChildrenBuildingRect, uint32_t aIndex, const nsRect& aChildrenBuildingRect, uint16_t aIndex,
ComputeTransformFunction aTransformGetter) ComputeTransformFunction aTransformGetter)
: nsDisplayHitTestInfoItem(aBuilder, aFrame), : nsDisplayHitTestInfoItem(aBuilder, aFrame),
mTransformGetter(aTransformGetter), mTransformGetter(aTransformGetter),

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

@ -2027,6 +2027,8 @@ MOZ_ALWAYS_INLINE T* MakeDisplayItem(nsDisplayListBuilder* aBuilder,
item->SetType(T::ItemType()); item->SetType(T::ItemType());
} }
item->SetPerFrameKey(item->CalculatePerFrameKey());
// TODO: Ideally we'd determine this before constructing the item, // TODO: Ideally we'd determine this before constructing the item,
// but we'd need a template specialization for every type that has // but we'd need a template specialization for every type that has
// children, or make all callers pass the type. // children, or make all callers pass the type.
@ -2166,8 +2168,19 @@ class nsDisplayItemBase : public nsDisplayItemLink {
* Pairing this with the Frame() pointer gives a key that * Pairing this with the Frame() pointer gives a key that
* uniquely identifies this display item in the display item tree. * uniquely identifies this display item in the display item tree.
*/ */
virtual uint32_t GetPerFrameKey() const { return uint32_t(GetType()); } uint32_t GetPerFrameKey() const {
void SetPerFrameKey(const uint32_t aKey) { mKey = aKey; } // The top 8 bits are currently unused.
// The middle 16 bits of the per frame key uniquely identify the display
// item when there are more than one item of the same type for a frame.
// The low 8 bits are the display item type.
return (static_cast<uint32_t>(mKey) << TYPE_BITS) |
static_cast<uint32_t>(mType);
}
/**
* Returns the initial per frame key for this display item.
*/
virtual uint16_t CalculatePerFrameKey() const { return 0; }
/** /**
* Returns true if this item was reused during display list merging. * Returns true if this item was reused during display list merging.
@ -2278,6 +2291,8 @@ class nsDisplayItemBase : public nsDisplayItemLink {
} }
} }
void SetPerFrameKey(const uint16_t aKey) { mKey = aKey; }
void SetDeletedFrame(); void SetDeletedFrame();
nsIFrame* mFrame; // 8 nsIFrame* mFrame; // 8
@ -4384,7 +4399,7 @@ class nsDisplayBackgroundImage : public nsDisplayImageContainer {
* aBackgroundRect is relative to aFrame. * aBackgroundRect is relative to aFrame.
*/ */
static InitData GetInitData(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, static InitData GetInitData(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
uint32_t aLayer, const nsRect& aBackgroundRect, uint16_t aLayer, const nsRect& aBackgroundRect,
mozilla::ComputedStyle* aBackgroundStyle); mozilla::ComputedStyle* aBackgroundStyle);
explicit nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilder, explicit nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilder,
@ -4435,9 +4450,7 @@ class nsDisplayBackgroundImage : public nsDisplayImageContainer {
void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
uint32_t GetPerFrameKey() const override { uint16_t CalculatePerFrameKey() const override { return mLayer; }
return (mLayer << TYPE_BITS) | nsDisplayItem::GetPerFrameKey();
}
/** /**
* Return the background positioning area. * Return the background positioning area.
@ -4532,7 +4545,7 @@ class nsDisplayBackgroundImage : public nsDisplayImageContainer {
nsRect mDestRect; nsRect mDestRect;
/* Bounds of this display item */ /* Bounds of this display item */
nsRect mBounds; nsRect mBounds;
uint32_t mLayer; uint16_t mLayer;
bool mIsRasterImage; bool mIsRasterImage;
/* Whether the image should be treated as fixed to the viewport. */ /* Whether the image should be treated as fixed to the viewport. */
bool mShouldFixToViewport; bool mShouldFixToViewport;
@ -4557,6 +4570,14 @@ static_assert(static_cast<uint8_t>(TableType::TABLE_TYPE_MAX) <
"TableType cannot fit with TableTypeBits::COUNT"); "TableType cannot fit with TableTypeBits::COUNT");
TableType GetTableTypeFromFrame(nsIFrame* aFrame); TableType GetTableTypeFromFrame(nsIFrame* aFrame);
static uint16_t CalculateTablePerFrameKey(const uint16_t aIndex,
const TableType aType) {
const uint32_t key = (aIndex << static_cast<uint8_t>(TableTypeBits::COUNT)) |
static_cast<uint8_t>(aType);
return static_cast<uint16_t>(key);
}
/** /**
* A display item to paint background image for table. For table parts, such * A display item to paint background image for table. For table parts, such
* as row, row group, col, col group, when drawing its background, we'll * as row, row group, col, col group, when drawing its background, we'll
@ -4579,11 +4600,8 @@ class nsDisplayTableBackgroundImage : public nsDisplayBackgroundImage {
NS_DISPLAY_DECL_NAME("TableBackgroundImage", TYPE_TABLE_BACKGROUND_IMAGE) NS_DISPLAY_DECL_NAME("TableBackgroundImage", TYPE_TABLE_BACKGROUND_IMAGE)
uint32_t GetPerFrameKey() const override { uint16_t CalculatePerFrameKey() const override {
return (mLayer << (TYPE_BITS + return CalculateTablePerFrameKey(mLayer, mTableType);
static_cast<uint8_t>(TableTypeBits::COUNT))) |
(static_cast<uint8_t>(mTableType) << TYPE_BITS) |
nsDisplayItem::GetPerFrameKey();
} }
bool IsInvalid(nsRect& aRect) const override; bool IsInvalid(nsRect& aRect) const override;
@ -4711,9 +4729,8 @@ class nsDisplayTableThemedBackground : public nsDisplayThemedBackground {
NS_DISPLAY_DECL_NAME("TableThemedBackground", NS_DISPLAY_DECL_NAME("TableThemedBackground",
TYPE_TABLE_THEMED_BACKGROUND_IMAGE) TYPE_TABLE_THEMED_BACKGROUND_IMAGE)
uint32_t GetPerFrameKey() const override { uint16_t CalculatePerFrameKey() const override {
return (static_cast<uint8_t>(mTableType) << TYPE_BITS) | return static_cast<uint8_t>(mTableType);
nsDisplayItem::GetPerFrameKey();
} }
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; } nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
@ -4903,9 +4920,8 @@ class nsDisplayTableBackgroundColor : public nsDisplayBackgroundColor {
nsDisplayBackgroundColor::RemoveFrame(aFrame); nsDisplayBackgroundColor::RemoveFrame(aFrame);
} }
uint32_t GetPerFrameKey() const override { uint16_t CalculatePerFrameKey() const override {
return (static_cast<uint8_t>(mTableType) << TYPE_BITS) | return static_cast<uint8_t>(mTableType);
nsDisplayItem::GetPerFrameKey();
} }
bool CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder) override { bool CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder) override {
@ -5151,7 +5167,7 @@ class nsDisplayCompositorHitTestInfo : public nsDisplayHitTestInfoItem {
nsDisplayCompositorHitTestInfo( nsDisplayCompositorHitTestInfo(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const mozilla::gfx::CompositorHitTestInfo& aHitTestFlags, const mozilla::gfx::CompositorHitTestInfo& aHitTestFlags,
uint32_t aIndex = 0, uint16_t aIndex = 0,
const mozilla::Maybe<nsRect>& aArea = mozilla::Nothing()); const mozilla::Maybe<nsRect>& aArea = mozilla::Nothing());
nsDisplayCompositorHitTestInfo( nsDisplayCompositorHitTestInfo(
@ -5174,7 +5190,7 @@ class nsDisplayCompositorHitTestInfo : public nsDisplayHitTestInfoItem {
const StackingContextHelper& aSc, const StackingContextHelper& aSc,
mozilla::layers::RenderRootStateManager* aManager, mozilla::layers::RenderRootStateManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) override; nsDisplayListBuilder* aDisplayListBuilder) override;
uint32_t GetPerFrameKey() const override; uint16_t CalculatePerFrameKey() const override;
int32_t ZIndex() const override; int32_t ZIndex() const override;
void SetOverrideZIndex(int32_t aZIndex); void SetOverrideZIndex(int32_t aZIndex);
@ -5196,7 +5212,7 @@ class nsDisplayCompositorHitTestInfo : public nsDisplayHitTestInfoItem {
private: private:
mozilla::Maybe<mozilla::layers::ScrollableLayerGuid::ViewID> mScrollTarget; mozilla::Maybe<mozilla::layers::ScrollableLayerGuid::ViewID> mScrollTarget;
uint32_t mIndex; uint16_t mIndex;
mozilla::Maybe<int32_t> mOverrideZIndex; mozilla::Maybe<int32_t> mOverrideZIndex;
int32_t mAppUnitsPerDevPixel; int32_t mAppUnitsPerDevPixel;
}; };
@ -5229,7 +5245,7 @@ class nsDisplayWrapList : public nsDisplayHitTestInfoItem {
nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayList* aList, nsDisplayList* aList,
const ActiveScrolledRoot* aActiveScrolledRoot, const ActiveScrolledRoot* aActiveScrolledRoot,
bool aClearClipChain = false, uint32_t aIndex = 0); bool aClearClipChain = false, uint16_t aIndex = 0);
nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayHitTestInfoItem(aBuilder, aFrame), : nsDisplayHitTestInfoItem(aBuilder, aFrame),
@ -5333,9 +5349,7 @@ class nsDisplayWrapList : public nsDisplayHitTestInfoItem {
bool ComputeVisibility(nsDisplayListBuilder* aBuilder, bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) override; nsRegion* aVisibleRegion) override;
uint32_t GetPerFrameKey() const override { uint16_t CalculatePerFrameKey() const override { return mIndex; }
return (mIndex << TYPE_BITS) | nsDisplayItem::GetPerFrameKey();
}
bool CanMerge(const nsDisplayItem* aItem) const override { return false; } bool CanMerge(const nsDisplayItem* aItem) const override { return false; }
@ -5441,7 +5455,7 @@ class nsDisplayWrapList : public nsDisplayHitTestInfoItem {
// Our mBuildingRect may include the visible areas of children. // Our mBuildingRect may include the visible areas of children.
nsRect mBaseBuildingRect; nsRect mBaseBuildingRect;
int32_t mOverrideZIndex; int32_t mOverrideZIndex;
uint32_t mIndex; uint16_t mIndex;
bool mHasZIndexOverride; bool mHasZIndexOverride;
bool mClearingClipChain = false; bool mClearingClipChain = false;
}; };
@ -5616,7 +5630,7 @@ class nsDisplayBlendMode : public nsDisplayWrapList {
nsDisplayBlendMode(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayBlendMode(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayList* aList, uint8_t aBlendMode, nsDisplayList* aList, uint8_t aBlendMode,
const ActiveScrolledRoot* aActiveScrolledRoot, const ActiveScrolledRoot* aActiveScrolledRoot,
uint32_t aIndex = 0); uint16_t aIndex = 0);
nsDisplayBlendMode(nsDisplayListBuilder* aBuilder, nsDisplayBlendMode(nsDisplayListBuilder* aBuilder,
const nsDisplayBlendMode& aOther) const nsDisplayBlendMode& aOther)
: nsDisplayWrapList(aBuilder, aOther), : nsDisplayWrapList(aBuilder, aOther),
@ -5646,9 +5660,7 @@ class nsDisplayBlendMode : public nsDisplayWrapList {
// LayerTreeInvalidation // LayerTreeInvalidation
} }
uint32_t GetPerFrameKey() const override { uint16_t CalculatePerFrameKey() const override { return mIndex; }
return (mIndex << TYPE_BITS) | nsDisplayItem::GetPerFrameKey();
}
LayerState GetLayerState( LayerState GetLayerState(
nsDisplayListBuilder* aBuilder, LayerManager* aManager, nsDisplayListBuilder* aBuilder, LayerManager* aManager,
@ -5672,7 +5684,7 @@ class nsDisplayBlendMode : public nsDisplayWrapList {
protected: protected:
uint8_t mBlendMode; uint8_t mBlendMode;
uint32_t mIndex; uint16_t mIndex;
}; };
class nsDisplayTableBlendMode : public nsDisplayBlendMode { class nsDisplayTableBlendMode : public nsDisplayBlendMode {
@ -5680,7 +5692,7 @@ class nsDisplayTableBlendMode : public nsDisplayBlendMode {
nsDisplayTableBlendMode(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayTableBlendMode(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayList* aList, uint8_t aBlendMode, nsDisplayList* aList, uint8_t aBlendMode,
const ActiveScrolledRoot* aActiveScrolledRoot, const ActiveScrolledRoot* aActiveScrolledRoot,
uint32_t aIndex, nsIFrame* aAncestorFrame) uint16_t aIndex, nsIFrame* aAncestorFrame)
: nsDisplayBlendMode(aBuilder, aFrame, aList, aBlendMode, : nsDisplayBlendMode(aBuilder, aFrame, aList, aBlendMode,
aActiveScrolledRoot, aIndex), aActiveScrolledRoot, aIndex),
mAncestorFrame(aAncestorFrame), mAncestorFrame(aAncestorFrame),
@ -5722,11 +5734,8 @@ class nsDisplayTableBlendMode : public nsDisplayBlendMode {
nsDisplayBlendMode::RemoveFrame(aFrame); nsDisplayBlendMode::RemoveFrame(aFrame);
} }
uint32_t GetPerFrameKey() const override { uint16_t CalculatePerFrameKey() const override {
return (mIndex << (TYPE_BITS + return CalculateTablePerFrameKey(mIndex, mTableType);
static_cast<uint8_t>(TableTypeBits::COUNT))) |
(static_cast<uint8_t>(mTableType) << TYPE_BITS) |
nsDisplayItem::GetPerFrameKey();
} }
protected: protected:
@ -5784,9 +5793,8 @@ class nsDisplayBlendContainer : public nsDisplayWrapList {
return false; return false;
} }
uint32_t GetPerFrameKey() const override { uint16_t CalculatePerFrameKey() const override {
return (mIsForBackground ? 1 << TYPE_BITS : 0) | return mIsForBackground ? 1 : 0;
nsDisplayItem::GetPerFrameKey();
} }
protected: protected:
@ -5826,9 +5834,8 @@ class nsDisplayTableBlendContainer : public nsDisplayBlendContainer {
nsDisplayBlendContainer::RemoveFrame(aFrame); nsDisplayBlendContainer::RemoveFrame(aFrame);
} }
uint32_t GetPerFrameKey() const override { uint16_t CalculatePerFrameKey() const override {
return (static_cast<uint8_t>(mTableType) << TYPE_BITS) | return static_cast<uint8_t>(mTableType);
nsDisplayItem::GetPerFrameKey();
} }
protected: protected:
@ -6148,15 +6155,15 @@ class nsDisplayFixedPosition : public nsDisplayOwnLayer {
: nsDisplayOwnLayer(aBuilder, aOther), : nsDisplayOwnLayer(aBuilder, aOther),
mAnimatedGeometryRootForScrollMetadata( mAnimatedGeometryRootForScrollMetadata(
aOther.mAnimatedGeometryRootForScrollMetadata), aOther.mAnimatedGeometryRootForScrollMetadata),
mContainerASR(aOther.mContainerASR),
mIndex(aOther.mIndex), mIndex(aOther.mIndex),
mIsFixedBackground(aOther.mIsFixedBackground), mIsFixedBackground(aOther.mIsFixedBackground) {
mContainerASR(aOther.mContainerASR) {
MOZ_COUNT_CTOR(nsDisplayFixedPosition); MOZ_COUNT_CTOR(nsDisplayFixedPosition);
} }
static nsDisplayFixedPosition* CreateForFixedBackground( static nsDisplayFixedPosition* CreateForFixedBackground(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayBackgroundImage* aImage, uint32_t aIndex); nsDisplayBackgroundImage* aImage, uint16_t aIndex);
#ifdef NS_BUILD_REFCNT_LOGGING #ifdef NS_BUILD_REFCNT_LOGGING
~nsDisplayFixedPosition() override { MOZ_COUNT_DTOR(nsDisplayFixedPosition); } ~nsDisplayFixedPosition() override { MOZ_COUNT_DTOR(nsDisplayFixedPosition); }
@ -6182,9 +6189,7 @@ class nsDisplayFixedPosition : public nsDisplayOwnLayer {
return mIsFixedBackground; return mIsFixedBackground;
} }
uint32_t GetPerFrameKey() const override { uint16_t CalculatePerFrameKey() const override { return mIndex; }
return (mIndex << TYPE_BITS) | nsDisplayItem::GetPerFrameKey();
}
AnimatedGeometryRoot* AnimatedGeometryRootForScrollMetadata() const override { AnimatedGeometryRoot* AnimatedGeometryRootForScrollMetadata() const override {
return mAnimatedGeometryRootForScrollMetadata; return mAnimatedGeometryRootForScrollMetadata;
@ -6204,21 +6209,21 @@ class nsDisplayFixedPosition : public nsDisplayOwnLayer {
protected: protected:
// For background-attachment:fixed // For background-attachment:fixed
nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayList* aList, uint32_t aIndex); nsDisplayList* aList, uint16_t aIndex);
void Init(nsDisplayListBuilder* aBuilder); void Init(nsDisplayListBuilder* aBuilder);
ViewID GetScrollTargetId(); ViewID GetScrollTargetId();
RefPtr<AnimatedGeometryRoot> mAnimatedGeometryRootForScrollMetadata; RefPtr<AnimatedGeometryRoot> mAnimatedGeometryRootForScrollMetadata;
uint32_t mIndex;
bool mIsFixedBackground;
RefPtr<const ActiveScrolledRoot> mContainerASR; RefPtr<const ActiveScrolledRoot> mContainerASR;
uint16_t mIndex;
bool mIsFixedBackground;
}; };
class nsDisplayTableFixedPosition : public nsDisplayFixedPosition { class nsDisplayTableFixedPosition : public nsDisplayFixedPosition {
public: public:
static nsDisplayTableFixedPosition* CreateForFixedBackground( static nsDisplayTableFixedPosition* CreateForFixedBackground(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayBackgroundImage* aImage, uint32_t aIndex, nsDisplayBackgroundImage* aImage, uint16_t aIndex,
nsIFrame* aAncestorFrame); nsIFrame* aAncestorFrame);
NS_DISPLAY_DECL_NAME("TableFixedPosition", TYPE_TABLE_FIXED_POSITION) NS_DISPLAY_DECL_NAME("TableFixedPosition", TYPE_TABLE_FIXED_POSITION)
@ -6237,16 +6242,13 @@ class nsDisplayTableFixedPosition : public nsDisplayFixedPosition {
nsDisplayFixedPosition::RemoveFrame(aFrame); nsDisplayFixedPosition::RemoveFrame(aFrame);
} }
uint32_t GetPerFrameKey() const override { uint16_t CalculatePerFrameKey() const override {
return (mIndex << (TYPE_BITS + return CalculateTablePerFrameKey(mIndex, mTableType);
static_cast<uint8_t>(TableTypeBits::COUNT))) |
(static_cast<uint8_t>(mTableType) << TYPE_BITS) |
nsDisplayItem::GetPerFrameKey();
} }
protected: protected:
nsDisplayTableFixedPosition(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayTableFixedPosition(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayList* aList, uint32_t aIndex, nsDisplayList* aList, uint16_t aIndex,
nsIFrame* aAncestorFrame); nsIFrame* aAncestorFrame);
nsDisplayTableFixedPosition(nsDisplayListBuilder* aBuilder, nsDisplayTableFixedPosition(nsDisplayListBuilder* aBuilder,
@ -6687,15 +6689,15 @@ class nsDisplayTransform : public nsDisplayHitTestInfoItem {
*/ */
nsDisplayTransform(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayTransform(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayList* aList, const nsRect& aChildrenBuildingRect, nsDisplayList* aList, const nsRect& aChildrenBuildingRect,
uint32_t aIndex); uint16_t aIndex);
nsDisplayTransform(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayTransform(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayList* aList, const nsRect& aChildrenBuildingRect, nsDisplayList* aList, const nsRect& aChildrenBuildingRect,
uint32_t aIndex, bool aAllowAsyncAnimation); uint16_t aIndex, bool aAllowAsyncAnimation);
nsDisplayTransform(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayTransform(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayList* aList, const nsRect& aChildrenBuildingRect, nsDisplayList* aList, const nsRect& aChildrenBuildingRect,
uint32_t aIndex, uint16_t aIndex,
ComputeTransformFunction aTransformGetter); ComputeTransformFunction aTransformGetter);
#ifdef NS_BUILD_REFCNT_LOGGING #ifdef NS_BUILD_REFCNT_LOGGING
@ -6762,9 +6764,7 @@ class nsDisplayTransform : public nsDisplayHitTestInfoItem {
bool CanMerge(const nsDisplayItem* aItem) const override { return false; } bool CanMerge(const nsDisplayItem* aItem) const override { return false; }
uint32_t GetPerFrameKey() const override { uint16_t CalculatePerFrameKey() const override { return mIndex; }
return (mIndex << TYPE_BITS) | nsDisplayItem::GetPerFrameKey();
}
nsDisplayItemGeometry* AllocateGeometry( nsDisplayItemGeometry* AllocateGeometry(
nsDisplayListBuilder* aBuilder) override { nsDisplayListBuilder* aBuilder) override {
@ -7010,8 +7010,9 @@ class nsDisplayTransform : public nsDisplayHitTestInfoItem {
RefPtr<AnimatedGeometryRoot> mAnimatedGeometryRootForChildren; RefPtr<AnimatedGeometryRoot> mAnimatedGeometryRootForChildren;
RefPtr<AnimatedGeometryRoot> mAnimatedGeometryRootForScrollMetadata; RefPtr<AnimatedGeometryRoot> mAnimatedGeometryRootForScrollMetadata;
nsRect mChildrenBuildingRect; nsRect mChildrenBuildingRect;
uint32_t mIndex;
mutable RetainedDisplayList mChildren; mutable RetainedDisplayList mChildren;
uint16_t mIndex;
// The untransformed bounds of |mChildren|. // The untransformed bounds of |mChildren|.
nsRect mChildBounds; nsRect mChildBounds;
// The transformed bounds of this display item. // The transformed bounds of this display item.