diff options
Diffstat (limited to 'xfa/fde/css/fde_cssstyleselector.cpp')
-rw-r--r-- | xfa/fde/css/fde_cssstyleselector.cpp | 1643 |
1 files changed, 408 insertions, 1235 deletions
diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp index d10cbf1d49..6808bab48a 100644 --- a/xfa/fde/css/fde_cssstyleselector.cpp +++ b/xfa/fde/css/fde_cssstyleselector.cpp @@ -19,80 +19,6 @@ #define FDE_CSSUNIVERSALHASH ('*') -int32_t CFDE_CSSCounterStyle::FindIndex(const FX_WCHAR* pszIdentifier) { - int32_t iCount = m_arrCounterData.GetSize(); - for (int32_t i = 0; i < iCount; i++) { - if (FXSYS_wcscmp(pszIdentifier, m_arrCounterData.ElementAt(i).m_pszIdent) == - 0) { - return i; - } - } - return -1; -} - -void CFDE_CSSCounterStyle::DoUpdateIndex(IFDE_CSSValueList* pList) { - if (!pList) - return; - - int32_t iCount = pList->CountValues(); - FX_FLOAT fDefValue = 1.0; - bool bDefIncrement = true; - if (pList == m_pCounterReset) { - fDefValue = 0.0; - bDefIncrement = false; - } - for (int32_t i = 0; i < iCount; i++) { - IFDE_CSSValueList* pCounter = - static_cast<IFDE_CSSValueList*>(pList->GetValue(i)); - int32_t iLen; - const FX_WCHAR* pszIdentifier = - static_cast<IFDE_CSSPrimitiveValue*>(pCounter->GetValue(0)) - ->GetString(iLen); - FX_FLOAT fValue = fDefValue; - if (pCounter->CountValues() > 1) { - fValue = static_cast<IFDE_CSSPrimitiveValue*>(pCounter->GetValue(1)) - ->GetFloat(); - } - int32_t iIndex = FindIndex(pszIdentifier); - if (iIndex == -1) { - FDE_CSSCOUNTERDATA data; - data.m_pszIdent = pszIdentifier; - if (bDefIncrement) { - data.m_bIncrement = true; - data.m_iIncVal = (int32_t)fValue; - } else { - data.m_iResetVal = (int32_t)fValue; - data.m_bReset = true; - } - m_arrCounterData.Add(data); - } else { - FDE_CSSCOUNTERDATA& data = m_arrCounterData.ElementAt(iIndex); - if (bDefIncrement) { - data.m_bIncrement = true; - data.m_iIncVal += (int32_t)fValue; - } else { - data.m_bReset = true; - data.m_iResetVal = (int32_t)fValue; - } - } - } -} - -CFDE_CSSCounterStyle::CFDE_CSSCounterStyle() - : m_pCounterInc(nullptr), m_pCounterReset(nullptr), m_bIndexDirty(false) {} - -CFDE_CSSCounterStyle::~CFDE_CSSCounterStyle() {} - -void CFDE_CSSCounterStyle::UpdateIndex() { - if (!m_bIndexDirty) { - return; - } - m_arrCounterData.RemoveAll(); - DoUpdateIndex(m_pCounterInc); - DoUpdateIndex(m_pCounterReset); - m_bIndexDirty = false; -} - FDE_CSSRuleData::FDE_CSSRuleData(CFDE_CSSSelector* pSel, CFDE_CSSDeclaration* pDecl, uint32_t dwPos) @@ -100,20 +26,22 @@ FDE_CSSRuleData::FDE_CSSRuleData(CFDE_CSSSelector* pSel, static const uint32_t s_Specific[5] = {0x00010000, 0x00010000, 0x00100000, 0x00100000, 0x01000000}; for (; pSel; pSel = pSel->GetNextSelector()) { - FDE_CSSSELECTORTYPE eType = pSel->GetType(); - if (eType > FDE_CSSSELECTORTYPE_Descendant || + FDE_CSSSelectorType eType = pSel->GetType(); + if (eType > FDE_CSSSelectorType::Descendant || pSel->GetNameHash() != FDE_CSSUNIVERSALHASH) { - dwPriority += s_Specific[eType]; + dwPriority += s_Specific[static_cast<int>(eType)]; } } } CFDE_CSSStyleSelector::CFDE_CSSStyleSelector(CFGAS_FontMgr* pFontMgr) : m_pFontMgr(pFontMgr), m_fDefFontSize(12.0f) { - m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_High] = FDE_CSSSTYLESHEETGROUP_Author; - m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_Mid] = FDE_CSSSTYLESHEETGROUP_User; - m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_Low] = - FDE_CSSSTYLESHEETGROUP_UserAgent; + m_ePriorities[static_cast<int32_t>(FDE_CSSStyleSheetPriority::High)] = + FDE_CSSStyleSheetGroup::Author; + m_ePriorities[static_cast<int32_t>(FDE_CSSStyleSheetPriority::Mid)] = + FDE_CSSStyleSheetGroup::User; + m_ePriorities[static_cast<int32_t>(FDE_CSSStyleSheetPriority::Low)] = + FDE_CSSStyleSheetGroup::UserAgent; } CFDE_CSSStyleSelector::~CFDE_CSSStyleSelector() { @@ -138,17 +66,14 @@ IFDE_CSSComputedStyle* CFDE_CSSStyleSelector::CreateComputedStyle( if (pParentStyle) { pStyle->m_InheritedData = static_cast<CFDE_CSSComputedStyle*>(pParentStyle)->m_InheritedData; - } else { - pStyle->m_InheritedData.Reset(); } - pStyle->m_NonInheritedData.Reset(); return pStyle; } -bool CFDE_CSSStyleSelector::SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, +bool CFDE_CSSStyleSelector::SetStyleSheet(FDE_CSSStyleSheetGroup eType, IFDE_CSSStyleSheet* pSheet) { - ASSERT(eType < FDE_CSSSTYLESHEETGROUP_MAX); - CFDE_CSSStyleSheetArray& dest = m_SheetGroups[eType]; + CFX_ArrayTemplate<IFDE_CSSStyleSheet*>& dest = + m_SheetGroups[static_cast<int32_t>(eType)]; dest.RemoveAt(0, dest.GetSize()); if (pSheet) dest.Add(pSheet); @@ -156,10 +81,10 @@ bool CFDE_CSSStyleSelector::SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, } bool CFDE_CSSStyleSelector::SetStyleSheets( - FDE_CSSSTYLESHEETGROUP eType, - const CFDE_CSSStyleSheetArray* pArray) { - ASSERT(eType < FDE_CSSSTYLESHEETGROUP_MAX); - CFDE_CSSStyleSheetArray& dest = m_SheetGroups[eType]; + FDE_CSSStyleSheetGroup eType, + const CFX_ArrayTemplate<IFDE_CSSStyleSheet*>* pArray) { + CFX_ArrayTemplate<IFDE_CSSStyleSheet*>& dest = + m_SheetGroups[static_cast<int32_t>(eType)]; if (pArray) dest.Copy(*pArray); else @@ -168,22 +93,24 @@ bool CFDE_CSSStyleSelector::SetStyleSheets( } void CFDE_CSSStyleSelector::SetStylePriority( - FDE_CSSSTYLESHEETGROUP eType, - FDE_CSSSTYLESHEETPRIORITY ePriority) { - m_ePriorities[ePriority] = eType; + FDE_CSSStyleSheetGroup eType, + FDE_CSSStyleSheetPriority ePriority) { + m_ePriorities[static_cast<int32_t>(ePriority)] = eType; } void CFDE_CSSStyleSelector::UpdateStyleIndex(uint32_t dwMediaList) { Reset(); - for (int32_t iGroup = 0; iGroup < FDE_CSSSTYLESHEETGROUP_MAX; ++iGroup) { + // TODO(dsinclair): Hard coded size bad. This should probably just be a map. + for (int32_t iGroup = 0; iGroup < 3; ++iGroup) { CFDE_CSSRuleCollection& rules = m_RuleCollection[iGroup]; rules.AddRulesFrom(m_SheetGroups[iGroup], dwMediaList, m_pFontMgr); } } void CFDE_CSSStyleSelector::Reset() { - for (int32_t iGroup = 0; iGroup < FDE_CSSSTYLESHEETGROUP_MAX; ++iGroup) { + // TODO(dsinclair): Hard coded size bad. This should probably just be a map. + for (int32_t iGroup = 0; iGroup < 3; ++iGroup) { m_RuleCollection[iGroup].Clear(); } } @@ -191,20 +118,21 @@ void CFDE_CSSStyleSelector::Reset() { int32_t CFDE_CSSStyleSelector::MatchDeclarations( CXFA_CSSTagProvider* pTag, CFDE_CSSDeclarationArray& matchedDecls, - FDE_CSSPSEUDO ePseudoType) { + FDE_CSSPseudo ePseudoType) { ASSERT(pTag); FDE_CSSTagCache* pCache = m_pAccelerator->GetTopElement(); ASSERT(pCache && pCache->GetTag() == pTag); matchedDecls.RemoveAt(0, matchedDecls.GetSize()); - for (int32_t ePriority = FDE_CSSSTYLESHEETPRIORITY_MAX - 1; ePriority >= 0; - --ePriority) { - FDE_CSSSTYLESHEETGROUP eGroup = m_ePriorities[ePriority]; - CFDE_CSSRuleCollection& rules = m_RuleCollection[eGroup]; + // TODO(dsinclair): Hard coded size bad ... + for (int32_t ePriority = 2; ePriority >= 0; --ePriority) { + FDE_CSSStyleSheetGroup eGroup = m_ePriorities[ePriority]; + CFDE_CSSRuleCollection& rules = + m_RuleCollection[static_cast<int32_t>(eGroup)]; if (rules.CountSelectors() == 0) continue; - if (ePseudoType == FDE_CSSPSEUDO_NONE) { + if (ePseudoType == FDE_CSSPseudo::NONE) { MatchRules(pCache, rules.GetUniversalRuleData(), ePseudoType); if (pCache->HashTag()) { MatchRules(pCache, rules.GetTagRuleData(pCache->HashTag()), @@ -233,7 +161,7 @@ int32_t CFDE_CSSStyleSelector::MatchDeclarations( void CFDE_CSSStyleSelector::MatchRules(FDE_CSSTagCache* pCache, FDE_CSSRuleData* pList, - FDE_CSSPSEUDO ePseudoType) { + FDE_CSSPseudo ePseudoType) { while (pList) { if (MatchSelector(pCache, pList->pSelector, ePseudoType)) m_MatchedRules.push_back(pList); @@ -243,11 +171,11 @@ void CFDE_CSSStyleSelector::MatchRules(FDE_CSSTagCache* pCache, bool CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache, CFDE_CSSSelector* pSel, - FDE_CSSPSEUDO ePseudoType) { + FDE_CSSPseudo ePseudoType) { uint32_t dwHash; while (pSel && pCache) { switch (pSel->GetType()) { - case FDE_CSSSELECTORTYPE_Descendant: + case FDE_CSSSelectorType::Descendant: dwHash = pSel->GetNameHash(); while ((pCache = pCache->GetParent()) != nullptr) { if (dwHash != FDE_CSSUNIVERSALHASH && dwHash != pCache->HashTag()) { @@ -258,25 +186,25 @@ bool CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache, } } return false; - case FDE_CSSSELECTORTYPE_ID: + case FDE_CSSSelectorType::ID: dwHash = pCache->HashID(); if (dwHash != pSel->GetNameHash()) { return false; } break; - case FDE_CSSSELECTORTYPE_Class: + case FDE_CSSSelectorType::Class: dwHash = pCache->HashClass(); if (dwHash != pSel->GetNameHash()) { return false; } break; - case FDE_CSSSELECTORTYPE_Element: + case FDE_CSSSelectorType::Element: dwHash = pSel->GetNameHash(); if (dwHash != FDE_CSSUNIVERSALHASH && dwHash != pCache->HashTag()) { return false; } break; - case FDE_CSSSELECTORTYPE_Pseudo: + case FDE_CSSSelectorType::Pseudo: dwHash = FDE_GetCSSPseudoByEnum(ePseudoType)->dwHash; if (dwHash != pSel->GetNameHash()) { return false; @@ -317,9 +245,9 @@ void CFDE_CSSStyleSelector::ComputeStyle( if (!pDecl) pDecl = new CFDE_CSSDeclaration; - FDE_CSSPROPERTYARGS args; + FDE_CSSPropertyArgs args; args.pStringCache = nullptr; - args.pProperty = FDE_GetCSSPropertyByEnum(FDE_CSSPROPERTY_TextAlign); + args.pProperty = FDE_GetCSSPropertyByEnum(FDE_CSSProperty::TextAlign); pDecl->AddProperty(&args, wsValue.c_str(), wsValue.GetLength()); } } @@ -362,7 +290,7 @@ void CFDE_CSSStyleSelector::ApplyDeclarations( IFDE_CSSValue* pLastest = nullptr; IFDE_CSSValue* pImportant = nullptr; for (i = 0; i < iDeclCount; ++i) { - pVal = ppDeclArray[i]->GetProperty(FDE_CSSPROPERTY_FontSize, bImportant); + pVal = ppDeclArray[i]->GetProperty(FDE_CSSProperty::FontSize, bImportant); if (!pVal) continue; @@ -372,21 +300,21 @@ void CFDE_CSSStyleSelector::ApplyDeclarations( pLastest = pVal; } if (pImportant) { - ApplyProperty(FDE_CSSPROPERTY_FontSize, pImportant, pComputedStyle); + ApplyProperty(FDE_CSSProperty::FontSize, pImportant, pComputedStyle); } else if (pLastest) { - ApplyProperty(FDE_CSSPROPERTY_FontSize, pLastest, pComputedStyle); + ApplyProperty(FDE_CSSProperty::FontSize, pLastest, pComputedStyle); } } else { CFDE_CSSDeclarationArray importants; const CFDE_CSSDeclaration* pDecl = nullptr; - FDE_CSSPROPERTY eProp; + FDE_CSSProperty eProp; FX_POSITION pos; for (i = 0; i < iDeclCount; ++i) { pDecl = ppDeclArray[i]; pos = pDecl->GetStartPosition(); while (pos) { pDecl->GetNextProperty(pos, eProp, pVal, bImportant); - if (eProp == FDE_CSSPROPERTY_FontSize) { + if (eProp == FDE_CSSProperty::FontSize) { continue; } else if (!bImportant) { ApplyProperty(eProp, pVal, pComputedStyle); @@ -402,7 +330,7 @@ void CFDE_CSSStyleSelector::ApplyDeclarations( pos = pDecl->GetStartPosition(); while (pos) { pDecl->GetNextProperty(pos, eProp, pVal, bImportant); - if (bImportant && eProp != FDE_CSSPROPERTY_FontSize) { + if (bImportant && eProp != FDE_CSSProperty::FontSize) { ApplyProperty(eProp, pVal, pComputedStyle); } } @@ -420,24 +348,24 @@ void CFDE_CSSStyleSelector::AppendInlineStyle(CFDE_CSSDeclaration* pDecl, const FX_WCHAR* psz, int32_t iLen) { ASSERT(pDecl && psz && iLen > 0); - std::unique_ptr<CFDE_CSSSyntaxParser> pSyntax(new CFDE_CSSSyntaxParser); + auto pSyntax = pdfium::MakeUnique<CFDE_CSSSyntaxParser>(); if (!pSyntax->Init(psz, iLen, 32, true)) return; int32_t iLen2 = 0; const FX_WCHAR* psz2; - FDE_CSSPROPERTYARGS args; + FDE_CSSPropertyArgs args; args.pStringCache = nullptr; args.pProperty = nullptr; CFX_WideString wsName; while (1) { - FDE_CSSSYNTAXSTATUS eStatus = pSyntax->DoSyntaxParse(); - if (eStatus == FDE_CSSSYNTAXSTATUS_PropertyName) { + FDE_CSSSyntaxStatus eStatus = pSyntax->DoSyntaxParse(); + if (eStatus == FDE_CSSSyntaxStatus::PropertyName) { psz2 = pSyntax->GetCurrentString(iLen2); args.pProperty = FDE_GetCSSPropertyByName(CFX_WideStringC(psz2, iLen2)); if (!args.pProperty) wsName = CFX_WideStringC(psz2, iLen2); - } else if (eStatus == FDE_CSSSYNTAXSTATUS_PropertyValue) { + } else if (eStatus == FDE_CSSSyntaxStatus::PropertyValue) { if (args.pProperty) { psz2 = pSyntax->GetCurrentString(iLen2); if (iLen2 > 0) @@ -455,458 +383,274 @@ void CFDE_CSSStyleSelector::AppendInlineStyle(CFDE_CSSDeclaration* pDecl, } } -#define FDE_CSSNONINHERITS (pComputedStyle->m_NonInheritedData) -#define FDE_CSSINHERITS (pComputedStyle->m_InheritedData) -#define FDE_CSSFONTSIZE (FDE_CSSINHERITS.m_fFontSize) void CFDE_CSSStyleSelector::ApplyProperty( - FDE_CSSPROPERTY eProperty, + FDE_CSSProperty eProperty, IFDE_CSSValue* pValue, CFDE_CSSComputedStyle* pComputedStyle) { if (pValue->GetType() == FDE_CSSVALUETYPE_Primitive) { IFDE_CSSPrimitiveValue* pPrimitive = static_cast<IFDE_CSSPrimitiveValue*>(pValue); - FDE_CSSPRIMITIVETYPE eType = pPrimitive->GetPrimitiveType(); + FDE_CSSPrimitiveType eType = pPrimitive->GetPrimitiveType(); switch (eProperty) { - case FDE_CSSPROPERTY_Display: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eDisplay = ToDisplay(pPrimitive->GetEnum()); + case FDE_CSSProperty::Display: + if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_NonInheritedData.m_eDisplay = + ToDisplay(pPrimitive->GetEnum()); } break; - case FDE_CSSPROPERTY_FontSize: { - FX_FLOAT& fFontSize = FDE_CSSFONTSIZE; - if (eType >= FDE_CSSPRIMITIVETYPE_Number && - eType <= FDE_CSSPRIMITIVETYPE_PC) { + case FDE_CSSProperty::FontSize: { + FX_FLOAT& fFontSize = pComputedStyle->m_InheritedData.m_fFontSize; + if (eType >= FDE_CSSPrimitiveType::Number && + eType <= FDE_CSSPrimitiveType::Picas) { fFontSize = ApplyNumber(eType, pPrimitive->GetFloat(), fFontSize); - } else if (eType == FDE_CSSPRIMITIVETYPE_Enum) { + } else if (eType == FDE_CSSPrimitiveType::Enum) { fFontSize = ToFontSize(pPrimitive->GetEnum(), fFontSize); } } break; - case FDE_CSSPROPERTY_LineHeight: - if (eType == FDE_CSSPRIMITIVETYPE_Number) { - FDE_CSSINHERITS.m_fLineHeight = - pPrimitive->GetFloat() * FDE_CSSFONTSIZE; - } else if (eType > FDE_CSSPRIMITIVETYPE_Number && - eType <= FDE_CSSPRIMITIVETYPE_PC) { - FDE_CSSINHERITS.m_fLineHeight = - ApplyNumber(eType, pPrimitive->GetFloat(), FDE_CSSFONTSIZE); + case FDE_CSSProperty::LineHeight: + if (eType == FDE_CSSPrimitiveType::Number) { + pComputedStyle->m_InheritedData.m_fLineHeight = + pPrimitive->GetFloat() * + pComputedStyle->m_InheritedData.m_fFontSize; + } else if (eType > FDE_CSSPrimitiveType::Number && + eType <= FDE_CSSPrimitiveType::Picas) { + pComputedStyle->m_InheritedData.m_fLineHeight = + ApplyNumber(eType, pPrimitive->GetFloat(), + pComputedStyle->m_InheritedData.m_fFontSize); } break; - case FDE_CSSPROPERTY_TextAlign: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eTextAligh = ToTextAlign(pPrimitive->GetEnum()); + case FDE_CSSProperty::TextAlign: + if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_InheritedData.m_eTextAlign = + ToTextAlign(pPrimitive->GetEnum()); } break; - case FDE_CSSPROPERTY_TextIndent: - SetLengthWithPercent(FDE_CSSINHERITS.m_TextIndent, eType, pPrimitive, - FDE_CSSFONTSIZE); + case FDE_CSSProperty::TextIndent: + SetLengthWithPercent(pComputedStyle->m_InheritedData.m_TextIndent, + eType, pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); break; - case FDE_CSSPROPERTY_FontWeight: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_wFontWeight = ToFontWeight(pPrimitive->GetEnum()); - } else if (eType == FDE_CSSPRIMITIVETYPE_Number) { + case FDE_CSSProperty::FontWeight: + if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_InheritedData.m_wFontWeight = + ToFontWeight(pPrimitive->GetEnum()); + } else if (eType == FDE_CSSPrimitiveType::Number) { int32_t iValue = (int32_t)pPrimitive->GetFloat() / 100; if (iValue >= 1 && iValue <= 9) { - FDE_CSSINHERITS.m_wFontWeight = iValue * 100; + pComputedStyle->m_InheritedData.m_wFontWeight = iValue * 100; } } break; - case FDE_CSSPROPERTY_FontStyle: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eFontStyle = ToFontStyle(pPrimitive->GetEnum()); + case FDE_CSSProperty::FontStyle: + if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_InheritedData.m_eFontStyle = + ToFontStyle(pPrimitive->GetEnum()); } break; - case FDE_CSSPROPERTY_Color: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSINHERITS.m_dwFontColor = pPrimitive->GetRGBColor(); + case FDE_CSSProperty::Color: + if (eType == FDE_CSSPrimitiveType::RGB) { + pComputedStyle->m_InheritedData.m_dwFontColor = + pPrimitive->GetRGBColor(); } break; - case FDE_CSSPROPERTY_MarginLeft: - FDE_CSSNONINHERITS.m_bHasMargin |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MarginWidth.left, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MarginTop: - FDE_CSSNONINHERITS.m_bHasMargin |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MarginWidth.top, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MarginRight: - FDE_CSSNONINHERITS.m_bHasMargin |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MarginWidth.right, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MarginBottom: - FDE_CSSNONINHERITS.m_bHasMargin |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MarginWidth.bottom, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_PaddingLeft: - FDE_CSSNONINHERITS.m_bHasPadding |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_PaddingWidth.left, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_PaddingTop: - FDE_CSSNONINHERITS.m_bHasPadding |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_PaddingWidth.top, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_PaddingRight: - FDE_CSSNONINHERITS.m_bHasPadding |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_PaddingWidth.right, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_PaddingBottom: - FDE_CSSNONINHERITS.m_bHasPadding |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_PaddingWidth.bottom, - eType, pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_BorderLeftWidth: - FDE_CSSNONINHERITS.m_bHasBorder |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_BorderWidth.left, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_BorderTopWidth: - FDE_CSSNONINHERITS.m_bHasBorder |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_BorderWidth.top, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_BorderRightWidth: - FDE_CSSNONINHERITS.m_bHasBorder |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_BorderWidth.right, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_BorderBottomWidth: - FDE_CSSNONINHERITS.m_bHasBorder |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_BorderWidth.bottom, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_BorderLeftStyle: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eBDRLeftStyle = - ToBorderStyle(pPrimitive->GetEnum()); + case FDE_CSSProperty::MarginLeft: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_MarginWidth.left, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasMargin = true; } break; - case FDE_CSSPROPERTY_BorderTopStyle: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eBDRTopStyle = - ToBorderStyle(pPrimitive->GetEnum()); + case FDE_CSSProperty::MarginTop: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_MarginWidth.top, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasMargin = true; } break; - case FDE_CSSPROPERTY_BorderRightStyle: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eBDRRightStyle = - ToBorderStyle(pPrimitive->GetEnum()); + case FDE_CSSProperty::MarginRight: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_MarginWidth.right, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasMargin = true; } break; - case FDE_CSSPROPERTY_BorderBottomStyle: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eBDRBottomStyle = - ToBorderStyle(pPrimitive->GetEnum()); + case FDE_CSSProperty::MarginBottom: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_MarginWidth.bottom, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasMargin = true; } break; - case FDE_CSSPROPERTY_BorderLeftColor: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSNONINHERITS.m_dwBDRLeftColor = pPrimitive->GetRGBColor(); + case FDE_CSSProperty::PaddingLeft: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_PaddingWidth.left, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasPadding = true; } break; - case FDE_CSSPROPERTY_BorderTopColor: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSNONINHERITS.m_dwBDRTopColor = pPrimitive->GetRGBColor(); + case FDE_CSSProperty::PaddingTop: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_PaddingWidth.top, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasPadding = true; } break; - case FDE_CSSPROPERTY_BorderRightColor: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSNONINHERITS.m_dwBDRRightColor = pPrimitive->GetRGBColor(); + case FDE_CSSProperty::PaddingRight: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_PaddingWidth.right, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasPadding = true; } break; - case FDE_CSSPROPERTY_BorderBottomColor: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSNONINHERITS.m_dwBDRBottomColor = pPrimitive->GetRGBColor(); + case FDE_CSSProperty::PaddingBottom: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_PaddingWidth.bottom, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasPadding = true; } break; - case FDE_CSSPROPERTY_ListStyleType: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eListStyleType = - ToListStyleType(pPrimitive->GetEnum()); + case FDE_CSSProperty::BorderLeftWidth: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_BorderWidth.left, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasBorder = true; } break; - case FDE_CSSPROPERTY_ListStylePosition: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eListStylePosition = - ToListStylePosition(pPrimitive->GetEnum()); + case FDE_CSSProperty::BorderTopWidth: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_BorderWidth.top, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasBorder = true; } break; - case FDE_CSSPROPERTY_BackgroundColor: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSNONINHERITS.m_dwBKGColor = pPrimitive->GetRGBColor(); - } else if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_dwBKGColor = 0; + case FDE_CSSProperty::BorderRightWidth: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_BorderWidth.right, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasBorder = true; } break; - case FDE_CSSPROPERTY_Visibility: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eVisibility = ToVisibility(pPrimitive->GetEnum()); + case FDE_CSSProperty::BorderBottomWidth: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_BorderWidth.bottom, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasBorder = true; } break; - case FDE_CSSPROPERTY_Width: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_BoxSize.cx, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_Height: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_BoxSize.cy, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MinWidth: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MinBoxSize.cx, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MinHeight: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MinBoxSize.cy, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MaxWidth: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MaxBoxSize.cx, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MaxHeight: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MaxBoxSize.cy, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_VerticalAlign: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eVerticalAlign = + case FDE_CSSProperty::VerticalAlign: + if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_NonInheritedData.m_eVerticalAlign = ToVerticalAlign(pPrimitive->GetEnum()); - } else if (eType >= FDE_CSSPRIMITIVETYPE_Number && - eType <= FDE_CSSPRIMITIVETYPE_PC) { - FDE_CSSNONINHERITS.m_eVerticalAlign = FDE_CSSVERTICALALIGN_Number; - FDE_CSSNONINHERITS.m_fVerticalAlign = - ApplyNumber(eType, pPrimitive->GetFloat(), FDE_CSSFONTSIZE); + } else if (eType >= FDE_CSSPrimitiveType::Number && + eType <= FDE_CSSPrimitiveType::Picas) { + pComputedStyle->m_NonInheritedData.m_eVerticalAlign = + FDE_CSSVerticalAlign::Number; + pComputedStyle->m_NonInheritedData.m_fVerticalAlign = + ApplyNumber(eType, pPrimitive->GetFloat(), + pComputedStyle->m_InheritedData.m_fFontSize); } break; - case FDE_CSSPROPERTY_WhiteSpace: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eWhiteSpace = ToWhiteSpace(pPrimitive->GetEnum()); + case FDE_CSSProperty::FontVariant: + if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_InheritedData.m_eFontVariant = + ToFontVariant(pPrimitive->GetEnum()); } break; - case FDE_CSSPROPERTY_TextTransform: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eTextTransform = - ToTextTransform(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_FontVariant: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eFontVariant = ToFontVariant(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_LetterSpacing: - if (eType == FDE_CSSPRIMITIVETYPE_Percent) { + case FDE_CSSProperty::LetterSpacing: + if (eType == FDE_CSSPrimitiveType::Percent) { break; - } else if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_LetterSpacing.Set(FDE_CSSLENGTHUNIT_Normal); - } else if (eType >= FDE_CSSPRIMITIVETYPE_Number && - eType <= FDE_CSSPRIMITIVETYPE_PC) { - SetLengthWithPercent(FDE_CSSINHERITS.m_LetterSpacing, eType, - pPrimitive, FDE_CSSFONTSIZE); + } else if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_InheritedData.m_LetterSpacing.Set( + FDE_CSSLengthUnit::Normal); + } else if (eType >= FDE_CSSPrimitiveType::Number && + eType <= FDE_CSSPrimitiveType::Picas) { + SetLengthWithPercent(pComputedStyle->m_InheritedData.m_LetterSpacing, + eType, pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); } break; - case FDE_CSSPROPERTY_WordSpacing: - if (eType == FDE_CSSPRIMITIVETYPE_Percent) { + case FDE_CSSProperty::WordSpacing: + if (eType == FDE_CSSPrimitiveType::Percent) { break; - } else if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_WordSpacing.Set(FDE_CSSLENGTHUNIT_Normal); - } else if (eType >= FDE_CSSPRIMITIVETYPE_Number && - eType <= FDE_CSSPRIMITIVETYPE_PC) { - SetLengthWithPercent(FDE_CSSINHERITS.m_WordSpacing, eType, pPrimitive, - FDE_CSSFONTSIZE); - } - break; - case FDE_CSSPROPERTY_Float: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eFloat = ToFloat(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_Clear: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eClear = ToClear(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_WritingMode: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eWritingMode = ToWritingMode(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_WordBreak: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eWordBreak = ToWordBreak(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_Widows: - if (eType == FDE_CSSPRIMITIVETYPE_Number) { - FDE_CSSINHERITS.m_iWidows = (int32_t)pPrimitive->GetFloat(); - } - break; - case FDE_CSSPROPERTY_Orphans: - if (eType == FDE_CSSPRIMITIVETYPE_Number) { - FDE_CSSINHERITS.m_iOrphans = (int32_t)pPrimitive->GetFloat(); - } - break; - case FDE_CSSPROPERTY_TextEmphasisColor: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - switch (pPrimitive->GetEnum()) { - case FDE_CSSPROPERTYVALUE_Transparent: - FDE_CSSINHERITS.m_dwTextEmphasisColor = 0; - FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = false; - break; - case FDE_CSSPROPERTYVALUE_Currentcolor: - 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; - } - break; - case FDE_CSSPROPERTY_PageBreakBefore: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_ePageBreakBefore = - ToPageBreak(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_PageBreakAfter: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_ePageBreakAfter = - ToPageBreak(pPrimitive->GetEnum()); + } else if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_InheritedData.m_WordSpacing.Set( + FDE_CSSLengthUnit::Normal); + } else if (eType >= FDE_CSSPrimitiveType::Number && + eType <= FDE_CSSPrimitiveType::Picas) { + SetLengthWithPercent(pComputedStyle->m_InheritedData.m_WordSpacing, + eType, pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); } break; - case FDE_CSSPROPERTY_PageBreakInside: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_ePageBreakInside = - ToPageBreak(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_OverflowX: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eOverflowX = ToOverflow(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_OverflowY: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eOverflowY = ToOverflow(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_LineBreak: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eLineBreak = ToLineBreak(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_ColumnCount: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_ColumnCount.Set(FDE_CSSLENGTHUNIT_Auto); - } else if (eType == FDE_CSSPRIMITIVETYPE_Number) { - FDE_CSSNONINHERITS.m_ColumnCount.Set(FDE_CSSLENGTHUNIT_Point, - pPrimitive->GetFloat()); - } - break; - case FDE_CSSPROPERTY_ColumnGap: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_ColumnGap, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_ColumnRuleColor: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSNONINHERITS.m_dwColumnRuleColor = pPrimitive->GetRGBColor(); - FDE_CSSNONINHERITS.m_bColumnRuleColorSame = false; - } - break; - case FDE_CSSPROPERTY_ColumnRuleStyle: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eColumnRuleStyle = - ToBorderStyle(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_ColumnRuleWidth: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_ColumnRuleWidth, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_ColumnWidth: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_ColumnWidth, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_BackgroundImage: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_pszBKGImage = nullptr; - } else if (eType == FDE_CSSPRIMITIVETYPE_URI) { - int32_t iLength; - FDE_CSSNONINHERITS.m_pszBKGImage = pPrimitive->GetString(iLength); - } - break; - case FDE_CSSPROPERTY_Position: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_ePosition = ToPosition(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_Top: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_Top, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_Bottom: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_Bottom, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_Left: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_Left, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_Right: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_Right, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_ListStyleImage: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_pszListStyleImage = nullptr; - } else if (eType == FDE_CSSPRIMITIVETYPE_URI) { - int32_t iLength; - FDE_CSSINHERITS.m_pszListStyleImage = pPrimitive->GetString(iLength); - } - break; - case FDE_CSSPROPERTY_CaptionSide: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eCaptionSide = ToCaptionSide(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_BackgroundRepeat: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eBKGRepeat = ToBKGRepeat(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_BackgroundAttachment: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eBKGAttachment = - ToBKGAttachment(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_RubyAlign: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eRubyAlign = ToRubyAlign(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_RubyOverhang: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eRubyOverhang = - ToRubyOverhang(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_RubyPosition: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eRubyPosition = - ToRubyPosition(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_RubySpan: - FDE_CSSNONINHERITS.m_pRubySpan = pPrimitive; - break; + case FDE_CSSProperty::Top: + SetLengthWithPercent(pComputedStyle->m_NonInheritedData.m_Top, eType, + pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); + break; + case FDE_CSSProperty::Bottom: + SetLengthWithPercent(pComputedStyle->m_NonInheritedData.m_Bottom, eType, + pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); + break; + case FDE_CSSProperty::Left: + SetLengthWithPercent(pComputedStyle->m_NonInheritedData.m_Left, eType, + pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); + break; + case FDE_CSSProperty::Right: + SetLengthWithPercent(pComputedStyle->m_NonInheritedData.m_Right, eType, + pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); + break; + case FDE_CSSProperty::BorderLeftStyle: + case FDE_CSSProperty::BorderTopStyle: + case FDE_CSSProperty::BorderRightStyle: + case FDE_CSSProperty::BorderBottomStyle: + case FDE_CSSProperty::BorderLeftColor: + case FDE_CSSProperty::BorderTopColor: + case FDE_CSSProperty::BorderRightColor: + case FDE_CSSProperty::BorderBottomColor: + case FDE_CSSProperty::ListStyleType: + case FDE_CSSProperty::ListStylePosition: + case FDE_CSSProperty::BackgroundColor: + case FDE_CSSProperty::Visibility: + case FDE_CSSProperty::Width: + case FDE_CSSProperty::Height: + case FDE_CSSProperty::MinWidth: + case FDE_CSSProperty::MinHeight: + case FDE_CSSProperty::MaxWidth: + case FDE_CSSProperty::MaxHeight: + case FDE_CSSProperty::WhiteSpace: + case FDE_CSSProperty::TextTransform: + case FDE_CSSProperty::Float: + case FDE_CSSProperty::Clear: + case FDE_CSSProperty::WritingMode: + case FDE_CSSProperty::WordBreak: + case FDE_CSSProperty::Widows: + case FDE_CSSProperty::Orphans: + case FDE_CSSProperty::TextEmphasisColor: + case FDE_CSSProperty::PageBreakBefore: + case FDE_CSSProperty::PageBreakAfter: + case FDE_CSSProperty::PageBreakInside: + case FDE_CSSProperty::OverflowX: + case FDE_CSSProperty::OverflowY: + case FDE_CSSProperty::LineBreak: + case FDE_CSSProperty::ColumnCount: + case FDE_CSSProperty::ColumnGap: + case FDE_CSSProperty::ColumnRuleColor: + case FDE_CSSProperty::ColumnRuleStyle: + case FDE_CSSProperty::ColumnRuleWidth: + case FDE_CSSProperty::ColumnWidth: + case FDE_CSSProperty::BackgroundImage: + case FDE_CSSProperty::Position: + case FDE_CSSProperty::ListStyleImage: + case FDE_CSSProperty::CaptionSide: + case FDE_CSSProperty::BackgroundRepeat: + case FDE_CSSProperty::BackgroundAttachment: + case FDE_CSSProperty::RubyAlign: + case FDE_CSSProperty::RubyOverhang: + case FDE_CSSProperty::RubyPosition: + case FDE_CSSProperty::RubySpan: default: break; } @@ -915,83 +659,19 @@ void CFDE_CSSStyleSelector::ApplyProperty( int32_t iCount = pList->CountValues(); if (iCount > 0) { switch (eProperty) { - case FDE_CSSPROPERTY_FontFamily: - FDE_CSSINHERITS.m_pFontFamily = pList; + case FDE_CSSProperty::FontFamily: + pComputedStyle->m_InheritedData.m_pFontFamily = pList; break; - case FDE_CSSPROPERTY_TextDecoration: - FDE_CSSNONINHERITS.m_dwTextDecoration = ToTextDecoration(pList); + case FDE_CSSProperty::TextDecoration: + pComputedStyle->m_NonInheritedData.m_dwTextDecoration = + ToTextDecoration(pList); break; - case FDE_CSSPROPERTY_CounterIncrement: { - if (!FDE_CSSNONINHERITS.m_pCounterStyle) - FDE_CSSNONINHERITS.m_pCounterStyle = new CFDE_CSSCounterStyle; - FDE_CSSNONINHERITS.m_pCounterStyle->SetCounterIncrementList(pList); - } break; - case FDE_CSSPROPERTY_CounterReset: { - if (!FDE_CSSNONINHERITS.m_pCounterStyle) - FDE_CSSNONINHERITS.m_pCounterStyle = new CFDE_CSSCounterStyle; - FDE_CSSNONINHERITS.m_pCounterStyle->SetCounterResetList(pList); - } break; - case FDE_CSSPROPERTY_Content: - FDE_CSSNONINHERITS.m_pContentList = pList; - break; - case FDE_CSSPROPERTY_Quotes: - FDE_CSSINHERITS.m_pQuotes = pList; - break; - case FDE_CSSPROPERTY_TextCombine: { - for (int32_t i = 0; i < pList->CountValues(); i++) { - IFDE_CSSPrimitiveValue* pVal = - static_cast<IFDE_CSSPrimitiveValue*>(pList->GetValue(i)); - switch (pVal->GetPrimitiveType()) { - case FDE_CSSPRIMITIVETYPE_Enum: { - switch (pVal->GetEnum()) { - case FDE_CSSPROPERTYVALUE_None: { - FDE_CSSNONINHERITS.m_eTextCombine = FDE_CSSTEXTCOMBINE_None; - FDE_CSSNONINHERITS.m_bHasTextCombineNumber = false; - } break; - case FDE_CSSPROPERTYVALUE_Horizontal: { - FDE_CSSNONINHERITS.m_eTextCombine = - FDE_CSSTEXTCOMBINE_Horizontal; - FDE_CSSNONINHERITS.m_bHasTextCombineNumber = false; - } break; - default: - break; - } - } break; - case FDE_CSSPRIMITIVETYPE_Number: - FDE_CSSNONINHERITS.m_fTextCombineNumber = pVal->GetFloat(); - break; - default: - break; - } - } - } break; - case FDE_CSSPROPERTY_TextEmphasisStyle: { - FDE_CSSTEXTEMPHASISFILL eFill; - FDE_CSSTEXTEMPHASISMARK eMark; - for (int32_t i = 0; i < pList->CountValues(); i++) { - IFDE_CSSPrimitiveValue* pVal = - static_cast<IFDE_CSSPrimitiveValue*>(pList->GetValue(i)); - switch (pVal->GetPrimitiveType()) { - case FDE_CSSPRIMITIVETYPE_Enum: { - if (ToTextEmphasisFill(pVal->GetEnum(), eFill)) { - FDE_CSSINHERITS.m_eTextEmphasisFill = eFill; - continue; - } else if (ToTextEmphasisMark(pVal->GetEnum(), eMark)) { - FDE_CSSINHERITS.m_eTextEmphasisMark = eMark; - } - } break; - case FDE_CSSPRIMITIVETYPE_String: { - FDE_CSSINHERITS.m_eTextEmphasisMark = - FDE_CSSTEXTEMPHASISMARK_Custom; - int32_t iLen; - FDE_CSSINHERITS.m_pszTextEmphasisCustomMark = - pVal->GetString(iLen); - } break; - default: - break; - } - } - } break; + case FDE_CSSProperty::CounterIncrement: + case FDE_CSSProperty::CounterReset: + case FDE_CSSProperty::Content: + case FDE_CSSProperty::Quotes: + case FDE_CSSProperty::TextCombine: + case FDE_CSSProperty::TextEmphasisStyle: default: break; } @@ -1001,500 +681,119 @@ void CFDE_CSSStyleSelector::ApplyProperty( } } -FX_FLOAT CFDE_CSSStyleSelector::ApplyNumber(FDE_CSSPRIMITIVETYPE eUnit, +FX_FLOAT CFDE_CSSStyleSelector::ApplyNumber(FDE_CSSPrimitiveType eUnit, FX_FLOAT fValue, FX_FLOAT fPercentBase) { switch (eUnit) { - case FDE_CSSPRIMITIVETYPE_PX: - case FDE_CSSPRIMITIVETYPE_Number: + case FDE_CSSPrimitiveType::Pixels: + case FDE_CSSPrimitiveType::Number: return fValue * 72 / 96; - case FDE_CSSPRIMITIVETYPE_PT: - return fValue; - case FDE_CSSPRIMITIVETYPE_EMS: - case FDE_CSSPRIMITIVETYPE_EXS: + case FDE_CSSPrimitiveType::EMS: + case FDE_CSSPrimitiveType::EXS: return fValue * fPercentBase; - case FDE_CSSPRIMITIVETYPE_Percent: + case FDE_CSSPrimitiveType::Percent: return fValue * fPercentBase / 100.0f; - case FDE_CSSPRIMITIVETYPE_CM: + case FDE_CSSPrimitiveType::CentiMeters: return fValue * 28.3464f; - case FDE_CSSPRIMITIVETYPE_MM: + case FDE_CSSPrimitiveType::MilliMeters: return fValue * 2.8346f; - case FDE_CSSPRIMITIVETYPE_IN: + case FDE_CSSPrimitiveType::Inches: return fValue * 72.0f; - case FDE_CSSPRIMITIVETYPE_PC: + case FDE_CSSPrimitiveType::Picas: return fValue / 12.0f; + case FDE_CSSPrimitiveType::Points: default: return fValue; } } -FDE_CSSRUBYSPAN CFDE_CSSStyleSelector::ToRubySpan(FDE_CSSPROPERTYVALUE eValue) { +FDE_CSSDisplay CFDE_CSSStyleSelector::ToDisplay(FDE_CSSPropertyValue eValue) { switch (eValue) { - case FDE_CSSPROPERTYVALUE_None: + case FDE_CSSPropertyValue::Block: + return FDE_CSSDisplay::Block; + case FDE_CSSPropertyValue::None: + return FDE_CSSDisplay::None; + case FDE_CSSPropertyValue::ListItem: + return FDE_CSSDisplay::ListItem; + case FDE_CSSPropertyValue::InlineTable: + return FDE_CSSDisplay::InlineTable; + case FDE_CSSPropertyValue::InlineBlock: + return FDE_CSSDisplay::InlineBlock; + case FDE_CSSPropertyValue::Inline: default: - return FDE_CSSRUBYSPAN_None; + return FDE_CSSDisplay::Inline; } } -FDE_CSSRUBYPOSITION CFDE_CSSStyleSelector::ToRubyPosition( - FDE_CSSPROPERTYVALUE eValue) { +FDE_CSSTextAlign CFDE_CSSStyleSelector::ToTextAlign( + FDE_CSSPropertyValue eValue) { switch (eValue) { - case FDE_CSSPROPERTYVALUE_Before: - return FDE_CSSRUBYPOSITION_Before; - case FDE_CSSPROPERTYVALUE_After: - return FDE_CSSRUBYPOSITION_After; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSRUBYPOSITION_Right; - case FDE_CSSPROPERTYVALUE_Inline: - return FDE_CSSRUBYPOSITION_Inline; + case FDE_CSSPropertyValue::Center: + return FDE_CSSTextAlign::Center; + case FDE_CSSPropertyValue::Right: + return FDE_CSSTextAlign::Right; + case FDE_CSSPropertyValue::Justify: + return FDE_CSSTextAlign::Justify; + case FDE_CSSPropertyValue::Left: default: - return FDE_CSSRUBYPOSITION_Before; + return FDE_CSSTextAlign::Left; } } -FDE_CSSRUBYOVERHANG CFDE_CSSStyleSelector::ToRubyOverhang( - FDE_CSSPROPERTYVALUE eValue) { +uint16_t CFDE_CSSStyleSelector::ToFontWeight(FDE_CSSPropertyValue eValue) { switch (eValue) { - case FDE_CSSPROPERTYVALUE_Auto: - return FDE_CSSRUBYOVERHANG_Auto; - case FDE_CSSPROPERTYVALUE_Start: - return FDE_CSSRUBYOVERHANG_Start; - case FDE_CSSPROPERTYVALUE_End: - return FDE_CSSRUBYOVERHANG_End; - case FDE_CSSPROPERTYVALUE_None: - default: - return FDE_CSSRUBYOVERHANG_None; - } -} - -FDE_CSSRUBYALIGN CFDE_CSSStyleSelector::ToRubyAlign( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Auto: - return FDE_CSSRUBYALIGN_Auto; - case FDE_CSSPROPERTYVALUE_Start: - return FDE_CSSRUBYALIGN_Start; - case FDE_CSSPROPERTYVALUE_Left: - return FDE_CSSRUBYALIGN_End; - case FDE_CSSPROPERTYVALUE_Center: - return FDE_CSSRUBYALIGN_Center; - case FDE_CSSPROPERTYVALUE_End: - return FDE_CSSRUBYALIGN_End; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSRUBYALIGN_Right; - case FDE_CSSPROPERTYVALUE_DistributeLetter: - return FDE_CSSRUBYALIGN_DistributeLetter; - case FDE_CSSPROPERTYVALUE_DistributeSpace: - return FDE_CSSRUBYALIGN_DistributeSpace; - case FDE_CSSPROPERTYVALUE_LineEdge: - return FDE_CSSRUBYALIGN_LineEdge; - default: - return FDE_CSSRUBYALIGN_Auto; - } -} - -bool CFDE_CSSStyleSelector::ToTextEmphasisMark(FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISMARK& eMark) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_None: - eMark = FDE_CSSTEXTEMPHASISMARK_None; - return true; - case FDE_CSSPROPERTYVALUE_Dot: - eMark = FDE_CSSTEXTEMPHASISMARK_Dot; - return true; - case FDE_CSSPROPERTYVALUE_Circle: - eMark = FDE_CSSTEXTEMPHASISMARK_Circle; - return true; - case FDE_CSSPROPERTYVALUE_DoubleCircle: - eMark = FDE_CSSTEXTEMPHASISMARK_DoubleCircle; - return true; - case FDE_CSSPROPERTYVALUE_Triangle: - eMark = FDE_CSSTEXTEMPHASISMARK_Triangle; - return true; - case FDE_CSSPROPERTYVALUE_Sesame: - eMark = FDE_CSSTEXTEMPHASISMARK_Sesame; - return true; - default: - return false; - } -} - -bool CFDE_CSSStyleSelector::ToTextEmphasisFill(FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISFILL& eFill) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Filled: - eFill = FDE_CSSTEXTEMPHASISFILL_Filled; - return true; - case FDE_CSSPROPERTYVALUE_Open: - eFill = FDE_CSSTEXTEMPHASISFILL_Open; - return true; - default: - return false; - } -} - -FDE_CSSBKGATTACHMENT CFDE_CSSStyleSelector::ToBKGAttachment( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Fixed: - return FDE_CSSBKGATTACHMENT_Fixed; - case FDE_CSSPROPERTYVALUE_Scroll: - return FDE_CSSBKGATTACHMENT_Scroll; - default: - return FDE_CSSBKGATTACHMENT_Fixed; - } -} - -FDE_CSSCAPTIONSIDE CFDE_CSSStyleSelector::ToCaptionSide( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Top: - return FDE_CSSCAPTIONSIDE_Top; - case FDE_CSSPROPERTYVALUE_Bottom: - return FDE_CSSCAPTIONSIDE_Bottom; - case FDE_CSSPROPERTYVALUE_Left: - return FDE_CSSCAPTIONSIDE_Left; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSCAPTIONSIDE_Right; - case FDE_CSSPROPERTYVALUE_Before: - return FDE_CSSCAPTIONSIDE_Before; - case FDE_CSSPROPERTYVALUE_After: - return FDE_CSSCAPTIONSIDE_After; - default: - return FDE_CSSCAPTIONSIDE_Top; - } -} - -FDE_CSSPOSITION CFDE_CSSStyleSelector::ToPosition(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Static: - return FDE_CSSPOSITION_Static; - case FDE_CSSPROPERTYVALUE_Relative: - return FDE_CSSPOSITION_Relative; - case FDE_CSSPROPERTYVALUE_Fixed: - return FDE_CSSPOSITION_Fixed; - case FDE_CSSPROPERTYVALUE_Absolute: - return FDE_CSSPOSITION_Absolute; - default: - return FDE_CSSPOSITION_Static; - } -} - -FDE_CSSCURSOR CFDE_CSSStyleSelector::ToCursor(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Auto: - return FDE_CSSCURSOR_Auto; - case FDE_CSSPROPERTYVALUE_Crosshair: - return FDE_CSSCURSOR_Crosshair; - case FDE_CSSPROPERTYVALUE_Default: - return FDE_CSSCURSOR_Default; - case FDE_CSSPROPERTYVALUE_Pointer: - return FDE_CSSCURSOR_Pointer; - case FDE_CSSPROPERTYVALUE_Move: - return FDE_CSSCURSOR_Move; - case FDE_CSSPROPERTYVALUE_EResize: - return FDE_CSSCURSOR_EResize; - case FDE_CSSPROPERTYVALUE_NeResize: - return FDE_CSSCURSOR_NeResize; - case FDE_CSSPROPERTYVALUE_NwResize: - return FDE_CSSCURSOR_NwResize; - case FDE_CSSPROPERTYVALUE_NResize: - return FDE_CSSCURSOR_NResize; - case FDE_CSSPROPERTYVALUE_SeResize: - return FDE_CSSCURSOR_SeResize; - case FDE_CSSPROPERTYVALUE_SwResize: - return FDE_CSSCURSOR_SwResize; - default: - return FDE_CSSCURSOR_Auto; - } -} - -FDE_CSSBKGREPEAT CFDE_CSSStyleSelector::ToBKGRepeat( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Repeat: - return FDE_CSSBKGREPEAT_Repeat; - case FDE_CSSPROPERTYVALUE_RepeatX: - return FDE_CSSBKGREPEAT_RepeatX; - case FDE_CSSPROPERTYVALUE_RepeatY: - return FDE_CSSBKGREPEAT_RepeatY; - case FDE_CSSPROPERTYVALUE_NoRepeat: - return FDE_CSSBKGREPEAT_NoRepeat; - default: - return FDE_CSSBKGREPEAT_Repeat; - } -} - -FDE_CSSTEXTCOMBINE CFDE_CSSStyleSelector::ToTextCombine( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Horizontal: - return FDE_CSSTEXTCOMBINE_Horizontal; - case FDE_CSSPROPERTYVALUE_None: - default: - return FDE_CSSTEXTCOMBINE_None; - } -} - -FDE_CSSLINEBREAK CFDE_CSSStyleSelector::ToLineBreak( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Auto: - return FDE_CSSLINEBREAK_Auto; - case FDE_CSSPROPERTYVALUE_Loose: - return FDE_CSSLINEBREAK_Loose; - case FDE_CSSPROPERTYVALUE_Normal: - return FDE_CSSLINEBREAK_Normal; - case FDE_CSSPROPERTYVALUE_Strict: - return FDE_CSSLINEBREAK_Strict; - default: - return FDE_CSSLINEBREAK_Auto; - } -} - -FDE_CSSOVERFLOW CFDE_CSSStyleSelector::ToOverflow(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Visible: - return FDE_CSSOVERFLOW_Visible; - case FDE_CSSPROPERTYVALUE_Hidden: - return FDE_CSSOVERFLOW_Hidden; - case FDE_CSSPROPERTYVALUE_Scroll: - return FDE_CSSOVERFLOW_Scroll; - case FDE_CSSPROPERTYVALUE_Auto: - return FDE_CSSOVERFLOW_Auto; - case FDE_CSSPROPERTYVALUE_NoDisplay: - return FDE_CSSOVERFLOW_NoDisplay; - case FDE_CSSPROPERTYVALUE_NoContent: - return FDE_CSSOVERFLOW_NoContent; - default: - return FDE_CSSOVERFLOW_Visible; - } -} - -FDE_CSSWRITINGMODE CFDE_CSSStyleSelector::ToWritingMode( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_HorizontalTb: - return FDE_CSSWRITINGMODE_HorizontalTb; - case FDE_CSSPROPERTYVALUE_VerticalRl: - return FDE_CSSWRITINGMODE_VerticalRl; - case FDE_CSSPROPERTYVALUE_VerticalLr: - return FDE_CSSWRITINGMODE_VerticalLr; - default: - return FDE_CSSWRITINGMODE_HorizontalTb; - } -} - -FDE_CSSWORDBREAK CFDE_CSSStyleSelector::ToWordBreak( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Normal: - return FDE_CSSWORDBREAK_Normal; - case FDE_CSSPROPERTYVALUE_KeepAll: - return FDE_CSSWORDBREAK_KeepAll; - case FDE_CSSPROPERTYVALUE_BreakAll: - return FDE_CSSWORDBREAK_BreakAll; - case FDE_CSSPROPERTYVALUE_KeepWords: - return FDE_CSSWORDBREAK_KeepWords; - default: - return FDE_CSSWORDBREAK_Normal; - } -} - -FDE_CSSFLOAT CFDE_CSSStyleSelector::ToFloat(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Left: - return FDE_CSSFLOAT_Left; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSFLOAT_Right; - case FDE_CSSPROPERTYVALUE_None: - return FDE_CSSFLOAT_None; - default: - return FDE_CSSFLOAT_None; - } -} - -FDE_CSSCLEAR CFDE_CSSStyleSelector::ToClear(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_None: - return FDE_CSSCLEAR_None; - case FDE_CSSPROPERTYVALUE_Left: - return FDE_CSSCLEAR_Left; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSCLEAR_Right; - case FDE_CSSPROPERTYVALUE_Both: - return FDE_CSSCLEAR_Both; - default: - return FDE_CSSCLEAR_None; - } -} - -FDE_CSSPAGEBREAK CFDE_CSSStyleSelector::ToPageBreak( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Avoid: - return FDE_CSSPAGEBREAK_Avoid; - case FDE_CSSPROPERTYVALUE_Auto: - return FDE_CSSPAGEBREAK_Auto; - case FDE_CSSPROPERTYVALUE_Always: - return FDE_CSSPAGEBREAK_Always; - case FDE_CSSPROPERTYVALUE_Left: - return FDE_CSSPAGEBREAK_Left; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSPAGEBREAK_Right; - default: - return FDE_CSSPAGEBREAK_Auto; - } -} - -FDE_CSSDISPLAY CFDE_CSSStyleSelector::ToDisplay(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Inline: - return FDE_CSSDISPLAY_Inline; - case FDE_CSSPROPERTYVALUE_Block: - return FDE_CSSDISPLAY_Block; - case FDE_CSSPROPERTYVALUE_None: - return FDE_CSSDISPLAY_None; - case FDE_CSSPROPERTYVALUE_ListItem: - return FDE_CSSDISPLAY_ListItem; - case FDE_CSSPROPERTYVALUE_TableCell: - return FDE_CSSDISPLAY_TableCell; - case FDE_CSSPROPERTYVALUE_TableRow: - return FDE_CSSDISPLAY_TableRow; - case FDE_CSSPROPERTYVALUE_Table: - return FDE_CSSDISPLAY_Table; - case FDE_CSSPROPERTYVALUE_TableCaption: - return FDE_CSSDISPLAY_TableCaption; - case FDE_CSSPROPERTYVALUE_TableRowGroup: - return FDE_CSSDISPLAY_TableRowGroup; - case FDE_CSSPROPERTYVALUE_TableHeaderGroup: - return FDE_CSSDISPLAY_TableHeaderGroup; - case FDE_CSSPROPERTYVALUE_TableFooterGroup: - return FDE_CSSDISPLAY_TableFooterGroup; - case FDE_CSSPROPERTYVALUE_TableColumnGroup: - return FDE_CSSDISPLAY_TableColumnGroup; - case FDE_CSSPROPERTYVALUE_TableColumn: - return FDE_CSSDISPLAY_TableColumn; - case FDE_CSSPROPERTYVALUE_InlineTable: - return FDE_CSSDISPLAY_InlineTable; - case FDE_CSSPROPERTYVALUE_InlineBlock: - return FDE_CSSDISPLAY_InlineBlock; - case FDE_CSSPROPERTYVALUE_RunIn: - return FDE_CSSDISPLAY_RunIn; - case FDE_CSSPROPERTYVALUE_Ruby: - return FDE_CSSDISPLAY_Ruby; - case FDE_CSSPROPERTYVALUE_RubyBase: - return FDE_CSSDISPLAY_RubyBase; - case FDE_CSSPROPERTYVALUE_RubyText: - return FDE_CSSDISPLAY_RubyText; - case FDE_CSSPROPERTYVALUE_RubyBaseGroup: - return FDE_CSSDISPLSY_RubyBaseGroup; - case FDE_CSSPROPERTYVALUE_RubyTextGroup: - return FDE_CSSDISPLAY_RubyTextGroup; - default: - return FDE_CSSDISPLAY_Inline; - } -} - -FDE_CSSTEXTALIGN CFDE_CSSStyleSelector::ToTextAlign( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Left: - return FDE_CSSTEXTALIGN_Left; - case FDE_CSSPROPERTYVALUE_Center: - return FDE_CSSTEXTALIGN_Center; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSTEXTALIGN_Right; - case FDE_CSSPROPERTYVALUE_Justify: - return FDE_CSSTEXTALIGN_Justify; - default: - return FDE_CSSTEXTALIGN_Left; - } -} - -uint16_t CFDE_CSSStyleSelector::ToFontWeight(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Normal: - return 400; - case FDE_CSSPROPERTYVALUE_Bold: + case FDE_CSSPropertyValue::Bold: return 700; - case FDE_CSSPROPERTYVALUE_Bolder: + case FDE_CSSPropertyValue::Bolder: return 900; - case FDE_CSSPROPERTYVALUE_Lighter: + case FDE_CSSPropertyValue::Lighter: return 200; + case FDE_CSSPropertyValue::Normal: default: return 400; } } -FDE_CSSFONTSTYLE CFDE_CSSStyleSelector::ToFontStyle( - FDE_CSSPROPERTYVALUE eValue) { +FDE_CSSFontStyle CFDE_CSSStyleSelector::ToFontStyle( + FDE_CSSPropertyValue eValue) { switch (eValue) { - case FDE_CSSPROPERTYVALUE_Italic: - case FDE_CSSPROPERTYVALUE_Oblique: - return FDE_CSSFONTSTYLE_Italic; + case FDE_CSSPropertyValue::Italic: + case FDE_CSSPropertyValue::Oblique: + return FDE_CSSFontStyle::Italic; default: - return FDE_CSSFONTSTYLE_Normal; - } -} - -FDE_CSSBORDERSTYLE CFDE_CSSStyleSelector::ToBorderStyle( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_None: - return FDE_CSSBORDERSTYLE_None; - case FDE_CSSPROPERTYVALUE_Solid: - return FDE_CSSBORDERSTYLE_Solid; - case FDE_CSSPROPERTYVALUE_Hidden: - return FDE_CSSBORDERSTYLE_Hidden; - case FDE_CSSPROPERTYVALUE_Dotted: - return FDE_CSSBORDERSTYLE_Dotted; - case FDE_CSSPROPERTYVALUE_Dashed: - return FDE_CSSBORDERSTYLE_Dashed; - case FDE_CSSPROPERTYVALUE_Double: - return FDE_CSSBORDERSTYLE_Double; - case FDE_CSSPROPERTYVALUE_Groove: - return FDE_CSSBORDERSTYLE_Groove; - case FDE_CSSPROPERTYVALUE_Ridge: - return FDE_CSSBORDERSTYLE_Ridge; - case FDE_CSSPROPERTYVALUE_Inset: - return FDE_CSSBORDERSTYLE_Inset; - case FDE_CSSPROPERTYVALUE_Outset: - return FDE_CSSBORDERSTYLE_outset; - default: - return FDE_CSSBORDERSTYLE_None; + return FDE_CSSFontStyle::Normal; } } bool CFDE_CSSStyleSelector::SetLengthWithPercent( FDE_CSSLENGTH& width, - FDE_CSSPRIMITIVETYPE eType, + FDE_CSSPrimitiveType eType, IFDE_CSSPrimitiveValue* pPrimitive, FX_FLOAT fFontSize) { - if (eType == FDE_CSSPRIMITIVETYPE_Percent) { - width.Set(FDE_CSSLENGTHUNIT_Percent, pPrimitive->GetFloat() / 100.0f); + if (eType == FDE_CSSPrimitiveType::Percent) { + width.Set(FDE_CSSLengthUnit::Percent, pPrimitive->GetFloat() / 100.0f); return width.NonZero(); - } else if (eType >= FDE_CSSPRIMITIVETYPE_Number && - eType <= FDE_CSSPRIMITIVETYPE_PC) { + } else if (eType >= FDE_CSSPrimitiveType::Number && + eType <= FDE_CSSPrimitiveType::Picas) { FX_FLOAT fValue = ApplyNumber(eType, pPrimitive->GetFloat(), fFontSize); - width.Set(FDE_CSSLENGTHUNIT_Point, fValue); + width.Set(FDE_CSSLengthUnit::Point, fValue); return width.NonZero(); - } else if (eType == FDE_CSSPRIMITIVETYPE_Enum) { + } else if (eType == FDE_CSSPrimitiveType::Enum) { switch (pPrimitive->GetEnum()) { - case FDE_CSSPROPERTYVALUE_Auto: - width.Set(FDE_CSSLENGTHUNIT_Auto); + case FDE_CSSPropertyValue::Auto: + width.Set(FDE_CSSLengthUnit::Auto); return true; - case FDE_CSSPROPERTYVALUE_None: - width.Set(FDE_CSSLENGTHUNIT_None); + case FDE_CSSPropertyValue::None: + width.Set(FDE_CSSLengthUnit::None); return true; - case FDE_CSSPROPERTYVALUE_Thin: - width.Set(FDE_CSSLENGTHUNIT_Point, 2); + case FDE_CSSPropertyValue::Thin: + width.Set(FDE_CSSLengthUnit::Point, 2); return true; - case FDE_CSSPROPERTYVALUE_Medium: - width.Set(FDE_CSSLENGTHUNIT_Point, 3); + case FDE_CSSPropertyValue::Medium: + width.Set(FDE_CSSLengthUnit::Point, 3); return true; - case FDE_CSSPROPERTYVALUE_Thick: - width.Set(FDE_CSSLENGTHUNIT_Point, 4); + case FDE_CSSPropertyValue::Thick: + width.Set(FDE_CSSLengthUnit::Point, 4); return true; default: return false; @@ -1503,142 +802,52 @@ bool CFDE_CSSStyleSelector::SetLengthWithPercent( return false; } -FX_FLOAT CFDE_CSSStyleSelector::ToFontSize(FDE_CSSPROPERTYVALUE eValue, +FX_FLOAT CFDE_CSSStyleSelector::ToFontSize(FDE_CSSPropertyValue eValue, FX_FLOAT fCurFontSize) { switch (eValue) { - case FDE_CSSPROPERTYVALUE_XxSmall: + case FDE_CSSPropertyValue::XxSmall: return m_fDefFontSize / 1.2f / 1.2f / 1.2f; - case FDE_CSSPROPERTYVALUE_XSmall: + case FDE_CSSPropertyValue::XSmall: return m_fDefFontSize / 1.2f / 1.2f; - case FDE_CSSPROPERTYVALUE_Small: + case FDE_CSSPropertyValue::Small: return m_fDefFontSize / 1.2f; - case FDE_CSSPROPERTYVALUE_Medium: + case FDE_CSSPropertyValue::Medium: return m_fDefFontSize; - case FDE_CSSPROPERTYVALUE_Large: + case FDE_CSSPropertyValue::Large: return m_fDefFontSize * 1.2f; - case FDE_CSSPROPERTYVALUE_XLarge: + case FDE_CSSPropertyValue::XLarge: return m_fDefFontSize * 1.2f * 1.2f; - case FDE_CSSPROPERTYVALUE_XxLarge: + case FDE_CSSPropertyValue::XxLarge: return m_fDefFontSize * 1.2f * 1.2f * 1.2f; - case FDE_CSSPROPERTYVALUE_Larger: + case FDE_CSSPropertyValue::Larger: return fCurFontSize * 1.2f; - case FDE_CSSPROPERTYVALUE_Smaller: + case FDE_CSSPropertyValue::Smaller: return fCurFontSize / 1.2f; default: return fCurFontSize; } } -FDE_CSSVERTICALALIGN CFDE_CSSStyleSelector::ToVerticalAlign( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Baseline: - return FDE_CSSVERTICALALIGN_Baseline; - case FDE_CSSPROPERTYVALUE_Middle: - return FDE_CSSVERTICALALIGN_Middle; - case FDE_CSSPROPERTYVALUE_Bottom: - return FDE_CSSVERTICALALIGN_Bottom; - case FDE_CSSPROPERTYVALUE_Super: - return FDE_CSSVERTICALALIGN_Super; - case FDE_CSSPROPERTYVALUE_Sub: - return FDE_CSSVERTICALALIGN_Sub; - case FDE_CSSPROPERTYVALUE_Top: - return FDE_CSSVERTICALALIGN_Top; - case FDE_CSSPROPERTYVALUE_TextTop: - return FDE_CSSVERTICALALIGN_TextTop; - case FDE_CSSPROPERTYVALUE_TextBottom: - return FDE_CSSVERTICALALIGN_TextBottom; - default: - return FDE_CSSVERTICALALIGN_Baseline; - } -} - -FDE_CSSLISTSTYLETYPE CFDE_CSSStyleSelector::ToListStyleType( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_None: - return FDE_CSSLISTSTYLETYPE_None; - case FDE_CSSPROPERTYVALUE_Disc: - return FDE_CSSLISTSTYLETYPE_Disc; - case FDE_CSSPROPERTYVALUE_Circle: - return FDE_CSSLISTSTYLETYPE_Circle; - case FDE_CSSPROPERTYVALUE_Square: - return FDE_CSSLISTSTYLETYPE_Square; - case FDE_CSSPROPERTYVALUE_Decimal: - return FDE_CSSLISTSTYLETYPE_Decimal; - case FDE_CSSPROPERTYVALUE_DecimalLeadingZero: - return FDE_CSSLISTSTYLETYPE_DecimalLeadingZero; - case FDE_CSSPROPERTYVALUE_LowerRoman: - return FDE_CSSLISTSTYLETYPE_LowerRoman; - case FDE_CSSPROPERTYVALUE_UpperRoman: - return FDE_CSSLISTSTYLETYPE_UpperRoman; - case FDE_CSSPROPERTYVALUE_LowerGreek: - return FDE_CSSLISTSTYLETYPE_LowerGreek; - case FDE_CSSPROPERTYVALUE_LowerLatin: - return FDE_CSSLISTSTYLETYPE_LowerLatin; - case FDE_CSSPROPERTYVALUE_UpperLatin: - return FDE_CSSLISTSTYLETYPE_UpperLatin; - case FDE_CSSPROPERTYVALUE_Armenian: - return FDE_CSSLISTSTYLETYPE_Armenian; - case FDE_CSSPROPERTYVALUE_Georgian: - return FDE_CSSLISTSTYLETYPE_Georgian; - case FDE_CSSPROPERTYVALUE_LowerAlpha: - return FDE_CSSLISTSTYLETYPE_LowerAlpha; - case FDE_CSSPROPERTYVALUE_UpperAlpha: - return FDE_CSSLISTSTYLETYPE_UpperAlpha; - case FDE_CSSPROPERTYVALUE_CjkIdeographic: - return FDE_CSSLISTSTYLETYPE_CjkIdeographic; - case FDE_CSSPROPERTYVALUE_Hebrew: - return FDE_CSSLISTSTYLETYPE_Hebrew; - case FDE_CSSLISTSTYLETYPE_Hiragana: - return FDE_CSSLISTSTYLETYPE_Hiragana; - case FDE_CSSLISTSTYLETYPE_HiraganaIroha: - return FDE_CSSLISTSTYLETYPE_HiraganaIroha; - case FDE_CSSLISTSTYLETYPE_Katakana: - return FDE_CSSLISTSTYLETYPE_Katakana; - case FDE_CSSLISTSTYLETYPE_KatakanaIroha: - return FDE_CSSLISTSTYLETYPE_KatakanaIroha; - default: - return FDE_CSSLISTSTYLETYPE_Disc; - } -} - -FDE_CSSLISTSTYLEPOSITION CFDE_CSSStyleSelector::ToListStylePosition( - FDE_CSSPROPERTYVALUE eValue) { - return eValue == FDE_CSSPROPERTYVALUE_Inside - ? FDE_CSSLISTSTYLEPOSITION_Inside - : FDE_CSSLISTSTYLEPOSITION_Outside; -} - -FDE_CSSVISIBILITY CFDE_CSSStyleSelector::ToVisibility( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Visible: - return FDE_CSSVISIBILITY_Visible; - case FDE_CSSPROPERTYVALUE_Hidden: - return FDE_CSSVISIBILITY_Hidden; - case FDE_CSSPROPERTYVALUE_Collapse: - return FDE_CSSVISIBILITY_Collapse; - default: - return FDE_CSSVISIBILITY_Visible; - } -} - -FDE_CSSWHITESPACE CFDE_CSSStyleSelector::ToWhiteSpace( - FDE_CSSPROPERTYVALUE eValue) { +FDE_CSSVerticalAlign CFDE_CSSStyleSelector::ToVerticalAlign( + FDE_CSSPropertyValue eValue) { switch (eValue) { - case FDE_CSSPROPERTYVALUE_Normal: - return FDE_CSSWHITESPACE_Normal; - case FDE_CSSPROPERTYVALUE_Pre: - return FDE_CSSWHITESPACE_Pre; - case FDE_CSSPROPERTYVALUE_Nowrap: - return FDE_CSSWHITESPACE_Nowrap; - case FDE_CSSPROPERTYVALUE_PreWrap: - return FDE_CSSWHITESPACE_PreWrap; - case FDE_CSSPROPERTYVALUE_PreLine: - return FDE_CSSWHITESPACE_PreLine; + case FDE_CSSPropertyValue::Middle: + return FDE_CSSVerticalAlign::Middle; + case FDE_CSSPropertyValue::Bottom: + return FDE_CSSVerticalAlign::Bottom; + case FDE_CSSPropertyValue::Super: + return FDE_CSSVerticalAlign::Super; + case FDE_CSSPropertyValue::Sub: + return FDE_CSSVerticalAlign::Sub; + case FDE_CSSPropertyValue::Top: + return FDE_CSSVerticalAlign::Top; + case FDE_CSSPropertyValue::TextTop: + return FDE_CSSVerticalAlign::TextTop; + case FDE_CSSPropertyValue::TextBottom: + return FDE_CSSVerticalAlign::TextBottom; + case FDE_CSSPropertyValue::Baseline: default: - return FDE_CSSWHITESPACE_Normal; + return FDE_CSSVerticalAlign::Baseline; } } @@ -1647,21 +856,21 @@ uint32_t CFDE_CSSStyleSelector::ToTextDecoration(IFDE_CSSValueList* pValue) { for (int32_t i = pValue->CountValues() - 1; i >= 0; --i) { IFDE_CSSPrimitiveValue* pPrimitive = static_cast<IFDE_CSSPrimitiveValue*>(pValue->GetValue(i)); - if (pPrimitive->GetPrimitiveType() == FDE_CSSPRIMITIVETYPE_Enum) { + if (pPrimitive->GetPrimitiveType() == FDE_CSSPrimitiveType::Enum) { switch (pPrimitive->GetEnum()) { - case FDE_CSSPROPERTYVALUE_Underline: + case FDE_CSSPropertyValue::Underline: dwDecoration |= FDE_CSSTEXTDECORATION_Underline; break; - case FDE_CSSPROPERTYVALUE_LineThrough: + case FDE_CSSPropertyValue::LineThrough: dwDecoration |= FDE_CSSTEXTDECORATION_LineThrough; break; - case FDE_CSSPROPERTYVALUE_Overline: + case FDE_CSSPropertyValue::Overline: dwDecoration |= FDE_CSSTEXTDECORATION_Overline; break; - case FDE_CSSPROPERTYVALUE_Blink: + case FDE_CSSPropertyValue::Blink: dwDecoration |= FDE_CSSTEXTDECORATION_Blink; break; - case FDE_CSSPROPERTYVALUE_Double: + case FDE_CSSPropertyValue::Double: dwDecoration |= FDE_CSSTEXTDECORATION_Double; break; default: @@ -1672,26 +881,11 @@ uint32_t CFDE_CSSStyleSelector::ToTextDecoration(IFDE_CSSValueList* pValue) { return dwDecoration; } -FDE_CSSTEXTTRANSFORM CFDE_CSSStyleSelector::ToTextTransform( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_None: - return FDE_CSSTEXTTRANSFORM_None; - case FDE_CSSPROPERTYVALUE_Capitalize: - return FDE_CSSTEXTTRANSFORM_Capitalize; - case FDE_CSSPROPERTYVALUE_Uppercase: - return FDE_CSSTEXTTRANSFORM_UpperCase; - case FDE_CSSPROPERTYVALUE_Lowercase: - return FDE_CSSTEXTTRANSFORM_LowerCase; - default: - return FDE_CSSTEXTTRANSFORM_None; - } -} - -FDE_CSSFONTVARIANT CFDE_CSSStyleSelector::ToFontVariant( - FDE_CSSPROPERTYVALUE eValue) { - return eValue == FDE_CSSPROPERTYVALUE_SmallCaps ? FDE_CSSFONTVARIANT_SmallCaps - : FDE_CSSFONTVARIANT_Normal; +FDE_CSSFontVariant CFDE_CSSStyleSelector::ToFontVariant( + FDE_CSSPropertyValue eValue) { + return eValue == FDE_CSSPropertyValue::SmallCaps + ? FDE_CSSFontVariant::SmallCaps + : FDE_CSSFontVariant::Normal; } CFDE_CSSComputedStyle::CFDE_CSSComputedStyle() : m_dwRefCount(1) {} @@ -1704,18 +898,11 @@ uint32_t CFDE_CSSComputedStyle::Retain() { uint32_t CFDE_CSSComputedStyle::Release() { uint32_t dwRefCount = --m_dwRefCount; - if (dwRefCount == 0) { - delete m_NonInheritedData.m_pCounterStyle; + if (dwRefCount == 0) delete this; - } return dwRefCount; } -void CFDE_CSSComputedStyle::Reset() { - m_InheritedData.Reset(); - m_NonInheritedData.Reset(); -} - IFDE_CSSFontStyle* CFDE_CSSComputedStyle::GetFontStyles() { return static_cast<IFDE_CSSFontStyle*>(this); } @@ -1760,12 +947,12 @@ uint16_t CFDE_CSSComputedStyle::GetFontWeight() const { return m_InheritedData.m_wFontWeight; } -FDE_CSSFONTVARIANT CFDE_CSSComputedStyle::GetFontVariant() const { - return static_cast<FDE_CSSFONTVARIANT>(m_InheritedData.m_eFontVariant); +FDE_CSSFontVariant CFDE_CSSComputedStyle::GetFontVariant() const { + return static_cast<FDE_CSSFontVariant>(m_InheritedData.m_eFontVariant); } -FDE_CSSFONTSTYLE CFDE_CSSComputedStyle::GetFontStyle() const { - return static_cast<FDE_CSSFONTSTYLE>(m_InheritedData.m_eFontStyle); +FDE_CSSFontStyle CFDE_CSSComputedStyle::GetFontStyle() const { + return static_cast<FDE_CSSFontStyle>(m_InheritedData.m_eFontStyle); } FX_FLOAT CFDE_CSSComputedStyle::GetFontSize() const { @@ -1780,11 +967,11 @@ void CFDE_CSSComputedStyle::SetFontWeight(uint16_t wFontWeight) { m_InheritedData.m_wFontWeight = wFontWeight; } -void CFDE_CSSComputedStyle::SetFontVariant(FDE_CSSFONTVARIANT eFontVariant) { +void CFDE_CSSComputedStyle::SetFontVariant(FDE_CSSFontVariant eFontVariant) { m_InheritedData.m_eFontVariant = eFontVariant; } -void CFDE_CSSComputedStyle::SetFontStyle(FDE_CSSFONTSTYLE eFontStyle) { +void CFDE_CSSComputedStyle::SetFontStyle(FDE_CSSFontStyle eFontStyle) { m_InheritedData.m_eFontStyle = eFontStyle; } @@ -1821,8 +1008,8 @@ void CFDE_CSSComputedStyle::SetPaddingWidth(const FDE_CSSRECT& rect) { m_NonInheritedData.m_bHasPadding = true; } -FDE_CSSDISPLAY CFDE_CSSComputedStyle::GetDisplay() const { - return static_cast<FDE_CSSDISPLAY>(m_NonInheritedData.m_eDisplay); +FDE_CSSDisplay CFDE_CSSComputedStyle::GetDisplay() const { + return static_cast<FDE_CSSDisplay>(m_NonInheritedData.m_eDisplay); } FX_FLOAT CFDE_CSSComputedStyle::GetLineHeight() const { @@ -1833,12 +1020,12 @@ const FDE_CSSLENGTH& CFDE_CSSComputedStyle::GetTextIndent() const { return m_InheritedData.m_TextIndent; } -FDE_CSSTEXTALIGN CFDE_CSSComputedStyle::GetTextAlign() const { - return static_cast<FDE_CSSTEXTALIGN>(m_InheritedData.m_eTextAligh); +FDE_CSSTextAlign CFDE_CSSComputedStyle::GetTextAlign() const { + return static_cast<FDE_CSSTextAlign>(m_InheritedData.m_eTextAlign); } -FDE_CSSVERTICALALIGN CFDE_CSSComputedStyle::GetVerticalAlign() const { - return static_cast<FDE_CSSVERTICALALIGN>(m_NonInheritedData.m_eVerticalAlign); +FDE_CSSVerticalAlign CFDE_CSSComputedStyle::GetVerticalAlign() const { + return static_cast<FDE_CSSVerticalAlign>(m_NonInheritedData.m_eVerticalAlign); } FX_FLOAT CFDE_CSSComputedStyle::GetNumberVerticalAlign() const { @@ -1861,12 +1048,12 @@ void CFDE_CSSComputedStyle::SetTextIndent(const FDE_CSSLENGTH& textIndent) { m_InheritedData.m_TextIndent = textIndent; } -void CFDE_CSSComputedStyle::SetTextAlign(FDE_CSSTEXTALIGN eTextAlign) { - m_InheritedData.m_eTextAligh = eTextAlign; +void CFDE_CSSComputedStyle::SetTextAlign(FDE_CSSTextAlign eTextAlign) { + m_InheritedData.m_eTextAlign = eTextAlign; } void CFDE_CSSComputedStyle::SetNumberVerticalAlign(FX_FLOAT fAlign) { - m_NonInheritedData.m_eVerticalAlign = FDE_CSSVERTICALALIGN_Number, + m_NonInheritedData.m_eVerticalAlign = FDE_CSSVerticalAlign::Number, m_NonInheritedData.m_fVerticalAlign = fAlign; } @@ -1885,41 +1072,27 @@ void CFDE_CSSComputedStyle::AddCustomStyle(const CFX_WideString& wsName, m_CustomProperties.push_back(wsValue); } -CFDE_CSSInheritedData::CFDE_CSSInheritedData() { - Reset(); -} - -void CFDE_CSSInheritedData::Reset() { - FXSYS_memset(this, 0, sizeof(CFDE_CSSInheritedData)); - m_LetterSpacing.Set(FDE_CSSLENGTHUNIT_Normal); - m_WordSpacing.Set(FDE_CSSLENGTHUNIT_Normal); - m_TextIndent.Set(FDE_CSSLENGTHUNIT_Point, 0); - m_fFontSize = 12.0f; - m_fLineHeight = 14.0f; - m_wFontWeight = 400; - m_dwFontColor = 0xFF000000; - m_iWidows = 2; - m_bTextEmphasisColorCurrent = true; - m_iOrphans = 2; -} - -CFDE_CSSNonInheritedData::CFDE_CSSNonInheritedData() { - Reset(); -} - -void CFDE_CSSNonInheritedData::Reset() { - FXSYS_memset(this, 0, sizeof(CFDE_CSSNonInheritedData)); - m_PaddingWidth.Set(FDE_CSSLENGTHUNIT_Point, 0); - m_MarginWidth = m_PaddingWidth; - m_BorderWidth = m_PaddingWidth; - m_MinBoxSize.Set(FDE_CSSLENGTHUNIT_Point, 0); - m_MaxBoxSize.Set(FDE_CSSLENGTHUNIT_None); - m_eDisplay = FDE_CSSDISPLAY_Inline; - m_fVerticalAlign = 0.0f; - m_ColumnCount.Set(FDE_CSSLENGTHUNIT_Auto); - m_ColumnGap.Set(FDE_CSSLENGTHUNIT_Normal); - m_bColumnRuleColorSame = true; - m_ColumnWidth.Set(FDE_CSSLENGTHUNIT_Auto); - m_ColumnRuleWidth.Set(FDE_CSSLENGTHUNIT_Auto); - m_eTextCombine = FDE_CSSTEXTCOMBINE_None; -} +CFDE_CSSInheritedData::CFDE_CSSInheritedData() + : m_LetterSpacing(FDE_CSSLengthUnit::Normal), + m_WordSpacing(FDE_CSSLengthUnit::Normal), + m_TextIndent(FDE_CSSLengthUnit::Point, 0), + m_pFontFamily(nullptr), + m_fFontSize(12.0f), + m_fLineHeight(14.0f), + m_dwFontColor(0xFF000000), + m_wFontWeight(400), + m_eFontVariant(FDE_CSSFontVariant::Normal), + m_eFontStyle(FDE_CSSFontStyle::Normal), + m_eTextAlign(FDE_CSSTextAlign::Left) {} + +CFDE_CSSNonInheritedData::CFDE_CSSNonInheritedData() + : m_MarginWidth(FDE_CSSLengthUnit::Point, 0), + m_BorderWidth(FDE_CSSLengthUnit::Point, 0), + m_PaddingWidth(FDE_CSSLengthUnit::Point, 0), + m_fVerticalAlign(0.0f), + m_eDisplay(FDE_CSSDisplay::Inline), + m_eVerticalAlign(FDE_CSSVerticalAlign::Baseline), + m_dwTextDecoration(0), + m_bHasMargin(false), + m_bHasBorder(false), + m_bHasPadding(false) {} |