summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-01-16 16:03:44 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-01-16 21:14:58 +0000
commitcfb856c4744a9e0ff0f0db5602d0a13c835570ce (patch)
tree8880b3041fd6d780a630ba49813a17a608b83d35 /xfa/fxfa/app
parent135609831bcad2da79d720cfdd3b55929b48b0ea (diff)
downloadpdfium-cfb856c4744a9e0ff0f0db5602d0a13c835570ce.tar.xz
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 <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r--xfa/fxfa/app/cxfa_loadercontext.h4
-rw-r--r--xfa/fxfa/app/cxfa_textlayout.cpp43
-rw-r--r--xfa/fxfa/app/cxfa_textlayout.h10
-rw-r--r--xfa/fxfa/app/cxfa_textparsecontext.cpp1
-rw-r--r--xfa/fxfa/app/cxfa_textparsecontext.h4
-rw-r--r--xfa/fxfa/app/cxfa_textparser.cpp138
-rw-r--r--xfa/fxfa/app/cxfa_textparser.h44
-rw-r--r--xfa/fxfa/app/cxfa_textuserdata.cpp5
-rw-r--r--xfa/fxfa/app/cxfa_textuserdata.h8
9 files changed, 125 insertions, 132 deletions
diff --git a/xfa/fxfa/app/cxfa_loadercontext.h b/xfa/fxfa/app/cxfa_loadercontext.h
index 39d2adc74d..c647f62a33 100644
--- a/xfa/fxfa/app/cxfa_loadercontext.h
+++ b/xfa/fxfa/app/cxfa_loadercontext.h
@@ -14,7 +14,7 @@
class CFDE_XMLNode;
class CXFA_Node;
-class IFDE_CSSComputedStyle;
+class CFDE_CSSComputedStyle;
class CXFA_LoaderContext {
public:
@@ -31,7 +31,7 @@ class CXFA_LoaderContext {
int32_t m_iTotalLines;
CFDE_XMLNode* m_pXMLNode;
CXFA_Node* m_pNode;
- IFDE_CSSComputedStyle* m_pParentStyle;
+ CFDE_CSSComputedStyle* m_pParentStyle;
CFX_ArrayTemplate<FX_FLOAT> m_lineHeights;
uint32_t m_dwFlags;
std::vector<FX_FLOAT> m_BlocksHeight;
diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp
index 47f40ac04f..a1870f1f58 100644
--- a/xfa/fxfa/app/cxfa_textlayout.cpp
+++ b/xfa/fxfa/app/cxfa_textlayout.cpp
@@ -11,6 +11,7 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_path.h"
+#include "xfa/fde/css/fde_cssstyleselector.h"
#include "xfa/fde/fde_gedevice.h"
#include "xfa/fde/fde_object.h"
#include "xfa/fde/xml/fde_xml_imp.h"
@@ -171,21 +172,20 @@ void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) {
m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f);
}
-void CXFA_TextLayout::InitBreak(IFDE_CSSComputedStyle* pStyle,
+void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
FDE_CSSDisplay eDisplay,
FX_FLOAT fLineWidth,
CFDE_XMLNode* pXMLNode,
- IFDE_CSSComputedStyle* pParentStyle) {
+ CFDE_CSSComputedStyle* pParentStyle) {
if (!pStyle) {
InitBreak(fLineWidth);
return;
}
- IFDE_CSSParagraphStyle* pParaStyle = pStyle->GetParagraphStyles();
if (eDisplay == FDE_CSSDisplay::Block ||
eDisplay == FDE_CSSDisplay::ListItem) {
int32_t iAlign = FX_RTFLINEALIGNMENT_Left;
- switch (pParaStyle->GetTextAlign()) {
+ switch (pStyle->GetTextAlign()) {
case FDE_CSSTextAlign::Right:
iAlign = FX_RTFLINEALIGNMENT_Right;
break;
@@ -203,9 +203,8 @@ void CXFA_TextLayout::InitBreak(IFDE_CSSComputedStyle* pStyle,
}
m_pBreak->SetAlignment(iAlign);
FX_FLOAT fStart = 0;
- const FDE_CSSRECT* pRect = pStyle->GetBoundaryStyles()->GetMarginWidth();
- const FDE_CSSRECT* pPaddingRect =
- pStyle->GetBoundaryStyles()->GetPaddingWidth();
+ const FDE_CSSRECT* pRect = pStyle->GetMarginWidth();
+ const FDE_CSSRECT* pPaddingRect = pStyle->GetPaddingWidth();
if (pRect) {
fStart = pRect->left.GetValue();
fLineWidth -= pRect->right.GetValue();
@@ -214,10 +213,8 @@ void CXFA_TextLayout::InitBreak(IFDE_CSSComputedStyle* pStyle,
fLineWidth -= pPaddingRect->right.GetValue();
}
if (eDisplay == FDE_CSSDisplay::ListItem) {
- const FDE_CSSRECT* pParRect =
- pParentStyle->GetBoundaryStyles()->GetMarginWidth();
- const FDE_CSSRECT* pParPaddingRect =
- pParentStyle->GetBoundaryStyles()->GetPaddingWidth();
+ const FDE_CSSRECT* pParRect = pParentStyle->GetMarginWidth();
+ const FDE_CSSRECT* pParPaddingRect = pParentStyle->GetPaddingWidth();
if (pParRect) {
fStart += pParRect->left.GetValue();
fLineWidth -= pParRect->right.GetValue();
@@ -231,11 +228,11 @@ void CXFA_TextLayout::InitBreak(IFDE_CSSComputedStyle* pStyle,
pNewRect.right.Set(FDE_CSSLengthUnit::Point, pRect->right.GetValue());
pNewRect.top.Set(FDE_CSSLengthUnit::Point, pRect->top.GetValue());
pNewRect.bottom.Set(FDE_CSSLengthUnit::Point, pRect->bottom.GetValue());
- pStyle->GetBoundaryStyles()->SetMarginWidth(pNewRect);
+ pStyle->SetMarginWidth(pNewRect);
}
}
m_pBreak->SetLineBoundary(fStart, fLineWidth);
- FX_FLOAT fIndent = pParaStyle->GetTextIndent().GetValue();
+ FX_FLOAT fIndent = pStyle->GetTextIndent().GetValue();
if (fIndent > 0)
fStart += fIndent;
@@ -257,7 +254,7 @@ void CXFA_TextLayout::InitBreak(IFDE_CSSComputedStyle* pStyle,
m_pBreak->SetHorizontalScale(
m_textParser.GetHorScale(m_pTextProvider, pStyle, pXMLNode));
m_pBreak->SetVerticalScale(m_textParser.GetVerScale(m_pTextProvider, pStyle));
- m_pBreak->SetCharSpace(pParaStyle->GetLetterSpacing().GetValue());
+ m_pBreak->SetCharSpace(pStyle->GetLetterSpacing().GetValue());
}
int32_t CXFA_TextLayout::GetText(CFX_WideString& wsText) {
@@ -679,7 +676,7 @@ bool CXFA_TextLayout::Loader(const CFX_SizeF& szText,
if (!m_textParser.IsParsed())
m_textParser.DoParse(pXMLContainer, m_pTextProvider);
- IFDE_CSSComputedStyle* pRootStyle =
+ CFDE_CSSComputedStyle* pRootStyle =
m_textParser.CreateRootStyle(m_pTextProvider);
LoadRichText(pXMLContainer, szText, fLinePos, pRootStyle, bSavePieces);
pRootStyle->Release();
@@ -726,7 +723,7 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode,
bool CXFA_TextLayout::LoadRichText(CFDE_XMLNode* pXMLNode,
const CFX_SizeF& szText,
FX_FLOAT& fLinePos,
- IFDE_CSSComputedStyle* pParentStyle,
+ CFDE_CSSComputedStyle* pParentStyle,
bool bSavePieces,
CXFA_LinkUserData* pLinkData,
bool bEndBreak,
@@ -740,7 +737,7 @@ bool CXFA_TextLayout::LoadRichText(CFDE_XMLNode* pXMLNode,
FDE_CSSDisplay eDisplay = FDE_CSSDisplay::None;
bool bContentNode = false;
FX_FLOAT fSpaceBelow = 0;
- IFDE_CSSComputedStyle* pStyle = nullptr;
+ CFDE_CSSComputedStyle* pStyle = nullptr;
CFX_WideString wsName;
if (bEndBreak) {
bool bCurOl = false;
@@ -778,8 +775,7 @@ bool CXFA_TextLayout::LoadRichText(CFDE_XMLNode* pXMLNode,
(wsName.IsEmpty() ||
(wsName != FX_WSTRC(L"body") && wsName != FX_WSTRC(L"html") &&
wsName != FX_WSTRC(L"ol") && wsName != FX_WSTRC(L"ul")))) {
- const FDE_CSSRECT* pRect =
- pStyle->GetBoundaryStyles()->GetMarginWidth();
+ const FDE_CSSRECT* pRect = pStyle->GetMarginWidth();
if (pRect) {
fLinePos += pRect->top.GetValue();
fSpaceBelow = pRect->bottom.GetValue();
@@ -1001,7 +997,7 @@ void CXFA_TextLayout::EndBreak(uint32_t dwStatus,
AppendTextLine(dwStatus, fLinePos, bSavePieces, true);
}
-void CXFA_TextLayout::DoTabstops(IFDE_CSSComputedStyle* pStyle,
+void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle,
CXFA_PieceLine* pPieceLine) {
if (!m_pTabstopContext || m_pTabstopContext->m_iTabCount == 0)
return;
@@ -1065,7 +1061,7 @@ void CXFA_TextLayout::AppendTextLine(uint32_t dwStatus,
if (iPieces < 1)
return;
- IFDE_CSSComputedStyle* pStyle = nullptr;
+ CFDE_CSSComputedStyle* pStyle = nullptr;
if (bSavePieces) {
CXFA_PieceLine* pPieceLine = new CXFA_PieceLine;
m_pieceLines.Add(pPieceLine);
@@ -1190,12 +1186,11 @@ void CXFA_TextLayout::AppendTextLine(uint32_t dwStatus,
if (pStyle) {
FX_FLOAT fStart = 0;
- const FDE_CSSRECT* pRect = pStyle->GetBoundaryStyles()->GetMarginWidth();
+ const FDE_CSSRECT* pRect = pStyle->GetMarginWidth();
if (pRect)
fStart = pRect->left.GetValue();
- FX_FLOAT fTextIndent =
- pStyle->GetParagraphStyles()->GetTextIndent().GetValue();
+ FX_FLOAT fTextIndent = pStyle->GetTextIndent().GetValue();
if (fTextIndent < 0)
fStart -= fTextIndent;
diff --git a/xfa/fxfa/app/cxfa_textlayout.h b/xfa/fxfa/app/cxfa_textlayout.h
index 7c34d0d323..8575071faa 100644
--- a/xfa/fxfa/app/cxfa_textlayout.h
+++ b/xfa/fxfa/app/cxfa_textlayout.h
@@ -17,6 +17,7 @@
#include "xfa/fxfa/app/cxfa_textparser.h"
class CFDE_Brush;
+class CFDE_CSSComputedStyle;
class CFDE_Pen;
class CFDE_RenderDevice;
class CFDE_XMLNode;
@@ -27,7 +28,6 @@ class CXFA_Node;
class CXFA_PieceLine;
class CXFA_TextProvider;
class CXFA_TextTabstopsContext;
-class IFDE_CSSComputedStyle;
class XFA_TextPiece;
class CXFA_TextLayout {
@@ -64,11 +64,11 @@ class CXFA_TextLayout {
CFDE_XMLNode* GetXMLContainerNode();
CFX_RTFBreak* CreateBreak(bool bDefault);
void InitBreak(FX_FLOAT fLineWidth);
- void InitBreak(IFDE_CSSComputedStyle* pStyle,
+ void InitBreak(CFDE_CSSComputedStyle* pStyle,
FDE_CSSDisplay eDisplay,
FX_FLOAT fLineWidth,
CFDE_XMLNode* pXMLNode,
- IFDE_CSSComputedStyle* pParentStyle = nullptr);
+ CFDE_CSSComputedStyle* pParentStyle = nullptr);
bool Loader(const CFX_SizeF& szText,
FX_FLOAT& fLinePos,
bool bSavePieces = true);
@@ -79,7 +79,7 @@ class CXFA_TextLayout {
bool LoadRichText(CFDE_XMLNode* pXMLNode,
const CFX_SizeF& szText,
FX_FLOAT& fLinePos,
- IFDE_CSSComputedStyle* pParentStyle,
+ CFDE_CSSComputedStyle* pParentStyle,
bool bSavePieces,
CXFA_LinkUserData* pLinkData = nullptr,
bool bEndBreak = true,
@@ -113,7 +113,7 @@ class CXFA_TextLayout {
FXTEXT_CHARPOS* pCharPos,
bool bCharCode = false);
bool ToRun(const XFA_TextPiece* pPiece, FX_RTFTEXTOBJ& tr);
- void DoTabstops(IFDE_CSSComputedStyle* pStyle, CXFA_PieceLine* pPieceLine);
+ void DoTabstops(CFDE_CSSComputedStyle* pStyle, CXFA_PieceLine* pPieceLine);
bool Layout(int32_t iBlock);
int32_t CountBlocks() const;
diff --git a/xfa/fxfa/app/cxfa_textparsecontext.cpp b/xfa/fxfa/app/cxfa_textparsecontext.cpp
index c1747c2c18..e416242309 100644
--- a/xfa/fxfa/app/cxfa_textparsecontext.cpp
+++ b/xfa/fxfa/app/cxfa_textparsecontext.cpp
@@ -7,6 +7,7 @@
#include "xfa/fxfa/app/cxfa_textparsecontext.h"
#include "xfa/fde/css/fde_cssdeclaration.h"
+#include "xfa/fde/css/fde_cssstyleselector.h"
CXFA_TextParseContext::CXFA_TextParseContext()
: m_pParentStyle(nullptr),
diff --git a/xfa/fxfa/app/cxfa_textparsecontext.h b/xfa/fxfa/app/cxfa_textparsecontext.h
index db39af7c54..2faaadb440 100644
--- a/xfa/fxfa/app/cxfa_textparsecontext.h
+++ b/xfa/fxfa/app/cxfa_textparsecontext.h
@@ -10,7 +10,7 @@
#include "xfa/fde/css/fde_css.h"
class CFDE_CSSDeclaration;
-class IFDE_CSSComputedStyle;
+class CFDE_CSSComputedStyle;
class CXFA_TextParseContext {
public:
@@ -26,7 +26,7 @@ class CXFA_TextParseContext {
}
uint32_t CountDecls() const { return m_dwMatchedDecls; }
- IFDE_CSSComputedStyle* m_pParentStyle;
+ CFDE_CSSComputedStyle* m_pParentStyle;
protected:
CFDE_CSSDeclaration** m_ppMatchedDecls;
diff --git a/xfa/fxfa/app/cxfa_textparser.cpp b/xfa/fxfa/app/cxfa_textparser.cpp
index 8fe923b058..77f22515be 100644
--- a/xfa/fxfa/app/cxfa_textparser.cpp
+++ b/xfa/fxfa/app/cxfa_textparser.cpp
@@ -11,6 +11,7 @@
#include "third_party/base/ptr_util.h"
#include "xfa/fde/css/fde_css.h"
#include "xfa/fde/css/fde_cssstyleselector.h"
+#include "xfa/fde/css/fde_cssstylesheet.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fxfa/app/cxfa_csstagprovider.h"
@@ -80,7 +81,7 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) {
}
}
-IFDE_CSSStyleSheet* CXFA_TextParser::LoadDefaultSheetStyle() {
+CFDE_CSSStyleSheet* CXFA_TextParser::LoadDefaultSheetStyle() {
static const FX_WCHAR s_pStyle[] =
L"html,body,ol,p,ul{display:block}"
L"li{display:list-item}"
@@ -90,17 +91,20 @@ IFDE_CSSStyleSheet* CXFA_TextParser::LoadDefaultSheetStyle() {
L"style:italic}"
L"sup{vertical-align:+15em;font-size:.66em}sub{vertical-align:-15em;font-"
L"size:.66em}";
- return IFDE_CSSStyleSheet::LoadFromBuffer(
- CFX_WideString(), s_pStyle, FXSYS_wcslen(s_pStyle), FX_CODEPAGE_UTF8);
+
+ CFDE_CSSStyleSheet* pStyleSheet = new CFDE_CSSStyleSheet();
+ if (!pStyleSheet->LoadFromBuffer(s_pStyle, FXSYS_wcslen(s_pStyle))) {
+ pStyleSheet->Release();
+ pStyleSheet = nullptr;
+ }
+ return pStyleSheet;
}
-IFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle(
+CFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle(
CXFA_TextProvider* pTextProvider) {
CXFA_Font font = pTextProvider->GetFontNode();
CXFA_Para para = pTextProvider->GetParaNode();
- IFDE_CSSComputedStyle* pStyle = m_pSelector->CreateComputedStyle(nullptr);
- IFDE_CSSFontStyle* pFontStyle = pStyle->GetFontStyles();
- IFDE_CSSParagraphStyle* pParaStyle = pStyle->GetParagraphStyles();
+ CFDE_CSSComputedStyle* pStyle = m_pSelector->CreateComputedStyle(nullptr);
FX_FLOAT fLineHeight = 0;
FX_FLOAT fFontSize = 10;
@@ -108,7 +112,7 @@ IFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle(
fLineHeight = para.GetLineHeight();
FDE_CSSLENGTH indent;
indent.Set(FDE_CSSLengthUnit::Point, para.GetTextIndent());
- pParaStyle->SetTextIndent(indent);
+ pStyle->SetTextIndent(indent);
FDE_CSSTextAlign hAlign = FDE_CSSTextAlign::Left;
switch (para.GetHorizontalAlign()) {
case XFA_ATTRIBUTEENUM_Center:
@@ -124,26 +128,25 @@ IFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle(
hAlign = FDE_CSSTextAlign::JustifyAll;
break;
}
- pParaStyle->SetTextAlign(hAlign);
+ pStyle->SetTextAlign(hAlign);
FDE_CSSRECT rtMarginWidth;
rtMarginWidth.left.Set(FDE_CSSLengthUnit::Point, para.GetMarginLeft());
rtMarginWidth.top.Set(FDE_CSSLengthUnit::Point, para.GetSpaceAbove());
rtMarginWidth.right.Set(FDE_CSSLengthUnit::Point, para.GetMarginRight());
rtMarginWidth.bottom.Set(FDE_CSSLengthUnit::Point, para.GetSpaceBelow());
- pStyle->GetBoundaryStyles()->SetMarginWidth(rtMarginWidth);
+ pStyle->SetMarginWidth(rtMarginWidth);
}
if (font) {
- pFontStyle->SetColor(font.GetColor());
- pFontStyle->SetFontStyle(font.IsItalic() ? FDE_CSSFontStyle::Italic
- : FDE_CSSFontStyle::Normal);
- pFontStyle->SetFontWeight(font.IsBold() ? FXFONT_FW_BOLD
- : FXFONT_FW_NORMAL);
- pParaStyle->SetNumberVerticalAlign(-font.GetBaselineShift());
+ pStyle->SetColor(font.GetColor());
+ pStyle->SetFontStyle(font.IsItalic() ? FDE_CSSFontStyle::Italic
+ : FDE_CSSFontStyle::Normal);
+ pStyle->SetFontWeight(font.IsBold() ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL);
+ pStyle->SetNumberVerticalAlign(-font.GetBaselineShift());
fFontSize = font.GetFontSize();
FDE_CSSLENGTH letterSpacing;
letterSpacing.Set(FDE_CSSLengthUnit::Point, font.GetLetterSpacing());
- pParaStyle->SetLetterSpacing(letterSpacing);
+ pStyle->SetLetterSpacing(letterSpacing);
uint32_t dwDecoration = 0;
if (font.GetLineThrough() > 0)
dwDecoration |= FDE_CSSTEXTDECORATION_LineThrough;
@@ -152,43 +155,38 @@ IFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle(
else if (font.GetUnderline() > 0)
dwDecoration |= FDE_CSSTEXTDECORATION_Underline;
- pParaStyle->SetTextDecoration(dwDecoration);
+ pStyle->SetTextDecoration(dwDecoration);
}
- pParaStyle->SetLineHeight(fLineHeight);
- pFontStyle->SetFontSize(fFontSize);
+ pStyle->SetLineHeight(fLineHeight);
+ pStyle->SetFontSize(fFontSize);
return pStyle;
}
-IFDE_CSSComputedStyle* CXFA_TextParser::CreateStyle(
- IFDE_CSSComputedStyle* pParentStyle) {
- IFDE_CSSComputedStyle* pNewStyle =
+CFDE_CSSComputedStyle* CXFA_TextParser::CreateStyle(
+ CFDE_CSSComputedStyle* pParentStyle) {
+ CFDE_CSSComputedStyle* pNewStyle =
m_pSelector->CreateComputedStyle(pParentStyle);
ASSERT(pNewStyle);
if (!pParentStyle)
return pNewStyle;
- IFDE_CSSParagraphStyle* pParaStyle = pParentStyle->GetParagraphStyles();
- uint32_t dwDecoration = pParaStyle->GetTextDecoration();
+ uint32_t dwDecoration = pParentStyle->GetTextDecoration();
FX_FLOAT fBaseLine = 0;
- if (pParaStyle->GetVerticalAlign() == FDE_CSSVerticalAlign::Number)
- fBaseLine = pParaStyle->GetNumberVerticalAlign();
-
- pParaStyle = pNewStyle->GetParagraphStyles();
- pParaStyle->SetTextDecoration(dwDecoration);
- pParaStyle->SetNumberVerticalAlign(fBaseLine);
-
- IFDE_CSSBoundaryStyle* pBoundarytyle = pParentStyle->GetBoundaryStyles();
- const FDE_CSSRECT* pRect = pBoundarytyle->GetMarginWidth();
- if (pRect) {
- pBoundarytyle = pNewStyle->GetBoundaryStyles();
- pBoundarytyle->SetMarginWidth(*pRect);
- }
+ if (pParentStyle->GetVerticalAlign() == FDE_CSSVerticalAlign::Number)
+ fBaseLine = pParentStyle->GetNumberVerticalAlign();
+
+ pNewStyle->SetTextDecoration(dwDecoration);
+ pNewStyle->SetNumberVerticalAlign(fBaseLine);
+
+ const FDE_CSSRECT* pRect = pParentStyle->GetMarginWidth();
+ if (pRect)
+ pNewStyle->SetMarginWidth(*pRect);
return pNewStyle;
}
-IFDE_CSSComputedStyle* CXFA_TextParser::ComputeStyle(
+CFDE_CSSComputedStyle* CXFA_TextParser::ComputeStyle(
CFDE_XMLNode* pXMLNode,
- IFDE_CSSComputedStyle* pParentStyle) {
+ CFDE_CSSComputedStyle* pParentStyle) {
auto it = m_mapXMLNodeToParseContext.find(pXMLNode);
if (it == m_mapXMLNodeToParseContext.end())
return nullptr;
@@ -205,7 +203,7 @@ IFDE_CSSComputedStyle* CXFA_TextParser::ComputeStyle(
if (tagProvider.m_bContent)
return nullptr;
- IFDE_CSSComputedStyle* pStyle = CreateStyle(pParentStyle);
+ CFDE_CSSComputedStyle* pStyle = CreateStyle(pParentStyle);
CFDE_CSSAccelerator* pCSSAccel = m_pSelector->InitAccelerator();
pCSSAccel->OnEnterTag(&tagProvider);
m_pSelector->ComputeStyle(&tagProvider, pContext->GetDecls(),
@@ -221,13 +219,13 @@ void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer,
m_bParsed = true;
InitCSSData(pTextProvider);
- IFDE_CSSComputedStyle* pRootStyle = CreateRootStyle(pTextProvider);
+ CFDE_CSSComputedStyle* pRootStyle = CreateRootStyle(pTextProvider);
ParseRichText(pXMLContainer, pRootStyle);
pRootStyle->Release();
}
void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode,
- IFDE_CSSComputedStyle* pParentStyle) {
+ CFDE_CSSComputedStyle* pParentStyle) {
if (!pXMLNode)
return;
@@ -236,7 +234,7 @@ void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode,
if (!tagProvider.m_bTagAvailable)
return;
- IFDE_CSSComputedStyle* pNewStyle = nullptr;
+ CFDE_CSSComputedStyle* pNewStyle = nullptr;
if ((tagProvider.GetTagName() != FX_WSTRC(L"body")) ||
(tagProvider.GetTagName() != FX_WSTRC(L"html"))) {
CXFA_TextParseContext* pTextContext = new CXFA_TextParseContext;
@@ -256,7 +254,7 @@ void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode,
if (iMatchedDecls > 0)
pTextContext->SetDecls(ppMatchDecls, iMatchedDecls);
- eDisplay = pNewStyle->GetPositionStyles()->GetDisplay();
+ eDisplay = pNewStyle->GetDisplay();
}
pTextContext->SetDisplay(eDisplay);
m_mapXMLNodeToParseContext[pXMLNode] = pTextContext;
@@ -318,21 +316,21 @@ int32_t CXFA_TextParser::GetVAlign(CXFA_TextProvider* pTextProvider) const {
return para ? para.GetVerticalAlign() : XFA_ATTRIBUTEENUM_Top;
}
-FX_FLOAT CXFA_TextParser::GetTabInterval(IFDE_CSSComputedStyle* pStyle) const {
+FX_FLOAT CXFA_TextParser::GetTabInterval(CFDE_CSSComputedStyle* pStyle) const {
CFX_WideString wsValue;
if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"tab-interval"), wsValue))
return CXFA_Measurement(wsValue.AsStringC()).ToUnit(XFA_UNIT_Pt);
return 36;
}
-int32_t CXFA_TextParser::CountTabs(IFDE_CSSComputedStyle* pStyle) const {
+int32_t CXFA_TextParser::CountTabs(CFDE_CSSComputedStyle* pStyle) const {
CFX_WideString wsValue;
if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-tab-count"), wsValue))
return wsValue.GetInteger();
return 0;
}
-bool CXFA_TextParser::IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const {
+bool CXFA_TextParser::IsSpaceRun(CFDE_CSSComputedStyle* pStyle) const {
CFX_WideString wsValue;
if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-spacerun"), wsValue)) {
wsValue.MakeLower();
@@ -343,7 +341,7 @@ bool CXFA_TextParser::IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const {
CFX_RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont(
CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle) const {
+ CFDE_CSSComputedStyle* pStyle) const {
CFX_WideStringC wsFamily = FX_WSTRC(L"Courier");
uint32_t dwStyle = 0;
CXFA_Font font = pTextProvider->GetFontNode();
@@ -356,15 +354,14 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont(
}
if (pStyle) {
- IFDE_CSSFontStyle* pFontStyle = pStyle->GetFontStyles();
- int32_t iCount = pFontStyle->CountFontFamilies();
+ int32_t iCount = pStyle->CountFontFamilies();
if (iCount > 0)
- wsFamily = pFontStyle->GetFontFamily(iCount - 1);
+ wsFamily = pStyle->GetFontFamily(iCount - 1);
dwStyle = 0;
- if (pFontStyle->GetFontWeight() > FXFONT_FW_NORMAL)
+ if (pStyle->GetFontWeight() > FXFONT_FW_NORMAL)
dwStyle |= FX_FONTSTYLE_Bold;
- if (pFontStyle->GetFontStyle() == FDE_CSSFontStyle::Italic)
+ if (pStyle->GetFontStyle() == FDE_CSSFontStyle::Italic)
dwStyle |= FX_FONTSTYLE_Italic;
}
@@ -374,9 +371,9 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont(
}
FX_FLOAT CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle) const {
+ CFDE_CSSComputedStyle* pStyle) const {
if (pStyle)
- return pStyle->GetFontStyles()->GetFontSize();
+ return pStyle->GetFontSize();
CXFA_Font font = pTextProvider->GetFontNode();
if (font)
@@ -385,7 +382,7 @@ FX_FLOAT CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider,
}
int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle,
+ CFDE_CSSComputedStyle* pStyle,
CFDE_XMLNode* pXMLNode) const {
if (pStyle) {
CFX_WideString wsValue;
@@ -412,7 +409,7 @@ int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider,
}
int32_t CXFA_TextParser::GetVerScale(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle) const {
+ CFDE_CSSComputedStyle* pStyle) const {
if (pStyle) {
CFX_WideString wsValue;
if (pStyle->GetCustomStyle(FX_WSTRC(L"xfa-font-vertical-scale"), wsValue))
@@ -425,7 +422,7 @@ int32_t CXFA_TextParser::GetVerScale(CXFA_TextProvider* pTextProvider,
}
void CXFA_TextParser::GetUnderline(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle,
+ CFDE_CSSComputedStyle* pStyle,
int32_t& iUnderline,
int32_t& iPeriod) const {
iUnderline = 0;
@@ -439,7 +436,7 @@ void CXFA_TextParser::GetUnderline(CXFA_TextProvider* pTextProvider,
return;
}
- uint32_t dwDecoration = pStyle->GetParagraphStyles()->GetTextDecoration();
+ uint32_t dwDecoration = pStyle->GetTextDecoration();
if (dwDecoration & FDE_CSSTEXTDECORATION_Double)
iUnderline = 2;
else if (dwDecoration & FDE_CSSTEXTDECORATION_Underline)
@@ -455,10 +452,10 @@ void CXFA_TextParser::GetUnderline(CXFA_TextProvider* pTextProvider,
}
void CXFA_TextParser::GetLinethrough(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle,
+ CFDE_CSSComputedStyle* pStyle,
int32_t& iLinethrough) const {
if (pStyle) {
- uint32_t dwDecoration = pStyle->GetParagraphStyles()->GetTextDecoration();
+ uint32_t dwDecoration = pStyle->GetTextDecoration();
iLinethrough = (dwDecoration & FDE_CSSTEXTDECORATION_LineThrough) ? 1 : 0;
return;
}
@@ -469,9 +466,9 @@ void CXFA_TextParser::GetLinethrough(CXFA_TextProvider* pTextProvider,
}
FX_ARGB CXFA_TextParser::GetColor(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle) const {
+ CFDE_CSSComputedStyle* pStyle) const {
if (pStyle)
- return pStyle->GetFontStyles()->GetColor();
+ return pStyle->GetColor();
if (CXFA_Font font = pTextProvider->GetFontNode())
return font.GetColor();
@@ -479,11 +476,10 @@ FX_ARGB CXFA_TextParser::GetColor(CXFA_TextProvider* pTextProvider,
}
FX_FLOAT CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle) const {
+ CFDE_CSSComputedStyle* pStyle) const {
if (pStyle) {
- IFDE_CSSParagraphStyle* pParaStyle = pStyle->GetParagraphStyles();
- if (pParaStyle->GetVerticalAlign() == FDE_CSSVerticalAlign::Number)
- return pParaStyle->GetNumberVerticalAlign();
+ if (pStyle->GetVerticalAlign() == FDE_CSSVerticalAlign::Number)
+ return pStyle->GetNumberVerticalAlign();
} else if (CXFA_Font font = pTextProvider->GetFontNode()) {
return font.GetBaselineShift();
}
@@ -491,12 +487,12 @@ FX_FLOAT CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider,
}
FX_FLOAT CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle,
+ CFDE_CSSComputedStyle* pStyle,
bool bFirst,
FX_FLOAT fVerScale) const {
FX_FLOAT fLineHeight = 0;
if (pStyle)
- fLineHeight = pStyle->GetParagraphStyles()->GetLineHeight();
+ fLineHeight = pStyle->GetLineHeight();
else if (CXFA_Para para = pTextProvider->GetParaNode())
fLineHeight = para.GetLineHeight();
@@ -563,7 +559,7 @@ CXFA_TextParseContext* CXFA_TextParser::GetParseContextFromMap(
return it != m_mapXMLNodeToParseContext.end() ? it->second : nullptr;
}
-bool CXFA_TextParser::GetTabstops(IFDE_CSSComputedStyle* pStyle,
+bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle,
CXFA_TextTabstopsContext* pTabstopContext) {
if (!pStyle || !pTabstopContext)
return false;
diff --git a/xfa/fxfa/app/cxfa_textparser.h b/xfa/fxfa/app/cxfa_textparser.h
index 923c07001a..a0b5ab1f29 100644
--- a/xfa/fxfa/app/cxfa_textparser.h
+++ b/xfa/fxfa/app/cxfa_textparser.h
@@ -16,14 +16,14 @@
#include "core/fxge/fx_dib.h"
#include "xfa/fgas/font/cfgas_gefont.h"
+class CFDE_CSSComputedStyle;
class CFDE_CSSStyleSelector;
+class CFDE_CSSStyleSheet;
class CFDE_XMLNode;
class CXFA_CSSTagProvider;
class CXFA_TextParseContext;
class CXFA_TextProvider;
class CXFA_TextTabstopsContext;
-class IFDE_CSSComputedStyle;
-class IFDE_CSSStyleSheet;
class CXFA_TextParser {
public:
@@ -33,45 +33,45 @@ class CXFA_TextParser {
void Reset();
void DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider);
- IFDE_CSSComputedStyle* CreateRootStyle(CXFA_TextProvider* pTextProvider);
- IFDE_CSSComputedStyle* ComputeStyle(CFDE_XMLNode* pXMLNode,
- IFDE_CSSComputedStyle* pParentStyle);
+ CFDE_CSSComputedStyle* CreateRootStyle(CXFA_TextProvider* pTextProvider);
+ CFDE_CSSComputedStyle* ComputeStyle(CFDE_XMLNode* pXMLNode,
+ CFDE_CSSComputedStyle* pParentStyle);
bool IsParsed() const { return m_bParsed; }
int32_t GetVAlign(CXFA_TextProvider* pTextProvider) const;
- FX_FLOAT GetTabInterval(IFDE_CSSComputedStyle* pStyle) const;
- int32_t CountTabs(IFDE_CSSComputedStyle* pStyle) const;
+ FX_FLOAT GetTabInterval(CFDE_CSSComputedStyle* pStyle) const;
+ int32_t CountTabs(CFDE_CSSComputedStyle* pStyle) const;
- bool IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const;
- bool GetTabstops(IFDE_CSSComputedStyle* pStyle,
+ bool IsSpaceRun(CFDE_CSSComputedStyle* pStyle) const;
+ bool GetTabstops(CFDE_CSSComputedStyle* pStyle,
CXFA_TextTabstopsContext* pTabstopContext);
CFX_RetainPtr<CFGAS_GEFont> GetFont(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle) const;
+ CFDE_CSSComputedStyle* pStyle) const;
FX_FLOAT GetFontSize(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle) const;
+ CFDE_CSSComputedStyle* pStyle) const;
int32_t GetHorScale(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle,
+ CFDE_CSSComputedStyle* pStyle,
CFDE_XMLNode* pXMLNode) const;
int32_t GetVerScale(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle) const;
+ CFDE_CSSComputedStyle* pStyle) const;
void GetUnderline(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle,
+ CFDE_CSSComputedStyle* pStyle,
int32_t& iUnderline,
int32_t& iPeriod) const;
void GetLinethrough(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle,
+ CFDE_CSSComputedStyle* pStyle,
int32_t& iLinethrough) const;
FX_ARGB GetColor(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle) const;
+ CFDE_CSSComputedStyle* pStyle) const;
FX_FLOAT GetBaseline(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle) const;
+ CFDE_CSSComputedStyle* pStyle) const;
FX_FLOAT GetLineHeight(CXFA_TextProvider* pTextProvider,
- IFDE_CSSComputedStyle* pStyle,
+ CFDE_CSSComputedStyle* pStyle,
bool bFirst,
FX_FLOAT fVerScale) const;
@@ -86,13 +86,13 @@ class CXFA_TextParser {
private:
void InitCSSData(CXFA_TextProvider* pTextProvider);
void ParseRichText(CFDE_XMLNode* pXMLNode,
- IFDE_CSSComputedStyle* pParentStyle);
+ CFDE_CSSComputedStyle* pParentStyle);
void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider);
- IFDE_CSSStyleSheet* LoadDefaultSheetStyle();
- IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle);
+ CFDE_CSSStyleSheet* LoadDefaultSheetStyle();
+ CFDE_CSSComputedStyle* CreateStyle(CFDE_CSSComputedStyle* pParentStyle);
std::unique_ptr<CFDE_CSSStyleSelector> m_pSelector;
- IFDE_CSSStyleSheet* m_pUASheet;
+ CFDE_CSSStyleSheet* m_pUASheet;
std::map<CFDE_XMLNode*, CXFA_TextParseContext*> m_mapXMLNodeToParseContext;
bool m_bParsed;
};
diff --git a/xfa/fxfa/app/cxfa_textuserdata.cpp b/xfa/fxfa/app/cxfa_textuserdata.cpp
index 62566deeac..7087810f4d 100644
--- a/xfa/fxfa/app/cxfa_textuserdata.cpp
+++ b/xfa/fxfa/app/cxfa_textuserdata.cpp
@@ -7,15 +7,16 @@
#include "xfa/fxfa/app/cxfa_textuserdata.h"
#include "xfa/fde/css/fde_css.h"
+#include "xfa/fde/css/fde_cssstyleselector.h"
#include "xfa/fxfa/app/cxfa_linkuserdata.h"
-CXFA_TextUserData::CXFA_TextUserData(IFDE_CSSComputedStyle* pStyle)
+CXFA_TextUserData::CXFA_TextUserData(CFDE_CSSComputedStyle* pStyle)
: m_pStyle(pStyle), m_pLinkData(nullptr), m_dwRefCount(0) {
if (m_pStyle)
m_pStyle->Retain();
}
-CXFA_TextUserData::CXFA_TextUserData(IFDE_CSSComputedStyle* pStyle,
+CXFA_TextUserData::CXFA_TextUserData(CFDE_CSSComputedStyle* pStyle,
CXFA_LinkUserData* pLinkData)
: m_pStyle(pStyle), m_pLinkData(pLinkData), m_dwRefCount(0) {
if (m_pStyle)
diff --git a/xfa/fxfa/app/cxfa_textuserdata.h b/xfa/fxfa/app/cxfa_textuserdata.h
index 308475b0dd..83f762ddbe 100644
--- a/xfa/fxfa/app/cxfa_textuserdata.h
+++ b/xfa/fxfa/app/cxfa_textuserdata.h
@@ -9,13 +9,13 @@
#include "core/fxcrt/fx_basic.h"
+class CFDE_CSSComputedStyle;
class CXFA_LinkUserData;
-class IFDE_CSSComputedStyle;
class CXFA_TextUserData : public IFX_Retainable {
public:
- explicit CXFA_TextUserData(IFDE_CSSComputedStyle* pStyle);
- CXFA_TextUserData(IFDE_CSSComputedStyle* pStyle,
+ explicit CXFA_TextUserData(CFDE_CSSComputedStyle* pStyle);
+ CXFA_TextUserData(CFDE_CSSComputedStyle* pStyle,
CXFA_LinkUserData* pLinkData);
~CXFA_TextUserData() override;
@@ -23,7 +23,7 @@ class CXFA_TextUserData : public IFX_Retainable {
uint32_t Retain() override;
uint32_t Release() override;
- IFDE_CSSComputedStyle* m_pStyle;
+ CFDE_CSSComputedStyle* m_pStyle;
CXFA_LinkUserData* m_pLinkData;
protected: