Bug 1613349 - Make nsIFrame::TakeProperty MOZ_MUST_USE. r=dholbert

Depends on D61756

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2020-02-06 00:39:10 +00:00
Родитель 86ca3370c2
Коммит bf6256b1fc
9 изменённых файлов: 12 добавлений и 11 удалений

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

@ -2665,7 +2665,9 @@ void WebRenderCommandBuilder::RemoveUnusedAndResetWebRenderUserData() {
WebRenderUserDataKey(data->GetDisplayItemKey(), data->GetType()));
if (!userDataTable->Count()) {
frame->RemoveProperty(WebRenderUserDataProperty::Key());
// Using TakeProperty as we delete the property manually on the line
// below.
Unused << frame->TakeProperty(WebRenderUserDataProperty::Key());
delete userDataTable;
}

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

@ -10359,7 +10359,7 @@ void nsCSSFrameConstructor::RemoveLetterFrames(PresShell* aPresShell,
nsContainerFrame* aBlockFrame) {
aBlockFrame =
static_cast<nsContainerFrame*>(aBlockFrame->FirstContinuation());
aBlockFrame->TakeProperty(nsContainerFrame::FirstLetterProperty());
aBlockFrame->DeleteProperty(nsContainerFrame::FirstLetterProperty());
nsContainerFrame* continuation = aBlockFrame;
bool stopLooking = false;

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

@ -1238,7 +1238,7 @@ void nsTextControlFrame::SetInitialChildList(ChildListID aListID,
MOZ_ASSERT(textControlElement);
textControlElement->InitializeKeyboardEventListeners();
if (nsPoint* contentScrollPos = GetProperty(ContentScrollPos())) {
if (nsPoint* contentScrollPos = TakeProperty(ContentScrollPos())) {
// If we have a scroll pos stored to be passed to our anonymous
// div, do it here!
nsIStatefulFrame* statefulFrame = do_QueryFrame(frame);
@ -1247,7 +1247,6 @@ void nsTextControlFrame::SetInitialChildList(ChildListID aListID,
UniquePtr<PresState> fakePresState = NewPresState();
fakePresState->scrollState() = *contentScrollPos;
statefulFrame->RestoreState(fakePresState.get());
TakeProperty(ContentScrollPos());
delete contentScrollPos;
}
} else {

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

@ -24,7 +24,7 @@ void RubyUtils::SetReservedISize(nsIFrame* aFrame, nscoord aISize) {
/* static */
void RubyUtils::ClearReservedISize(nsIFrame* aFrame) {
MOZ_ASSERT(IsExpandableRubyBox(aFrame));
aFrame->TakeProperty(ReservedISize());
aFrame->DeleteProperty(ReservedISize());
}
/* static */

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

@ -195,7 +195,7 @@ void nsContainerFrame::SafelyDestroyFrameListProp(
if (MOZ_LIKELY(frame)) {
frame->DestroyFrom(aDestructRoot, aPostDestroyData);
} else {
TakeProperty(aProp);
Unused << TakeProperty(aProp);
frameList->Delete(aPresShell);
return;
}
@ -1244,7 +1244,7 @@ static bool TryRemoveFrame(nsIFrame* aFrame,
if (list && list->StartRemoveFrame(aChildToRemove)) {
// aChildToRemove *may* have been removed from this list.
if (list->IsEmpty()) {
aFrame->TakeProperty(aProp);
Unused << aFrame->TakeProperty(aProp);
list->Delete(aFrame->PresShell());
}
return true;

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

@ -4270,7 +4270,7 @@ class MOZ_RAII AutoFlexItemMainSizeOverride final {
}
~AutoFlexItemMainSizeOverride() {
mItemFrame->TakeProperty(nsIFrame::FlexItemMainSizeOverride());
mItemFrame->DeleteProperty(nsIFrame::FlexItemMainSizeOverride());
}
private:

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

@ -3674,7 +3674,7 @@ class nsIFrame : public nsQueryFrame {
}
template <typename T>
FrameProperties::PropertyType<T> TakeProperty(
MOZ_MUST_USE FrameProperties::PropertyType<T> TakeProperty(
FrameProperties::Descriptor<T> aProperty, bool* aFoundResult = nullptr) {
return mProperties.Take(aProperty, aFoundResult);
}

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

@ -758,7 +758,7 @@ void nsLineLayout::ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus,
#endif
if (mCurrentSpan == mRootSpan) {
pfd->mFrame->TakeProperty(nsIFrame::LineBaselineOffset());
pfd->mFrame->DeleteProperty(nsIFrame::LineBaselineOffset());
} else {
#ifdef DEBUG
bool hasLineOffset;

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

@ -9383,7 +9383,7 @@ void nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
gfxFloat em = fm->EmHeight();
// Compress the characters in horizontal axis if necessary.
if (width <= em) {
TakeProperty(TextCombineScaleFactorProperty());
DeleteProperty(TextCombineScaleFactorProperty());
} else {
SetProperty(TextCombineScaleFactorProperty(), em / width);
finalSize.ISize(wm) = em;