Bug 1263486 part 2 - Use nsCSSValue move assignment operator in nsCSSValue::Adopt(Pair)ListValue
MozReview-Commit-ID: 2fTFNmtHxIP
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -6,16 +6,17 @@
/* representation of simple property values within CSS declarations */
#include "nsCSSValue.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/Likely.h"
#include "mozilla/MemoryReporting.h"
+#include "mozilla/Move.h"
#include "mozilla/css/ImageLoader.h"
#include "CSSCalc.h"
#include "gfxFontConstants.h"
#include "imgIRequest.h"
#include "imgRequestProxy.h"
#include "nsIDocument.h"
#include "nsIPrincipal.h"
#include "nsCSSProps.h"
@@ -635,19 +636,17 @@ void nsCSSValue::SetDependentListValue(n
}
void
nsCSSValue::AdoptListValue(UniquePtr<nsCSSValueList> aValue)
{
// We have to copy the first element since for owned lists the first
// element should be an nsCSSValueList_heap object.
SetListValue();
- // FIXME: If nsCSSValue gets a swap method or move assignment operator,
- // we should use that here to avoid allocating an extra value.
- mValue.mList->mValue = aValue->mValue;
+ mValue.mList->mValue = Move(aValue->mValue);
mValue.mList->mNext = aValue->mNext;
aValue->mNext = nullptr;
aValue.reset();
}
nsCSSValuePairList* nsCSSValue::SetPairListValue()
{
Reset();
@@ -667,20 +666,18 @@ void nsCSSValue::SetDependentPairListVal
}
void
nsCSSValue::AdoptPairListValue(UniquePtr<nsCSSValuePairList> aValue)
{
// We have to copy the first element, since for owned pair lists, the first
// element should be an nsCSSValuePairList_heap object.
SetPairListValue();
- // FIXME: If nsCSSValue gets a swap method or move assignment operator,
- // we should use that here to avoid allocating extra values.
- mValue.mPairList->mXValue = aValue->mXValue;
- mValue.mPairList->mYValue = aValue->mYValue;
+ mValue.mPairList->mXValue = Move(aValue->mXValue);
+ mValue.mPairList->mYValue = Move(aValue->mYValue);
mValue.mPairList->mNext = aValue->mNext;
aValue->mNext = nullptr;
aValue.reset();
}
void nsCSSValue::SetAutoValue()
{
Reset();