From 0b95042db2e6dab5876abd12ce485fff0a8e08fe Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 21 Sep 2017 15:49:49 -0400 Subject: Rename CFX_RetainPtr to RetainPtr This CL renames CFX_RetainPtr to RetainPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I8798a9f79cb0840d3f037e8d04937cedd742914e Reviewed-on: https://pdfium-review.googlesource.com/14616 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- core/fxcrt/css/cfx_csscomputedstyle.h | 6 ++-- core/fxcrt/css/cfx_cssdeclaration.cpp | 46 ++++++++++++--------------- core/fxcrt/css/cfx_cssdeclaration.h | 25 +++++++-------- core/fxcrt/css/cfx_csspropertyholder.h | 4 +-- core/fxcrt/css/cfx_cssstyleselector.cpp | 21 ++++++------ core/fxcrt/css/cfx_cssstyleselector.h | 8 ++--- core/fxcrt/css/cfx_cssstylesheet_unittest.cpp | 8 ++--- core/fxcrt/css/cfx_cssvalue.h | 2 +- core/fxcrt/css/cfx_cssvaluelist.cpp | 5 ++- core/fxcrt/css/cfx_cssvaluelist.h | 6 ++-- 10 files changed, 62 insertions(+), 69 deletions(-) (limited to 'core/fxcrt/css') diff --git a/core/fxcrt/css/cfx_csscomputedstyle.h b/core/fxcrt/css/cfx_csscomputedstyle.h index b05339ac02..4b44a6d87c 100644 --- a/core/fxcrt/css/cfx_csscomputedstyle.h +++ b/core/fxcrt/css/cfx_csscomputedstyle.h @@ -15,7 +15,7 @@ class CFX_CSSValueList; -class CFX_CSSComputedStyle : public CFX_Retainable { +class CFX_CSSComputedStyle : public Retainable { public: class InheritedData { public: @@ -25,7 +25,7 @@ class CFX_CSSComputedStyle : public CFX_Retainable { CFX_CSSLength m_LetterSpacing; CFX_CSSLength m_WordSpacing; CFX_CSSLength m_TextIndent; - CFX_RetainPtr m_pFontFamily; + RetainPtr m_pFontFamily; float m_fFontSize; float m_fLineHeight; FX_ARGB m_dwFontColor; @@ -98,7 +98,7 @@ class CFX_CSSComputedStyle : public CFX_Retainable { private: template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr pdfium::MakeRetain(Args&&... args); CFX_CSSComputedStyle(); ~CFX_CSSComputedStyle() override; diff --git a/core/fxcrt/css/cfx_cssdeclaration.cpp b/core/fxcrt/css/cfx_cssdeclaration.cpp index f2c7d3930b..c44c878196 100644 --- a/core/fxcrt/css/cfx_cssdeclaration.cpp +++ b/core/fxcrt/css/cfx_cssdeclaration.cpp @@ -285,7 +285,7 @@ CFX_CSSDeclaration::CFX_CSSDeclaration() {} CFX_CSSDeclaration::~CFX_CSSDeclaration() {} -CFX_RetainPtr CFX_CSSDeclaration::GetProperty( +RetainPtr CFX_CSSDeclaration::GetProperty( CFX_CSSProperty eProperty, bool* bImportant) const { for (const auto& p : properties_) { @@ -298,7 +298,7 @@ CFX_RetainPtr CFX_CSSDeclaration::GetProperty( } void CFX_CSSDeclaration::AddPropertyHolder(CFX_CSSProperty eProperty, - CFX_RetainPtr pValue, + RetainPtr pValue, bool bImportant) { auto pHolder = pdfium::MakeUnique(); pHolder->bImportant = bImportant; @@ -335,7 +335,7 @@ void CFX_CSSDeclaration::AddProperty(const CFX_CSSPropertyTable* pTable, if (dwMatch == 0) { continue; } - CFX_RetainPtr pCSSValue; + RetainPtr pCSSValue; switch (dwMatch) { case CFX_CSSVALUETYPE_MaybeNumber: pCSSValue = ParseNumber(pszValue, iValueLen); @@ -363,7 +363,7 @@ void CFX_CSSDeclaration::AddProperty(const CFX_CSSPropertyTable* pTable, break; } case CFX_CSSVALUETYPE_Shorthand: { - CFX_RetainPtr pWidth; + RetainPtr pWidth; switch (pTable->eName) { case CFX_CSSProperty::Font: ParseFontProperty(pszValue, iValueLen, bImportant); @@ -428,9 +428,8 @@ void CFX_CSSDeclaration::AddProperty(const WideString& prop, pdfium::MakeUnique(prop, value)); } -CFX_RetainPtr CFX_CSSDeclaration::ParseNumber( - const wchar_t* pszValue, - int32_t iValueLen) { +RetainPtr CFX_CSSDeclaration::ParseNumber(const wchar_t* pszValue, + int32_t iValueLen) { float fValue; CFX_CSSNumberType eUnit; if (!ParseCSSNumber(pszValue, iValueLen, fValue, eUnit)) @@ -438,26 +437,23 @@ CFX_RetainPtr CFX_CSSDeclaration::ParseNumber( return pdfium::MakeRetain(eUnit, fValue); } -CFX_RetainPtr CFX_CSSDeclaration::ParseEnum( - const wchar_t* pszValue, - int32_t iValueLen) { +RetainPtr CFX_CSSDeclaration::ParseEnum(const wchar_t* pszValue, + int32_t iValueLen) { const CFX_CSSPropertyValueTable* pValue = GetCSSPropertyValueByName(WideStringView(pszValue, iValueLen)); return pValue ? pdfium::MakeRetain(pValue->eName) : nullptr; } -CFX_RetainPtr CFX_CSSDeclaration::ParseColor( - const wchar_t* pszValue, - int32_t iValueLen) { +RetainPtr CFX_CSSDeclaration::ParseColor(const wchar_t* pszValue, + int32_t iValueLen) { FX_ARGB dwColor; if (!ParseCSSColor(pszValue, iValueLen, &dwColor)) return nullptr; return pdfium::MakeRetain(dwColor); } -CFX_RetainPtr CFX_CSSDeclaration::ParseString( - const wchar_t* pszValue, - int32_t iValueLen) { +RetainPtr CFX_CSSDeclaration::ParseString(const wchar_t* pszValue, + int32_t iValueLen) { int32_t iOffset; if (!ParseCSSString(pszValue, iValueLen, &iOffset, &iValueLen)) return nullptr; @@ -480,7 +476,7 @@ void CFX_CSSDeclaration::ParseValueListProperty( const uint32_t dwType = pTable->dwType; CFX_CSSPrimitiveType eType; - std::vector> list; + std::vector> list; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { case CFX_CSSPrimitiveType::Number: @@ -556,7 +552,7 @@ void CFX_CSSDeclaration::ParseValueListProperty( } void CFX_CSSDeclaration::Add4ValuesProperty( - const std::vector>& list, + const std::vector>& list, bool bImportant, CFX_CSSProperty eLeft, CFX_CSSProperty eTop, @@ -595,7 +591,7 @@ void CFX_CSSDeclaration::Add4ValuesProperty( bool CFX_CSSDeclaration::ParseBorderProperty( const wchar_t* pszValue, int32_t iValueLen, - CFX_RetainPtr& pWidth) const { + RetainPtr& pWidth) const { pWidth.Reset(nullptr); CFX_CSSValueListParser parser(pszValue, iValueLen, ' '); @@ -650,12 +646,12 @@ void CFX_CSSDeclaration::ParseFontProperty(const wchar_t* pszValue, int32_t iValueLen, bool bImportant) { CFX_CSSValueListParser parser(pszValue, iValueLen, '/'); - CFX_RetainPtr pStyle; - CFX_RetainPtr pVariant; - CFX_RetainPtr pWeight; - CFX_RetainPtr pFontSize; - CFX_RetainPtr pLineHeight; - std::vector> familyList; + RetainPtr pStyle; + RetainPtr pVariant; + RetainPtr pWeight; + RetainPtr pFontSize; + RetainPtr pLineHeight; + std::vector> familyList; CFX_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { diff --git a/core/fxcrt/css/cfx_cssdeclaration.h b/core/fxcrt/css/cfx_cssdeclaration.h index dba1d44fc7..7dd0bba90e 100644 --- a/core/fxcrt/css/cfx_cssdeclaration.h +++ b/core/fxcrt/css/cfx_cssdeclaration.h @@ -34,8 +34,8 @@ class CFX_CSSDeclaration { CFX_CSSDeclaration(); ~CFX_CSSDeclaration(); - CFX_RetainPtr GetProperty(CFX_CSSProperty eProperty, - bool* bImportant) const; + RetainPtr GetProperty(CFX_CSSProperty eProperty, + bool* bImportant) const; const_prop_iterator begin() const { return properties_.begin(); } const_prop_iterator end() const { return properties_.end(); } @@ -63,27 +63,26 @@ class CFX_CSSDeclaration { bool bImportant); bool ParseBorderProperty(const wchar_t* pszValue, int32_t iValueLen, - CFX_RetainPtr& pWidth) const; + RetainPtr& pWidth) const; void ParseValueListProperty(const CFX_CSSPropertyTable* pTable, const wchar_t* pszValue, int32_t iValueLen, bool bImportant); - void Add4ValuesProperty(const std::vector>& list, + void Add4ValuesProperty(const std::vector>& list, bool bImportant, CFX_CSSProperty eLeft, CFX_CSSProperty eTop, CFX_CSSProperty eRight, CFX_CSSProperty eBottom); - CFX_RetainPtr ParseNumber(const wchar_t* pszValue, - int32_t iValueLen); - CFX_RetainPtr ParseEnum(const wchar_t* pszValue, - int32_t iValueLen); - CFX_RetainPtr ParseColor(const wchar_t* pszValue, - int32_t iValueLen); - CFX_RetainPtr ParseString(const wchar_t* pszValue, - int32_t iValueLen); + RetainPtr ParseNumber(const wchar_t* pszValue, + int32_t iValueLen); + RetainPtr ParseEnum(const wchar_t* pszValue, int32_t iValueLen); + RetainPtr ParseColor(const wchar_t* pszValue, + int32_t iValueLen); + RetainPtr ParseString(const wchar_t* pszValue, + int32_t iValueLen); void AddPropertyHolder(CFX_CSSProperty eProperty, - CFX_RetainPtr pValue, + RetainPtr pValue, bool bImportant); std::vector> properties_; diff --git a/core/fxcrt/css/cfx_csspropertyholder.h b/core/fxcrt/css/cfx_csspropertyholder.h index ab0e0ae1fb..a271bdafc7 100644 --- a/core/fxcrt/css/cfx_csspropertyholder.h +++ b/core/fxcrt/css/cfx_csspropertyholder.h @@ -7,9 +7,9 @@ #ifndef CORE_FXCRT_CSS_CFX_CSSPROPERTYHOLDER_H_ #define CORE_FXCRT_CSS_CFX_CSSPROPERTYHOLDER_H_ -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/css/cfx_css.h" #include "core/fxcrt/css/cfx_cssvalue.h" +#include "core/fxcrt/retain_ptr.h" class CFX_CSSPropertyHolder { public: @@ -18,7 +18,7 @@ class CFX_CSSPropertyHolder { CFX_CSSProperty eProperty; bool bImportant; - CFX_RetainPtr pValue; + RetainPtr pValue; }; #endif // CORE_FXCRT_CSS_CFX_CSSPROPERTYHOLDER_H_ diff --git a/core/fxcrt/css/cfx_cssstyleselector.cpp b/core/fxcrt/css/cfx_cssstyleselector.cpp index 9ae2b876f7..cb9ab2f499 100644 --- a/core/fxcrt/css/cfx_cssstyleselector.cpp +++ b/core/fxcrt/css/cfx_cssstyleselector.cpp @@ -31,7 +31,7 @@ void CFX_CSSStyleSelector::SetDefFontSize(float fFontSize) { m_fDefFontSize = fFontSize; } -CFX_RetainPtr CFX_CSSStyleSelector::CreateComputedStyle( +RetainPtr CFX_CSSStyleSelector::CreateComputedStyle( CFX_CSSComputedStyle* pParentStyle) { auto pStyle = pdfium::MakeRetain(); if (pParentStyle) @@ -168,10 +168,9 @@ void CFX_CSSStyleSelector::AppendInlineStyle(CFX_CSSDeclaration* pDecl, } } -void CFX_CSSStyleSelector::ApplyProperty( - CFX_CSSProperty eProperty, - const CFX_RetainPtr& pValue, - CFX_CSSComputedStyle* pComputedStyle) { +void CFX_CSSStyleSelector::ApplyProperty(CFX_CSSProperty eProperty, + const RetainPtr& pValue, + CFX_CSSComputedStyle* pComputedStyle) { if (pValue->GetType() != CFX_CSSPrimitiveType::List) { CFX_CSSPrimitiveType eType = pValue->GetType(); switch (eProperty) { @@ -192,7 +191,7 @@ void CFX_CSSStyleSelector::ApplyProperty( } break; case CFX_CSSProperty::LineHeight: if (eType == CFX_CSSPrimitiveType::Number) { - CFX_RetainPtr v = pValue.As(); + RetainPtr v = pValue.As(); if (v->Kind() == CFX_CSSNumberType::Number) { pComputedStyle->m_InheritedData.m_fLineHeight = v->Value() * pComputedStyle->m_InheritedData.m_fFontSize; @@ -392,7 +391,7 @@ void CFX_CSSStyleSelector::ApplyProperty( break; } } else if (pValue->GetType() == CFX_CSSPrimitiveType::List) { - CFX_RetainPtr pList = pValue.As(); + RetainPtr pList = pValue.As(); int32_t iCount = pList->CountValues(); if (iCount > 0) { switch (eProperty) { @@ -473,10 +472,10 @@ CFX_CSSFontStyle CFX_CSSStyleSelector::ToFontStyle( bool CFX_CSSStyleSelector::SetLengthWithPercent( CFX_CSSLength& width, CFX_CSSPrimitiveType eType, - const CFX_RetainPtr& pValue, + const RetainPtr& pValue, float fFontSize) { if (eType == CFX_CSSPrimitiveType::Number) { - CFX_RetainPtr v = pValue.As(); + RetainPtr v = pValue.As(); if (v->Kind() == CFX_CSSNumberType::Percent) { width.Set(CFX_CSSLengthUnit::Percent, pValue.As()->Value() / 100.0f); @@ -560,10 +559,10 @@ CFX_CSSVerticalAlign CFX_CSSStyleSelector::ToVerticalAlign( } uint32_t CFX_CSSStyleSelector::ToTextDecoration( - const CFX_RetainPtr& pValue) { + const RetainPtr& pValue) { uint32_t dwDecoration = 0; for (int32_t i = pValue->CountValues() - 1; i >= 0; --i) { - const CFX_RetainPtr pVal = pValue->GetValue(i); + const RetainPtr pVal = pValue->GetValue(i); if (pVal->GetType() != CFX_CSSPrimitiveType::Enum) continue; diff --git a/core/fxcrt/css/cfx_cssstyleselector.h b/core/fxcrt/css/cfx_cssstyleselector.h index b59e3048d6..13a0f74427 100644 --- a/core/fxcrt/css/cfx_cssstyleselector.h +++ b/core/fxcrt/css/cfx_cssstyleselector.h @@ -32,7 +32,7 @@ class CFX_CSSStyleSelector { void SetUAStyleSheet(std::unique_ptr pSheet); void UpdateStyleIndex(); - CFX_RetainPtr CreateComputedStyle( + RetainPtr CreateComputedStyle( CFX_CSSComputedStyle* pParentStyle); // Note, the dest style has to be an out param because the CXFA_TextParser @@ -55,7 +55,7 @@ class CFX_CSSStyleSelector { const CFX_CSSDeclaration* extraDecl, CFX_CSSComputedStyle* pDestStyle); void ApplyProperty(CFX_CSSProperty eProperty, - const CFX_RetainPtr& pValue, + const RetainPtr& pValue, CFX_CSSComputedStyle* pComputedStyle); void ExtractValues(const CFX_CSSDeclaration* decl, std::vector* importants, @@ -64,7 +64,7 @@ class CFX_CSSStyleSelector { bool SetLengthWithPercent(CFX_CSSLength& width, CFX_CSSPrimitiveType eType, - const CFX_RetainPtr& pValue, + const RetainPtr& pValue, float fFontSize); float ToFontSize(CFX_CSSPropertyValue eValue, float fCurFontSize); CFX_CSSDisplay ToDisplay(CFX_CSSPropertyValue eValue); @@ -72,7 +72,7 @@ class CFX_CSSStyleSelector { uint16_t ToFontWeight(CFX_CSSPropertyValue eValue); CFX_CSSFontStyle ToFontStyle(CFX_CSSPropertyValue eValue); CFX_CSSVerticalAlign ToVerticalAlign(CFX_CSSPropertyValue eValue); - uint32_t ToTextDecoration(const CFX_RetainPtr& pList); + uint32_t ToTextDecoration(const RetainPtr& pList); CFX_CSSFontVariant ToFontVariant(CFX_CSSPropertyValue eValue); float m_fDefFontSize; diff --git a/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp b/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp index abcd2f6972..30298243bc 100644 --- a/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp +++ b/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp @@ -51,7 +51,7 @@ class CFX_CSSStyleSheetTest : public testing::Test { ASSERT(decl_); bool important; - CFX_RetainPtr v = decl_->GetProperty(prop, &important); + RetainPtr v = decl_->GetProperty(prop, &important); EXPECT_EQ(v->GetType(), CFX_CSSPrimitiveType::Number); EXPECT_EQ(v.As()->Kind(), type); EXPECT_EQ(v.As()->Value(), val); @@ -61,7 +61,7 @@ class CFX_CSSStyleSheetTest : public testing::Test { ASSERT(decl_); bool important; - CFX_RetainPtr v = decl_->GetProperty(prop, &important); + RetainPtr v = decl_->GetProperty(prop, &important); EXPECT_EQ(v->GetType(), CFX_CSSPrimitiveType::Enum); EXPECT_EQ(v.As()->Value(), val); } @@ -71,12 +71,12 @@ class CFX_CSSStyleSheetTest : public testing::Test { ASSERT(decl_); bool important; - CFX_RetainPtr list = + RetainPtr list = decl_->GetProperty(prop, &important).As(); EXPECT_EQ(list->CountValues(), pdfium::CollectionSize(values)); for (size_t i = 0; i < values.size(); i++) { - CFX_RetainPtr val = list->GetValue(i); + RetainPtr val = list->GetValue(i); EXPECT_EQ(val->GetType(), CFX_CSSPrimitiveType::Enum); EXPECT_EQ(val.As()->Value(), values[i]); } diff --git a/core/fxcrt/css/cfx_cssvalue.h b/core/fxcrt/css/cfx_cssvalue.h index 4f11e4e0d7..f143e96036 100644 --- a/core/fxcrt/css/cfx_cssvalue.h +++ b/core/fxcrt/css/cfx_cssvalue.h @@ -9,7 +9,7 @@ #include "core/fxcrt/css/cfx_css.h" -class CFX_CSSValue : public CFX_Retainable { +class CFX_CSSValue : public Retainable { public: CFX_CSSPrimitiveType GetType() const { return m_value; } diff --git a/core/fxcrt/css/cfx_cssvaluelist.cpp b/core/fxcrt/css/cfx_cssvaluelist.cpp index 18b5d82054..b96f1658af 100644 --- a/core/fxcrt/css/cfx_cssvaluelist.cpp +++ b/core/fxcrt/css/cfx_cssvaluelist.cpp @@ -10,8 +10,7 @@ #include "core/fxcrt/css/cfx_css.h" -CFX_CSSValueList::CFX_CSSValueList( - std::vector>& list) +CFX_CSSValueList::CFX_CSSValueList(std::vector>& list) : CFX_CSSValue(CFX_CSSPrimitiveType::List), m_ppList(std::move(list)) {} CFX_CSSValueList::~CFX_CSSValueList() {} @@ -20,6 +19,6 @@ int32_t CFX_CSSValueList::CountValues() const { return m_ppList.size(); } -CFX_RetainPtr CFX_CSSValueList::GetValue(int32_t index) const { +RetainPtr CFX_CSSValueList::GetValue(int32_t index) const { return m_ppList[index]; } diff --git a/core/fxcrt/css/cfx_cssvaluelist.h b/core/fxcrt/css/cfx_cssvaluelist.h index 475abf4066..d2b0c6e7d1 100644 --- a/core/fxcrt/css/cfx_cssvaluelist.h +++ b/core/fxcrt/css/cfx_cssvaluelist.h @@ -13,14 +13,14 @@ class CFX_CSSValueList : public CFX_CSSValue { public: - explicit CFX_CSSValueList(std::vector>& list); + explicit CFX_CSSValueList(std::vector>& list); ~CFX_CSSValueList() override; int32_t CountValues() const; - CFX_RetainPtr GetValue(int32_t index) const; + RetainPtr GetValue(int32_t index) const; protected: - std::vector> m_ppList; + std::vector> m_ppList; }; #endif // CORE_FXCRT_CSS_CFX_CSSVALUELIST_H_ -- cgit v1.2.3