Use std::move() with CFX_CSSValueList ctor.
Explicitly move vectors into CFX_CSSValueList, so it is more obvious
when constructing CFX_CSSValueLists that moves are happening.
Change-Id: I2e57d5bd5b387a527ba34f913851209605bb3b70
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/70793
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/css/cfx_cssdeclaration.cpp b/core/fxcrt/css/cfx_cssdeclaration.cpp
index 5ef726b..6a843a3 100644
--- a/core/fxcrt/css/cfx_cssdeclaration.cpp
+++ b/core/fxcrt/css/cfx_cssdeclaration.cpp
@@ -401,8 +401,8 @@
CFX_CSSProperty::PaddingBottom);
return;
default: {
- auto pList = pdfium::MakeRetain<CFX_CSSValueList>(list);
- AddPropertyHolder(pProperty->eName, pList, bImportant);
+ auto value_list = pdfium::MakeRetain<CFX_CSSValueList>(std::move(list));
+ AddPropertyHolder(pProperty->eName, value_list, bImportant);
return;
}
}
@@ -509,7 +509,7 @@
RetainPtr<CFX_CSSValue> pWeight;
RetainPtr<CFX_CSSValue> pFontSize;
RetainPtr<CFX_CSSValue> pLineHeight;
- std::vector<RetainPtr<CFX_CSSValue>> familyList;
+ std::vector<RetainPtr<CFX_CSSValue>> family_list;
CFX_CSSPrimitiveType eType;
while (parser.NextValue(&eType, &pszValue, &iValueLen)) {
switch (eType) {
@@ -564,7 +564,7 @@
}
}
if (pFontSize) {
- familyList.push_back(pdfium::MakeRetain<CFX_CSSStringValue>(
+ family_list.push_back(pdfium::MakeRetain<CFX_CSSStringValue>(
WideString(pszValue, iValueLen)));
}
parser.UseCommaSeparator();
@@ -629,9 +629,10 @@
AddPropertyHolder(CFX_CSSProperty::FontWeight, pWeight, bImportant);
AddPropertyHolder(CFX_CSSProperty::FontSize, pFontSize, bImportant);
AddPropertyHolder(CFX_CSSProperty::LineHeight, pLineHeight, bImportant);
- if (!familyList.empty()) {
- auto pList = pdfium::MakeRetain<CFX_CSSValueList>(familyList);
- AddPropertyHolder(CFX_CSSProperty::FontFamily, pList, bImportant);
+ if (!family_list.empty()) {
+ auto value_list =
+ pdfium::MakeRetain<CFX_CSSValueList>(std::move(family_list));
+ AddPropertyHolder(CFX_CSSProperty::FontFamily, value_list, bImportant);
}
}
diff --git a/core/fxcrt/css/cfx_cssstyleselector.cpp b/core/fxcrt/css/cfx_cssstyleselector.cpp
index bf8b3a7..7766d8e 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.cpp
+++ b/core/fxcrt/css/cfx_cssstyleselector.cpp
@@ -391,15 +391,15 @@
break;
}
} else if (pValue->GetType() == CFX_CSSPrimitiveType::List) {
- RetainPtr<CFX_CSSValueList> pList = pValue.As<CFX_CSSValueList>();
- if (!pList->values().empty()) {
+ RetainPtr<CFX_CSSValueList> value_list = pValue.As<CFX_CSSValueList>();
+ if (!value_list->values().empty()) {
switch (eProperty) {
case CFX_CSSProperty::FontFamily:
- pComputedStyle->m_InheritedData.m_pFontFamily = pList;
+ pComputedStyle->m_InheritedData.m_pFontFamily = std::move(value_list);
break;
case CFX_CSSProperty::TextDecoration:
pComputedStyle->m_NonInheritedData.m_dwTextDecoration =
- ToTextDecoration(pList);
+ ToTextDecoration(value_list);
break;
default:
break;
diff --git a/core/fxcrt/css/cfx_cssvaluelist.cpp b/core/fxcrt/css/cfx_cssvaluelist.cpp
index 529d387..2f34ecc 100644
--- a/core/fxcrt/css/cfx_cssvaluelist.cpp
+++ b/core/fxcrt/css/cfx_cssvaluelist.cpp
@@ -10,7 +10,7 @@
#include "core/fxcrt/css/cfx_css.h"
-CFX_CSSValueList::CFX_CSSValueList(std::vector<RetainPtr<CFX_CSSValue>>& list)
+CFX_CSSValueList::CFX_CSSValueList(std::vector<RetainPtr<CFX_CSSValue>> list)
: CFX_CSSValue(CFX_CSSPrimitiveType::List), list_(std::move(list)) {}
CFX_CSSValueList::~CFX_CSSValueList() = default;
diff --git a/core/fxcrt/css/cfx_cssvaluelist.h b/core/fxcrt/css/cfx_cssvaluelist.h
index 328b7d2..71a990f 100644
--- a/core/fxcrt/css/cfx_cssvaluelist.h
+++ b/core/fxcrt/css/cfx_cssvaluelist.h
@@ -13,7 +13,7 @@
class CFX_CSSValueList final : public CFX_CSSValue {
public:
- explicit CFX_CSSValueList(std::vector<RetainPtr<CFX_CSSValue>>& list);
+ explicit CFX_CSSValueList(std::vector<RetainPtr<CFX_CSSValue>> list);
~CFX_CSSValueList() override;
const std::vector<RetainPtr<CFX_CSSValue>>& values() const { return list_; }