diff options
Diffstat (limited to 'xfa/fde/css')
-rw-r--r-- | xfa/fde/css/cfde_cssrulecollection.cpp | 10 | ||||
-rw-r--r-- | xfa/fde/css/fde_css.h | 8 | ||||
-rw-r--r-- | xfa/fde/css/fde_csscache.h | 2 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssdatatable.cpp | 92 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssdatatable.h | 34 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssdeclaration.cpp | 189 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssdeclaration.h | 125 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstyleselector.cpp | 136 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstyleselector.h | 55 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstylesheet.cpp | 31 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstylesheet.h | 18 | ||||
-rw-r--r-- | xfa/fde/css/fde_csssyntax.cpp | 75 | ||||
-rw-r--r-- | xfa/fde/css/fde_csssyntax.h | 38 |
13 files changed, 401 insertions, 412 deletions
diff --git a/xfa/fde/css/cfde_cssrulecollection.cpp b/xfa/fde/css/cfde_cssrulecollection.cpp index 95f94cbff3..70cc655a56 100644 --- a/xfa/fde/css/cfde_cssrulecollection.cpp +++ b/xfa/fde/css/cfde_cssrulecollection.cpp @@ -92,7 +92,7 @@ void CFDE_CSSRuleCollection::AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, AddRuleTo(m_pUniversalRules, NewRuleData(pSelector, pDeclaration)); break; default: - ASSERT(FALSE); + ASSERT(false); break; } } @@ -126,16 +126,16 @@ void CFDE_CSSRuleCollection::AddRuleTo(CFX_MapPtrToPtr& map, } } -FX_BOOL CFDE_CSSRuleCollection::AddRuleTo(FDE_CSSRuleData*& pList, - FDE_CSSRuleData* pData) { +bool CFDE_CSSRuleCollection::AddRuleTo(FDE_CSSRuleData*& pList, + FDE_CSSRuleData* pData) { if (pList) { pData->pNext = pList->pNext; pList->pNext = pData; - return FALSE; + return false; } pList = pData; - return TRUE; + return true; } FDE_CSSRuleData* CFDE_CSSRuleCollection::NewRuleData( diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h index 5b033cf014..1ee037537c 100644 --- a/xfa/fde/css/fde_css.h +++ b/xfa/fde/css/fde_css.h @@ -760,7 +760,7 @@ class IFDE_CSSStyleSheet : public IFX_Retainable { int32_t iBufSize, uint16_t wCodePage, uint32_t dwMediaList = FDE_CSSMEDIATYPE_ALL); - virtual FX_BOOL GetUrl(CFX_WideString& szUrl) = 0; + virtual bool GetUrl(CFX_WideString& szUrl) = 0; virtual uint32_t GetMediaList() const = 0; virtual uint16_t GetCodePage() const = 0; @@ -783,7 +783,7 @@ struct FDE_CSSLENGTH { return (FDE_CSSLENGTHUNIT)(m_iData & FDE_CSSUNITMASK); } FX_FLOAT GetValue() const { return (m_iData >> FDE_CSSUNITBITS) / 1024.0f; } - FX_BOOL NonZero() const { return (m_iData >> FDE_CSSUNITBITS) != 0; } + bool NonZero() const { return (m_iData >> FDE_CSSUNITBITS) != 0; } private: intptr_t m_iData; @@ -897,8 +897,8 @@ class IFDE_CSSComputedStyle : public IFX_Retainable { virtual IFDE_CSSBoundaryStyle* GetBoundaryStyles() = 0; virtual IFDE_CSSPositionStyle* GetPositionStyles() = 0; virtual IFDE_CSSParagraphStyle* GetParagraphStyles() = 0; - virtual FX_BOOL GetCustomStyle(const CFX_WideStringC& wsName, - CFX_WideString& wsValue) const = 0; + virtual bool GetCustomStyle(const CFX_WideStringC& wsName, + CFX_WideString& wsValue) const = 0; }; #endif // XFA_FDE_CSS_FDE_CSS_H_ diff --git a/xfa/fde/css/fde_csscache.h b/xfa/fde/css/fde_csscache.h index 8f4f2a78c7..10f4d9e0fa 100644 --- a/xfa/fde/css/fde_csscache.h +++ b/xfa/fde/css/fde_csscache.h @@ -58,7 +58,7 @@ class CFDE_CSSAccelerator : public CFX_Target { void OnEnterTag(CXFA_CSSTagProvider* pTag); void OnLeaveTag(CXFA_CSSTagProvider* pTag); - void Clear() { m_Stack.RemoveAll(FALSE); } + void Clear() { m_Stack.RemoveAll(false); } FDE_CSSTagCache* GetTopElement() const { return m_Stack.GetTopElement(); } diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp index 955fe9e747..d2f81833e3 100644 --- a/xfa/fde/css/fde_cssdatatable.cpp +++ b/xfa/fde/css/fde_cssdatatable.cpp @@ -17,25 +17,25 @@ uint8_t Hex2Dec(uint8_t hexHigh, uint8_t hexLow) { } // namespace -FX_BOOL FDE_CSSLengthToFloat(const FDE_CSSLENGTH& len, - FX_FLOAT fPercentBase, - FX_FLOAT& fResult) { +bool FDE_CSSLengthToFloat(const FDE_CSSLENGTH& len, + FX_FLOAT fPercentBase, + FX_FLOAT& fResult) { switch (len.GetUnit()) { case FDE_CSSLENGTHUNIT_Point: fResult = len.GetValue(); - return TRUE; + return true; case FDE_CSSLENGTHUNIT_Percent: fResult = len.GetValue() * fPercentBase; - return TRUE; + return true; default: - return FALSE; + return false; } } CFX_FloatRect FDE_CSSBoundaryToRect(IFDE_CSSBoundaryStyle* pBoundStyle, FX_FLOAT fContainerWidth, - FX_BOOL bPadding, - FX_BOOL bBorder, - FX_BOOL bMargin) { + bool bPadding, + bool bBorder, + bool bMargin) { FX_FLOAT fResult; const FDE_CSSRECT* pRect; CFX_FloatRect rect(0, 0, 0, 0); @@ -672,15 +672,15 @@ FDE_LPCCSSCOLORTABLE FDE_GetCSSColorByName(const CFX_WideStringC& wsName) { return nullptr; } -FX_BOOL FDE_ParseCSSNumber(const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_FLOAT& fValue, - FDE_CSSPRIMITIVETYPE& eUnit) { +bool FDE_ParseCSSNumber(const FX_WCHAR* pszValue, + int32_t iValueLen, + FX_FLOAT& fValue, + FDE_CSSPRIMITIVETYPE& eUnit) { ASSERT(pszValue && iValueLen > 0); int32_t iUsedLen = 0; fValue = FXSYS_wcstof(pszValue, iValueLen, &iUsedLen); if (iUsedLen <= 0) - return FALSE; + return false; iValueLen -= iUsedLen; pszValue += iUsedLen; @@ -693,13 +693,13 @@ FX_BOOL FDE_ParseCSSNumber(const FX_WCHAR* pszValue, if (pUnit) eUnit = (FDE_CSSPRIMITIVETYPE)pUnit->wValue; } - return TRUE; + return true; } -FX_BOOL FDE_ParseCSSString(const FX_WCHAR* pszValue, - int32_t iValueLen, - int32_t& iOffset, - int32_t& iLength) { +bool FDE_ParseCSSString(const FX_WCHAR* pszValue, + int32_t iValueLen, + int32_t& iOffset, + int32_t& iLength) { ASSERT(pszValue && iValueLen > 0); iOffset = 0; iLength = iValueLen; @@ -712,25 +712,25 @@ FX_BOOL FDE_ParseCSSString(const FX_WCHAR* pszValue, return iValueLen > 0; } -FX_BOOL FDE_ParseCSSURI(const FX_WCHAR* pszValue, - int32_t iValueLen, - int32_t& iOffset, - int32_t& iLength) { +bool FDE_ParseCSSURI(const FX_WCHAR* pszValue, + int32_t iValueLen, + int32_t& iOffset, + int32_t& iLength) { ASSERT(pszValue && iValueLen > 0); if (iValueLen < 6 || pszValue[iValueLen - 1] != ')' || FXSYS_wcsnicmp(L"url(", pszValue, 4)) { - return FALSE; + return false; } if (FDE_ParseCSSString(pszValue + 4, iValueLen - 5, iOffset, iLength)) { iOffset += 4; - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_ARGB& dwColor) { +bool FDE_ParseCSSColor(const FX_WCHAR* pszValue, + int32_t iValueLen, + FX_ARGB& dwColor) { ASSERT(pszValue && iValueLen > 0); if (*pszValue == '#') { @@ -740,23 +740,23 @@ FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue, uint8_t green = Hex2Dec((uint8_t)pszValue[2], (uint8_t)pszValue[2]); uint8_t blue = Hex2Dec((uint8_t)pszValue[3], (uint8_t)pszValue[3]); dwColor = ArgbEncode(255, red, green, blue); - return TRUE; + return true; } case 7: { uint8_t red = Hex2Dec((uint8_t)pszValue[1], (uint8_t)pszValue[2]); uint8_t green = Hex2Dec((uint8_t)pszValue[3], (uint8_t)pszValue[4]); uint8_t blue = Hex2Dec((uint8_t)pszValue[5], (uint8_t)pszValue[6]); dwColor = ArgbEncode(255, red, green, blue); - return TRUE; + return true; } default: - return FALSE; + return false; } } if (iValueLen >= 10) { if (pszValue[iValueLen - 1] != ')' || FXSYS_wcsnicmp(L"rgb(", pszValue, 4)) - return FALSE; + return false; uint8_t rgb[3] = {0}; FX_FLOAT fValue; @@ -764,27 +764,27 @@ FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue, CFDE_CSSValueListParser list(pszValue + 4, iValueLen - 5, ','); for (int32_t i = 0; i < 3; ++i) { if (!list.NextValue(eType, pszValue, iValueLen)) - return FALSE; + return false; if (eType != FDE_CSSPRIMITIVETYPE_Number) - return FALSE; + return false; if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) - return FALSE; + return false; rgb[i] = eType == FDE_CSSPRIMITIVETYPE_Percent ? FXSYS_round(fValue * 2.55f) : FXSYS_round(fValue); } dwColor = ArgbEncode(255, rgb[0], rgb[1], rgb[2]); - return TRUE; + return true; } FDE_LPCCSSCOLORTABLE pColor = FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen)); if (!pColor) - return FALSE; + return false; dwColor = pColor->dwValue; - return TRUE; + return true; } CFDE_CSSValueList::CFDE_CSSValueList(IFX_MemoryAllocator* pStaticStore, @@ -802,14 +802,14 @@ int32_t CFDE_CSSValueList::CountValues() const { IFDE_CSSValue* CFDE_CSSValueList::GetValue(int32_t index) const { return m_ppList[index]; } -FX_BOOL CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType, - const FX_WCHAR*& pStart, - int32_t& iLength) { +bool CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType, + const FX_WCHAR*& pStart, + int32_t& iLength) { while (m_pCur < m_pEnd && (*m_pCur <= ' ' || *m_pCur == m_Separator)) { ++m_pCur; } if (m_pCur >= m_pEnd) { - return FALSE; + return false; } eType = FDE_CSSPRIMITIVETYPE_Unknown; pStart = m_pCur; @@ -853,14 +853,14 @@ FX_BOOL CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType, eType = FDE_CSSPRIMITIVETYPE_RGB; } } else { - iLength = SkipTo(m_Separator, TRUE, TRUE); + iLength = SkipTo(m_Separator, true, true); eType = FDE_CSSPRIMITIVETYPE_String; } return m_pCur <= m_pEnd && iLength > 0; } int32_t CFDE_CSSValueListParser::SkipTo(FX_WCHAR wch, - FX_BOOL bWSSeparator, - FX_BOOL bBrContinue) { + bool bWSSeparator, + bool bBrContinue) { const FX_WCHAR* pStart = m_pCur; if (!bBrContinue) { if (bWSSeparator) { diff --git a/xfa/fde/css/fde_cssdatatable.h b/xfa/fde/css/fde_cssdatatable.h index 62eff3f014..660895cdb0 100644 --- a/xfa/fde/css/fde_cssdatatable.h +++ b/xfa/fde/css/fde_cssdatatable.h @@ -81,15 +81,15 @@ class CFDE_CSSValueListParser : public CFX_Target { : m_Separator(separator), m_pCur(psz), m_pEnd(psz + iLen) { ASSERT(psz && iLen > 0); } - FX_BOOL NextValue(FDE_CSSPRIMITIVETYPE& eType, - const FX_WCHAR*& pStart, - int32_t& iLength); + bool NextValue(FDE_CSSPRIMITIVETYPE& eType, + const FX_WCHAR*& pStart, + int32_t& iLength); FX_WCHAR m_Separator; protected: int32_t SkipTo(FX_WCHAR wch, - FX_BOOL bWSSeparator = FALSE, - FX_BOOL bBrContinue = FALSE); + bool bWSSeparator = false, + bool bBrContinue = false); const FX_WCHAR* m_pCur; const FX_WCHAR* m_pEnd; @@ -155,20 +155,20 @@ struct FDE_CSSPERSUDOTABLE { typedef FDE_CSSPERSUDOTABLE const* FDE_LPCCSSPERSUDOTABLE; FDE_LPCCSSPERSUDOTABLE FDE_GetCSSPersudoByEnum(FDE_CSSPERSUDO ePersudo); -FX_BOOL FDE_ParseCSSNumber(const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_FLOAT& fValue, - FDE_CSSPRIMITIVETYPE& eUnit); -FX_BOOL FDE_ParseCSSString(const FX_WCHAR* pszValue, - int32_t iValueLen, - int32_t& iOffset, - int32_t& iLength); -FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_ARGB& dwColor); -FX_BOOL FDE_ParseCSSURI(const FX_WCHAR* pszValue, +bool FDE_ParseCSSNumber(const FX_WCHAR* pszValue, + int32_t iValueLen, + FX_FLOAT& fValue, + FDE_CSSPRIMITIVETYPE& eUnit); +bool FDE_ParseCSSString(const FX_WCHAR* pszValue, int32_t iValueLen, int32_t& iOffset, int32_t& iLength); +bool FDE_ParseCSSColor(const FX_WCHAR* pszValue, + int32_t iValueLen, + FX_ARGB& dwColor); +bool FDE_ParseCSSURI(const FX_WCHAR* pszValue, + int32_t iValueLen, + int32_t& iOffset, + int32_t& iLength); #endif // XFA_FDE_CSS_FDE_CSSDATATABLE_H_ diff --git a/xfa/fde/css/fde_cssdeclaration.cpp b/xfa/fde/css/fde_cssdeclaration.cpp index 3ce6ebabd6..2196d6bd91 100644 --- a/xfa/fde/css/fde_cssdeclaration.cpp +++ b/xfa/fde/css/fde_cssdeclaration.cpp @@ -9,7 +9,7 @@ #include "core/fxcrt/fx_ext.h" IFDE_CSSValue* CFDE_CSSDeclaration::GetProperty(FDE_CSSPROPERTY eProperty, - FX_BOOL& bImportant) const { + bool& bImportant) const { for (const FDE_CSSPropertyHolder* pHolder = m_pFirstProperty; pHolder; pHolder = pHolder->pNext) { if (pHolder->eProperty == eProperty) { @@ -25,7 +25,7 @@ FX_POSITION CFDE_CSSDeclaration::GetStartPosition() const { void CFDE_CSSDeclaration::GetNextProperty(FX_POSITION& pos, FDE_CSSPROPERTY& eProperty, IFDE_CSSValue*& pValue, - FX_BOOL& bImportant) const { + bool& bImportant) const { const FDE_CSSPropertyHolder* pHolder = (const FDE_CSSPropertyHolder*)pos; bImportant = pHolder->bImportant; eProperty = (FDE_CSSPROPERTY)pHolder->eProperty; @@ -86,7 +86,7 @@ inline IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewEnumValue( void CFDE_CSSDeclaration::AddPropertyHolder(IFX_MemoryAllocator* pStaticStore, FDE_CSSPROPERTY eProperty, IFDE_CSSValue* pValue, - FX_BOOL bImportant) { + bool bImportant) { FDE_CSSPropertyHolder* pHolder = FXTARGET_NewWith(pStaticStore) FDE_CSSPropertyHolder; pHolder->bImportant = bImportant; @@ -99,17 +99,17 @@ void CFDE_CSSDeclaration::AddPropertyHolder(IFX_MemoryAllocator* pStaticStore, m_pFirstProperty = pHolder; m_pLastProperty = pHolder; } -FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen) { +bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen) { ASSERT(iValueLen > 0); - FX_BOOL bImportant = FALSE; + bool bImportant = false; if (iValueLen >= 10 && pszValue[iValueLen - 10] == '!' && FXSYS_wcsnicmp(L"important", pszValue + iValueLen - 9, 9) == 0) { if ((iValueLen -= 10) == 0) { - return FALSE; + return false; } - bImportant = TRUE; + bImportant = true; } const uint32_t dwType = pArgs->pProperty->dwType; switch (dwType & 0x0F) { @@ -152,10 +152,10 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, if (pCSSValue) { AddPropertyHolder(pArgs->pStaticStore, pArgs->pProperty->eName, pCSSValue, bImportant); - return TRUE; + return true; } if (FDE_IsOnlyValue(dwType, g_ValueGuessOrder[i])) { - return FALSE; + return false; } } } break; @@ -189,7 +189,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, FDE_CSSPROPERTY_BorderBottomColor, FDE_CSSPROPERTY_BorderBottomStyle, FDE_CSSPROPERTY_BorderBottomWidth); - return TRUE; + return true; } break; case FDE_CSSPROPERTY_BorderLeft: @@ -199,7 +199,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, FDE_CSSPROPERTY_BorderLeftColor, FDE_CSSPROPERTY_BorderLeftStyle, FDE_CSSPROPERTY_BorderLeftWidth); - return TRUE; + return true; } break; case FDE_CSSPROPERTY_BorderTop: @@ -209,7 +209,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, FDE_CSSPROPERTY_BorderTopColor, FDE_CSSPROPERTY_BorderTopStyle, FDE_CSSPROPERTY_BorderTopWidth); - return TRUE; + return true; } break; case FDE_CSSPROPERTY_BorderRight: @@ -219,7 +219,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, FDE_CSSPROPERTY_BorderRightColor, FDE_CSSPROPERTY_BorderRightStyle, FDE_CSSPROPERTY_BorderRightWidth); - return TRUE; + return true; } break; case FDE_CSSPROPERTY_BorderBottom: @@ -229,7 +229,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, FDE_CSSPROPERTY_BorderBottomColor, FDE_CSSPROPERTY_BorderBottomStyle, FDE_CSSPROPERTY_BorderBottomWidth); - return TRUE; + return true; } break; case FDE_CSSPROPERTY_Overflow: @@ -252,16 +252,16 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, return ParseValueListProperty(pArgs, pszValue, iValueLen, bImportant); } default: - ASSERT(FALSE); + ASSERT(false); break; } - return FALSE; + return false; } -FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszName, - int32_t iNameLen, - const FX_WCHAR* pszValue, - int32_t iValueLen) { +bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszName, + int32_t iNameLen, + const FX_WCHAR* pszValue, + int32_t iValueLen) { FDE_CSSCustomProperty* pProperty = FXTARGET_NewWith(pArgs->pStaticStore) FDE_CSSCustomProperty; pProperty->pwsName = CopyToLocal(pArgs, pszName, iNameLen); @@ -272,7 +272,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, else m_pFirstCustom = pProperty; m_pLastCustom = pProperty; - return TRUE; + return true; } IFDE_CSSValue* CFDE_CSSDeclaration::ParseNumber( const FDE_CSSPROPERTYARGS* pArgs, @@ -401,11 +401,10 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( return FXTARGET_NewWith(pArgs->pStaticStore) CFDE_CSSPrimitiveValue(pFunction); } -FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( - const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant) { +bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); FDE_CSSPRIMITIVETYPE eType; @@ -417,7 +416,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( eType, CopyToLocal(pArgs, pszValue, iValueLen))); break; case FDE_CSSPRIMITIVETYPE_Number: - return FALSE; + return false; case FDE_CSSPRIMITIVETYPE_String: { const FDE_CSSPROPERTYVALUETABLE* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); @@ -428,7 +427,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( if (list.GetSize() == 0) { list.Add(NewEnumValue(pStaticStore, pValue->eName)); } else { - return FALSE; + return false; } } break; case FDE_CSSPROPERTYVALUE_OpenQuote: @@ -438,7 +437,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( list.Add(NewEnumValue(pStaticStore, pValue->eName)); break; default: - return FALSE; + return false; } continue; } @@ -451,25 +450,24 @@ FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( eType, CopyToLocal(pArgs, pszValue, iValueLen))); } break; case FDE_CSSPRIMITIVETYPE_RGB: - return FALSE; + return false; default: break; } } if (list.GetSize() == 0) { - return FALSE; + return false; } AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, FXTARGET_NewWith(pStaticStore) CFDE_CSSValueList(pStaticStore, list), bImportant); - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseCounterProperty( - const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant) { +bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); CFDE_CSSValueArray list; @@ -486,7 +484,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseCounterProperty( CFDE_CSSValueList(pStaticStore, list)); list.RemoveAll(); } else { - return FALSE; + return false; } } } break; @@ -513,19 +511,19 @@ FX_BOOL CFDE_CSSDeclaration::ParseCounterProperty( CFDE_CSSValueList(pStaticStore, list)); } if (listFull.GetSize() == 0) { - return FALSE; + return false; } AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, FXTARGET_NewWith(pStaticStore) CFDE_CSSValueList(pStaticStore, listFull), bImportant); - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseValueListProperty( +bool CFDE_CSSDeclaration::ParseValueListProperty( const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - FX_BOOL bImportant) { + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; FX_WCHAR separator = (pArgs->pProperty->eName == FDE_CSSPROPERTY_FontFamily) ? ',' : ' '; @@ -581,7 +579,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseValueListProperty( } } if (list.GetSize() == 0) { - return FALSE; + return false; } switch (pArgs->pProperty->eName) { case FDE_CSSPROPERTY_BorderColor: @@ -614,50 +612,49 @@ FX_BOOL CFDE_CSSDeclaration::ParseValueListProperty( FXTARGET_NewWith(pStaticStore) CFDE_CSSValueList(pStaticStore, list); AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, pList, bImportant); - return TRUE; + return true; } break; } - return FALSE; + return false; } -FX_BOOL CFDE_CSSDeclaration::Add4ValuesProperty( - IFX_MemoryAllocator* pStaticStore, - const CFDE_CSSValueArray& list, - FX_BOOL bImportant, - FDE_CSSPROPERTY eLeft, - FDE_CSSPROPERTY eTop, - FDE_CSSPROPERTY eRight, - FDE_CSSPROPERTY eBottom) { +bool CFDE_CSSDeclaration::Add4ValuesProperty(IFX_MemoryAllocator* pStaticStore, + const CFDE_CSSValueArray& list, + bool bImportant, + FDE_CSSPROPERTY eLeft, + FDE_CSSPROPERTY eTop, + FDE_CSSPROPERTY eRight, + FDE_CSSPROPERTY eBottom) { switch (list.GetSize()) { case 1: AddPropertyHolder(pStaticStore, eLeft, list[0], bImportant); AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); AddPropertyHolder(pStaticStore, eRight, list[0], bImportant); AddPropertyHolder(pStaticStore, eBottom, list[0], bImportant); - return TRUE; + return true; case 2: AddPropertyHolder(pStaticStore, eLeft, list[1], bImportant); AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); AddPropertyHolder(pStaticStore, eBottom, list[0], bImportant); - return TRUE; + return true; case 3: AddPropertyHolder(pStaticStore, eLeft, list[1], bImportant); AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); AddPropertyHolder(pStaticStore, eBottom, list[2], bImportant); - return TRUE; + return true; case 4: AddPropertyHolder(pStaticStore, eLeft, list[3], bImportant); AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); AddPropertyHolder(pStaticStore, eBottom, list[2], bImportant); - return TRUE; + return true; default: break; } - return FALSE; + return false; } -FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty( +bool CFDE_CSSDeclaration::ParseBorderPropoerty( IFX_MemoryAllocator* pStaticStore, const FX_WCHAR* pszValue, int32_t iValueLen, @@ -741,13 +738,13 @@ FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty( pStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); if (!pWidth) pWidth = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f); - return TRUE; + return true; } void CFDE_CSSDeclaration::AddBorderProperty(IFX_MemoryAllocator* pStaticStore, IFDE_CSSValue* pColor, IFDE_CSSValue* pStyle, IFDE_CSSValue* pWidth, - FX_BOOL bImportant, + bool bImportant, FDE_CSSPROPERTY eColor, FDE_CSSPROPERTY eStyle, FDE_CSSPROPERTY eWidth) { @@ -755,11 +752,11 @@ void CFDE_CSSDeclaration::AddBorderProperty(IFX_MemoryAllocator* pStaticStore, AddPropertyHolder(pStaticStore, eWidth, pWidth, bImportant); AddPropertyHolder(pStaticStore, eColor, pColor, bImportant); } -FX_BOOL CFDE_CSSDeclaration::ParseListStyleProperty( +bool CFDE_CSSDeclaration::ParseListStyleProperty( const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - FX_BOOL bImportant) { + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pType = nullptr; @@ -829,13 +826,13 @@ FX_BOOL CFDE_CSSDeclaration::ParseListStyleProperty( bImportant); AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStyleType, pType, bImportant); - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty( +bool CFDE_CSSDeclaration::ParseBackgroundProperty( const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - FX_BOOL bImportant) { + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pColor = nullptr; @@ -966,12 +963,12 @@ FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty( bImportant); AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundAttachment, pAttachment, bImportant); - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant) { +bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, '/'); IFDE_CSSPrimitiveValue* pStyle = nullptr; @@ -1096,13 +1093,13 @@ FX_BOOL CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontFamily, pList, bImportant); } - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty( +bool CFDE_CSSDeclaration::ParseColumnRuleProperty( const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - FX_BOOL bImportant) { + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pColumnRuleWidth = nullptr; @@ -1172,7 +1169,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty( } } if (!pColumnRuleColor && !pColumnRuleStyle && !pColumnRuleWidth) - return FALSE; + return false; if (!pColumnRuleStyle) pColumnRuleStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); @@ -1188,13 +1185,12 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty( pColumnRuleWidth, bImportant); AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnRuleColor, pColumnRuleColor, bImportant); - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseTextEmphasisProperty( - FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant) { +bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); CFDE_CSSValueArray arrEmphasisStyle; @@ -1241,13 +1237,12 @@ FX_BOOL CFDE_CSSDeclaration::ParseTextEmphasisProperty( AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_TextEmphasisColor, pEmphasisColor, bImportant); } - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty( - const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant) { +bool CFDE_CSSDeclaration::ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pColumnWidth = nullptr; @@ -1282,7 +1277,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty( } } if (!pColumnWidth && !pColumnCount) - return FALSE; + return false; if (!pColumnWidth) pColumnWidth = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Auto); @@ -1293,13 +1288,13 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty( bImportant); AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnCount, pColumnCount, bImportant); - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty( +bool CFDE_CSSDeclaration::ParseOverflowProperty( const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - FX_BOOL bImportant) { + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pOverflowX = nullptr; @@ -1318,7 +1313,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty( case FDE_CSSOVERFLOW_NoDisplay: case FDE_CSSOVERFLOW_NoContent: if (pOverflowX && pOverflowY) - return FALSE; + return false; if (!pOverflowX) { pOverflowX = NewEnumValue(pStaticStore, pValue->eName); } else if (!pOverflowY) { @@ -1332,7 +1327,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty( } } if (!pOverflowX && !pOverflowY) - return FALSE; + return false; if (!pOverflowY) pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum()); @@ -1341,5 +1336,5 @@ FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty( bImportant); AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY, bImportant); - return TRUE; + return true; } diff --git a/xfa/fde/css/fde_cssdeclaration.h b/xfa/fde/css/fde_cssdeclaration.h index 3598429e3a..f03b0c616a 100644 --- a/xfa/fde/css/fde_cssdeclaration.h +++ b/xfa/fde/css/fde_cssdeclaration.h @@ -14,7 +14,7 @@ class FDE_CSSPropertyHolder : public CFX_Target { public: int16_t eProperty; - FX_BOOL bImportant; + bool bImportant; IFDE_CSSValue* pValue; FDE_CSSPropertyHolder* pNext; }; @@ -40,88 +40,87 @@ class CFDE_CSSDeclaration : public CFX_Target { m_pFirstCustom(nullptr), m_pLastCustom(nullptr) {} - IFDE_CSSValue* GetProperty(FDE_CSSPROPERTY eProperty, - FX_BOOL& bImportant) const; + IFDE_CSSValue* GetProperty(FDE_CSSPROPERTY eProperty, bool& bImportant) const; FX_POSITION GetStartPosition() const; void GetNextProperty(FX_POSITION& pos, FDE_CSSPROPERTY& eProperty, IFDE_CSSValue*& pValue, - FX_BOOL& bImportant) const; + bool& bImportant) const; FX_POSITION GetStartCustom() const; void GetNextCustom(FX_POSITION& pos, CFX_WideString& wsName, CFX_WideString& wsValue) const; - FX_BOOL AddProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen); - FX_BOOL AddProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszName, - int32_t iNameLen, - const FX_WCHAR* pszValue, - int32_t iValueLen); + bool AddProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen); + bool AddProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszName, + int32_t iNameLen, + const FX_WCHAR* pszValue, + int32_t iValueLen); protected: - FX_BOOL ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseColumnRuleProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseOverflowProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseBackgroundProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseListStyleProperty(const FDE_CSSPROPERTYARGS* pArgs, + bool ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseBorderPropoerty(IFX_MemoryAllocator* pStaticStore, + bool bImportant); + bool ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseColumnRuleProperty(const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - IFDE_CSSValue*& pColor, - IFDE_CSSValue*& pStyle, - IFDE_CSSValue*& pWidth) const; + bool bImportant); + bool ParseOverflowProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseBackgroundProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseListStyleProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseBorderPropoerty(IFX_MemoryAllocator* pStaticStore, + const FX_WCHAR* pszValue, + int32_t iValueLen, + IFDE_CSSValue*& pColor, + IFDE_CSSValue*& pStyle, + IFDE_CSSValue*& pWidth) const; void AddBorderProperty(IFX_MemoryAllocator* pStaticStore, IFDE_CSSValue* pColor, IFDE_CSSValue* pStyle, IFDE_CSSValue* pWidth, - FX_BOOL bImportant, + bool bImportant, FDE_CSSPROPERTY eColor, FDE_CSSPROPERTY eStyle, FDE_CSSPROPERTY eWidth); - FX_BOOL ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseValueListProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL Add4ValuesProperty(IFX_MemoryAllocator* pStaticStore, - const CFDE_CSSValueArray& list, - FX_BOOL bImportant, - FDE_CSSPROPERTY eLeft, - FDE_CSSPROPERTY eTop, - FDE_CSSPROPERTY eRight, - FDE_CSSPROPERTY eBottom); + bool ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseValueListProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool Add4ValuesProperty(IFX_MemoryAllocator* pStaticStore, + const CFDE_CSSValueArray& list, + bool bImportant, + FDE_CSSPROPERTY eLeft, + FDE_CSSPROPERTY eTop, + FDE_CSSPROPERTY eRight, + FDE_CSSPROPERTY eBottom); IFDE_CSSValue* ParseNumber(const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen); @@ -146,7 +145,7 @@ class CFDE_CSSDeclaration : public CFX_Target { void AddPropertyHolder(IFX_MemoryAllocator* pStaticStore, FDE_CSSPROPERTY eProperty, IFDE_CSSValue* pValue, - FX_BOOL bImportant); + bool bImportant); IFDE_CSSPrimitiveValue* NewNumberValue(IFX_MemoryAllocator* pStaticStore, FDE_CSSPRIMITIVETYPE eUnit, FX_FLOAT fValue) const; diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp index b68ace8dce..3eef4e4a4a 100644 --- a/xfa/fde/css/fde_cssstyleselector.cpp +++ b/xfa/fde/css/fde_cssstyleselector.cpp @@ -34,10 +34,10 @@ void CFDE_CSSCounterStyle::DoUpdateIndex(IFDE_CSSValueList* pList) { int32_t iCount = pList->CountValues(); FX_FLOAT fDefValue = 1.0; - FX_BOOL bDefIncrement = TRUE; + bool bDefIncrement = true; if (pList == m_pCounterReset) { fDefValue = 0.0; - bDefIncrement = FALSE; + bDefIncrement = false; } for (int32_t i = 0; i < iCount; i++) { IFDE_CSSValueList* pCounter = @@ -56,20 +56,20 @@ void CFDE_CSSCounterStyle::DoUpdateIndex(IFDE_CSSValueList* pList) { FDE_CSSCOUNTERDATA data; data.m_pszIdent = pszIdentifier; if (bDefIncrement) { - data.m_bIncrement = TRUE; + data.m_bIncrement = true; data.m_iIncVal = (int32_t)fValue; } else { data.m_iResetVal = (int32_t)fValue; - data.m_bReset = TRUE; + data.m_bReset = true; } m_arrCounterData.Add(data); } else { FDE_CSSCOUNTERDATA& data = m_arrCounterData.ElementAt(iIndex); if (bDefIncrement) { - data.m_bIncrement = TRUE; + data.m_bIncrement = true; data.m_iIncVal += (int32_t)fValue; } else { - data.m_bReset = TRUE; + data.m_bReset = true; data.m_iResetVal = (int32_t)fValue; } } @@ -77,7 +77,7 @@ void CFDE_CSSCounterStyle::DoUpdateIndex(IFDE_CSSValueList* pList) { } CFDE_CSSCounterStyle::CFDE_CSSCounterStyle() - : m_pCounterInc(nullptr), m_pCounterReset(nullptr), m_bIndexDirty(FALSE) {} + : m_pCounterInc(nullptr), m_pCounterReset(nullptr), m_bIndexDirty(false) {} CFDE_CSSCounterStyle::~CFDE_CSSCounterStyle() {} @@ -88,7 +88,7 @@ void CFDE_CSSCounterStyle::UpdateIndex() { m_arrCounterData.RemoveAll(); DoUpdateIndex(m_pCounterInc); DoUpdateIndex(m_pCounterReset); - m_bIndexDirty = FALSE; + m_bIndexDirty = false; } FDE_CSSRuleData::FDE_CSSRuleData(CFDE_CSSSelector* pSel, @@ -148,17 +148,17 @@ IFDE_CSSComputedStyle* CFDE_CSSStyleSelector::CreateComputedStyle( return pStyle; } -FX_BOOL CFDE_CSSStyleSelector::SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, - IFDE_CSSStyleSheet* pSheet) { +bool CFDE_CSSStyleSelector::SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, + IFDE_CSSStyleSheet* pSheet) { ASSERT(eType < FDE_CSSSTYLESHEETGROUP_MAX); CFDE_CSSStyleSheetArray& dest = m_SheetGroups[eType]; dest.RemoveAt(0, dest.GetSize()); if (pSheet) dest.Add(pSheet); - return TRUE; + return true; } -FX_BOOL CFDE_CSSStyleSelector::SetStyleSheets( +bool CFDE_CSSStyleSelector::SetStyleSheets( FDE_CSSSTYLESHEETGROUP eType, const CFDE_CSSStyleSheetArray* pArray) { ASSERT(eType < FDE_CSSSTYLESHEETGROUP_MAX); @@ -167,7 +167,7 @@ FX_BOOL CFDE_CSSStyleSelector::SetStyleSheets( dest.Copy(*pArray); else dest.RemoveAt(0, dest.GetSize()); - return TRUE; + return true; } void CFDE_CSSStyleSelector::SetStylePriority( @@ -247,9 +247,9 @@ void CFDE_CSSStyleSelector::MatchRules(FDE_CSSTagCache* pCache, } } -FX_BOOL CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache, - CFDE_CSSSelector* pSel, - FDE_CSSPERSUDO ePersudoType) { +bool CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache, + CFDE_CSSSelector* pSel, + FDE_CSSPERSUDO ePersudoType) { uint32_t dwHash; while (pSel && pCache) { switch (pSel->GetType()) { @@ -260,36 +260,36 @@ FX_BOOL CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache, continue; } if (MatchSelector(pCache, pSel->GetNextSelector(), ePersudoType)) { - return TRUE; + return true; } } - return FALSE; + return false; case FDE_CSSSELECTORTYPE_ID: dwHash = pCache->HashID(); if (dwHash != pSel->GetNameHash()) { - return FALSE; + return false; } break; case FDE_CSSSELECTORTYPE_Class: dwHash = pCache->HashClass(); if (dwHash != pSel->GetNameHash()) { - return FALSE; + return false; } break; case FDE_CSSSELECTORTYPE_Element: dwHash = pSel->GetNameHash(); if (dwHash != FDE_CSSUNIVERSALHASH && dwHash != pCache->HashTag()) { - return FALSE; + return false; } break; case FDE_CSSSELECTORTYPE_Persudo: dwHash = FDE_GetCSSPersudoByEnum(ePersudoType)->dwHash; if (dwHash != pSel->GetNameHash()) { - return FALSE; + return false; } break; default: - ASSERT(FALSE); + ASSERT(false); break; } pSel = pSel->GetNextSelector(); @@ -344,9 +344,9 @@ void CFDE_CSSStyleSelector::ComputeStyle( FXSYS_memcpy(ppInline, ppDeclArray, iDeclCount * sizeof(CFDE_CSSDeclaration*)); ppInline[iDeclCount++] = pDecl; - ApplyDeclarations(TRUE, const_cast<const CFDE_CSSDeclaration**>(ppInline), + ApplyDeclarations(true, const_cast<const CFDE_CSSDeclaration**>(ppInline), iDeclCount, pDestStyle); - ApplyDeclarations(FALSE, + ApplyDeclarations(false, const_cast<const CFDE_CSSDeclaration**>(ppInline), iDeclCount, pDestStyle); return; @@ -356,20 +356,20 @@ void CFDE_CSSStyleSelector::ComputeStyle( if (iDeclCount > 0) { ASSERT(ppDeclArray); - ApplyDeclarations(TRUE, ppDeclArray, iDeclCount, pDestStyle); - ApplyDeclarations(FALSE, ppDeclArray, iDeclCount, pDestStyle); + ApplyDeclarations(true, ppDeclArray, iDeclCount, pDestStyle); + ApplyDeclarations(false, ppDeclArray, iDeclCount, pDestStyle); } } void CFDE_CSSStyleSelector::ApplyDeclarations( - FX_BOOL bPriority, + bool bPriority, const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount, IFDE_CSSComputedStyle* pDestStyle) { CFDE_CSSComputedStyle* pComputedStyle = static_cast<CFDE_CSSComputedStyle*>(pDestStyle); IFDE_CSSValue* pVal; - FX_BOOL bImportant; + bool bImportant; int32_t i; if (bPriority) { IFDE_CSSValue* pLastest = nullptr; @@ -434,7 +434,7 @@ void CFDE_CSSStyleSelector::AppendInlineStyle(CFDE_CSSDeclaration* pDecl, int32_t iLen) { ASSERT(pDecl && psz && iLen > 0); std::unique_ptr<CFDE_CSSSyntaxParser> pSyntax(new CFDE_CSSSyntaxParser); - if (!pSyntax->Init(psz, iLen, 32, TRUE)) + if (!pSyntax->Init(psz, iLen, 32, true)) return; int32_t iLen2 = 0; @@ -770,17 +770,17 @@ void CFDE_CSSStyleSelector::ApplyProperty( switch (pPrimitive->GetEnum()) { case FDE_CSSPROPERTYVALUE_Transparent: FDE_CSSINHERITS.m_dwTextEmphasisColor = 0; - FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = FALSE; + FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = false; break; case FDE_CSSPROPERTYVALUE_Currentcolor: - FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = TRUE; + FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = true; break; default: break; } } else if (eType == FDE_CSSPRIMITIVETYPE_RGB) { FDE_CSSINHERITS.m_dwTextEmphasisColor = pPrimitive->GetRGBColor(); - FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = FALSE; + FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = false; } break; case FDE_CSSPROPERTY_PageBreakBefore: @@ -831,7 +831,7 @@ void CFDE_CSSStyleSelector::ApplyProperty( case FDE_CSSPROPERTY_ColumnRuleColor: if (eType == FDE_CSSPRIMITIVETYPE_RGB) { FDE_CSSNONINHERITS.m_dwColumnRuleColor = pPrimitive->GetRGBColor(); - FDE_CSSNONINHERITS.m_bColumnRuleColorSame = FALSE; + FDE_CSSNONINHERITS.m_bColumnRuleColorSame = false; } break; case FDE_CSSPROPERTY_ColumnRuleStyle: @@ -960,12 +960,12 @@ void CFDE_CSSStyleSelector::ApplyProperty( switch (pVal->GetEnum()) { case FDE_CSSPROPERTYVALUE_None: { FDE_CSSNONINHERITS.m_eTextCombine = FDE_CSSTEXTCOMBINE_None; - FDE_CSSNONINHERITS.m_bHasTextCombineNumber = FALSE; + FDE_CSSNONINHERITS.m_bHasTextCombineNumber = false; } break; case FDE_CSSPROPERTYVALUE_Horizontal: { FDE_CSSNONINHERITS.m_eTextCombine = FDE_CSSTEXTCOMBINE_Horizontal; - FDE_CSSNONINHERITS.m_bHasTextCombineNumber = FALSE; + FDE_CSSNONINHERITS.m_bHasTextCombineNumber = false; } break; default: break; @@ -1011,7 +1011,7 @@ void CFDE_CSSStyleSelector::ApplyProperty( } } } else { - ASSERT(FALSE); + ASSERT(false); } } @@ -1107,45 +1107,43 @@ FDE_CSSRUBYALIGN CFDE_CSSStyleSelector::ToRubyAlign( } } -FX_BOOL CFDE_CSSStyleSelector::ToTextEmphasisMark( - FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISMARK& eMark) { +bool CFDE_CSSStyleSelector::ToTextEmphasisMark(FDE_CSSPROPERTYVALUE eValue, + FDE_CSSTEXTEMPHASISMARK& eMark) { switch (eValue) { case FDE_CSSPROPERTYVALUE_None: eMark = FDE_CSSTEXTEMPHASISMARK_None; - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Dot: eMark = FDE_CSSTEXTEMPHASISMARK_Dot; - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Circle: eMark = FDE_CSSTEXTEMPHASISMARK_Circle; - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_DoubleCircle: eMark = FDE_CSSTEXTEMPHASISMARK_DoubleCircle; - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Triangle: eMark = FDE_CSSTEXTEMPHASISMARK_Triangle; - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Sesame: eMark = FDE_CSSTEXTEMPHASISMARK_Sesame; - return TRUE; + return true; default: - return FALSE; + return false; } } -FX_BOOL CFDE_CSSStyleSelector::ToTextEmphasisFill( - FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISFILL& eFill) { +bool CFDE_CSSStyleSelector::ToTextEmphasisFill(FDE_CSSPROPERTYVALUE eValue, + FDE_CSSTEXTEMPHASISFILL& eFill) { switch (eValue) { case FDE_CSSPROPERTYVALUE_Filled: eFill = FDE_CSSTEXTEMPHASISFILL_Filled; - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Open: eFill = FDE_CSSTEXTEMPHASISFILL_Open; - return TRUE; + return true; default: - return FALSE; + return false; } } @@ -1482,7 +1480,7 @@ FDE_CSSBORDERSTYLE CFDE_CSSStyleSelector::ToBorderStyle( } } -FX_BOOL CFDE_CSSStyleSelector::SetLengthWithPercent( +bool CFDE_CSSStyleSelector::SetLengthWithPercent( FDE_CSSLENGTH& width, FDE_CSSPRIMITIVETYPE eType, IFDE_CSSPrimitiveValue* pPrimitive, @@ -1499,24 +1497,24 @@ FX_BOOL CFDE_CSSStyleSelector::SetLengthWithPercent( switch (pPrimitive->GetEnum()) { case FDE_CSSPROPERTYVALUE_Auto: width.Set(FDE_CSSLENGTHUNIT_Auto); - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_None: width.Set(FDE_CSSLENGTHUNIT_None); - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Thin: width.Set(FDE_CSSLENGTHUNIT_Point, 2); - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Medium: width.Set(FDE_CSSLENGTHUNIT_Point, 3); - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Thick: width.Set(FDE_CSSLENGTHUNIT_Point, 4); - return TRUE; + return true; default: - return FALSE; + return false; } } - return FALSE; + return false; } FX_FLOAT CFDE_CSSStyleSelector::ToFontSize(FDE_CSSPROPERTYVALUE eValue, @@ -1749,15 +1747,15 @@ IFDE_CSSParagraphStyle* CFDE_CSSComputedStyle::GetParagraphStyles() { return static_cast<IFDE_CSSParagraphStyle*>(this); } -FX_BOOL CFDE_CSSComputedStyle::GetCustomStyle(const CFX_WideStringC& wsName, - CFX_WideString& wsValue) const { +bool CFDE_CSSComputedStyle::GetCustomStyle(const CFX_WideStringC& wsName, + CFX_WideString& wsValue) const { for (int32_t i = m_CustomProperties.GetSize() - 2; i > -1; i -= 2) { if (wsName == m_CustomProperties[i]) { wsValue = m_CustomProperties[i + 1]; - return TRUE; + return true; } } - return FALSE; + return false; } int32_t CFDE_CSSComputedStyle::CountFontFamilies() const { @@ -1829,12 +1827,12 @@ const FDE_CSSRECT* CFDE_CSSComputedStyle::GetPaddingWidth() const { void CFDE_CSSComputedStyle::SetMarginWidth(const FDE_CSSRECT& rect) { m_NonInheritedData.m_MarginWidth = rect; - m_NonInheritedData.m_bHasMargin = TRUE; + m_NonInheritedData.m_bHasMargin = true; } void CFDE_CSSComputedStyle::SetPaddingWidth(const FDE_CSSRECT& rect) { m_NonInheritedData.m_PaddingWidth = rect; - m_NonInheritedData.m_bHasPadding = TRUE; + m_NonInheritedData.m_bHasPadding = true; } FDE_CSSDISPLAY CFDE_CSSComputedStyle::GetDisplay() const { @@ -1915,7 +1913,7 @@ void CFDE_CSSInheritedData::Reset() { m_wFontWeight = 400; m_dwFontColor = 0xFF000000; m_iWidows = 2; - m_bTextEmphasisColorCurrent = TRUE; + m_bTextEmphasisColorCurrent = true; m_iOrphans = 2; } @@ -1934,7 +1932,7 @@ void CFDE_CSSNonInheritedData::Reset() { m_fVerticalAlign = 0.0f; m_ColumnCount.Set(FDE_CSSLENGTHUNIT_Auto); m_ColumnGap.Set(FDE_CSSLENGTHUNIT_Normal); - m_bColumnRuleColorSame = TRUE; + m_bColumnRuleColorSame = true; m_ColumnWidth.Set(FDE_CSSLENGTHUNIT_Auto); m_ColumnRuleWidth.Set(FDE_CSSLENGTHUNIT_Auto); m_eTextCombine = FDE_CSSTEXTCOMBINE_None; diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h index ba2037677e..d72c9bf0cd 100644 --- a/xfa/fde/css/fde_cssstyleselector.h +++ b/xfa/fde/css/fde_cssstyleselector.h @@ -75,7 +75,7 @@ class CFDE_CSSRuleCollection : public CFX_Target { uint32_t dwKey, CFDE_CSSSelector* pSel, CFDE_CSSDeclaration* pDecl); - FX_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; @@ -93,10 +93,9 @@ class CFDE_CSSStyleSelector : public CFX_Target { void SetDefFontSize(FX_FLOAT fFontSize); - FX_BOOL SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, - IFDE_CSSStyleSheet* pSheet); - FX_BOOL SetStyleSheets(FDE_CSSSTYLESHEETGROUP eType, - const CFDE_CSSStyleSheetArray* pArray); + bool SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, IFDE_CSSStyleSheet* pSheet); + bool SetStyleSheets(FDE_CSSSTYLESHEETGROUP eType, + const CFDE_CSSStyleSheetArray* pArray); void SetStylePriority(FDE_CSSSTYLESHEETGROUP eType, FDE_CSSSTYLESHEETPRIORITY ePriority); void UpdateStyleIndex(uint32_t dwMediaList); @@ -116,13 +115,13 @@ class CFDE_CSSStyleSelector : public CFX_Target { void MatchRules(FDE_CSSTagCache* pCache, FDE_CSSRuleData* pList, FDE_CSSPERSUDO ePersudoType); - FX_BOOL MatchSelector(FDE_CSSTagCache* pCache, - CFDE_CSSSelector* pSel, - FDE_CSSPERSUDO ePersudoType); + bool MatchSelector(FDE_CSSTagCache* pCache, + CFDE_CSSSelector* pSel, + FDE_CSSPERSUDO ePersudoType); void AppendInlineStyle(CFDE_CSSDeclaration* pDecl, const FX_WCHAR* psz, int32_t iLen); - void ApplyDeclarations(FX_BOOL bPriority, + void ApplyDeclarations(bool bPriority, const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount, IFDE_CSSComputedStyle* pDestStyle); @@ -133,10 +132,10 @@ class CFDE_CSSStyleSelector : public CFX_Target { FX_FLOAT ApplyNumber(FDE_CSSPRIMITIVETYPE eUnit, FX_FLOAT fValue, FX_FLOAT fPercentBase); - FX_BOOL SetLengthWithPercent(FDE_CSSLENGTH& width, - FDE_CSSPRIMITIVETYPE eType, - IFDE_CSSPrimitiveValue* pPrimitive, - FX_FLOAT fFontSize); + bool SetLengthWithPercent(FDE_CSSLENGTH& width, + FDE_CSSPRIMITIVETYPE eType, + IFDE_CSSPrimitiveValue* pPrimitive, + FX_FLOAT fFontSize); FX_FLOAT ToFontSize(FDE_CSSPROPERTYVALUE eValue, FX_FLOAT fCurFontSize); FDE_CSSDISPLAY ToDisplay(FDE_CSSPROPERTYVALUE eValue); FDE_CSSTEXTALIGN ToTextAlign(FDE_CSSPROPERTYVALUE eValue); @@ -159,10 +158,10 @@ class CFDE_CSSStyleSelector : public CFX_Target { FDE_CSSOVERFLOW ToOverflow(FDE_CSSPROPERTYVALUE eValue); FDE_CSSLINEBREAK ToLineBreak(FDE_CSSPROPERTYVALUE eValue); FDE_CSSTEXTCOMBINE ToTextCombine(FDE_CSSPROPERTYVALUE eValue); - FX_BOOL ToTextEmphasisMark(FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISMARK& eMark); - FX_BOOL ToTextEmphasisFill(FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISFILL& eFill); + bool ToTextEmphasisMark(FDE_CSSPROPERTYVALUE eValue, + FDE_CSSTEXTEMPHASISMARK& eMark); + bool ToTextEmphasisFill(FDE_CSSPROPERTYVALUE eValue, + FDE_CSSTEXTEMPHASISFILL& eFill); FDE_CSSCURSOR ToCursor(FDE_CSSPROPERTYVALUE eValue); FDE_CSSPOSITION ToPosition(FDE_CSSPROPERTYVALUE eValue); FDE_CSSCAPTIONSIDE ToCaptionSide(FDE_CSSPROPERTYVALUE eValue); @@ -188,18 +187,18 @@ class CFDE_CSSStyleSelector : public CFX_Target { struct FDE_CSSCOUNTERDATA { public: FDE_CSSCOUNTERDATA() { FXSYS_memset(this, 0, sizeof(FDE_CSSCOUNTERDATA)); } - FX_BOOL GetCounterIncrement(int32_t& iValue) { + bool GetCounterIncrement(int32_t& iValue) { iValue = m_iIncVal; return m_bIncrement; } - FX_BOOL GetCounterReset(int32_t& iValue) { + bool GetCounterReset(int32_t& iValue) { iValue = m_iResetVal; return m_bReset; } const FX_WCHAR* m_pszIdent; - FX_BOOL m_bIncrement; - FX_BOOL m_bReset; + bool m_bIncrement; + bool m_bReset; int32_t m_iIncVal; int32_t m_iResetVal; }; @@ -211,21 +210,21 @@ class CFDE_CSSCounterStyle { void SetCounterIncrementList(IFDE_CSSValueList* pList) { m_pCounterInc = pList; - m_bIndexDirty = TRUE; + m_bIndexDirty = true; } void SetCounterResetList(IFDE_CSSValueList* pList) { m_pCounterReset = pList; - m_bIndexDirty = TRUE; + m_bIndexDirty = true; } int32_t CountCounters() { UpdateIndex(); return m_arrCounterData.GetSize(); } - FX_BOOL GetCounterIncrement(int32_t index, int32_t& iValue) { + bool GetCounterIncrement(int32_t index, int32_t& iValue) { UpdateIndex(); return m_arrCounterData.ElementAt(index).GetCounterIncrement(iValue); } - FX_BOOL GetCounterReset(int32_t index, int32_t& iValue) { + bool GetCounterReset(int32_t index, int32_t& iValue) { UpdateIndex(); return m_arrCounterData.ElementAt(index).GetCounterReset(iValue); } @@ -242,7 +241,7 @@ class CFDE_CSSCounterStyle { IFDE_CSSValueList* m_pCounterInc; IFDE_CSSValueList* m_pCounterReset; CFX_ArrayTemplate<FDE_CSSCOUNTERDATA> m_arrCounterData; - FX_BOOL m_bIndexDirty; + bool m_bIndexDirty; }; class CFDE_CSSInheritedData { @@ -367,8 +366,8 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, IFDE_CSSBoundaryStyle* GetBoundaryStyles() override; IFDE_CSSPositionStyle* GetPositionStyles() override; IFDE_CSSParagraphStyle* GetParagraphStyles() override; - FX_BOOL GetCustomStyle(const CFX_WideStringC& wsName, - CFX_WideString& wsValue) const override; + bool GetCustomStyle(const CFX_WideStringC& wsName, + CFX_WideString& wsValue) const override; // IFDE_CSSFontStyle: int32_t CountFontFamilies() const override; diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index bc94cc2f70..e376aca399 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -100,11 +100,11 @@ void CFDE_CSSStyleSheet::Reset() { static_cast<CFDE_CSSFontFaceRule*>(pRule)->~CFDE_CSSFontFaceRule(); break; default: - ASSERT(FALSE); + ASSERT(false); break; } } - m_RuleArray.RemoveAll(FALSE); + m_RuleArray.RemoveAll(false); m_Selectors.RemoveAll(); m_StringCache.clear(); m_pAllocator.reset(); @@ -122,7 +122,7 @@ uint32_t CFDE_CSSStyleSheet::Release() { return dwRefCount; } -FX_BOOL CFDE_CSSStyleSheet::GetUrl(CFX_WideString& szUrl) { +bool CFDE_CSSStyleSheet::GetUrl(CFX_WideString& szUrl) { szUrl = m_szUrl; return szUrl.GetLength() > 0; } @@ -143,33 +143,32 @@ IFDE_CSSRule* CFDE_CSSStyleSheet::GetRule(int32_t index) { return m_RuleArray.GetAt(index); } -FX_BOOL CFDE_CSSStyleSheet::LoadFromStream(const CFX_WideString& szUrl, - IFX_Stream* pStream, - uint16_t wCodePage) { +bool CFDE_CSSStyleSheet::LoadFromStream(const CFX_WideString& szUrl, + IFX_Stream* pStream, + uint16_t wCodePage) { std::unique_ptr<CFDE_CSSSyntaxParser> pSyntax(new CFDE_CSSSyntaxParser); if (pStream->GetCodePage() != wCodePage) pStream->SetCodePage(wCodePage); - FX_BOOL bRet = pSyntax->Init(pStream, 4096) && LoadFromSyntax(pSyntax.get()); + bool bRet = pSyntax->Init(pStream, 4096) && LoadFromSyntax(pSyntax.get()); m_wCodePage = wCodePage; m_szUrl = szUrl; return bRet; } -FX_BOOL CFDE_CSSStyleSheet::LoadFromBuffer(const CFX_WideString& szUrl, - const FX_WCHAR* pBuffer, - int32_t iBufSize, - uint16_t wCodePage) { +bool CFDE_CSSStyleSheet::LoadFromBuffer(const CFX_WideString& szUrl, + const FX_WCHAR* pBuffer, + int32_t iBufSize, + uint16_t wCodePage) { ASSERT(pBuffer && iBufSize > 0); std::unique_ptr<CFDE_CSSSyntaxParser> pSyntax(new CFDE_CSSSyntaxParser); - FX_BOOL bRet = - pSyntax->Init(pBuffer, iBufSize) && LoadFromSyntax(pSyntax.get()); + bool bRet = pSyntax->Init(pBuffer, iBufSize) && LoadFromSyntax(pSyntax.get()); m_wCodePage = wCodePage; m_szUrl = szUrl; return bRet; } -FX_BOOL CFDE_CSSStyleSheet::LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax) { +bool CFDE_CSSStyleSheet::LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax) { Reset(); m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Static, 1024, 0); FDE_CSSSYNTAXSTATUS eStatus; @@ -415,7 +414,7 @@ CFDE_CSSMediaRule::~CFDE_CSSMediaRule() { ((CFDE_CSSStyleRule*)pRule)->~CFDE_CSSStyleRule(); break; default: - ASSERT(FALSE); + ASSERT(false); break; } } @@ -433,7 +432,7 @@ IFDE_CSSRule* CFDE_CSSMediaRule::GetRule(int32_t index) { return m_RuleArray.GetAt(index); } -FX_BOOL FDE_IsCSSChar(FX_WCHAR wch) { +bool FDE_IsCSSChar(FX_WCHAR wch) { return (wch >= 'a' && wch <= 'z') || (wch >= 'A' && wch <= 'Z'); } diff --git a/xfa/fde/css/fde_cssstylesheet.h b/xfa/fde/css/fde_cssstylesheet.h index cd587ddcae..0fe63477d3 100644 --- a/xfa/fde/css/fde_cssstylesheet.h +++ b/xfa/fde/css/fde_cssstylesheet.h @@ -104,23 +104,23 @@ class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet, public CFX_Target { uint32_t Release() override; // IFDE_CSSStyleSheet: - FX_BOOL GetUrl(CFX_WideString& szUrl) override; + bool GetUrl(CFX_WideString& szUrl) override; uint32_t GetMediaList() const override; uint16_t GetCodePage() const override; int32_t CountRules() const override; IFDE_CSSRule* GetRule(int32_t index) override; - FX_BOOL LoadFromStream(const CFX_WideString& szUrl, - IFX_Stream* pStream, - uint16_t wCodePage); - FX_BOOL LoadFromBuffer(const CFX_WideString& szUrl, - const FX_WCHAR* pBuffer, - int32_t iBufSize, - uint16_t wCodePage); + bool LoadFromStream(const CFX_WideString& szUrl, + IFX_Stream* pStream, + uint16_t wCodePage); + bool LoadFromBuffer(const CFX_WideString& szUrl, + const FX_WCHAR* pBuffer, + int32_t iBufSize, + uint16_t wCodePage); protected: void Reset(); - FX_BOOL LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax); + bool LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax); FDE_CSSSYNTAXSTATUS LoadStyleRule( CFDE_CSSSyntaxParser* pSyntax, CFX_MassArrayTemplate<IFDE_CSSRule*>& ruleArray); diff --git a/xfa/fde/css/fde_csssyntax.cpp b/xfa/fde/css/fde_csssyntax.cpp index c2b0265a6e..436a94b67b 100644 --- a/xfa/fde/css/fde_csssyntax.cpp +++ b/xfa/fde/css/fde_csssyntax.cpp @@ -33,33 +33,33 @@ CFDE_CSSSyntaxParser::~CFDE_CSSSyntaxParser() { m_TextPlane.Reset(); } -FX_BOOL CFDE_CSSSyntaxParser::Init(IFX_Stream* pStream, - int32_t iCSSPlaneSize, - int32_t iTextDataSize, - FX_BOOL bOnlyDeclaration) { +bool CFDE_CSSSyntaxParser::Init(IFX_Stream* pStream, + int32_t iCSSPlaneSize, + int32_t iTextDataSize, + bool bOnlyDeclaration) { ASSERT(pStream && iCSSPlaneSize > 0 && iTextDataSize > 0); Reset(bOnlyDeclaration); if (!m_TextData.EstimateSize(iTextDataSize)) { - return FALSE; + return false; } uint8_t bom[4]; m_pStream = pStream; m_iStreamPos = m_pStream->GetBOM(bom); m_iPlaneSize = iCSSPlaneSize; - return TRUE; + return true; } -FX_BOOL CFDE_CSSSyntaxParser::Init(const FX_WCHAR* pBuffer, - int32_t iBufferSize, - int32_t iTextDatSize, - FX_BOOL bOnlyDeclaration) { +bool CFDE_CSSSyntaxParser::Init(const FX_WCHAR* pBuffer, + int32_t iBufferSize, + int32_t iTextDatSize, + bool bOnlyDeclaration) { ASSERT(pBuffer && iBufferSize > 0 && iTextDatSize > 0); Reset(bOnlyDeclaration); if (!m_TextData.EstimateSize(iTextDatSize)) { - return FALSE; + return false; } return m_TextPlane.AttachBuffer(pBuffer, iBufferSize); } -void CFDE_CSSSyntaxParser::Reset(FX_BOOL bOnlyDeclaration) { +void CFDE_CSSSyntaxParser::Reset(bool bOnlyDeclaration) { m_TextPlane.Reset(); m_TextData.Reset(); m_pStream = nullptr; @@ -81,7 +81,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { } return m_eStatus = FDE_CSSSYNTAXSTATUS_EOS; } - FX_BOOL bEOS; + bool bEOS; int32_t iLen = m_TextPlane.LoadFromStream(m_pStream, m_iStreamPos, m_iPlaneSize, bEOS); m_iStreamPos = m_pStream->GetPosition(); @@ -251,7 +251,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { return FDE_CSSSYNTAXSTATUS_MediaType; } } else { - FX_BOOL bEnabled = IsImportEnabled(); + bool bEnabled = IsImportEnabled(); m_TextPlane.MoveNext(); m_ModeStack.Pop(); SwitchMode(FDE_CSSSYNTAXMODE_RuleSet); @@ -354,29 +354,29 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { m_TextPlane.MoveNext(); break; default: - ASSERT(FALSE); + ASSERT(false); break; } } } return m_eStatus; } -FX_BOOL CFDE_CSSSyntaxParser::IsImportEnabled() const { +bool CFDE_CSSSyntaxParser::IsImportEnabled() const { if ((m_dwCheck & FDE_CSSSYNTAXCHECK_AllowImport) == 0) { - return FALSE; + return false; } if (m_ModeStack.GetSize() > 1) { - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CFDE_CSSSyntaxParser::AppendChar(FX_WCHAR wch) { +bool CFDE_CSSSyntaxParser::AppendChar(FX_WCHAR wch) { m_TextPlane.MoveNext(); if (m_TextData.GetLength() > 0 || wch > ' ') { m_TextData.AppendChar(wch); - return TRUE; + return true; } - return FALSE; + return false; } int32_t CFDE_CSSSyntaxParser::SaveTextData() { m_iTextDatLen = m_TextData.TrimEnd(); @@ -393,21 +393,21 @@ int32_t CFDE_CSSSyntaxParser::SwitchToComment() { SwitchMode(FDE_CSSSYNTAXMODE_Comment); return iLength; } -FX_BOOL CFDE_CSSSyntaxParser::RestoreMode() { +bool CFDE_CSSSyntaxParser::RestoreMode() { FDE_CSSSYNTAXMODE* pMode = m_ModeStack.GetTopElement(); if (!pMode) - return FALSE; + return false; SwitchMode(*pMode); m_ModeStack.Pop(); - return TRUE; + return true; } const FX_WCHAR* CFDE_CSSSyntaxParser::GetCurrentString(int32_t& iLength) const { iLength = m_iTextDatLen; return m_TextData.GetBuffer(); } CFDE_CSSTextBuf::CFDE_CSSTextBuf() - : m_bExtBuf(FALSE), + : m_bExtBuf(false), m_pBuffer(nullptr), m_iBufLen(0), m_iDatLen(0), @@ -422,26 +422,25 @@ void CFDE_CSSTextBuf::Reset() { } m_iDatPos = m_iDatLen = m_iBufLen; } -FX_BOOL CFDE_CSSTextBuf::AttachBuffer(const FX_WCHAR* pBuffer, - int32_t iBufLen) { +bool CFDE_CSSTextBuf::AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen) { Reset(); m_pBuffer = const_cast<FX_WCHAR*>(pBuffer); m_iDatLen = m_iBufLen = iBufLen; - return m_bExtBuf = TRUE; + return m_bExtBuf = true; } -FX_BOOL CFDE_CSSTextBuf::EstimateSize(int32_t iAllocSize) { +bool CFDE_CSSTextBuf::EstimateSize(int32_t iAllocSize) { ASSERT(iAllocSize > 0); Clear(); - m_bExtBuf = FALSE; + m_bExtBuf = false; return ExpandBuf(iAllocSize); } int32_t CFDE_CSSTextBuf::LoadFromStream(IFX_Stream* pTxtStream, int32_t iStreamOffset, int32_t iMaxChars, - FX_BOOL& bEOS) { + bool& bEOS) { ASSERT(iStreamOffset >= 0 && iMaxChars > 0); Clear(); - m_bExtBuf = FALSE; + m_bExtBuf = false; if (!ExpandBuf(iMaxChars)) { return 0; } @@ -451,23 +450,23 @@ int32_t CFDE_CSSTextBuf::LoadFromStream(IFX_Stream* pTxtStream, m_iDatLen = pTxtStream->ReadString(m_pBuffer, iMaxChars, bEOS); return m_iDatLen; } -FX_BOOL CFDE_CSSTextBuf::ExpandBuf(int32_t iDesiredSize) { +bool CFDE_CSSTextBuf::ExpandBuf(int32_t iDesiredSize) { if (m_bExtBuf) { - return FALSE; + return false; } if (!m_pBuffer) { m_pBuffer = FX_Alloc(FX_WCHAR, iDesiredSize); } else if (m_iBufLen != iDesiredSize) { m_pBuffer = FX_Realloc(FX_WCHAR, m_pBuffer, iDesiredSize); } else { - return TRUE; + return true; } if (!m_pBuffer) { m_iBufLen = 0; - return FALSE; + return false; } m_iBufLen = iDesiredSize; - return TRUE; + return true; } void CFDE_CSSTextBuf::Subtract(int32_t iStart, int32_t iLength) { ASSERT(iStart >= 0 && iLength > 0); diff --git a/xfa/fde/css/fde_csssyntax.h b/xfa/fde/css/fde_csssyntax.h index af1d444144..c2c80c5e67 100644 --- a/xfa/fde/css/fde_csssyntax.h +++ b/xfa/fde/css/fde_csssyntax.h @@ -16,12 +16,12 @@ class CFDE_CSSTextBuf : public CFX_Target { CFDE_CSSTextBuf(); ~CFDE_CSSTextBuf() override; - FX_BOOL AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen); - FX_BOOL EstimateSize(int32_t iAllocSize); + bool AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen); + bool EstimateSize(int32_t iAllocSize); int32_t LoadFromStream(IFX_Stream* pTxtStream, int32_t iStreamOffset, int32_t iMaxChars, - FX_BOOL& bEOS); + bool& bEOS); bool AppendChar(FX_WCHAR wch) { if (m_iDatLen >= m_iBufLen && !ExpandBuf(m_iBufLen * 2)) return false; @@ -38,7 +38,7 @@ class CFDE_CSSTextBuf : public CFX_Target { return --m_iDatLen; } void Subtract(int32_t iStart, int32_t iLength); - FX_BOOL IsEOF() const { return m_iDatPos >= m_iDatLen; } + bool IsEOF() const { return m_iDatPos >= m_iDatLen; } FX_WCHAR GetAt(int32_t index) const { return m_pBuffer[index]; } FX_WCHAR GetChar() const { return m_pBuffer[m_iDatPos]; } FX_WCHAR GetNextChar() const { @@ -49,8 +49,8 @@ class CFDE_CSSTextBuf : public CFX_Target { const FX_WCHAR* GetBuffer() const { return m_pBuffer; } protected: - FX_BOOL ExpandBuf(int32_t iDesiredSize); - FX_BOOL m_bExtBuf; + bool ExpandBuf(int32_t iDesiredSize); + bool m_bExtBuf; FX_WCHAR* m_pBuffer; int32_t m_iBufLen; int32_t m_iDatLen; @@ -80,30 +80,30 @@ class CFDE_CSSSyntaxParser : public CFX_Target { CFDE_CSSSyntaxParser(); ~CFDE_CSSSyntaxParser() override; - FX_BOOL Init(IFX_Stream* pStream, - int32_t iCSSPlaneSize, - int32_t iTextDataSize = 32, - FX_BOOL bOnlyDeclaration = FALSE); - FX_BOOL Init(const FX_WCHAR* pBuffer, - int32_t iBufferSize, - int32_t iTextDatSize = 32, - FX_BOOL bOnlyDeclaration = FALSE); + bool Init(IFX_Stream* pStream, + int32_t iCSSPlaneSize, + int32_t iTextDataSize = 32, + bool bOnlyDeclaration = false); + bool Init(const FX_WCHAR* pBuffer, + int32_t iBufferSize, + int32_t iTextDatSize = 32, + bool bOnlyDeclaration = false); FDE_CSSSYNTAXSTATUS DoSyntaxParse(); const FX_WCHAR* GetCurrentString(int32_t& iLength) const; protected: - void Reset(FX_BOOL bOnlyDeclaration); + void Reset(bool bOnlyDeclaration); void SwitchMode(FDE_CSSSYNTAXMODE eMode); int32_t SwitchToComment(); - FX_BOOL RestoreMode(); - FX_BOOL AppendChar(FX_WCHAR wch); + bool RestoreMode(); + bool AppendChar(FX_WCHAR wch); int32_t SaveTextData(); - FX_BOOL IsCharsetEnabled() const { + bool IsCharsetEnabled() const { return (m_dwCheck & FDE_CSSSYNTAXCHECK_AllowCharset) != 0; } void DisableCharset() { m_dwCheck = FDE_CSSSYNTAXCHECK_AllowImport; } - FX_BOOL IsImportEnabled() const; + bool IsImportEnabled() const; void DisableImport() { m_dwCheck = 0; } IFX_Stream* m_pStream; |