Bug 1526970 - Part 3: Remove nsPaintedDisplayItem::mDisplayItemData r=mattwoodrow

Depends on D106164

Differential Revision: https://phabricator.services.mozilla.com/D106165
This commit is contained in:
Miko Mynttinen 2021-02-24 22:22:18 +00:00
Родитель 87ae7c68c4
Коммит 7d83febd11
4 изменённых файлов: 4 добавлений и 79 удалений

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

@ -386,14 +386,8 @@ void DisplayItemData::BeginUpdate(Layer* aLayer, LayerState aState,
mLayerState = aState;
mUsed = true;
if (aLayer->AsPaintedLayer()) {
if (aItem != mItem) {
aItem->SetDisplayItemData(this, aLayer->Manager());
} else {
MOZ_ASSERT(aItem->GetDisplayItemData() == this);
}
mReusedItem = aIsReused;
}
mItem = aItem;
mReusedItem = aIsReused;
if (!aItem) {
return;
@ -436,11 +430,6 @@ static const nsIFrame* sDestroyedFrame = nullptr;
DisplayItemData::~DisplayItemData() {
MOZ_COUNT_DTOR(DisplayItemData);
if (mItem) {
MOZ_ASSERT(mItem->GetDisplayItemData() == this);
mItem->SetDisplayItemData(nullptr, nullptr);
}
for (nsIFrame* frame : mFrameList) {
if (frame == sDestroyedFrame) {
continue;
@ -3905,12 +3894,8 @@ void PaintedLayerData::Accumulate(ContainerState* aState, nsDisplayItem* aItem,
bool clipMatches =
(oldClip == mItemClip) || (oldClip && *oldClip == *mItemClip);
DisplayItemData* currentData =
isMerged ? nullptr : item->GetDisplayItemData();
DisplayItemData* oldData = aState->mLayerBuilder->GetOldLayerForFrame(
item->Frame(), item->GetPerFrameKey(), currentData,
item->GetDisplayItemDataLayerManager());
item->Frame(), item->GetPerFrameKey());
mAssignedDisplayItems.emplace_back(item, aLayerState, oldData, aContentRect,
aType, hasOpacity, aTransform, isMerged);
@ -5411,12 +5396,6 @@ void FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
data->BeginUpdate(layer, aItem.mLayerState, aItem.mItem, aItem.mReused,
aItem.mMerged);
} else {
if (data && data->mUsed) {
// If the DID has already been used (by a previously merged frame,
// which is not merged this paint) we must create a new DID for the
// item.
aItem.mItem->SetDisplayItemData(nullptr, nullptr);
}
data = StoreDataForFrame(aItem.mItem, layer, aItem.mLayerState, nullptr);
}
data->mInactiveManager = aItem.mInactiveLayerData

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

@ -107,8 +107,6 @@ class DisplayItemData final {
const DisplayItemClip& GetClip() const { return mClip; }
void Invalidate() { mIsInvalid = true; }
void NotifyRemoved();
void SetItem(nsPaintedDisplayItem* aItem) { mItem = aItem; }
nsPaintedDisplayItem* GetItem() const { return mItem; }
nsIFrame* FirstFrame() const { return mFrameList[0]; }
layers::BasicLayerManager* InactiveManager() const {
return mInactiveManager;

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

@ -156,24 +156,6 @@ bool ShouldBuildItemForEvents(const DisplayItemType aType) {
(GetDisplayItemFlagsForType(aType) & TYPE_IS_CONTAINER);
}
void UpdateDisplayItemData(nsPaintedDisplayItem* aItem) {
auto* array = aItem->Frame()->DisplayItemData();
if (!array) {
return;
}
for (auto* did : *array) {
if (did->GetDisplayItemKey() == aItem->GetPerFrameKey() &&
did->GetLayer()->AsPaintedLayer()) {
if (!did->HasMergedFrames()) {
aItem->SetDisplayItemData(did, did->GetLayer()->Manager());
}
return;
}
}
}
static bool ItemTypeSupportsHitTesting(const DisplayItemType aType) {
switch (aType) {
case DisplayItemType::TYPE_BACKGROUND:

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

@ -2092,11 +2092,6 @@ void AssertUniqueItem(nsDisplayItem* aItem);
*/
bool ShouldBuildItemForEvents(const DisplayItemType aType);
/**
* Updates the item DisplayItemData if needed.
*/
void UpdateDisplayItemData(nsPaintedDisplayItem* aItem);
/**
* Initializes the hit test information of |aItem| if the item type supports it.
*/
@ -2130,7 +2125,6 @@ MOZ_ALWAYS_INLINE T* MakeDisplayItemWithIndex(nsDisplayListBuilder* aBuilder,
nsPaintedDisplayItem* paintedItem = item->AsPaintedDisplayItem();
if (paintedItem) {
UpdateDisplayItemData(paintedItem);
InitializeHitTestInfo(aBuilder, paintedItem, type);
}
@ -3183,30 +3177,6 @@ class nsPaintedDisplayItem : public nsDisplayItem {
return this;
}
~nsPaintedDisplayItem() override { SetDisplayItemData(nullptr, nullptr); }
void SetDisplayItemData(mozilla::DisplayItemData* aDID,
mozilla::layers::LayerManager* aLayerManager) {
if (mDisplayItemData) {
MOZ_ASSERT(!mDisplayItemData->GetItem() ||
mDisplayItemData->GetItem() == this);
mDisplayItemData->SetItem(nullptr);
}
if (aDID) {
if (aDID->GetItem()) {
aDID->GetItem()->SetDisplayItemData(nullptr, nullptr);
}
aDID->SetItem(this);
}
mDisplayItemData = aDID;
mDisplayItemDataLayerManager = aLayerManager;
}
mozilla::DisplayItemData* GetDisplayItemData() { return mDisplayItemData; }
mozilla::layers::LayerManager* GetDisplayItemDataLayerManager() {
return mDisplayItemDataLayerManager;
}
/**
* Stores the given opacity value to be applied when drawing. It is an error
* to call this if CanApplyOpacity returned false.
@ -3299,13 +3269,9 @@ class nsPaintedDisplayItem : public nsDisplayItem {
const nsPaintedDisplayItem& aOther)
: nsDisplayItem(aBuilder, aOther), mHitTestInfo(aOther.mHitTestInfo) {}
private:
mozilla::DisplayItemData* mDisplayItemData = nullptr;
mozilla::layers::LayerManager* mDisplayItemDataLayerManager = nullptr;
mozilla::Maybe<uint16_t> mCacheIndex;
protected:
mozilla::HitTestInfo mHitTestInfo;
mozilla::Maybe<uint16_t> mCacheIndex;
};
/**