diff options
author | tsepez <tsepez@chromium.org> | 2017-01-05 09:09:49 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2017-01-05 09:09:49 -0800 |
commit | e4d611c9c6d882bd47b6936554bdfc5c1ea614a0 (patch) | |
tree | 0d74e49c9b56c687b343e41df8afd42e0d694dbb | |
parent | 0ef7ba086f9e48100f9caebd0a52de478f0ada0a (diff) | |
download | pdfium-e4d611c9c6d882bd47b6936554bdfc5c1ea614a0.tar.xz |
Remove CFX_MapPtrToPtr from xfa/fde.
Fix spelling of "pseudo" along the way.
Remove some FDE_LPCxxx typedefs for the sake of clarity.
Review-Url: https://codereview.chromium.org/2616813002
-rw-r--r-- | xfa/fde/css/cfde_cssrulecollection.cpp | 55 | ||||
-rw-r--r-- | xfa/fde/css/fde_css.h | 11 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssdatatable.cpp | 23 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssdatatable.h | 22 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstyleselector.cpp | 27 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstyleselector.h | 47 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstylesheet.cpp | 26 |
7 files changed, 107 insertions, 104 deletions
diff --git a/xfa/fde/css/cfde_cssrulecollection.cpp b/xfa/fde/css/cfde_cssrulecollection.cpp index 2f91c13628..5a439724a0 100644 --- a/xfa/fde/css/cfde_cssrulecollection.cpp +++ b/xfa/fde/css/cfde_cssrulecollection.cpp @@ -7,6 +7,7 @@ #include "xfa/fde/css/fde_cssstyleselector.h" #include <algorithm> +#include <map> #include <memory> #include "xfa/fde/css/fde_csscache.h" @@ -18,9 +19,9 @@ #define FDE_CSSUNIVERSALHASH ('*') void CFDE_CSSRuleCollection::Clear() { - m_IDRules.RemoveAll(); - m_TagRules.RemoveAll(); - m_ClassRules.RemoveAll(); + m_IDRules.clear(); + m_TagRules.clear(); + m_ClassRules.clear(); m_pUniversalRules = nullptr; m_pStaticStore = nullptr; m_iSelectors = 0; @@ -29,7 +30,7 @@ void CFDE_CSSRuleCollection::Clear() { CFDE_CSSRuleCollection::CFDE_CSSRuleCollection() : m_pStaticStore(nullptr), m_pUniversalRules(nullptr), - m_pPersudoRules(nullptr), + m_pPseudoRules(nullptr), m_iSelectors(0) {} CFDE_CSSRuleCollection::~CFDE_CSSRuleCollection() { @@ -62,33 +63,34 @@ void CFDE_CSSRuleCollection::AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, int32_t iSelectors = pStyleRule->CountSelectorLists(); for (int32_t i = 0; i < iSelectors; ++i) { CFDE_CSSSelector* pSelector = pStyleRule->GetSelectorList(i); - if (pSelector->GetType() == FDE_CSSSELECTORTYPE_Persudo) { + if (pSelector->GetType() == FDE_CSSSELECTORTYPE_Pseudo) { FDE_CSSRuleData* pData = NewRuleData(pSelector, pDeclaration); - AddRuleTo(m_pPersudoRules, pData); + AddRuleTo(&m_pPseudoRules, pData); continue; } if (pSelector->GetNameHash() != FDE_CSSUNIVERSALHASH) { - AddRuleTo(m_TagRules, pSelector->GetNameHash(), pSelector, + AddRuleTo(&m_TagRules, pSelector->GetNameHash(), pSelector, pDeclaration); continue; } CFDE_CSSSelector* pNext = pSelector->GetNextSelector(); if (!pNext) { FDE_CSSRuleData* pData = NewRuleData(pSelector, pDeclaration); - AddRuleTo(m_pUniversalRules, pData); + AddRuleTo(&m_pUniversalRules, pData); continue; } switch (pNext->GetType()) { case FDE_CSSSELECTORTYPE_ID: - AddRuleTo(m_IDRules, pNext->GetNameHash(), pSelector, pDeclaration); + AddRuleTo(&m_IDRules, pNext->GetNameHash(), pSelector, + pDeclaration); break; case FDE_CSSSELECTORTYPE_Class: - AddRuleTo(m_ClassRules, pNext->GetNameHash(), pSelector, + AddRuleTo(&m_ClassRules, pNext->GetNameHash(), pSelector, pDeclaration); break; case FDE_CSSSELECTORTYPE_Descendant: case FDE_CSSSELECTORTYPE_Element: - AddRuleTo(m_pUniversalRules, NewRuleData(pSelector, pDeclaration)); + AddRuleTo(&m_pUniversalRules, NewRuleData(pSelector, pDeclaration)); break; default: ASSERT(false); @@ -111,29 +113,28 @@ void CFDE_CSSRuleCollection::AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, } } -void CFDE_CSSRuleCollection::AddRuleTo(CFX_MapPtrToPtr& map, - uint32_t dwKey, - CFDE_CSSSelector* pSel, - CFDE_CSSDeclaration* pDecl) { - void* pKey = (void*)(uintptr_t)dwKey; +void CFDE_CSSRuleCollection::AddRuleTo( + std::map<uint32_t, FDE_CSSRuleData*>* pMap, + uint32_t dwKey, + CFDE_CSSSelector* pSel, + CFDE_CSSDeclaration* pDecl) { FDE_CSSRuleData* pData = NewRuleData(pSel, pDecl); - FDE_CSSRuleData* pList = nullptr; - if (!map.Lookup(pKey, (void*&)pList)) { - map.SetAt(pKey, pData); - } else if (AddRuleTo(pList, pData)) { - map.SetAt(pKey, pList); + FDE_CSSRuleData* pList = (*pMap)[dwKey]; + if (!pList) { + (*pMap)[dwKey] = pData; + } else if (AddRuleTo(&pList, pData)) { + (*pMap)[dwKey] = pList; } } -bool CFDE_CSSRuleCollection::AddRuleTo(FDE_CSSRuleData*& pList, +bool CFDE_CSSRuleCollection::AddRuleTo(FDE_CSSRuleData** pList, FDE_CSSRuleData* pData) { - if (pList) { - pData->pNext = pList->pNext; - pList->pNext = pData; + if (*pList) { + pData->pNext = (*pList)->pNext; + (*pList)->pNext = pData; return false; } - - pList = pData; + *pList = pData; return true; } diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h index 15468c2c4a..77656116a3 100644 --- a/xfa/fde/css/fde_css.h +++ b/xfa/fde/css/fde_css.h @@ -344,16 +344,17 @@ enum FDE_CSSPROPERTY { FDE_CSSPROPERTY_MAX }; -enum FDE_CSSPERSUDO { - FDE_CSSPERSUDO_After, - FDE_CSSPERSUDO_Before, - FDE_CSSPERSUDO_NONE +enum FDE_CSSPSEUDO { + FDE_CSSPSEUDO_After, + FDE_CSSPSEUDO_Before, + FDE_CSSPSEUDO_NONE }; + enum FDE_CSSSELECTORTYPE { FDE_CSSSELECTORTYPE_Element, FDE_CSSSELECTORTYPE_Descendant, FDE_CSSSELECTORTYPE_Class, - FDE_CSSSELECTORTYPE_Persudo, + FDE_CSSSELECTORTYPE_Pseudo, FDE_CSSSELECTORTYPE_ID, }; diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp index 2f4841429d..992fe80fd3 100644 --- a/xfa/fde/css/fde_cssdatatable.cpp +++ b/xfa/fde/css/fde_cssdatatable.cpp @@ -553,13 +553,12 @@ static const FDE_CSSCOLORTABLE g_FDE_CSSColors[] = { {0xDB64391D, 0xff000000}, {0xF616D507, 0xff00ff00}, {0xF6EFFF31, 0xff008000}, }; -static const FDE_CSSPERSUDOTABLE g_FDE_CSSPersudoType[] = { - {FDE_CSSPERSUDO_After, L":after", 0x16EE1FEC}, - {FDE_CSSPERSUDO_Before, L":before", 0x7DCDDE2D}, +static const FDE_CSSPSEUDOTABLE g_FDE_CSSPseudoType[] = { + {FDE_CSSPSEUDO_After, L":after", 0x16EE1FEC}, + {FDE_CSSPSEUDO_Before, L":before", 0x7DCDDE2D}, }; -FDE_LPCCSSPERSUDOTABLE FDE_GetCSSPersudoByEnum(FDE_CSSPERSUDO ePersudo) { - return (ePersudo < FDE_CSSPERSUDO_NONE) ? (g_FDE_CSSPersudoType + ePersudo) - : nullptr; +const FDE_CSSPSEUDOTABLE* FDE_GetCSSPseudoByEnum(FDE_CSSPSEUDO ePseudo) { + return ePseudo < FDE_CSSPSEUDO_NONE ? g_FDE_CSSPseudoType + ePseudo : nullptr; } const FDE_CSSPROPERTYTABLE* FDE_GetCSSPropertyByName( const CFX_WideStringC& wsName) { @@ -610,7 +609,7 @@ const FDE_CSSPROPERTYVALUETABLE* FDE_GetCSSPropertyValueByEnum( return (eName < FDE_CSSPROPERTYVALUE_MAX) ? (g_FDE_CSSPropertyValues + eName) : nullptr; } -FDE_LPCCSSMEDIATYPETABLE FDE_GetCSSMediaTypeByName( +const FDE_CSSMEDIATYPETABLE* FDE_GetCSSMediaTypeByName( const CFX_WideStringC& wsName) { ASSERT(!wsName.IsEmpty()); uint16_t wHash = FX_HashCode_GetW(wsName, true); @@ -631,7 +630,8 @@ FDE_LPCCSSMEDIATYPETABLE FDE_GetCSSMediaTypeByName( } while (iStart <= iEnd); return nullptr; } -FDE_LPCCSSLENGTHUNITTABLE FDE_GetCSSLengthUnitByName( + +const FDE_CSSLENGTHUNITTABLE* FDE_GetCSSLengthUnitByName( const CFX_WideStringC& wsName) { ASSERT(!wsName.IsEmpty()); uint16_t wHash = FX_HashCode_GetW(wsName, true); @@ -652,7 +652,8 @@ FDE_LPCCSSLENGTHUNITTABLE FDE_GetCSSLengthUnitByName( } while (iStart <= iEnd); return nullptr; } -FDE_LPCCSSCOLORTABLE FDE_GetCSSColorByName(const CFX_WideStringC& wsName) { + +const FDE_CSSCOLORTABLE* FDE_GetCSSColorByName(const CFX_WideStringC& wsName) { ASSERT(!wsName.IsEmpty()); uint32_t dwHash = FX_HashCode_GetW(wsName, true); int32_t iEnd = sizeof(g_FDE_CSSColors) / sizeof(FDE_CSSCOLORTABLE) - 1; @@ -688,7 +689,7 @@ bool FDE_ParseCSSNumber(const FX_WCHAR* pszValue, if (iValueLen >= 1 && *pszValue == '%') { eUnit = FDE_CSSPRIMITIVETYPE_Percent; } else if (iValueLen == 2) { - FDE_LPCCSSLENGTHUNITTABLE pUnit = + const FDE_CSSLENGTHUNITTABLE* pUnit = FDE_GetCSSLengthUnitByName(CFX_WideStringC(pszValue, 2)); if (pUnit) eUnit = (FDE_CSSPRIMITIVETYPE)pUnit->wValue; @@ -778,7 +779,7 @@ bool FDE_ParseCSSColor(const FX_WCHAR* pszValue, return true; } - FDE_LPCCSSCOLORTABLE pColor = + const FDE_CSSCOLORTABLE* pColor = FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen)); if (!pColor) return false; diff --git a/xfa/fde/css/fde_cssdatatable.h b/xfa/fde/css/fde_cssdatatable.h index 260432d9fc..305b58df51 100644 --- a/xfa/fde/css/fde_cssdatatable.h +++ b/xfa/fde/css/fde_cssdatatable.h @@ -130,31 +130,33 @@ struct FDE_CSSMEDIATYPETABLE { uint16_t wHash; uint16_t wValue; }; -typedef FDE_CSSMEDIATYPETABLE const* FDE_LPCCSSMEDIATYPETABLE; -FDE_LPCCSSMEDIATYPETABLE FDE_GetCSSMediaTypeByName( + +const FDE_CSSMEDIATYPETABLE* FDE_GetCSSMediaTypeByName( const CFX_WideStringC& wsName); + struct FDE_CSSLENGTHUNITTABLE { uint16_t wHash; uint16_t wValue; }; -typedef FDE_CSSLENGTHUNITTABLE const* FDE_LPCCSSLENGTHUNITTABLE; -FDE_LPCCSSLENGTHUNITTABLE FDE_GetCSSLengthUnitByName( + +const FDE_CSSLENGTHUNITTABLE* FDE_GetCSSLengthUnitByName( const CFX_WideStringC& wsName); + struct FDE_CSSCOLORTABLE { uint32_t dwHash; FX_ARGB dwValue; }; -typedef FDE_CSSCOLORTABLE const* FDE_LPCCSSCOLORTABLE; -FDE_LPCCSSCOLORTABLE FDE_GetCSSColorByName(const CFX_WideStringC& wsName); -struct FDE_CSSPERSUDOTABLE { - FDE_CSSPERSUDO eName; +const FDE_CSSCOLORTABLE* FDE_GetCSSColorByName(const CFX_WideStringC& wsName); + +struct FDE_CSSPSEUDOTABLE { + FDE_CSSPSEUDO eName; const FX_WCHAR* pszName; uint32_t dwHash; }; -typedef FDE_CSSPERSUDOTABLE const* FDE_LPCCSSPERSUDOTABLE; -FDE_LPCCSSPERSUDOTABLE FDE_GetCSSPersudoByEnum(FDE_CSSPERSUDO ePersudo); +const FDE_CSSPSEUDOTABLE* FDE_GetCSSPseudoByEnum(FDE_CSSPSEUDO ePseudo); + bool FDE_ParseCSSNumber(const FX_WCHAR* pszValue, int32_t iValueLen, FX_FLOAT& fValue, diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp index 72e5ffc12b..681d189fcc 100644 --- a/xfa/fde/css/fde_cssstyleselector.cpp +++ b/xfa/fde/css/fde_cssstyleselector.cpp @@ -198,9 +198,8 @@ void CFDE_CSSStyleSelector::Reset() { int32_t CFDE_CSSStyleSelector::MatchDeclarations( CXFA_CSSTagProvider* pTag, CFDE_CSSDeclarationArray& matchedDecls, - FDE_CSSPERSUDO ePersudoType) { - ASSERT(m_pAccelerator && pTag); - + FDE_CSSPSEUDO ePseudoType) { + ASSERT(pTag); FDE_CSSTagCache* pCache = m_pAccelerator->GetTopElement(); ASSERT(pCache && pCache->GetTag() == pTag); @@ -212,20 +211,20 @@ int32_t CFDE_CSSStyleSelector::MatchDeclarations( if (rules.CountSelectors() == 0) continue; - if (ePersudoType == FDE_CSSPERSUDO_NONE) { - MatchRules(pCache, rules.GetUniversalRuleData(), ePersudoType); + if (ePseudoType == FDE_CSSPSEUDO_NONE) { + MatchRules(pCache, rules.GetUniversalRuleData(), ePseudoType); if (pCache->HashTag()) { MatchRules(pCache, rules.GetTagRuleData(pCache->HashTag()), - ePersudoType); + ePseudoType); } int32_t iCount = pCache->CountHashClass(); for (int32_t i = 0; i < iCount; i++) { pCache->SetClassIndex(i); MatchRules(pCache, rules.GetClassRuleData(pCache->HashClass()), - ePersudoType); + ePseudoType); } } else { - MatchRules(pCache, rules.GetPersudoRuleData(), ePersudoType); + MatchRules(pCache, rules.GetPseudoRuleData(), ePseudoType); } std::sort(m_MatchedRules.begin(), m_MatchedRules.end(), @@ -241,9 +240,9 @@ int32_t CFDE_CSSStyleSelector::MatchDeclarations( void CFDE_CSSStyleSelector::MatchRules(FDE_CSSTagCache* pCache, FDE_CSSRuleData* pList, - FDE_CSSPERSUDO ePersudoType) { + FDE_CSSPSEUDO ePseudoType) { while (pList) { - if (MatchSelector(pCache, pList->pSelector, ePersudoType)) + if (MatchSelector(pCache, pList->pSelector, ePseudoType)) m_MatchedRules.push_back(pList); pList = pList->pNext; } @@ -251,7 +250,7 @@ void CFDE_CSSStyleSelector::MatchRules(FDE_CSSTagCache* pCache, bool CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache, CFDE_CSSSelector* pSel, - FDE_CSSPERSUDO ePersudoType) { + FDE_CSSPSEUDO ePseudoType) { uint32_t dwHash; while (pSel && pCache) { switch (pSel->GetType()) { @@ -261,7 +260,7 @@ bool CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache, if (dwHash != FDE_CSSUNIVERSALHASH && dwHash != pCache->HashTag()) { continue; } - if (MatchSelector(pCache, pSel->GetNextSelector(), ePersudoType)) { + if (MatchSelector(pCache, pSel->GetNextSelector(), ePseudoType)) { return true; } } @@ -284,8 +283,8 @@ bool CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache, return false; } break; - case FDE_CSSSELECTORTYPE_Persudo: - dwHash = FDE_GetCSSPersudoByEnum(ePersudoType)->dwHash; + case FDE_CSSSELECTORTYPE_Pseudo: + dwHash = FDE_GetCSSPseudoByEnum(ePseudoType)->dwHash; if (dwHash != pSel->GetNameHash()) { return false; } diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h index 81566a93b1..f4ad422c96 100644 --- a/xfa/fde/css/fde_cssstyleselector.h +++ b/xfa/fde/css/fde_cssstyleselector.h @@ -7,6 +7,7 @@ #ifndef XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ #define XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ +#include <map> #include <memory> #include <vector> @@ -41,28 +42,25 @@ class CFDE_CSSRuleCollection : public CFX_Target { uint32_t dwMediaList, CFGAS_FontMgr* pFontMgr); void Clear(); - int32_t CountSelectors() const { return m_iSelectors; } + FDE_CSSRuleData* GetIDRuleData(uint32_t dwIDHash) { - void* pData; - return m_IDRules.Lookup((void*)(uintptr_t)dwIDHash, pData) - ? (FDE_CSSRuleData*)pData - : nullptr; + auto it = m_IDRules.find(dwIDHash); + return it != m_IDRules.end() ? it->second : nullptr; } - FDE_CSSRuleData* GetTagRuleData(uint32_t dwTagHasn) { - void* pData; - return m_TagRules.Lookup((void*)(uintptr_t)dwTagHasn, pData) - ? (FDE_CSSRuleData*)pData - : nullptr; + + FDE_CSSRuleData* GetTagRuleData(uint32_t dwTagHash) { + auto it = m_TagRules.find(dwTagHash); + return it != m_TagRules.end() ? it->second : nullptr; } + FDE_CSSRuleData* GetClassRuleData(uint32_t dwIDHash) { - void* pData; - return m_ClassRules.Lookup((void*)(uintptr_t)dwIDHash, pData) - ? (FDE_CSSRuleData*)pData - : nullptr; + auto it = m_ClassRules.find(dwIDHash); + return it != m_ClassRules.end() ? it->second : nullptr; } + FDE_CSSRuleData* GetUniversalRuleData() { return m_pUniversalRules; } - FDE_CSSRuleData* GetPersudoRuleData() { return m_pPersudoRules; } + FDE_CSSRuleData* GetPseudoRuleData() { return m_pPseudoRules; } IFX_MemoryAllocator* m_pStaticStore; @@ -71,18 +69,19 @@ class CFDE_CSSRuleCollection : public CFX_Target { IFDE_CSSRule* pRule, uint32_t dwMediaList, CFGAS_FontMgr* pFontMgr); - void AddRuleTo(CFX_MapPtrToPtr& map, + void AddRuleTo(std::map<uint32_t, FDE_CSSRuleData*>* pMap, uint32_t dwKey, CFDE_CSSSelector* pSel, CFDE_CSSDeclaration* pDecl); - bool AddRuleTo(FDE_CSSRuleData*& pList, FDE_CSSRuleData* pData); + bool AddRuleTo(FDE_CSSRuleData** pList, FDE_CSSRuleData* pData); FDE_CSSRuleData* NewRuleData(CFDE_CSSSelector* pSel, CFDE_CSSDeclaration* pDecl); - CFX_MapPtrToPtr m_IDRules; - CFX_MapPtrToPtr m_TagRules; - CFX_MapPtrToPtr m_ClassRules; + + std::map<uint32_t, FDE_CSSRuleData*> m_IDRules; + std::map<uint32_t, FDE_CSSRuleData*> m_TagRules; + std::map<uint32_t, FDE_CSSRuleData*> m_ClassRules; FDE_CSSRuleData* m_pUniversalRules; - FDE_CSSRuleData* m_pPersudoRules; + FDE_CSSRuleData* m_pPseudoRules; int32_t m_iSelectors; }; @@ -104,7 +103,7 @@ class CFDE_CSSStyleSelector : public CFX_Target { IFDE_CSSComputedStyle* pParentStyle); int32_t MatchDeclarations(CXFA_CSSTagProvider* pTag, CFDE_CSSDeclarationArray& matchedDecls, - FDE_CSSPERSUDO ePersudoType = FDE_CSSPERSUDO_NONE); + FDE_CSSPSEUDO ePseudoType = FDE_CSSPSEUDO_NONE); void ComputeStyle(CXFA_CSSTagProvider* pTag, const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount, @@ -114,10 +113,10 @@ class CFDE_CSSStyleSelector : public CFX_Target { void Reset(); void MatchRules(FDE_CSSTagCache* pCache, FDE_CSSRuleData* pList, - FDE_CSSPERSUDO ePersudoType); + FDE_CSSPSEUDO ePseudoType); bool MatchSelector(FDE_CSSTagCache* pCache, CFDE_CSSSelector* pSel, - FDE_CSSPERSUDO ePersudoType); + FDE_CSSPSEUDO ePseudoType); void AppendInlineStyle(CFDE_CSSDeclaration* pDecl, const FX_WCHAR* psz, int32_t iLen); diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index fbecf4325b..a373994798 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -209,7 +209,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadMediaRule( case FDE_CSSSYNTAXSTATUS_MediaType: { int32_t iLen; const FX_WCHAR* psz = pSyntax->GetCurrentString(iLen); - FDE_LPCCSSMEDIATYPETABLE pMediaType = + const FDE_CSSMEDIATYPETABLE* pMediaType = FDE_GetCSSMediaTypeByName(CFX_WideStringC(psz, iLen)); if (pMediaType) dwMediaList |= pMediaType->wValue; @@ -438,7 +438,7 @@ bool FDE_IsCSSChar(FX_WCHAR wch) { return (wch >= 'a' && wch <= 'z') || (wch >= 'A' && wch <= 'Z'); } -int32_t FDE_GetCSSPersudoLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) { +int32_t FDE_GetCSSPseudoLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) { ASSERT(*psz == ':'); const FX_WCHAR* pStart = psz; while (psz < pEnd) { @@ -504,8 +504,8 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString( } CFDE_CSSSelector* pFirst = nullptr; CFDE_CSSSelector* pLast = nullptr; - CFDE_CSSSelector* pPersudoFirst = nullptr; - CFDE_CSSSelector* pPersudoLast = nullptr; + CFDE_CSSSelector* pPseudoFirst = nullptr; + CFDE_CSSSelector* pPseudoLast = nullptr; for (psz = pStart; psz < pEnd;) { FX_WCHAR wch = *psz; if (wch == '.' || wch == '#') { @@ -555,20 +555,20 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString( pLast = p; psz += iNameLen; } else if (wch == ':') { - int32_t iNameLen = FDE_GetCSSPersudoLen(psz, pEnd); + int32_t iNameLen = FDE_GetCSSPseudoLen(psz, pEnd); if (iNameLen == 0) { return nullptr; } CFDE_CSSSelector* p = FXTARGET_NewWith(pStaticStore) - CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Persudo, psz, iNameLen, true); + CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Pseudo, psz, iNameLen, true); if (!p) return nullptr; - if (pPersudoFirst) - pPersudoLast->SetNext(p); + if (pPseudoFirst) + pPseudoLast->SetNext(p); else - pPersudoFirst = p; - pPersudoLast = p; + pPseudoFirst = p; + pPseudoLast = p; psz += iNameLen; } else if (wch == ' ') { psz++; @@ -576,11 +576,11 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString( return nullptr; } } - if (!pPersudoFirst) + if (!pPseudoFirst) return pFirst; - pPersudoLast->SetNext(pFirst); - return pPersudoFirst; + pPseudoLast->SetNext(pFirst); + return pPseudoFirst; } CFDE_CSSDeclaration* CFDE_CSSFontFaceRule::GetDeclaration() { |