From cfb856c4744a9e0ff0f0db5602d0a13c835570ce Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 16 Jan 2017 16:03:44 -0500 Subject: Remove IFDE_CSS interfaces which are only implemented once. This CL cleans up some interface classes from FDE CSS. Change-Id: I975e5d63f8ae6a0bc7bb849b6f11f0ae43092e4d Reviewed-on: https://pdfium-review.googlesource.com/2177 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fde/css/cfde_cssrulecollection.cpp | 10 +-- xfa/fde/css/fde_css.cpp | 27 ------- xfa/fde/css/fde_css.h | 141 +-------------------------------- xfa/fde/css/fde_cssdatatable.cpp | 13 ++- xfa/fde/css/fde_cssdatatable.h | 68 ++++++++-------- xfa/fde/css/fde_cssdeclaration.cpp | 16 ++-- xfa/fde/css/fde_cssdeclaration.h | 4 +- xfa/fde/css/fde_cssstyleselector.cpp | 67 ++++++---------- xfa/fde/css/fde_cssstyleselector.h | 117 +++++++++++++-------------- xfa/fde/css/fde_cssstylesheet.cpp | 50 +++++------- xfa/fde/css/fde_cssstylesheet.h | 55 +++++++------ 11 files changed, 190 insertions(+), 378 deletions(-) delete mode 100644 xfa/fde/css/fde_css.cpp (limited to 'xfa/fde/css') diff --git a/xfa/fde/css/cfde_cssrulecollection.cpp b/xfa/fde/css/cfde_cssrulecollection.cpp index baa6eb465a..d9bc9b7545 100644 --- a/xfa/fde/css/cfde_cssrulecollection.cpp +++ b/xfa/fde/css/cfde_cssrulecollection.cpp @@ -33,12 +33,12 @@ CFDE_CSSRuleCollection::~CFDE_CSSRuleCollection() { } void CFDE_CSSRuleCollection::AddRulesFrom( - const CFX_ArrayTemplate& sheets, + const CFX_ArrayTemplate& sheets, uint32_t dwMediaList, CFGAS_FontMgr* pFontMgr) { int32_t iSheets = sheets.GetSize(); for (int32_t i = 0; i < iSheets; ++i) { - IFDE_CSSStyleSheet* pSheet = sheets.GetAt(i); + CFDE_CSSStyleSheet* pSheet = sheets.GetAt(i); if (uint32_t dwMatchMedia = pSheet->GetMediaList() & dwMediaList) { int32_t iRules = pSheet->CountRules(); for (int32_t j = 0; j < iRules; j++) { @@ -48,13 +48,13 @@ void CFDE_CSSRuleCollection::AddRulesFrom( } } -void CFDE_CSSRuleCollection::AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, +void CFDE_CSSRuleCollection::AddRulesFrom(CFDE_CSSStyleSheet* pStyleSheet, IFDE_CSSRule* pRule, uint32_t dwMediaList, CFGAS_FontMgr* pFontMgr) { switch (pRule->GetType()) { case FDE_CSSRuleType::Style: { - IFDE_CSSStyleRule* pStyleRule = static_cast(pRule); + CFDE_CSSStyleRule* pStyleRule = static_cast(pRule); CFDE_CSSDeclaration* pDeclaration = pStyleRule->GetDeclaration(); int32_t iSelectors = pStyleRule->CountSelectorLists(); for (int32_t i = 0; i < iSelectors; ++i) { @@ -95,7 +95,7 @@ void CFDE_CSSRuleCollection::AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, } } break; case FDE_CSSRuleType::Media: { - IFDE_CSSMediaRule* pMediaRule = static_cast(pRule); + CFDE_CSSMediaRule* pMediaRule = static_cast(pRule); if (pMediaRule->GetMediaList() & dwMediaList) { int32_t iRules = pMediaRule->CountRules(); for (int32_t i = 0; i < iRules; ++i) { diff --git a/xfa/fde/css/fde_css.cpp b/xfa/fde/css/fde_css.cpp deleted file mode 100644 index c9122b4bfd..0000000000 --- a/xfa/fde/css/fde_css.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fde/css/fde_css.h" - -FDE_CSSVALUETYPE IFDE_CSSPrimitiveValue::GetType() const { - return FDE_CSSVALUETYPE_Primitive; -} - -FDE_CSSVALUETYPE IFDE_CSSValueList::GetType() const { - return FDE_CSSVALUETYPE_List; -} - -FDE_CSSRuleType IFDE_CSSStyleRule::GetType() const { - return FDE_CSSRuleType::Style; -} - -FDE_CSSRuleType IFDE_CSSMediaRule::GetType() const { - return FDE_CSSRuleType::Media; -} - -FDE_CSSRuleType IFDE_CSSFontFaceRule::GetType() const { - return FDE_CSSRuleType::FontFace; -} diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h index 42662cfb73..90763d6c38 100644 --- a/xfa/fde/css/fde_css.h +++ b/xfa/fde/css/fde_css.h @@ -14,17 +14,12 @@ class CFDE_CSSAccelerator; class CFDE_CSSDeclaration; +class CFDE_CSSComputedStyle; class CFDE_CSSSelector; +class CFDE_CSSStyleSheet; class CXFA_CSSTagProvider; -class IFDE_CSSBoundaryStyle; -class IFDE_CSSComputedStyle; -class IFDE_CSSFontStyle; -class IFDE_CSSParagraphStyle; -class IFDE_CSSPositionStyle; class IFDE_CSSRule; -class IFDE_CSSStyleSheet; class IFDE_CSSValue; -class IFDE_CSSValueList; enum FDE_CSSMEDIATYPE { FDE_CSSMEDIATYPE_Braille = 0x01, @@ -268,80 +263,12 @@ class IFDE_CSSValue { virtual FDE_CSSVALUETYPE GetType() const = 0; }; -class IFDE_CSSPrimitiveValue : public IFDE_CSSValue { - public: - // IFDE_CSSValue - FDE_CSSVALUETYPE GetType() const override; - - virtual FDE_CSSPrimitiveType GetPrimitiveType() const = 0; - virtual FX_ARGB GetRGBColor() const = 0; - virtual FX_FLOAT GetFloat() const = 0; - virtual const FX_WCHAR* GetString(int32_t& iLength) const = 0; - virtual FDE_CSSPropertyValue GetEnum() const = 0; - virtual const FX_WCHAR* GetFuncName() const = 0; - virtual int32_t CountArgs() const = 0; - virtual IFDE_CSSValue* GetArgs(int32_t index) const = 0; -}; - -class IFDE_CSSValueList : public IFDE_CSSValue { - public: - // IFDE_CSSValue - FDE_CSSVALUETYPE GetType() const override; - - virtual int32_t CountValues() const = 0; - virtual IFDE_CSSValue* GetValue(int32_t index) const = 0; -}; - class IFDE_CSSRule { public: virtual ~IFDE_CSSRule() {} virtual FDE_CSSRuleType GetType() const = 0; }; -class IFDE_CSSStyleRule : public IFDE_CSSRule { - public: - // IFDE_CSSValue - FDE_CSSRuleType GetType() const override; - - virtual int32_t CountSelectorLists() const = 0; - virtual CFDE_CSSSelector* GetSelectorList(int32_t index) const = 0; - virtual CFDE_CSSDeclaration* GetDeclaration() = 0; -}; - -class IFDE_CSSMediaRule : public IFDE_CSSRule { - public: - // IFDE_CSSValue - FDE_CSSRuleType GetType() const override; - - virtual uint32_t GetMediaList() const = 0; - virtual int32_t CountRules() const = 0; - virtual IFDE_CSSRule* GetRule(int32_t index) = 0; -}; - -class IFDE_CSSFontFaceRule : public IFDE_CSSRule { - public: - // IFDE_CSSValue - FDE_CSSRuleType GetType() const override; - - virtual CFDE_CSSDeclaration* GetDeclaration() = 0; -}; - -class IFDE_CSSStyleSheet : public IFX_Retainable { - public: - static IFDE_CSSStyleSheet* LoadFromBuffer( - const CFX_WideString& szUrl, - const FX_WCHAR* pBuffer, - int32_t iBufSize, - uint16_t wCodePage, - uint32_t dwMediaList = FDE_CSSMEDIATYPE_ALL); - virtual bool GetUrl(CFX_WideString& szUrl) = 0; - virtual uint32_t GetMediaList() const = 0; - virtual uint16_t GetCodePage() const = 0; - - virtual int32_t CountRules() const = 0; - virtual IFDE_CSSRule* GetRule(int32_t index) = 0; -}; - struct FDE_CSSLENGTH { FDE_CSSLENGTH() {} @@ -398,68 +325,4 @@ struct FDE_CSSRECT { FDE_CSSLENGTH left, top, right, bottom; }; -class IFDE_CSSFontStyle { - public: - virtual ~IFDE_CSSFontStyle() {} - - virtual int32_t CountFontFamilies() const = 0; - virtual const FX_WCHAR* GetFontFamily(int32_t index) const = 0; - virtual uint16_t GetFontWeight() const = 0; - virtual FDE_CSSFontVariant GetFontVariant() const = 0; - virtual FDE_CSSFontStyle GetFontStyle() const = 0; - virtual FX_FLOAT GetFontSize() const = 0; - virtual FX_ARGB GetColor() const = 0; - virtual void SetFontWeight(uint16_t wFontWeight) = 0; - virtual void SetFontVariant(FDE_CSSFontVariant eFontVariant) = 0; - virtual void SetFontStyle(FDE_CSSFontStyle eFontStyle) = 0; - virtual void SetFontSize(FX_FLOAT fFontSize) = 0; - virtual void SetColor(FX_ARGB dwFontColor) = 0; -}; - -class IFDE_CSSBoundaryStyle { - public: - virtual ~IFDE_CSSBoundaryStyle() {} - - virtual const FDE_CSSRECT* GetBorderWidth() const = 0; - virtual const FDE_CSSRECT* GetMarginWidth() const = 0; - virtual const FDE_CSSRECT* GetPaddingWidth() const = 0; - virtual void SetMarginWidth(const FDE_CSSRECT& rect) = 0; - virtual void SetPaddingWidth(const FDE_CSSRECT& rect) = 0; -}; - -class IFDE_CSSPositionStyle { - public: - virtual ~IFDE_CSSPositionStyle() {} - virtual FDE_CSSDisplay GetDisplay() const = 0; -}; - -class IFDE_CSSParagraphStyle { - public: - virtual ~IFDE_CSSParagraphStyle() {} - - virtual FX_FLOAT GetLineHeight() const = 0; - virtual const FDE_CSSLENGTH& GetTextIndent() const = 0; - virtual FDE_CSSTextAlign GetTextAlign() const = 0; - virtual FDE_CSSVerticalAlign GetVerticalAlign() const = 0; - virtual FX_FLOAT GetNumberVerticalAlign() const = 0; - virtual uint32_t GetTextDecoration() const = 0; - virtual const FDE_CSSLENGTH& GetLetterSpacing() const = 0; - virtual void SetLineHeight(FX_FLOAT fLineHeight) = 0; - virtual void SetTextIndent(const FDE_CSSLENGTH& textIndent) = 0; - virtual void SetTextAlign(FDE_CSSTextAlign eTextAlign) = 0; - virtual void SetNumberVerticalAlign(FX_FLOAT fAlign) = 0; - virtual void SetTextDecoration(uint32_t dwTextDecoration) = 0; - virtual void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) = 0; -}; - -class IFDE_CSSComputedStyle : public IFX_Retainable { - public: - virtual IFDE_CSSFontStyle* GetFontStyles() = 0; - virtual IFDE_CSSBoundaryStyle* GetBoundaryStyles() = 0; - virtual IFDE_CSSPositionStyle* GetPositionStyles() = 0; - virtual IFDE_CSSParagraphStyle* GetParagraphStyles() = 0; - virtual bool GetCustomStyle(const CFX_WideStringC& wsName, - CFX_WideString& wsValue) const = 0; -}; - #endif // XFA_FDE_CSS_FDE_CSS_H_ diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp index 7421f407b5..7db704a8f5 100644 --- a/xfa/fde/css/fde_cssdatatable.cpp +++ b/xfa/fde/css/fde_cssdatatable.cpp @@ -7,6 +7,7 @@ #include "xfa/fde/css/fde_cssdatatable.h" #include "core/fxcrt/fx_ext.h" +#include "xfa/fde/css/fde_cssstyleselector.h" #include "xfa/fgas/crt/fgas_codepage.h" namespace { @@ -31,7 +32,7 @@ bool FDE_CSSLengthToFloat(const FDE_CSSLENGTH& len, return false; } } -CFX_FloatRect FDE_CSSBoundaryToRect(IFDE_CSSBoundaryStyle* pBoundStyle, +CFX_FloatRect FDE_CSSBoundaryToRect(CFDE_CSSComputedStyle* pBoundStyle, FX_FLOAT fContainerWidth, bool bPadding, bool bBorder, @@ -92,7 +93,7 @@ CFX_FloatRect FDE_CSSBoundaryToRect(IFDE_CSSBoundaryStyle* pBoundStyle, } return rect; } -uint32_t FDE_CSSFontStyleToFDE(IFDE_CSSFontStyle* pFontStyle) { +uint32_t FDE_CSSFontStyleToFDE(CFDE_CSSComputedStyle* pFontStyle) { uint32_t dwFontStyle = FX_FONTSTYLE_Normal; if (pFontStyle->GetFontStyle() == FDE_CSSFontStyle::Italic) { dwFontStyle |= FX_FONTSTYLE_Italic; @@ -544,6 +545,10 @@ int32_t CFDE_CSSValueList::CountValues() const { return m_iCount; } +FDE_CSSVALUETYPE CFDE_CSSValueList::GetType() const { + return FDE_CSSVALUETYPE_List; +} + IFDE_CSSValue* CFDE_CSSValueList::GetValue(int32_t index) const { return m_ppList[index]; } @@ -671,6 +676,10 @@ CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType eType, CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(CFDE_CSSFunction* pFunction) : m_eType(FDE_CSSPrimitiveType::Function), m_pFunction(pFunction) {} +FDE_CSSVALUETYPE CFDE_CSSPrimitiveValue::GetType() const { + return FDE_CSSVALUETYPE_Primitive; +} + FDE_CSSPrimitiveType CFDE_CSSPrimitiveValue::GetPrimitiveType() const { return m_eType; } diff --git a/xfa/fde/css/fde_cssdatatable.h b/xfa/fde/css/fde_cssdatatable.h index f11cae2eac..d62ddf6b03 100644 --- a/xfa/fde/css/fde_cssdatatable.h +++ b/xfa/fde/css/fde_cssdatatable.h @@ -10,24 +10,9 @@ #include "core/fxcrt/fx_system.h" #include "xfa/fde/css/fde_css.h" -class CFDE_CSSFunction { - public: - CFDE_CSSFunction(const FX_WCHAR* pszFuncName, IFDE_CSSValueList* pArgList) - : m_pArgList(pArgList), m_pszFuncName(pszFuncName) { - ASSERT(pArgList); - } - int32_t CountArgs() const { return m_pArgList->CountValues(); } - IFDE_CSSValue* GetArgs(int32_t index) const { - return m_pArgList->GetValue(index); - } - const FX_WCHAR* GetFuncName() const { return m_pszFuncName; } - - protected: - IFDE_CSSValueList* m_pArgList; - const FX_WCHAR* m_pszFuncName; -}; +class CFDE_CSSFunction; -class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue { +class CFDE_CSSPrimitiveValue : public IFDE_CSSValue { public: explicit CFDE_CSSPrimitiveValue(FX_ARGB color); explicit CFDE_CSSPrimitiveValue(FDE_CSSPropertyValue eValue); @@ -36,15 +21,17 @@ class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue { CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType eType, const FX_WCHAR* pValue); CFDE_CSSPrimitiveValue(const CFDE_CSSPrimitiveValue& src); - // IFDE_CSSPrimitiveValue - FDE_CSSPrimitiveType GetPrimitiveType() const override; - FX_ARGB GetRGBColor() const override; - FX_FLOAT GetFloat() const override; - const FX_WCHAR* GetString(int32_t& iLength) const override; - FDE_CSSPropertyValue GetEnum() const override; - const FX_WCHAR* GetFuncName() const override; - int32_t CountArgs() const override; - IFDE_CSSValue* GetArgs(int32_t index) const override; + // IFDE_CSSValue + FDE_CSSVALUETYPE GetType() const override; + + FDE_CSSPrimitiveType GetPrimitiveType() const; + FX_ARGB GetRGBColor() const; + FX_FLOAT GetFloat() const; + const FX_WCHAR* GetString(int32_t& iLength) const; + FDE_CSSPropertyValue GetEnum() const; + const FX_WCHAR* GetFuncName() const; + int32_t CountArgs() const; + IFDE_CSSValue* GetArgs(int32_t index) const; FDE_CSSPrimitiveType m_eType; union { @@ -56,16 +43,18 @@ class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue { }; }; -typedef CFX_ArrayTemplate CFDE_CSSPrimitiveArray; +typedef CFX_ArrayTemplate CFDE_CSSPrimitiveArray; typedef CFX_ArrayTemplate CFDE_CSSValueArray; -class CFDE_CSSValueList : public IFDE_CSSValueList { +class CFDE_CSSValueList : public IFDE_CSSValue { public: explicit CFDE_CSSValueList(const CFDE_CSSValueArray& list); - // IFDE_CSSValueList - int32_t CountValues() const override; - IFDE_CSSValue* GetValue(int32_t index) const override; + // IFDE_CSSValue + FDE_CSSVALUETYPE GetType() const override; + + int32_t CountValues() const; + IFDE_CSSValue* GetValue(int32_t index) const; protected: IFDE_CSSValue** m_ppList; @@ -92,6 +81,23 @@ class CFDE_CSSValueListParser { const FX_WCHAR* m_pEnd; }; +class CFDE_CSSFunction { + public: + CFDE_CSSFunction(const FX_WCHAR* pszFuncName, CFDE_CSSValueList* pArgList) + : m_pArgList(pArgList), m_pszFuncName(pszFuncName) { + ASSERT(pArgList); + } + int32_t CountArgs() const { return m_pArgList->CountValues(); } + IFDE_CSSValue* GetArgs(int32_t index) const { + return m_pArgList->GetValue(index); + } + const FX_WCHAR* GetFuncName() const { return m_pszFuncName; } + + protected: + CFDE_CSSValueList* m_pArgList; + const FX_WCHAR* m_pszFuncName; +}; + #define FDE_IsOnlyValue(type, enum) \ (((type) & ~(enum)) == FDE_CSSVALUETYPE_Primitive) diff --git a/xfa/fde/css/fde_cssdeclaration.cpp b/xfa/fde/css/fde_cssdeclaration.cpp index 23c92343d0..50d0b8c854 100644 --- a/xfa/fde/css/fde_cssdeclaration.cpp +++ b/xfa/fde/css/fde_cssdeclaration.cpp @@ -67,7 +67,7 @@ const FX_WCHAR* CFDE_CSSDeclaration::CopyToLocal( return psz; } -IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewNumberValue( +CFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewNumberValue( FDE_CSSPrimitiveType eUnit, FX_FLOAT fValue) const { static CFDE_CSSPrimitiveValue s_ZeroValue(FDE_CSSPrimitiveType::Number, 0.0f); @@ -76,7 +76,7 @@ IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewNumberValue( } return new CFDE_CSSPrimitiveValue(eUnit, fValue); } -inline IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewEnumValue( +CFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewEnumValue( FDE_CSSPropertyValue eValue) const { return new CFDE_CSSPrimitiveValue(eValue); } @@ -345,7 +345,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( break; } } - IFDE_CSSValueList* pArgumentList = new CFDE_CSSValueList(argumentArr); + CFDE_CSSValueList* pArgumentList = new CFDE_CSSValueList(argumentArr); CFDE_CSSFunction* pFunction = new CFDE_CSSFunction(pszFuncName, pArgumentList); return new CFDE_CSSPrimitiveValue(pFunction); @@ -525,11 +525,11 @@ bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPropertyArgs* pArgs, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, '/'); - IFDE_CSSPrimitiveValue* pStyle = nullptr; - IFDE_CSSPrimitiveValue* pVariant = nullptr; - IFDE_CSSPrimitiveValue* pWeight = nullptr; - IFDE_CSSPrimitiveValue* pFontSize = nullptr; - IFDE_CSSPrimitiveValue* pLineHeight = nullptr; + CFDE_CSSPrimitiveValue* pStyle = nullptr; + CFDE_CSSPrimitiveValue* pVariant = nullptr; + CFDE_CSSPrimitiveValue* pWeight = nullptr; + CFDE_CSSPrimitiveValue* pFontSize = nullptr; + CFDE_CSSPrimitiveValue* pLineHeight = nullptr; CFDE_CSSValueArray familyList; FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { diff --git a/xfa/fde/css/fde_cssdeclaration.h b/xfa/fde/css/fde_cssdeclaration.h index 18b769c00e..8db6d7b6a1 100644 --- a/xfa/fde/css/fde_cssdeclaration.h +++ b/xfa/fde/css/fde_cssdeclaration.h @@ -100,9 +100,9 @@ class CFDE_CSSDeclaration { void AddPropertyHolder(FDE_CSSProperty eProperty, IFDE_CSSValue* pValue, bool bImportant); - IFDE_CSSPrimitiveValue* NewNumberValue(FDE_CSSPrimitiveType eUnit, + CFDE_CSSPrimitiveValue* NewNumberValue(FDE_CSSPrimitiveType eUnit, FX_FLOAT fValue) const; - IFDE_CSSPrimitiveValue* NewEnumValue(FDE_CSSPropertyValue eValue) const; + CFDE_CSSPrimitiveValue* NewEnumValue(FDE_CSSPropertyValue eValue) const; FDE_CSSPropertyHolder* m_pFirstProperty; FDE_CSSPropertyHolder* m_pLastProperty; diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp index 4861edfb34..53424a1d30 100644 --- a/xfa/fde/css/fde_cssstyleselector.cpp +++ b/xfa/fde/css/fde_cssstyleselector.cpp @@ -60,19 +60,17 @@ CFDE_CSSAccelerator* CFDE_CSSStyleSelector::InitAccelerator() { return m_pAccelerator.get(); } -IFDE_CSSComputedStyle* CFDE_CSSStyleSelector::CreateComputedStyle( - IFDE_CSSComputedStyle* pParentStyle) { +CFDE_CSSComputedStyle* CFDE_CSSStyleSelector::CreateComputedStyle( + CFDE_CSSComputedStyle* pParentStyle) { CFDE_CSSComputedStyle* pStyle = new CFDE_CSSComputedStyle(); - if (pParentStyle) { - pStyle->m_InheritedData = - static_cast(pParentStyle)->m_InheritedData; - } + if (pParentStyle) + pStyle->m_InheritedData = pParentStyle->m_InheritedData; return pStyle; } bool CFDE_CSSStyleSelector::SetStyleSheet(FDE_CSSStyleSheetGroup eType, - IFDE_CSSStyleSheet* pSheet) { - CFX_ArrayTemplate& dest = + CFDE_CSSStyleSheet* pSheet) { + CFX_ArrayTemplate& dest = m_SheetGroups[static_cast(eType)]; dest.RemoveAt(0, dest.GetSize()); if (pSheet) @@ -82,8 +80,8 @@ bool CFDE_CSSStyleSelector::SetStyleSheet(FDE_CSSStyleSheetGroup eType, bool CFDE_CSSStyleSelector::SetStyleSheets( FDE_CSSStyleSheetGroup eType, - const CFX_ArrayTemplate* pArray) { - CFX_ArrayTemplate& dest = + const CFX_ArrayTemplate* pArray) { + CFX_ArrayTemplate& dest = m_SheetGroups[static_cast(eType)]; if (pArray) dest.Copy(*pArray); @@ -223,7 +221,7 @@ void CFDE_CSSStyleSelector::ComputeStyle( CXFA_CSSTagProvider* pTag, const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount, - IFDE_CSSComputedStyle* pDestStyle) { + CFDE_CSSComputedStyle* pDestStyle) { ASSERT(iDeclCount >= 0); ASSERT(pDestStyle); @@ -280,9 +278,8 @@ void CFDE_CSSStyleSelector::ApplyDeclarations( bool bPriority, const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount, - IFDE_CSSComputedStyle* pDestStyle) { - CFDE_CSSComputedStyle* pComputedStyle = - static_cast(pDestStyle); + CFDE_CSSComputedStyle* pDestStyle) { + CFDE_CSSComputedStyle* pComputedStyle = pDestStyle; IFDE_CSSValue* pVal; bool bImportant; int32_t i; @@ -388,8 +385,8 @@ void CFDE_CSSStyleSelector::ApplyProperty( IFDE_CSSValue* pValue, CFDE_CSSComputedStyle* pComputedStyle) { if (pValue->GetType() == FDE_CSSVALUETYPE_Primitive) { - IFDE_CSSPrimitiveValue* pPrimitive = - static_cast(pValue); + CFDE_CSSPrimitiveValue* pPrimitive = + static_cast(pValue); FDE_CSSPrimitiveType eType = pPrimitive->GetPrimitiveType(); switch (eProperty) { case FDE_CSSProperty::Display: @@ -606,7 +603,7 @@ void CFDE_CSSStyleSelector::ApplyProperty( break; } } else if (pValue->GetType() == FDE_CSSVALUETYPE_List) { - IFDE_CSSValueList* pList = static_cast(pValue); + CFDE_CSSValueList* pList = static_cast(pValue); int32_t iCount = pList->CountValues(); if (iCount > 0) { switch (eProperty) { @@ -713,7 +710,7 @@ FDE_CSSFontStyle CFDE_CSSStyleSelector::ToFontStyle( bool CFDE_CSSStyleSelector::SetLengthWithPercent( FDE_CSSLENGTH& width, FDE_CSSPrimitiveType eType, - IFDE_CSSPrimitiveValue* pPrimitive, + CFDE_CSSPrimitiveValue* pPrimitive, FX_FLOAT fFontSize) { if (eType == FDE_CSSPrimitiveType::Percent) { width.Set(FDE_CSSLengthUnit::Percent, pPrimitive->GetFloat() / 100.0f); @@ -796,11 +793,11 @@ FDE_CSSVerticalAlign CFDE_CSSStyleSelector::ToVerticalAlign( } } -uint32_t CFDE_CSSStyleSelector::ToTextDecoration(IFDE_CSSValueList* pValue) { +uint32_t CFDE_CSSStyleSelector::ToTextDecoration(CFDE_CSSValueList* pValue) { uint32_t dwDecoration = 0; for (int32_t i = pValue->CountValues() - 1; i >= 0; --i) { - IFDE_CSSPrimitiveValue* pPrimitive = - static_cast(pValue->GetValue(i)); + CFDE_CSSPrimitiveValue* pPrimitive = + static_cast(pValue->GetValue(i)); if (pPrimitive->GetPrimitiveType() == FDE_CSSPrimitiveType::Enum) { switch (pPrimitive->GetEnum()) { case FDE_CSSPropertyValue::Underline: @@ -848,22 +845,6 @@ uint32_t CFDE_CSSComputedStyle::Release() { return dwRefCount; } -IFDE_CSSFontStyle* CFDE_CSSComputedStyle::GetFontStyles() { - return static_cast(this); -} - -IFDE_CSSBoundaryStyle* CFDE_CSSComputedStyle::GetBoundaryStyles() { - return static_cast(this); -} - -IFDE_CSSPositionStyle* CFDE_CSSComputedStyle::GetPositionStyles() { - return static_cast(this); -} - -IFDE_CSSParagraphStyle* CFDE_CSSComputedStyle::GetParagraphStyles() { - return static_cast(this); -} - bool CFDE_CSSComputedStyle::GetCustomStyle(const CFX_WideStringC& wsName, CFX_WideString& wsValue) const { for (int32_t i = pdfium::CollectionSize(m_CustomProperties) - 2; @@ -883,7 +864,7 @@ int32_t CFDE_CSSComputedStyle::CountFontFamilies() const { } const FX_WCHAR* CFDE_CSSComputedStyle::GetFontFamily(int32_t index) const { - return (static_cast( + return (static_cast( m_InheritedData.m_pFontFamily->GetValue(index))) ->GetString(index); } @@ -893,11 +874,11 @@ uint16_t CFDE_CSSComputedStyle::GetFontWeight() const { } FDE_CSSFontVariant CFDE_CSSComputedStyle::GetFontVariant() const { - return static_cast(m_InheritedData.m_eFontVariant); + return m_InheritedData.m_eFontVariant; } FDE_CSSFontStyle CFDE_CSSComputedStyle::GetFontStyle() const { - return static_cast(m_InheritedData.m_eFontStyle); + return m_InheritedData.m_eFontStyle; } FX_FLOAT CFDE_CSSComputedStyle::GetFontSize() const { @@ -954,7 +935,7 @@ void CFDE_CSSComputedStyle::SetPaddingWidth(const FDE_CSSRECT& rect) { } FDE_CSSDisplay CFDE_CSSComputedStyle::GetDisplay() const { - return static_cast(m_NonInheritedData.m_eDisplay); + return m_NonInheritedData.m_eDisplay; } FX_FLOAT CFDE_CSSComputedStyle::GetLineHeight() const { @@ -966,11 +947,11 @@ const FDE_CSSLENGTH& CFDE_CSSComputedStyle::GetTextIndent() const { } FDE_CSSTextAlign CFDE_CSSComputedStyle::GetTextAlign() const { - return static_cast(m_InheritedData.m_eTextAlign); + return m_InheritedData.m_eTextAlign; } FDE_CSSVerticalAlign CFDE_CSSComputedStyle::GetVerticalAlign() const { - return static_cast(m_NonInheritedData.m_eVerticalAlign); + return m_NonInheritedData.m_eVerticalAlign; } FX_FLOAT CFDE_CSSComputedStyle::GetNumberVerticalAlign() const { diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h index 185ba75ba3..6c06f0e4e2 100644 --- a/xfa/fde/css/fde_cssstyleselector.h +++ b/xfa/fde/css/fde_cssstyleselector.h @@ -37,7 +37,7 @@ class CFDE_CSSRuleCollection { CFDE_CSSRuleCollection(); ~CFDE_CSSRuleCollection(); - void AddRulesFrom(const CFX_ArrayTemplate& sheets, + void AddRulesFrom(const CFX_ArrayTemplate& sheets, uint32_t dwMediaList, CFGAS_FontMgr* pFontMgr); void Clear(); @@ -62,7 +62,7 @@ class CFDE_CSSRuleCollection { FDE_CSSRuleData* GetPseudoRuleData() { return m_pPseudoRules; } protected: - void AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, + void AddRulesFrom(CFDE_CSSStyleSheet* pStyleSheet, IFDE_CSSRule* pRule, uint32_t dwMediaList, CFGAS_FontMgr* pFontMgr); @@ -89,15 +89,15 @@ class CFDE_CSSStyleSelector { void SetDefFontSize(FX_FLOAT fFontSize); - bool SetStyleSheet(FDE_CSSStyleSheetGroup eType, IFDE_CSSStyleSheet* pSheet); + bool SetStyleSheet(FDE_CSSStyleSheetGroup eType, CFDE_CSSStyleSheet* pSheet); bool SetStyleSheets(FDE_CSSStyleSheetGroup eType, - const CFX_ArrayTemplate* pArray); + const CFX_ArrayTemplate* pArray); void SetStylePriority(FDE_CSSStyleSheetGroup eType, FDE_CSSStyleSheetPriority ePriority); void UpdateStyleIndex(uint32_t dwMediaList); CFDE_CSSAccelerator* InitAccelerator(); - IFDE_CSSComputedStyle* CreateComputedStyle( - IFDE_CSSComputedStyle* pParentStyle); + CFDE_CSSComputedStyle* CreateComputedStyle( + CFDE_CSSComputedStyle* pParentStyle); int32_t MatchDeclarations( CXFA_CSSTagProvider* pTag, CFX_ArrayTemplate& matchedDecls, @@ -105,7 +105,7 @@ class CFDE_CSSStyleSelector { void ComputeStyle(CXFA_CSSTagProvider* pTag, const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount, - IFDE_CSSComputedStyle* pDestStyle); + CFDE_CSSComputedStyle* pDestStyle); protected: void Reset(); @@ -121,7 +121,7 @@ class CFDE_CSSStyleSelector { void ApplyDeclarations(bool bPriority, const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount, - IFDE_CSSComputedStyle* pDestStyle); + CFDE_CSSComputedStyle* pDestStyle); void ApplyProperty(FDE_CSSProperty eProperty, IFDE_CSSValue* pValue, CFDE_CSSComputedStyle* pComputedStyle); @@ -131,7 +131,7 @@ class CFDE_CSSStyleSelector { FX_FLOAT fPercentBase); bool SetLengthWithPercent(FDE_CSSLENGTH& width, FDE_CSSPrimitiveType eType, - IFDE_CSSPrimitiveValue* pPrimitive, + CFDE_CSSPrimitiveValue* pPrimitive, FX_FLOAT fFontSize); FX_FLOAT ToFontSize(FDE_CSSPropertyValue eValue, FX_FLOAT fCurFontSize); FDE_CSSDisplay ToDisplay(FDE_CSSPropertyValue eValue); @@ -139,12 +139,12 @@ class CFDE_CSSStyleSelector { uint16_t ToFontWeight(FDE_CSSPropertyValue eValue); FDE_CSSFontStyle ToFontStyle(FDE_CSSPropertyValue eValue); FDE_CSSVerticalAlign ToVerticalAlign(FDE_CSSPropertyValue eValue); - uint32_t ToTextDecoration(IFDE_CSSValueList* pList); + uint32_t ToTextDecoration(CFDE_CSSValueList* pList); FDE_CSSFontVariant ToFontVariant(FDE_CSSPropertyValue eValue); CFGAS_FontMgr* const m_pFontMgr; FX_FLOAT m_fDefFontSize; - CFX_ArrayTemplate m_SheetGroups[3]; + CFX_ArrayTemplate m_SheetGroups[3]; CFDE_CSSRuleCollection m_RuleCollection[3]; FDE_CSSStyleSheetGroup m_ePriorities[3]; std::unique_ptr m_pAccelerator; @@ -158,7 +158,7 @@ class CFDE_CSSInheritedData { FDE_CSSLENGTH m_LetterSpacing; FDE_CSSLENGTH m_WordSpacing; FDE_CSSLENGTH m_TextIndent; - IFDE_CSSValueList* m_pFontFamily; + CFDE_CSSValueList* m_pFontFamily; FX_FLOAT m_fFontSize; FX_FLOAT m_fLineHeight; FX_ARGB m_dwFontColor; @@ -188,11 +188,7 @@ class CFDE_CSSNonInheritedData { bool m_bHasPadding; }; -class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, - public IFDE_CSSBoundaryStyle, - public IFDE_CSSFontStyle, - public IFDE_CSSPositionStyle, - public IFDE_CSSParagraphStyle { +class CFDE_CSSComputedStyle : public IFX_Retainable { public: CFDE_CSSComputedStyle(); ~CFDE_CSSComputedStyle() override; @@ -201,58 +197,51 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, uint32_t Retain() override; uint32_t Release() override; - // IFDE_CSSComputedStyle - IFDE_CSSFontStyle* GetFontStyles() override; - IFDE_CSSBoundaryStyle* GetBoundaryStyles() override; - IFDE_CSSPositionStyle* GetPositionStyles() override; - IFDE_CSSParagraphStyle* GetParagraphStyles() override; - bool GetCustomStyle(const CFX_WideStringC& wsName, - CFX_WideString& wsValue) const override; - - // IFDE_CSSFontStyle: - int32_t CountFontFamilies() const override; - const FX_WCHAR* GetFontFamily(int32_t index) const override; - uint16_t GetFontWeight() const override; - FDE_CSSFontVariant GetFontVariant() const override; - FDE_CSSFontStyle GetFontStyle() const override; - FX_FLOAT GetFontSize() const override; - FX_ARGB GetColor() const override; - void SetFontWeight(uint16_t wFontWeight) override; - void SetFontVariant(FDE_CSSFontVariant eFontVariant) override; - void SetFontStyle(FDE_CSSFontStyle eFontStyle) override; - void SetFontSize(FX_FLOAT fFontSize) override; - void SetColor(FX_ARGB dwFontColor) override; - - // IFDE_CSSBoundaryStyle: - const FDE_CSSRECT* GetBorderWidth() const override; - const FDE_CSSRECT* GetMarginWidth() const override; - const FDE_CSSRECT* GetPaddingWidth() const override; - void SetMarginWidth(const FDE_CSSRECT& rect) override; - void SetPaddingWidth(const FDE_CSSRECT& rect) override; - - // IFDE_CSSPositionStyle: - FDE_CSSDisplay GetDisplay() const override; - - // IFDE_CSSParagraphStyle: - FX_FLOAT GetLineHeight() const override; - const FDE_CSSLENGTH& GetTextIndent() const override; - FDE_CSSTextAlign GetTextAlign() const override; - FDE_CSSVerticalAlign GetVerticalAlign() const override; - FX_FLOAT GetNumberVerticalAlign() const override; - uint32_t GetTextDecoration() const override; - const FDE_CSSLENGTH& GetLetterSpacing() const override; - void SetLineHeight(FX_FLOAT fLineHeight) override; - void SetTextIndent(const FDE_CSSLENGTH& textIndent) override; - void SetTextAlign(FDE_CSSTextAlign eTextAlign) override; - void SetNumberVerticalAlign(FX_FLOAT fAlign) override; - void SetTextDecoration(uint32_t dwTextDecoration) override; - void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) override; + int32_t CountFontFamilies() const; + const FX_WCHAR* GetFontFamily(int32_t index) const; + uint16_t GetFontWeight() const; + FDE_CSSFontVariant GetFontVariant() const; + FDE_CSSFontStyle GetFontStyle() const; + FX_FLOAT GetFontSize() const; + FX_ARGB GetColor() const; + void SetFontWeight(uint16_t wFontWeight); + void SetFontVariant(FDE_CSSFontVariant eFontVariant); + void SetFontStyle(FDE_CSSFontStyle eFontStyle); + void SetFontSize(FX_FLOAT fFontSize); + void SetColor(FX_ARGB dwFontColor); + + const FDE_CSSRECT* GetBorderWidth() const; + const FDE_CSSRECT* GetMarginWidth() const; + const FDE_CSSRECT* GetPaddingWidth() const; + void SetMarginWidth(const FDE_CSSRECT& rect); + void SetPaddingWidth(const FDE_CSSRECT& rect); + + FDE_CSSDisplay GetDisplay() const; + + FX_FLOAT GetLineHeight() const; + const FDE_CSSLENGTH& GetTextIndent() const; + FDE_CSSTextAlign GetTextAlign() const; + FDE_CSSVerticalAlign GetVerticalAlign() const; + FX_FLOAT GetNumberVerticalAlign() const; + uint32_t GetTextDecoration() const; + const FDE_CSSLENGTH& GetLetterSpacing() const; + void SetLineHeight(FX_FLOAT fLineHeight); + void SetTextIndent(const FDE_CSSLENGTH& textIndent); + void SetTextAlign(FDE_CSSTextAlign eTextAlign); + void SetNumberVerticalAlign(FX_FLOAT fAlign); + void SetTextDecoration(uint32_t dwTextDecoration); + void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing); void AddCustomStyle(const CFX_WideString& wsName, const CFX_WideString& wsValue); - uint32_t m_dwRefCount; + bool GetCustomStyle(const CFX_WideStringC& wsName, + CFX_WideString& wsValue) const; + CFDE_CSSInheritedData m_InheritedData; CFDE_CSSNonInheritedData m_NonInheritedData; + + private: + uint32_t m_dwRefCount; std::vector m_CustomProperties; }; diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index f48789533c..a3783c3756 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -13,24 +13,10 @@ #include "xfa/fde/css/fde_csssyntax.h" #include "xfa/fgas/crt/fgas_codepage.h" -IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadFromBuffer( - const CFX_WideString& szUrl, - const FX_WCHAR* pBuffer, - int32_t iBufSize, - uint16_t wCodePage, - uint32_t dwMediaList) { - CFDE_CSSStyleSheet* pStyleSheet = new CFDE_CSSStyleSheet(dwMediaList); - if (!pStyleSheet->LoadFromBuffer(szUrl, pBuffer, iBufSize, wCodePage)) { - pStyleSheet->Release(); - pStyleSheet = nullptr; - } - return pStyleSheet; -} - -CFDE_CSSStyleSheet::CFDE_CSSStyleSheet(uint32_t dwMediaList) +CFDE_CSSStyleSheet::CFDE_CSSStyleSheet() : m_wCodePage(FX_CODEPAGE_UTF8), m_wRefCount(1), - m_dwMediaList(dwMediaList), + m_dwMediaList(FDE_CSSMEDIATYPE_ALL), m_RuleArray(100) { ASSERT(m_dwMediaList > 0); } @@ -68,9 +54,8 @@ uint32_t CFDE_CSSStyleSheet::Retain() { uint32_t CFDE_CSSStyleSheet::Release() { uint32_t dwRefCount = --m_wRefCount; - if (dwRefCount == 0) { + if (dwRefCount == 0) delete this; - } return dwRefCount; } @@ -95,16 +80,15 @@ IFDE_CSSRule* CFDE_CSSStyleSheet::GetRule(int32_t index) { return m_RuleArray.GetAt(index); } -bool CFDE_CSSStyleSheet::LoadFromBuffer(const CFX_WideString& szUrl, - const FX_WCHAR* pBuffer, - int32_t iBufSize, - uint16_t wCodePage) { +bool CFDE_CSSStyleSheet::LoadFromBuffer(const FX_WCHAR* pBuffer, + int32_t iBufSize) { ASSERT(pBuffer && iBufSize > 0); - std::unique_ptr pSyntax(new CFDE_CSSSyntaxParser); - bool bRet = pSyntax->Init(pBuffer, iBufSize) && LoadFromSyntax(pSyntax.get()); - m_wCodePage = wCodePage; - m_szUrl = szUrl; - return bRet; + + m_wCodePage = FX_CODEPAGE_UTF8; + m_szUrl = CFX_WideString(); + + auto pSyntax = pdfium::MakeUnique(); + return pSyntax->Init(pBuffer, iBufSize) && LoadFromSyntax(pSyntax.get()); } bool CFDE_CSSStyleSheet::LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax) { @@ -333,6 +317,10 @@ FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::SkipRuleSet( CFDE_CSSStyleRule::CFDE_CSSStyleRule() : m_ppSelector(nullptr), m_iSelectors(0) {} +FDE_CSSRuleType CFDE_CSSStyleRule::GetType() const { + return FDE_CSSRuleType::Style; +} + int32_t CFDE_CSSStyleRule::CountSelectorLists() const { return m_iSelectors; } @@ -373,6 +361,10 @@ CFDE_CSSMediaRule::~CFDE_CSSMediaRule() { } } +FDE_CSSRuleType CFDE_CSSMediaRule::GetType() const { + return FDE_CSSRuleType::Media; +} + uint32_t CFDE_CSSMediaRule::GetMediaList() const { return m_dwMediaList; } @@ -532,6 +524,6 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString( return pPseudoFirst; } -CFDE_CSSDeclaration* CFDE_CSSFontFaceRule::GetDeclaration() { - return &m_Declaration; +FDE_CSSRuleType CFDE_CSSFontFaceRule::GetType() const { + return FDE_CSSRuleType::FontFace; } diff --git a/xfa/fde/css/fde_cssstylesheet.h b/xfa/fde/css/fde_cssstylesheet.h index 0d038c9eb5..2fc195c9dd 100644 --- a/xfa/fde/css/fde_cssstylesheet.h +++ b/xfa/fde/css/fde_cssstylesheet.h @@ -38,33 +38,36 @@ class CFDE_CSSSelector { CFDE_CSSSelector* m_pNext; }; -class CFDE_CSSStyleRule : public IFDE_CSSStyleRule { +class CFDE_CSSStyleRule : public IFDE_CSSRule { public: CFDE_CSSStyleRule(); - // IFDE_CSSStyleRule - int32_t CountSelectorLists() const override; - CFDE_CSSSelector* GetSelectorList(int32_t index) const override; - CFDE_CSSDeclaration* GetDeclaration() override; + // IFDE_CSSRule + FDE_CSSRuleType GetType() const override; + int32_t CountSelectorLists() const; + CFDE_CSSSelector* GetSelectorList(int32_t index) const; + CFDE_CSSDeclaration* GetDeclaration(); CFDE_CSSDeclaration& GetDeclImp() { return m_Declaration; } void SetSelector(const CFX_ArrayTemplate& list); - protected: + private: CFDE_CSSDeclaration m_Declaration; CFDE_CSSSelector** m_ppSelector; int32_t m_iSelectors; }; -class CFDE_CSSMediaRule : public IFDE_CSSMediaRule { +class CFDE_CSSMediaRule : public IFDE_CSSRule { public: explicit CFDE_CSSMediaRule(uint32_t dwMediaList); ~CFDE_CSSMediaRule() override; - // IFDE_CSSMediaRule - uint32_t GetMediaList() const override; - int32_t CountRules() const override; - IFDE_CSSRule* GetRule(int32_t index) override; + // IFDE_CSSValue + FDE_CSSRuleType GetType() const override; + + uint32_t GetMediaList() const; + int32_t CountRules() const; + IFDE_CSSRule* GetRule(int32_t index); CFX_MassArrayTemplate& GetArray() { return m_RuleArray; } @@ -73,39 +76,35 @@ class CFDE_CSSMediaRule : public IFDE_CSSMediaRule { CFX_MassArrayTemplate m_RuleArray; }; -class CFDE_CSSFontFaceRule : public IFDE_CSSFontFaceRule { +class CFDE_CSSFontFaceRule : public IFDE_CSSRule { public: - // IFDE_CSSFontFaceRule - CFDE_CSSDeclaration* GetDeclaration() override; + // IFDE_CSSRule. + FDE_CSSRuleType GetType() const override; CFDE_CSSDeclaration& GetDeclImp() { return m_Declaration; } - protected: + private: CFDE_CSSDeclaration m_Declaration; }; -class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet { +class CFDE_CSSStyleSheet : public IFX_Retainable { public: - explicit CFDE_CSSStyleSheet(uint32_t dwMediaList); + CFDE_CSSStyleSheet(); ~CFDE_CSSStyleSheet() override; // IFX_Retainable: uint32_t Retain() override; uint32_t Release() override; - // IFDE_CSSStyleSheet: - bool GetUrl(CFX_WideString& szUrl) override; - uint32_t GetMediaList() const override; - uint16_t GetCodePage() const override; - int32_t CountRules() const override; - IFDE_CSSRule* GetRule(int32_t index) override; + bool LoadFromBuffer(const FX_WCHAR* pBuffer, int32_t iBufSize); - bool LoadFromBuffer(const CFX_WideString& szUrl, - const FX_WCHAR* pBuffer, - int32_t iBufSize, - uint16_t wCodePage); + bool GetUrl(CFX_WideString& szUrl); + uint32_t GetMediaList() const; + uint16_t GetCodePage() const; + int32_t CountRules() const; + IFDE_CSSRule* GetRule(int32_t index); - protected: + private: void Reset(); bool LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax); FDE_CSSSyntaxStatus LoadStyleRule( -- cgit v1.2.3