Bug 1641085 Part 5 - Remove SetPropTableFrames() in nsContainerFrame. r=mats

We already use SetProperty() extensively for nsFrameList properties like
OutsideMarkerProperty(), BackdropProperty(), etc, so we can simplify the
interface by removing SetPropTableFrames().

Differential Revision: https://phabricator.services.mozilla.com/D88459
This commit is contained in:
Ting-Yu Lin
2020-08-29 00:22:41 +00:00
parent 7469a121cb
commit c4487abfeb
4 changed files with 12 additions and 22 deletions

View File

@@ -5450,8 +5450,8 @@ void nsBlockFrame::SetOverflowOutOfFlows(const nsFrameList& aList,
"prop value mismatch");
*aPropValue = aList;
} else {
SetPropTableFrames(new (PresShell()) nsFrameList(aList),
OverflowOutOfFlowsProperty());
SetProperty(OverflowOutOfFlowsProperty(),
new (PresShell()) nsFrameList(aList));
AddStateBits(NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS);
}
}

View File

@@ -1589,18 +1589,6 @@ nsFrameList* nsContainerFrame::RemovePropTableFrames(
return TakeProperty(aProperty);
}
void nsContainerFrame::SetPropTableFrames(
nsFrameList* aFrameList, FrameListPropertyDescriptor aProperty) {
MOZ_ASSERT(aProperty && aFrameList, "null ptr");
MOZ_ASSERT(
(aProperty != nsContainerFrame::OverflowContainersProperty() &&
aProperty != nsContainerFrame::ExcessOverflowContainersProperty()) ||
IsFrameOfType(nsIFrame::eCanContainOverflowContainers),
"this type of frame can't have overflow containers");
MOZ_ASSERT(!GetPropTableFrames(aProperty));
SetProperty(aProperty, aFrameList);
}
void nsContainerFrame::PushChildrenToOverflow(nsIFrame* aFromChild,
nsIFrame* aPrevSibling) {
MOZ_ASSERT(aFromChild, "null pointer");

View File

@@ -828,13 +828,6 @@ class nsContainerFrame : public nsSplittableFrame {
[[nodiscard]] nsFrameList* RemovePropTableFrames(
FrameListPropertyDescriptor aProperty);
/**
* Set the PresContext-stored nsFrameList named aPropID for this frame
* to the given aFrameList, which must not be null.
*/
void SetPropTableFrames(nsFrameList* aFrameList,
FrameListPropertyDescriptor aProperty);
/**
* Safely destroy the frames on the nsFrameList stored on aProp for this
* frame then remove the property and delete the frame list.

View File

@@ -4110,10 +4110,19 @@ class nsIFrame : public nsQueryFrame {
return mProperties.Has(aProperty);
}
// Add a property, or update an existing property for the given descriptor.
/**
* Add a property, or update an existing property for the given descriptor.
*
* Note: This function asserts if updating an existing nsFrameList property.
*/
template <typename T>
void SetProperty(FrameProperties::Descriptor<T> aProperty,
FrameProperties::PropertyType<T> aValue) {
if constexpr (std::is_same_v<T, nsFrameList>) {
MOZ_ASSERT(aValue, "Shouldn't set nullptr to a nsFrameList property!");
MOZ_ASSERT(!HasProperty(aProperty),
"Shouldn't update an existing nsFrameList property!");
}
mProperties.Set(aProperty, aValue, this);
}