Bug 1641085 Part 6 - Remove GetPropTableFrames() and RemovePropTableFrames() in nsContainerFrame. r=mats

Differential Revision: https://phabricator.services.mozilla.com/D88460
This commit is contained in:
Ting-Yu Lin 2020-08-29 00:22:43 +00:00
Родитель a69c3e6644
Коммит 71a0063df5
4 изменённых файлов: 12 добавлений и 36 удалений

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

@ -5424,7 +5424,7 @@ nsFrameList* nsBlockFrame::GetOverflowOutOfFlows() const {
if (!HasAnyStateBits(NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS)) {
return nullptr;
}
nsFrameList* result = GetPropTableFrames(OverflowOutOfFlowsProperty());
nsFrameList* result = GetProperty(OverflowOutOfFlowsProperty());
NS_ASSERTION(result, "value should always be non-empty when state set");
return result;
}
@ -5440,13 +5440,13 @@ void nsBlockFrame::SetOverflowOutOfFlows(const nsFrameList& aList,
if (!HasAnyStateBits(NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS)) {
return;
}
nsFrameList* list = RemovePropTableFrames(OverflowOutOfFlowsProperty());
nsFrameList* list = TakeProperty(OverflowOutOfFlowsProperty());
NS_ASSERTION(aPropValue == list, "prop value mismatch");
list->Clear();
list->Delete(PresShell());
RemoveStateBits(NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS);
} else if (HasAnyStateBits(NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS)) {
NS_ASSERTION(aPropValue == GetPropTableFrames(OverflowOutOfFlowsProperty()),
NS_ASSERTION(aPropValue == GetProperty(OverflowOutOfFlowsProperty()),
"prop value mismatch");
*aPropValue = aList;
} else {

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

@ -309,7 +309,7 @@ const nsFrameList& nsContainerFrame::GetChildList(ChildListID aListID) const {
return list ? *list : nsFrameList::EmptyList();
}
case kBackdropList: {
nsFrameList* list = GetPropTableFrames(BackdropProperty());
nsFrameList* list = GetProperty(BackdropProperty());
return list ? *list : nsFrameList::EmptyList();
}
default:
@ -1579,16 +1579,6 @@ void nsContainerFrame::DeleteNextInFlowChild(nsIFrame* aNextInFlow,
MOZ_ASSERT(!prevInFlow->GetNextInFlow(), "non null next-in-flow");
}
nsFrameList* nsContainerFrame::GetPropTableFrames(
FrameListPropertyDescriptor aProperty) const {
return GetProperty(aProperty);
}
nsFrameList* nsContainerFrame::RemovePropTableFrames(
FrameListPropertyDescriptor aProperty) {
return TakeProperty(aProperty);
}
void nsContainerFrame::PushChildrenToOverflow(nsIFrame* aFromChild,
nsIFrame* aPrevSibling) {
MOZ_ASSERT(aFromChild, "null pointer");

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

@ -634,7 +634,7 @@ class nsContainerFrame : public nsSplittableFrame {
* the frames before calling these methods.
*/
void DestroyOverflowList() {
nsFrameList* list = RemovePropTableFrames(OverflowProperty());
nsFrameList* list = TakeProperty(OverflowProperty());
MOZ_ASSERT(list && list->IsEmpty());
list->Delete(PresShell());
}
@ -807,27 +807,6 @@ class nsContainerFrame : public nsSplittableFrame {
*/
nsIFrame* PullNextInFlowChild(ContinuationTraversingState& aState);
// ==========================================================================
/*
* Convenience methods for nsFrameLists stored in the
* PresContext's proptable
*/
/**
* Get the PresContext-stored nsFrameList named aPropID for this frame.
* May return null.
*/
nsFrameList* GetPropTableFrames(FrameListPropertyDescriptor aProperty) const;
/**
* Remove and return the PresContext-stored nsFrameList named aPropID for
* this frame. May return null. The caller is responsible for deleting
* nsFrameList and either passing ownership of the frames to someone else or
* destroying the frames.
*/
[[nodiscard]] nsFrameList* RemovePropTableFrames(
FrameListPropertyDescriptor aProperty);
/**
* Safely destroy the frames on the nsFrameList stored on aProp for this
* frame then remove the property and delete the frame list.

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

@ -4134,6 +4134,13 @@ class nsIFrame : public nsQueryFrame {
mProperties.Add(aProperty, aValue);
}
/**
* Remove a property and return its value without destroying it. May return
* nullptr.
*
* Note: The caller is responsible for handling the life cycle of the returned
* value.
*/
template <typename T>
[[nodiscard]] FrameProperties::PropertyType<T> TakeProperty(
FrameProperties::Descriptor<T> aProperty, bool* aFoundResult = nullptr) {