diff options
Diffstat (limited to 'xfa/fde/css/fde_cssdeclaration.cpp')
-rw-r--r-- | xfa/fde/css/fde_cssdeclaration.cpp | 585 |
1 files changed, 293 insertions, 292 deletions
diff --git a/xfa/fde/css/fde_cssdeclaration.cpp b/xfa/fde/css/fde_cssdeclaration.cpp index a5385af0db..e723ee6801 100644 --- a/xfa/fde/css/fde_cssdeclaration.cpp +++ b/xfa/fde/css/fde_cssdeclaration.cpp @@ -8,7 +8,7 @@ #include "core/fxcrt/fx_ext.h" -IFDE_CSSValue* CFDE_CSSDeclaration::GetProperty(FDE_CSSPROPERTY eProperty, +IFDE_CSSValue* CFDE_CSSDeclaration::GetProperty(FDE_CSSProperty eProperty, bool& bImportant) const { for (const FDE_CSSPropertyHolder* pHolder = m_pFirstProperty; pHolder; pHolder = pHolder->pNext) { @@ -23,12 +23,12 @@ FX_POSITION CFDE_CSSDeclaration::GetStartPosition() const { return (FX_POSITION)m_pFirstProperty; } void CFDE_CSSDeclaration::GetNextProperty(FX_POSITION& pos, - FDE_CSSPROPERTY& eProperty, + FDE_CSSProperty& eProperty, IFDE_CSSValue*& pValue, bool& bImportant) const { const FDE_CSSPropertyHolder* pHolder = (const FDE_CSSPropertyHolder*)pos; bImportant = pHolder->bImportant; - eProperty = (FDE_CSSPROPERTY)pHolder->eProperty; + eProperty = pHolder->eProperty; pValue = pHolder->pValue; pos = (FX_POSITION)pHolder->pNext; } @@ -47,7 +47,7 @@ void CFDE_CSSDeclaration::GetNextCustom(FX_POSITION& pos, pos = (FX_POSITION)pProperty->pNext; } const FX_WCHAR* CFDE_CSSDeclaration::CopyToLocal( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { ASSERT(iValueLen > 0); @@ -68,19 +68,19 @@ const FX_WCHAR* CFDE_CSSDeclaration::CopyToLocal( return psz; } IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewNumberValue( - FDE_CSSPRIMITIVETYPE eUnit, + FDE_CSSPrimitiveType eUnit, FX_FLOAT fValue) const { - static CFDE_CSSPrimitiveValue s_ZeroValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); - if (eUnit == FDE_CSSPRIMITIVETYPE_Number && FXSYS_fabs(fValue) < 0.001f) { + static CFDE_CSSPrimitiveValue s_ZeroValue(FDE_CSSPrimitiveType::Number, 0.0f); + if (eUnit == FDE_CSSPrimitiveType::Number && FXSYS_fabs(fValue) < 0.001f) { return &s_ZeroValue; } return new CFDE_CSSPrimitiveValue(eUnit, fValue); } inline IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewEnumValue( - FDE_CSSPROPERTYVALUE eValue) const { + FDE_CSSPropertyValue eValue) const { return new CFDE_CSSPrimitiveValue(eValue); } -void CFDE_CSSDeclaration::AddPropertyHolder(FDE_CSSPROPERTY eProperty, +void CFDE_CSSDeclaration::AddPropertyHolder(FDE_CSSProperty eProperty, IFDE_CSSValue* pValue, bool bImportant) { FDE_CSSPropertyHolder* pHolder = new FDE_CSSPropertyHolder; @@ -94,7 +94,7 @@ void CFDE_CSSDeclaration::AddPropertyHolder(FDE_CSSPROPERTY eProperty, m_pFirstProperty = pHolder; m_pLastProperty = pHolder; } -bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { ASSERT(iValueLen > 0); @@ -156,78 +156,78 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, case FDE_CSSVALUETYPE_Shorthand: { IFDE_CSSValue *pColor, *pStyle, *pWidth; switch (pArgs->pProperty->eName) { - case FDE_CSSPROPERTY_Font: + case FDE_CSSProperty::Font: return ParseFontProperty(pArgs, pszValue, iValueLen, bImportant); - case FDE_CSSPROPERTY_Background: + case FDE_CSSProperty::Background: return ParseBackgroundProperty(pArgs, pszValue, iValueLen, bImportant); - case FDE_CSSPROPERTY_ListStyle: + case FDE_CSSProperty::ListStyle: return ParseListStyleProperty(pArgs, pszValue, iValueLen, bImportant); - case FDE_CSSPROPERTY_Border: + case FDE_CSSProperty::Border: if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, pWidth)) { AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderLeftColor, - FDE_CSSPROPERTY_BorderLeftStyle, - FDE_CSSPROPERTY_BorderLeftWidth); + FDE_CSSProperty::BorderLeftColor, + FDE_CSSProperty::BorderLeftStyle, + FDE_CSSProperty::BorderLeftWidth); AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderTopColor, - FDE_CSSPROPERTY_BorderTopStyle, - FDE_CSSPROPERTY_BorderTopWidth); + FDE_CSSProperty::BorderTopColor, + FDE_CSSProperty::BorderTopStyle, + FDE_CSSProperty::BorderTopWidth); AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderRightColor, - FDE_CSSPROPERTY_BorderRightStyle, - FDE_CSSPROPERTY_BorderRightWidth); + FDE_CSSProperty::BorderRightColor, + FDE_CSSProperty::BorderRightStyle, + FDE_CSSProperty::BorderRightWidth); AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderBottomColor, - FDE_CSSPROPERTY_BorderBottomStyle, - FDE_CSSPROPERTY_BorderBottomWidth); + FDE_CSSProperty::BorderBottomColor, + FDE_CSSProperty::BorderBottomStyle, + FDE_CSSProperty::BorderBottomWidth); return true; } break; - case FDE_CSSPROPERTY_BorderLeft: + case FDE_CSSProperty::BorderLeft: if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, pWidth)) { AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderLeftColor, - FDE_CSSPROPERTY_BorderLeftStyle, - FDE_CSSPROPERTY_BorderLeftWidth); + FDE_CSSProperty::BorderLeftColor, + FDE_CSSProperty::BorderLeftStyle, + FDE_CSSProperty::BorderLeftWidth); return true; } break; - case FDE_CSSPROPERTY_BorderTop: + case FDE_CSSProperty::BorderTop: if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, pWidth)) { AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderTopColor, - FDE_CSSPROPERTY_BorderTopStyle, - FDE_CSSPROPERTY_BorderTopWidth); + FDE_CSSProperty::BorderTopColor, + FDE_CSSProperty::BorderTopStyle, + FDE_CSSProperty::BorderTopWidth); return true; } break; - case FDE_CSSPROPERTY_BorderRight: + case FDE_CSSProperty::BorderRight: if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, pWidth)) { AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderRightColor, - FDE_CSSPROPERTY_BorderRightStyle, - FDE_CSSPROPERTY_BorderRightWidth); + FDE_CSSProperty::BorderRightColor, + FDE_CSSProperty::BorderRightStyle, + FDE_CSSProperty::BorderRightWidth); return true; } break; - case FDE_CSSPROPERTY_BorderBottom: + case FDE_CSSProperty::BorderBottom: if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, pWidth)) { AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderBottomColor, - FDE_CSSPROPERTY_BorderBottomStyle, - FDE_CSSPROPERTY_BorderBottomWidth); + FDE_CSSProperty::BorderBottomColor, + FDE_CSSProperty::BorderBottomStyle, + FDE_CSSProperty::BorderBottomWidth); return true; } break; - case FDE_CSSPROPERTY_Overflow: + case FDE_CSSProperty::Overflow: return ParseOverflowProperty(pArgs, pszValue, iValueLen, bImportant); - case FDE_CSSPROPERTY_ColumnRule: + case FDE_CSSProperty::ColumnRule: return ParseColumnRuleProperty(pArgs, pszValue, iValueLen, bImportant); default: @@ -236,10 +236,10 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, } break; case FDE_CSSVALUETYPE_List: switch (pArgs->pProperty->eName) { - case FDE_CSSPROPERTY_CounterIncrement: - case FDE_CSSPROPERTY_CounterReset: + case FDE_CSSProperty::CounterIncrement: + case FDE_CSSProperty::CounterReset: return ParseCounterProperty(pArgs, pszValue, iValueLen, bImportant); - case FDE_CSSPROPERTY_Content: + case FDE_CSSProperty::Content: return ParseContentProperty(pArgs, pszValue, iValueLen, bImportant); default: return ParseValueListProperty(pArgs, pszValue, iValueLen, bImportant); @@ -250,7 +250,7 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, } return false; } -bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszName, int32_t iNameLen, const FX_WCHAR* pszValue, @@ -267,24 +267,24 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, return true; } IFDE_CSSValue* CFDE_CSSDeclaration::ParseNumber( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { FX_FLOAT fValue; - FDE_CSSPRIMITIVETYPE eUnit; + FDE_CSSPrimitiveType eUnit; if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eUnit)) { return nullptr; } return NewNumberValue(eUnit, fValue); } -IFDE_CSSValue* CFDE_CSSDeclaration::ParseEnum(const FDE_CSSPROPERTYARGS* pArgs, +IFDE_CSSValue* CFDE_CSSDeclaration::ParseEnum(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { - const FDE_CSSPROPERTYVALUETABLE* pValue = + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); return pValue ? NewEnumValue(pValue->eName) : nullptr; } -IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPROPERTYARGS* pArgs, +IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { FX_ARGB dwColor; @@ -294,7 +294,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPROPERTYARGS* pArgs, return new CFDE_CSSPrimitiveValue(dwColor); } -IFDE_CSSValue* CFDE_CSSDeclaration::ParseURI(const FDE_CSSPROPERTYARGS* pArgs, +IFDE_CSSValue* CFDE_CSSDeclaration::ParseURI(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { int32_t iOffset; @@ -306,12 +306,12 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseURI(const FDE_CSSPROPERTYARGS* pArgs, pszValue = CopyToLocal(pArgs, pszValue + iOffset, iValueLen); return pszValue - ? new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_URI, pszValue) + ? new CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType::URI, pszValue) : nullptr; } IFDE_CSSValue* CFDE_CSSDeclaration::ParseString( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { int32_t iOffset; @@ -322,12 +322,12 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseString( return nullptr; pszValue = CopyToLocal(pArgs, pszValue + iOffset, iValueLen); - return pszValue - ? new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, pszValue) - : nullptr; + return pszValue ? new CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType::String, + pszValue) + : nullptr; } IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { if (pszValue[iValueLen - 1] != ')') { @@ -349,11 +349,11 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( iValueLen -= (iStartBracket + 2); CFDE_CSSValueArray argumentArr; CFDE_CSSValueListParser parser(pszValue, iValueLen, ','); - FDE_CSSPRIMITIVETYPE ePrimitiveType; + FDE_CSSPrimitiveType ePrimitiveType; while (parser.NextValue(ePrimitiveType, pszValue, iValueLen)) { switch (ePrimitiveType) { - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pPropertyValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pPropertyValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pPropertyValue) { argumentArr.Add(NewEnumValue(pPropertyValue->eName)); @@ -366,10 +366,10 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( continue; } argumentArr.Add(new CFDE_CSSPrimitiveValue( - FDE_CSSPRIMITIVETYPE_String, + FDE_CSSPrimitiveType::String, CopyToLocal(pArgs, pszValue, iValueLen))); } break; - case FDE_CSSPRIMITIVETYPE_Number: { + case FDE_CSSPrimitiveType::Number: { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, ePrimitiveType)) { argumentArr.Add(NewNumberValue(ePrimitiveType, fValue)); @@ -377,7 +377,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( } break; default: argumentArr.Add(new CFDE_CSSPrimitiveValue( - FDE_CSSPRIMITIVETYPE_String, + FDE_CSSPrimitiveType::String, CopyToLocal(pArgs, pszValue, iValueLen))); break; } @@ -387,38 +387,38 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( new CFDE_CSSFunction(pszFuncName, pArgumentList); return new CFDE_CSSPrimitiveValue(pFunction); } -bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; CFDE_CSSValueArray list; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_URI: + case FDE_CSSPrimitiveType::URI: list.Add(new CFDE_CSSPrimitiveValue( eType, CopyToLocal(pArgs, pszValue, iValueLen))); break; - case FDE_CSSPRIMITIVETYPE_Number: + case FDE_CSSPrimitiveType::Number: return false; - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue) { switch (pValue->eName) { - case FDE_CSSPROPERTYVALUE_Normal: - case FDE_CSSPROPERTYVALUE_None: { + case FDE_CSSPropertyValue::Normal: + case FDE_CSSPropertyValue::None: { if (list.GetSize() == 0) { list.Add(NewEnumValue(pValue->eName)); } else { return false; } } break; - case FDE_CSSPROPERTYVALUE_OpenQuote: - case FDE_CSSPROPERTYVALUE_CloseQuote: - case FDE_CSSPROPERTYVALUE_NoOpenQuote: - case FDE_CSSPROPERTYVALUE_NoCloseQuote: + case FDE_CSSPropertyValue::OpenQuote: + case FDE_CSSPropertyValue::CloseQuote: + case FDE_CSSPropertyValue::NoOpenQuote: + case FDE_CSSPropertyValue::NoCloseQuote: list.Add(NewEnumValue(pValue->eName)); break; default: @@ -434,7 +434,7 @@ bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, list.Add(new CFDE_CSSPrimitiveValue( eType, CopyToLocal(pArgs, pszValue, iValueLen))); } break; - case FDE_CSSPRIMITIVETYPE_RGB: + case FDE_CSSPrimitiveType::RGB: return false; default: break; @@ -447,17 +447,17 @@ bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, bImportant); return true; } -bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); CFDE_CSSValueArray list; CFDE_CSSValueArray listFull; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_Number: { + case FDE_CSSPrimitiveType::Number: { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { if (list.GetSize() == 1) { @@ -469,16 +469,16 @@ bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, } } } break; - case FDE_CSSPRIMITIVETYPE_String: { + case FDE_CSSPrimitiveType::String: { if (list.GetSize() == 0) { pszValue = CopyToLocal(pArgs, pszValue, iValueLen); - list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, + list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType::String, pszValue)); } else { listFull.Add(new CFDE_CSSValueList(list)); list.RemoveAll(); pszValue = CopyToLocal(pArgs, pszValue, iValueLen); - list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, + list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType::String, pszValue)); } } break; @@ -497,19 +497,19 @@ bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, return true; } bool CFDE_CSSDeclaration::ParseValueListProperty( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { FX_WCHAR separator = - (pArgs->pProperty->eName == FDE_CSSPROPERTY_FontFamily) ? ',' : ' '; + (pArgs->pProperty->eName == FDE_CSSProperty::FontFamily) ? ',' : ' '; CFDE_CSSValueListParser parser(pszValue, iValueLen, separator); const uint32_t dwType = pArgs->pProperty->dwType; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; CFDE_CSSValueArray list; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_Number: + case FDE_CSSPrimitiveType::Number: if (dwType & FDE_CSSVALUETYPE_MaybeNumber) { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { @@ -517,7 +517,7 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( } } break; - case FDE_CSSPRIMITIVETYPE_String: + case FDE_CSSPrimitiveType::String: if (dwType & FDE_CSSVALUETYPE_MaybeColor) { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { @@ -526,7 +526,7 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( } } if (dwType & FDE_CSSVALUETYPE_MaybeEnum) { - const FDE_CSSPROPERTYVALUETABLE* pValue = + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName( CFX_WideStringC(pszValue, iValueLen)); if (pValue) { @@ -536,11 +536,11 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( } if (dwType & FDE_CSSVALUETYPE_MaybeString) { pszValue = CopyToLocal(pArgs, pszValue, iValueLen); - list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, + list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType::String, pszValue)); } break; - case FDE_CSSPRIMITIVETYPE_RGB: + case FDE_CSSPrimitiveType::RGB: if (dwType & FDE_CSSVALUETYPE_MaybeColor) { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { @@ -556,31 +556,31 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( return false; } switch (pArgs->pProperty->eName) { - case FDE_CSSPROPERTY_BorderColor: + case FDE_CSSProperty::BorderColor: return Add4ValuesProperty( - list, bImportant, FDE_CSSPROPERTY_BorderLeftColor, - FDE_CSSPROPERTY_BorderTopColor, FDE_CSSPROPERTY_BorderRightColor, - FDE_CSSPROPERTY_BorderBottomColor); - case FDE_CSSPROPERTY_BorderStyle: + list, bImportant, FDE_CSSProperty::BorderLeftColor, + FDE_CSSProperty::BorderTopColor, FDE_CSSProperty::BorderRightColor, + FDE_CSSProperty::BorderBottomColor); + case FDE_CSSProperty::BorderStyle: return Add4ValuesProperty( - list, bImportant, FDE_CSSPROPERTY_BorderLeftStyle, - FDE_CSSPROPERTY_BorderTopStyle, FDE_CSSPROPERTY_BorderRightStyle, - FDE_CSSPROPERTY_BorderBottomStyle); - case FDE_CSSPROPERTY_BorderWidth: + list, bImportant, FDE_CSSProperty::BorderLeftStyle, + FDE_CSSProperty::BorderTopStyle, FDE_CSSProperty::BorderRightStyle, + FDE_CSSProperty::BorderBottomStyle); + case FDE_CSSProperty::BorderWidth: return Add4ValuesProperty( - list, bImportant, FDE_CSSPROPERTY_BorderLeftWidth, - FDE_CSSPROPERTY_BorderTopWidth, FDE_CSSPROPERTY_BorderRightWidth, - FDE_CSSPROPERTY_BorderBottomWidth); - case FDE_CSSPROPERTY_Margin: - return Add4ValuesProperty(list, bImportant, FDE_CSSPROPERTY_MarginLeft, - FDE_CSSPROPERTY_MarginTop, - FDE_CSSPROPERTY_MarginRight, - FDE_CSSPROPERTY_MarginBottom); - case FDE_CSSPROPERTY_Padding: - return Add4ValuesProperty(list, bImportant, FDE_CSSPROPERTY_PaddingLeft, - FDE_CSSPROPERTY_PaddingTop, - FDE_CSSPROPERTY_PaddingRight, - FDE_CSSPROPERTY_PaddingBottom); + list, bImportant, FDE_CSSProperty::BorderLeftWidth, + FDE_CSSProperty::BorderTopWidth, FDE_CSSProperty::BorderRightWidth, + FDE_CSSProperty::BorderBottomWidth); + case FDE_CSSProperty::Margin: + return Add4ValuesProperty(list, bImportant, FDE_CSSProperty::MarginLeft, + FDE_CSSProperty::MarginTop, + FDE_CSSProperty::MarginRight, + FDE_CSSProperty::MarginBottom); + case FDE_CSSProperty::Padding: + return Add4ValuesProperty(list, bImportant, FDE_CSSProperty::PaddingLeft, + FDE_CSSProperty::PaddingTop, + FDE_CSSProperty::PaddingRight, + FDE_CSSProperty::PaddingBottom); default: { CFDE_CSSValueList* pList = new CFDE_CSSValueList(list); AddPropertyHolder(pArgs->pProperty->eName, pList, bImportant); @@ -589,12 +589,13 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( } return false; } + bool CFDE_CSSDeclaration::Add4ValuesProperty(const CFDE_CSSValueArray& list, bool bImportant, - FDE_CSSPROPERTY eLeft, - FDE_CSSPROPERTY eTop, - FDE_CSSPROPERTY eRight, - FDE_CSSPROPERTY eBottom) { + FDE_CSSProperty eLeft, + FDE_CSSProperty eTop, + FDE_CSSProperty eRight, + FDE_CSSProperty eBottom) { switch (list.GetSize()) { case 1: AddPropertyHolder(eLeft, list[0], bImportant); @@ -633,10 +634,10 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( IFDE_CSSValue*& pWidth) const { pColor = pStyle = pWidth = nullptr; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_Number: + case FDE_CSSPrimitiveType::Number: if (!pWidth) { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { @@ -644,7 +645,7 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( } } break; - case FDE_CSSPRIMITIVETYPE_RGB: + case FDE_CSSPrimitiveType::RGB: if (!pColor) { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { @@ -652,7 +653,7 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( } } break; - case FDE_CSSPRIMITIVETYPE_String: { + case FDE_CSSPrimitiveType::String: { const FDE_CSSCOLORTABLE* pColorItem = FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen)); if (pColorItem) { @@ -661,33 +662,33 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( } continue; } - const FDE_CSSPROPERTYVALUETABLE* pValue = + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (!pValue) continue; switch (pValue->eName) { - case FDE_CSSPROPERTYVALUE_Transparent: + case FDE_CSSPropertyValue::Transparent: if (!pColor) { pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); } break; - case FDE_CSSPROPERTYVALUE_Thin: - case FDE_CSSPROPERTYVALUE_Thick: - case FDE_CSSPROPERTYVALUE_Medium: + case FDE_CSSPropertyValue::Thin: + case FDE_CSSPropertyValue::Thick: + case FDE_CSSPropertyValue::Medium: if (!pWidth) pWidth = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_None: - case FDE_CSSPROPERTYVALUE_Hidden: - case FDE_CSSPROPERTYVALUE_Dotted: - case FDE_CSSPROPERTYVALUE_Dashed: - case FDE_CSSPROPERTYVALUE_Solid: - case FDE_CSSPROPERTYVALUE_Double: - case FDE_CSSPROPERTYVALUE_Groove: - case FDE_CSSPROPERTYVALUE_Ridge: - case FDE_CSSPROPERTYVALUE_Inset: - case FDE_CSSPROPERTYVALUE_Outset: + case FDE_CSSPropertyValue::None: + case FDE_CSSPropertyValue::Hidden: + case FDE_CSSPropertyValue::Dotted: + case FDE_CSSPropertyValue::Dashed: + case FDE_CSSPropertyValue::Solid: + case FDE_CSSPropertyValue::Double: + case FDE_CSSPropertyValue::Groove: + case FDE_CSSPropertyValue::Ridge: + case FDE_CSSPropertyValue::Inset: + case FDE_CSSPropertyValue::Outset: if (!pStyle) pStyle = NewEnumValue(pValue->eName); break; @@ -702,24 +703,24 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( if (!pColor) pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); if (!pStyle) - pStyle = NewEnumValue(FDE_CSSPROPERTYVALUE_None); + pStyle = NewEnumValue(FDE_CSSPropertyValue::None); if (!pWidth) - pWidth = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); + pWidth = NewNumberValue(FDE_CSSPrimitiveType::Number, 0.0f); return true; } void CFDE_CSSDeclaration::AddBorderProperty(IFDE_CSSValue* pColor, IFDE_CSSValue* pStyle, IFDE_CSSValue* pWidth, bool bImportant, - FDE_CSSPROPERTY eColor, - FDE_CSSPROPERTY eStyle, - FDE_CSSPROPERTY eWidth) { + FDE_CSSProperty eColor, + FDE_CSSProperty eStyle, + FDE_CSSProperty eWidth) { AddPropertyHolder(eStyle, pStyle, bImportant); AddPropertyHolder(eWidth, pWidth, bImportant); AddPropertyHolder(eColor, pColor, bImportant); } bool CFDE_CSSDeclaration::ParseListStyleProperty( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { @@ -727,47 +728,47 @@ bool CFDE_CSSDeclaration::ParseListStyleProperty( IFDE_CSSPrimitiveValue* pType = nullptr; IFDE_CSSPrimitiveValue* pImage = nullptr; IFDE_CSSPrimitiveValue* pPosition = nullptr; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_URI: + case FDE_CSSPrimitiveType::URI: if (!pImage) { pImage = new CFDE_CSSPrimitiveValue( eType, CopyToLocal(pArgs, pszValue, iValueLen)); } break; - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (!pValue) break; switch (pValue->eName) { - case FDE_CSSPROPERTYVALUE_None: + case FDE_CSSPropertyValue::None: if (!pImage) pImage = NewEnumValue(pValue->eName); else if (!pType) pImage = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Inside: - case FDE_CSSPROPERTYVALUE_Outside: + case FDE_CSSPropertyValue::Inside: + case FDE_CSSPropertyValue::Outside: if (!pPosition) pPosition = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Disc: - case FDE_CSSPROPERTYVALUE_Circle: - case FDE_CSSPROPERTYVALUE_Square: - case FDE_CSSPROPERTYVALUE_Decimal: - case FDE_CSSPROPERTYVALUE_DecimalLeadingZero: - case FDE_CSSPROPERTYVALUE_LowerRoman: - case FDE_CSSPROPERTYVALUE_UpperRoman: - case FDE_CSSPROPERTYVALUE_LowerGreek: - case FDE_CSSPROPERTYVALUE_LowerLatin: - case FDE_CSSPROPERTYVALUE_UpperLatin: - case FDE_CSSPROPERTYVALUE_Armenian: - case FDE_CSSPROPERTYVALUE_Georgian: - case FDE_CSSPROPERTYVALUE_LowerAlpha: - case FDE_CSSPROPERTYVALUE_UpperAlpha: + case FDE_CSSPropertyValue::Disc: + case FDE_CSSPropertyValue::Circle: + case FDE_CSSPropertyValue::Square: + case FDE_CSSPropertyValue::Decimal: + case FDE_CSSPropertyValue::DecimalLeadingZero: + case FDE_CSSPropertyValue::LowerRoman: + case FDE_CSSPropertyValue::UpperRoman: + case FDE_CSSPropertyValue::LowerGreek: + case FDE_CSSPropertyValue::LowerLatin: + case FDE_CSSPropertyValue::UpperLatin: + case FDE_CSSPropertyValue::Armenian: + case FDE_CSSPropertyValue::Georgian: + case FDE_CSSPropertyValue::LowerAlpha: + case FDE_CSSPropertyValue::UpperAlpha: if (!pType) pType = NewEnumValue(pValue->eName); break; @@ -780,18 +781,18 @@ bool CFDE_CSSDeclaration::ParseListStyleProperty( } } if (!pPosition) - pPosition = NewEnumValue(FDE_CSSPROPERTYVALUE_Outside); + pPosition = NewEnumValue(FDE_CSSPropertyValue::Outside); if (!pImage) - pImage = NewEnumValue(FDE_CSSPROPERTYVALUE_None); + pImage = NewEnumValue(FDE_CSSPropertyValue::None); if (!pType) - pType = NewEnumValue(FDE_CSSPROPERTYVALUE_None); - AddPropertyHolder(FDE_CSSPROPERTY_ListStylePosition, pPosition, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_ListStyleImage, pImage, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_ListStyleType, pType, bImportant); + pType = NewEnumValue(FDE_CSSPropertyValue::None); + AddPropertyHolder(FDE_CSSProperty::ListStylePosition, pPosition, bImportant); + AddPropertyHolder(FDE_CSSProperty::ListStyleImage, pImage, bImportant); + AddPropertyHolder(FDE_CSSProperty::ListStyleType, pType, bImportant); return true; } bool CFDE_CSSDeclaration::ParseBackgroundProperty( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { @@ -802,16 +803,16 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( IFDE_CSSPrimitiveValue* pPosX = nullptr; IFDE_CSSPrimitiveValue* pPosY = nullptr; IFDE_CSSPrimitiveValue* pAttachment = nullptr; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_URI: + case FDE_CSSPrimitiveType::URI: if (!pImage) { pImage = new CFDE_CSSPrimitiveValue( eType, CopyToLocal(pArgs, pszValue, iValueLen)); } break; - case FDE_CSSPRIMITIVETYPE_Number: { + case FDE_CSSPrimitiveType::Number: { FX_FLOAT fValue; if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { break; @@ -821,43 +822,43 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( else if (!pPosY) pPosY = NewNumberValue(eType, fValue); } break; - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue) { switch (pValue->eName) { - case FDE_CSSPROPERTYVALUE_None: + case FDE_CSSPropertyValue::None: if (!pImage) pImage = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Transparent: + case FDE_CSSPropertyValue::Transparent: if (!pColor) { pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); } break; - case FDE_CSSPROPERTYVALUE_Fixed: - case FDE_CSSPROPERTYVALUE_Scroll: + case FDE_CSSPropertyValue::Fixed: + case FDE_CSSPropertyValue::Scroll: if (!pAttachment) pAttachment = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Repeat: - case FDE_CSSPROPERTYVALUE_RepeatX: - case FDE_CSSPROPERTYVALUE_RepeatY: - case FDE_CSSPROPERTYVALUE_NoRepeat: + case FDE_CSSPropertyValue::Repeat: + case FDE_CSSPropertyValue::RepeatX: + case FDE_CSSPropertyValue::RepeatY: + case FDE_CSSPropertyValue::NoRepeat: if (!pRepeat) pRepeat = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Left: - case FDE_CSSPROPERTYVALUE_Right: + case FDE_CSSPropertyValue::Left: + case FDE_CSSPropertyValue::Right: if (!pPosX) pPosX = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Top: - case FDE_CSSPROPERTYVALUE_Bottom: + case FDE_CSSPropertyValue::Top: + case FDE_CSSPropertyValue::Bottom: if (!pPosY) pPosX = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Center: + case FDE_CSSPropertyValue::Center: if (!pPosX) pPosX = NewEnumValue(pValue->eName); else if (!pPosY) @@ -876,7 +877,7 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( } } } break; - case FDE_CSSPRIMITIVETYPE_RGB: + case FDE_CSSPrimitiveType::RGB: if (!pColor) { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { @@ -892,33 +893,33 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); } if (!pImage) - pImage = NewEnumValue(FDE_CSSPROPERTYVALUE_None); + pImage = NewEnumValue(FDE_CSSPropertyValue::None); if (!pRepeat) - pRepeat = NewEnumValue(FDE_CSSPROPERTYVALUE_Repeat); + pRepeat = NewEnumValue(FDE_CSSPropertyValue::Repeat); if (!pAttachment) - pAttachment = NewEnumValue(FDE_CSSPROPERTYVALUE_Scroll); + pAttachment = NewEnumValue(FDE_CSSPropertyValue::Scroll); if (!pPosX) { - pPosX = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); - pPosY = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); + pPosX = NewNumberValue(FDE_CSSPrimitiveType::Number, 0.0f); + pPosY = NewNumberValue(FDE_CSSPrimitiveType::Number, 0.0f); } else if (!pPosY) { - pPosY = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); + pPosY = NewNumberValue(FDE_CSSPrimitiveType::Number, 0.0f); } CFDE_CSSValueArray position; position.Add(pPosX); position.Add(pPosY); CFDE_CSSValueList* pPosList = new CFDE_CSSValueList(position); - AddPropertyHolder(FDE_CSSPROPERTY_BackgroundColor, pColor, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_BackgroundImage, pImage, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_BackgroundRepeat, pRepeat, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_BackgroundPosition, pPosList, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_BackgroundAttachment, pAttachment, + AddPropertyHolder(FDE_CSSProperty::BackgroundColor, pColor, bImportant); + AddPropertyHolder(FDE_CSSProperty::BackgroundImage, pImage, bImportant); + AddPropertyHolder(FDE_CSSProperty::BackgroundRepeat, pRepeat, bImportant); + AddPropertyHolder(FDE_CSSProperty::BackgroundPosition, pPosList, bImportant); + AddPropertyHolder(FDE_CSSProperty::BackgroundAttachment, pAttachment, bImportant); return true; } -bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { @@ -929,42 +930,42 @@ bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, IFDE_CSSPrimitiveValue* pFontSize = nullptr; IFDE_CSSPrimitiveValue* pLineHeight = nullptr; CFDE_CSSValueArray familyList; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue) { switch (pValue->eName) { - case FDE_CSSPROPERTYVALUE_XxSmall: - case FDE_CSSPROPERTYVALUE_XSmall: - case FDE_CSSPROPERTYVALUE_Small: - case FDE_CSSPROPERTYVALUE_Medium: - case FDE_CSSPROPERTYVALUE_Large: - case FDE_CSSPROPERTYVALUE_XLarge: - case FDE_CSSPROPERTYVALUE_XxLarge: - case FDE_CSSPROPERTYVALUE_Smaller: - case FDE_CSSPROPERTYVALUE_Larger: + case FDE_CSSPropertyValue::XxSmall: + case FDE_CSSPropertyValue::XSmall: + case FDE_CSSPropertyValue::Small: + case FDE_CSSPropertyValue::Medium: + case FDE_CSSPropertyValue::Large: + case FDE_CSSPropertyValue::XLarge: + case FDE_CSSPropertyValue::XxLarge: + case FDE_CSSPropertyValue::Smaller: + case FDE_CSSPropertyValue::Larger: if (!pFontSize) pFontSize = NewEnumValue(pValue->eName); continue; - case FDE_CSSPROPERTYVALUE_Bold: - case FDE_CSSPROPERTYVALUE_Bolder: - case FDE_CSSPROPERTYVALUE_Lighter: + case FDE_CSSPropertyValue::Bold: + case FDE_CSSPropertyValue::Bolder: + case FDE_CSSPropertyValue::Lighter: if (!pWeight) pWeight = NewEnumValue(pValue->eName); continue; - case FDE_CSSPROPERTYVALUE_Italic: - case FDE_CSSPROPERTYVALUE_Oblique: + case FDE_CSSPropertyValue::Italic: + case FDE_CSSPropertyValue::Oblique: if (!pStyle) pStyle = NewEnumValue(pValue->eName); continue; - case FDE_CSSPROPERTYVALUE_SmallCaps: + case FDE_CSSPropertyValue::SmallCaps: if (!pVariant) pVariant = NewEnumValue(pValue->eName); continue; - case FDE_CSSPROPERTYVALUE_Normal: + case FDE_CSSPropertyValue::Normal: if (!pStyle) pStyle = NewEnumValue(pValue->eName); else if (!pVariant) @@ -986,12 +987,12 @@ bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, } parser.m_Separator = ','; } break; - case FDE_CSSPRIMITIVETYPE_Number: { + case FDE_CSSPrimitiveType::Number: { FX_FLOAT fValue; if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { break; } - if (eType == FDE_CSSPRIMITIVETYPE_Number) { + if (eType == FDE_CSSPrimitiveType::Number) { switch ((int32_t)fValue) { case 100: case 200: @@ -1003,7 +1004,7 @@ bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, case 800: case 900: if (!pWeight) { - pWeight = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, fValue); + pWeight = NewNumberValue(FDE_CSSPrimitiveType::Number, fValue); } continue; } @@ -1018,29 +1019,29 @@ bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, } } if (!pStyle) - pStyle = NewEnumValue(FDE_CSSPROPERTYVALUE_Normal); + pStyle = NewEnumValue(FDE_CSSPropertyValue::Normal); if (!pVariant) - pVariant = NewEnumValue(FDE_CSSPROPERTYVALUE_Normal); + pVariant = NewEnumValue(FDE_CSSPropertyValue::Normal); if (!pWeight) - pWeight = NewEnumValue(FDE_CSSPROPERTYVALUE_Normal); + pWeight = NewEnumValue(FDE_CSSPropertyValue::Normal); if (!pFontSize) - pFontSize = NewEnumValue(FDE_CSSPROPERTYVALUE_Medium); + pFontSize = NewEnumValue(FDE_CSSPropertyValue::Medium); if (!pLineHeight) - pLineHeight = NewEnumValue(FDE_CSSPROPERTYVALUE_Normal); + pLineHeight = NewEnumValue(FDE_CSSPropertyValue::Normal); - AddPropertyHolder(FDE_CSSPROPERTY_FontStyle, pStyle, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_FontVariant, pVariant, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_FontWeight, pWeight, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_FontSize, pFontSize, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_LineHeight, pLineHeight, bImportant); + AddPropertyHolder(FDE_CSSProperty::FontStyle, pStyle, bImportant); + AddPropertyHolder(FDE_CSSProperty::FontVariant, pVariant, bImportant); + AddPropertyHolder(FDE_CSSProperty::FontWeight, pWeight, bImportant); + AddPropertyHolder(FDE_CSSProperty::FontSize, pFontSize, bImportant); + AddPropertyHolder(FDE_CSSProperty::LineHeight, pLineHeight, bImportant); if (familyList.GetSize() > 0) { CFDE_CSSValueList* pList = new CFDE_CSSValueList(familyList); - AddPropertyHolder(FDE_CSSPROPERTY_FontFamily, pList, bImportant); + AddPropertyHolder(FDE_CSSProperty::FontFamily, pList, bImportant); } return true; } bool CFDE_CSSDeclaration::ParseColumnRuleProperty( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { @@ -1048,34 +1049,34 @@ bool CFDE_CSSDeclaration::ParseColumnRuleProperty( IFDE_CSSPrimitiveValue* pColumnRuleWidth = nullptr; IFDE_CSSPrimitiveValue* pColumnRuleStyle = nullptr; IFDE_CSSPrimitiveValue* pColumnRuleColor = nullptr; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue) { switch (pValue->eName) { - case FDE_CSSPROPERTYVALUE_None: - case FDE_CSSPROPERTYVALUE_Hidden: - case FDE_CSSPROPERTYVALUE_Dotted: - case FDE_CSSPROPERTYVALUE_Dashed: - case FDE_CSSPROPERTYVALUE_Solid: - case FDE_CSSPROPERTYVALUE_Double: - case FDE_CSSPROPERTYVALUE_Groove: - case FDE_CSSPROPERTYVALUE_Ridge: - case FDE_CSSPROPERTYVALUE_Inset: - case FDE_CSSPROPERTYVALUE_Outset: + case FDE_CSSPropertyValue::None: + case FDE_CSSPropertyValue::Hidden: + case FDE_CSSPropertyValue::Dotted: + case FDE_CSSPropertyValue::Dashed: + case FDE_CSSPropertyValue::Solid: + case FDE_CSSPropertyValue::Double: + case FDE_CSSPropertyValue::Groove: + case FDE_CSSPropertyValue::Ridge: + case FDE_CSSPropertyValue::Inset: + case FDE_CSSPropertyValue::Outset: if (!pColumnRuleStyle) pColumnRuleStyle = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Transparent: + case FDE_CSSPropertyValue::Transparent: if (!pColumnRuleColor) pColumnRuleColor = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Thin: - case FDE_CSSPROPERTYVALUE_Medium: - case FDE_CSSPROPERTYVALUE_Thick: + case FDE_CSSPropertyValue::Thin: + case FDE_CSSPropertyValue::Medium: + case FDE_CSSPropertyValue::Thick: if (!pColumnRuleWidth) pColumnRuleWidth = NewEnumValue(pValue->eName); break; @@ -1091,14 +1092,14 @@ bool CFDE_CSSDeclaration::ParseColumnRuleProperty( continue; } } break; - case FDE_CSSPRIMITIVETYPE_Number: { + case FDE_CSSPrimitiveType::Number: { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType) && !pColumnRuleWidth) { pColumnRuleWidth = NewNumberValue(eType, fValue); } } break; - case FDE_CSSPRIMITIVETYPE_RGB: { + case FDE_CSSPrimitiveType::RGB: { FX_ARGB dwColor; if (!pColumnRuleColor && FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { @@ -1113,32 +1114,32 @@ bool CFDE_CSSDeclaration::ParseColumnRuleProperty( return false; if (!pColumnRuleStyle) - pColumnRuleStyle = NewEnumValue(FDE_CSSPROPERTYVALUE_None); + pColumnRuleStyle = NewEnumValue(FDE_CSSPropertyValue::None); if (!pColumnRuleWidth) - pColumnRuleWidth = NewEnumValue(FDE_CSSPROPERTYVALUE_Medium); + pColumnRuleWidth = NewEnumValue(FDE_CSSPropertyValue::Medium); if (!pColumnRuleColor) { pColumnRuleColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); } - AddPropertyHolder(FDE_CSSPROPERTY_ColumnRuleStyle, pColumnRuleStyle, + AddPropertyHolder(FDE_CSSProperty::ColumnRuleStyle, pColumnRuleStyle, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_ColumnRuleWidth, pColumnRuleWidth, + AddPropertyHolder(FDE_CSSProperty::ColumnRuleWidth, pColumnRuleWidth, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_ColumnRuleColor, pColumnRuleColor, + AddPropertyHolder(FDE_CSSProperty::ColumnRuleColor, pColumnRuleColor, bImportant); return true; } -bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); CFDE_CSSValueArray arrEmphasisStyle; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; IFDE_CSSPrimitiveValue* pEmphasisColor = nullptr; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue) { arrEmphasisStyle.Add(NewEnumValue(pValue->eName)); @@ -1151,9 +1152,9 @@ bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, } pszValue = CopyToLocal(pArgs, pszValue, iValueLen); arrEmphasisStyle.Add( - new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, pszValue)); + new CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType::String, pszValue)); } break; - case FDE_CSSPRIMITIVETYPE_RGB: { + case FDE_CSSPrimitiveType::RGB: { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { pEmphasisColor = new CFDE_CSSPrimitiveValue(dwColor); @@ -1164,37 +1165,37 @@ bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, } } if (arrEmphasisStyle.GetSize() != 0) { - AddPropertyHolder(FDE_CSSPROPERTY_TextEmphasisStyle, + AddPropertyHolder(FDE_CSSProperty::TextEmphasisStyle, new CFDE_CSSValueList(arrEmphasisStyle), bImportant); } if (pEmphasisColor) { - AddPropertyHolder(FDE_CSSPROPERTY_TextEmphasisColor, pEmphasisColor, + AddPropertyHolder(FDE_CSSProperty::TextEmphasisColor, pEmphasisColor, bImportant); } return true; } -bool CFDE_CSSDeclaration::ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::ParseColumnsProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pColumnWidth = nullptr; IFDE_CSSPrimitiveValue* pColumnCount = nullptr; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); - if (!pValue && pValue->eName == FDE_CSSPROPERTYVALUE_Auto) { + if (!pValue && pValue->eName == FDE_CSSPropertyValue::Auto) { pColumnWidth = NewEnumValue(pValue->eName); } } break; - case FDE_CSSPRIMITIVETYPE_Number: { + case FDE_CSSPrimitiveType::Number: { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_Number: + case FDE_CSSPrimitiveType::Number: if (!pColumnCount) pColumnCount = NewNumberValue(eType, fValue); break; @@ -1213,35 +1214,35 @@ bool CFDE_CSSDeclaration::ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, return false; if (!pColumnWidth) - pColumnWidth = NewEnumValue(FDE_CSSPROPERTYVALUE_Auto); + pColumnWidth = NewEnumValue(FDE_CSSPropertyValue::Auto); else if (!pColumnCount) - pColumnCount = NewEnumValue(FDE_CSSPROPERTYVALUE_Auto); + pColumnCount = NewEnumValue(FDE_CSSPropertyValue::Auto); - AddPropertyHolder(FDE_CSSPROPERTY_ColumnWidth, pColumnWidth, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_ColumnCount, pColumnCount, bImportant); + AddPropertyHolder(FDE_CSSProperty::ColumnWidth, pColumnWidth, bImportant); + AddPropertyHolder(FDE_CSSProperty::ColumnCount, pColumnCount, bImportant); return true; } bool CFDE_CSSDeclaration::ParseOverflowProperty( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pOverflowX = nullptr; IFDE_CSSPrimitiveValue* pOverflowY = nullptr; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { - if (eType == FDE_CSSPRIMITIVETYPE_String) { - const FDE_CSSPROPERTYVALUETABLE* pValue = + if (eType == FDE_CSSPrimitiveType::String) { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue) { switch (pValue->eName) { - case FDE_CSSOVERFLOW_Visible: - case FDE_CSSOVERFLOW_Hidden: - case FDE_CSSOVERFLOW_Scroll: - case FDE_CSSOVERFLOW_Auto: - case FDE_CSSOVERFLOW_NoDisplay: - case FDE_CSSOVERFLOW_NoContent: + case FDE_CSSPropertyValue::Visible: + case FDE_CSSPropertyValue::Hidden: + case FDE_CSSPropertyValue::Scroll: + case FDE_CSSPropertyValue::Auto: + case FDE_CSSPropertyValue::NoDisplay: + case FDE_CSSPropertyValue::NoContent: if (pOverflowX && pOverflowY) return false; if (!pOverflowX) { @@ -1262,7 +1263,7 @@ bool CFDE_CSSDeclaration::ParseOverflowProperty( if (!pOverflowY) pOverflowY = NewEnumValue(pOverflowX->GetEnum()); - AddPropertyHolder(FDE_CSSPROPERTY_OverflowX, pOverflowX, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_OverflowY, pOverflowY, bImportant); + AddPropertyHolder(FDE_CSSProperty::OverflowX, pOverflowX, bImportant); + AddPropertyHolder(FDE_CSSProperty::OverflowY, pOverflowY, bImportant); return true; } |