diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-07-27 11:58:31 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-27 17:06:59 +0000 |
commit | 2b70ec2d6df96bdf6f72cfac7a8cbbcdd1293d8c (patch) | |
tree | b586aa34419d4aa22fe50a1a01922fc87fb02c84 | |
parent | 6f38b4b29c8daa41fe91cc5161d3d75511167ec6 (diff) | |
download | pdfium-2b70ec2d6df96bdf6f72cfac7a8cbbcdd1293d8c.tar.xz |
The FDE CSS code does not use the CFGAS_FontMgr
The CFGAS_FontMgr is being provided to the CSS style selector in order
to pas it to the RulesCollection. The RulesCollection does not use the
font manager so remove the font manager from the CSS code.
Change-Id: I61a4a5060053615935902cb31fbc12d9856acded
Reviewed-on: https://pdfium-review.googlesource.com/9270
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | xfa/fde/css/cfde_cssrulecollection.cpp | 8 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssrulecollection.h | 6 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssstyleselector.cpp | 5 | ||||
-rw-r--r-- | xfa/fde/css/cfde_cssstyleselector.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_textparser.cpp | 6 |
5 files changed, 10 insertions, 19 deletions
diff --git a/xfa/fde/css/cfde_cssrulecollection.cpp b/xfa/fde/css/cfde_cssrulecollection.cpp index e318651137..b945fd518b 100644 --- a/xfa/fde/css/cfde_cssrulecollection.cpp +++ b/xfa/fde/css/cfde_cssrulecollection.cpp @@ -33,16 +33,14 @@ CFDE_CSSRuleCollection::GetTagRuleData(const CFX_WideString& tagname) const { return it != m_TagRules.end() ? &it->second : nullptr; } -void CFDE_CSSRuleCollection::AddRulesFrom(const CFDE_CSSStyleSheet* sheet, - CFGAS_FontMgr* pFontMgr) { +void CFDE_CSSRuleCollection::AddRulesFrom(const CFDE_CSSStyleSheet* sheet) { int32_t iRules = sheet->CountRules(); for (int32_t j = 0; j < iRules; j++) - AddRulesFrom(sheet, sheet->GetRule(j), pFontMgr); + AddRulesFrom(sheet, sheet->GetRule(j)); } void CFDE_CSSRuleCollection::AddRulesFrom(const CFDE_CSSStyleSheet* pStyleSheet, - CFDE_CSSStyleRule* pStyleRule, - CFGAS_FontMgr* pFontMgr) { + CFDE_CSSStyleRule* pStyleRule) { CFDE_CSSDeclaration* pDeclaration = pStyleRule->GetDeclaration(); int32_t iSelectors = pStyleRule->CountSelectorLists(); for (int32_t i = 0; i < iSelectors; ++i) { diff --git a/xfa/fde/css/cfde_cssrulecollection.h b/xfa/fde/css/cfde_cssrulecollection.h index 5d49922fcd..e9ce7c31d3 100644 --- a/xfa/fde/css/cfde_cssrulecollection.h +++ b/xfa/fde/css/cfde_cssrulecollection.h @@ -17,7 +17,6 @@ class CFDE_CSSDeclaration; class CFDE_CSSSelector; class CFDE_CSSStyleRule; class CFDE_CSSStyleSheet; -class CFGAS_FontMgr; class CFDE_CSSRuleCollection { public: @@ -32,7 +31,7 @@ class CFDE_CSSRuleCollection { CFDE_CSSRuleCollection(); ~CFDE_CSSRuleCollection(); - void AddRulesFrom(const CFDE_CSSStyleSheet* sheet, CFGAS_FontMgr* pFontMgr); + void AddRulesFrom(const CFDE_CSSStyleSheet* sheet); void Clear(); int32_t CountSelectors() const { return m_iSelectors; } @@ -41,8 +40,7 @@ class CFDE_CSSRuleCollection { private: void AddRulesFrom(const CFDE_CSSStyleSheet* pStyleSheet, - CFDE_CSSStyleRule* pRule, - CFGAS_FontMgr* pFontMgr); + CFDE_CSSStyleRule* pRule); std::map<uint32_t, std::vector<std::unique_ptr<Data>>> m_TagRules; int32_t m_iSelectors; diff --git a/xfa/fde/css/cfde_cssstyleselector.cpp b/xfa/fde/css/cfde_cssstyleselector.cpp index 51e60bce4f..141e74c865 100644 --- a/xfa/fde/css/cfde_cssstyleselector.cpp +++ b/xfa/fde/css/cfde_cssstyleselector.cpp @@ -22,8 +22,7 @@ #include "xfa/fde/css/cfde_csssyntaxparser.h" #include "xfa/fde/css/cfde_cssvaluelist.h" -CFDE_CSSStyleSelector::CFDE_CSSStyleSelector(CFGAS_FontMgr* pFontMgr) - : m_pFontMgr(pFontMgr), m_fDefFontSize(12.0f) {} +CFDE_CSSStyleSelector::CFDE_CSSStyleSelector() : m_fDefFontSize(12.0f) {} CFDE_CSSStyleSelector::~CFDE_CSSStyleSelector() {} @@ -47,7 +46,7 @@ void CFDE_CSSStyleSelector::SetUAStyleSheet( void CFDE_CSSStyleSelector::UpdateStyleIndex() { m_UARules.Clear(); - m_UARules.AddRulesFrom(m_UAStyles.get(), m_pFontMgr.Get()); + m_UARules.AddRulesFrom(m_UAStyles.get()); } std::vector<const CFDE_CSSDeclaration*> diff --git a/xfa/fde/css/cfde_cssstyleselector.h b/xfa/fde/css/cfde_cssstyleselector.h index 6f40c968c7..7ead812fd2 100644 --- a/xfa/fde/css/cfde_cssstyleselector.h +++ b/xfa/fde/css/cfde_cssstyleselector.h @@ -23,11 +23,10 @@ class CFDE_CSSSelector; class CFDE_CSSStyleSheet; class CFDE_CSSValue; class CFDE_CSSValueList; -class CFGAS_FontMgr; class CFDE_CSSStyleSelector { public: - explicit CFDE_CSSStyleSelector(CFGAS_FontMgr* pFontMgr); + CFDE_CSSStyleSelector(); ~CFDE_CSSStyleSelector(); void SetDefFontSize(float fFontSize); @@ -78,7 +77,6 @@ class CFDE_CSSStyleSelector { uint32_t ToTextDecoration(const CFX_RetainPtr<CFDE_CSSValueList>& pList); FDE_CSSFontVariant ToFontVariant(FDE_CSSPropertyValue eValue); - CFX_UnownedPtr<CFGAS_FontMgr> const m_pFontMgr; float m_fDefFontSize; std::unique_ptr<CFDE_CSSStyleSheet> m_UAStyles; CFDE_CSSRuleCollection m_UARules; diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp index c74cf50900..de5490a766 100644 --- a/xfa/fxfa/cxfa_textparser.cpp +++ b/xfa/fxfa/cxfa_textparser.cpp @@ -56,10 +56,8 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) { return; if (!m_pSelector) { - CXFA_FFDoc* pDoc = pTextProvider->GetDocNode(); - CFGAS_FontMgr* pFontMgr = pDoc->GetApp()->GetFDEFontMgr(); - ASSERT(pFontMgr); - m_pSelector = pdfium::MakeUnique<CFDE_CSSStyleSelector>(pFontMgr); + m_pSelector = pdfium::MakeUnique<CFDE_CSSStyleSelector>(); + CXFA_Font font = pTextProvider->GetFontNode(); m_pSelector->SetDefFontSize(font ? font.GetFontSize() : 10.0f); } |