summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-08-08 13:23:24 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-08 17:37:54 +0000
commit9f0e85ac36826e39a242f8039c2b2c333ee99f4f (patch)
treec93f2a9322968f7723a4b3da5ea5e4cb7b79b075 /xfa/fxfa
parent78fc9aa402409f3fcd8dc1f458e67798cb3b483e (diff)
downloadpdfium-9f0e85ac36826e39a242f8039c2b2c333ee99f4f.tar.xz
Move CSS code to core
The xfa/fde/css code has no other links into xfa/. This CL moves the css code to core/fxcrt/css and sets to only build when pdf_enable_xfa is enabled. Change-Id: Iefd208e1f83a28b80b567c574e841e87bce310be Reviewed-on: https://pdfium-review.googlesource.com/9251 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/cxfa_loadercontext.h4
-rw-r--r--xfa/fxfa/cxfa_textlayout.cpp76
-rw-r--r--xfa/fxfa/cxfa_textlayout.h14
-rw-r--r--xfa/fxfa/cxfa_textparsecontext.cpp8
-rw-r--r--xfa/fxfa/cxfa_textparsecontext.h20
-rw-r--r--xfa/fxfa/cxfa_textparser.cpp108
-rw-r--r--xfa/fxfa/cxfa_textparser.h49
-rw-r--r--xfa/fxfa/cxfa_textuserdata.cpp10
-rw-r--r--xfa/fxfa/cxfa_textuserdata.h9
9 files changed, 148 insertions, 150 deletions
diff --git a/xfa/fxfa/cxfa_loadercontext.h b/xfa/fxfa/cxfa_loadercontext.h
index 5bf8ed3661..48077ff538 100644
--- a/xfa/fxfa/cxfa_loadercontext.h
+++ b/xfa/fxfa/cxfa_loadercontext.h
@@ -9,9 +9,9 @@
#include <vector>
+#include "core/fxcrt/css/cfx_csscomputedstyle.h"
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_system.h"
-#include "xfa/fde/css/cfde_csscomputedstyle.h"
class CFX_XMLNode;
class CXFA_Node;
@@ -32,7 +32,7 @@ class CXFA_LoaderContext {
uint32_t m_dwFlags;
CFX_XMLNode* m_pXMLNode;
CXFA_Node* m_pNode;
- CFX_RetainPtr<CFDE_CSSComputedStyle> m_pParentStyle;
+ CFX_RetainPtr<CFX_CSSComputedStyle> m_pParentStyle;
std::vector<float> m_lineHeights;
std::vector<float> m_BlocksHeight;
};
diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp
index 138587c2fc..125c73a11d 100644
--- a/xfa/fxfa/cxfa_textlayout.cpp
+++ b/xfa/fxfa/cxfa_textlayout.cpp
@@ -9,6 +9,8 @@
#include <algorithm>
#include <utility>
+#include "core/fxcrt/css/cfx_csscomputedstyle.h"
+#include "core/fxcrt/css/cfx_cssstyleselector.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "core/fxcrt/xml/cfx_xmltext.h"
@@ -18,8 +20,6 @@
#include "xfa/fde/cfde_path.h"
#include "xfa/fde/cfde_pen.h"
#include "xfa/fde/cfde_renderdevice.h"
-#include "xfa/fde/css/cfde_csscomputedstyle.h"
-#include "xfa/fde/css/cfde_cssstyleselector.h"
#include "xfa/fxfa/cxfa_linkuserdata.h"
#include "xfa/fxfa/cxfa_loadercontext.h"
#include "xfa/fxfa/cxfa_pieceline.h"
@@ -155,30 +155,30 @@ void CXFA_TextLayout::InitBreak(float fLineWidth) {
m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f);
}
-void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
- FDE_CSSDisplay eDisplay,
+void CXFA_TextLayout::InitBreak(CFX_CSSComputedStyle* pStyle,
+ CFX_CSSDisplay eDisplay,
float fLineWidth,
CFX_XMLNode* pXMLNode,
- CFDE_CSSComputedStyle* pParentStyle) {
+ CFX_CSSComputedStyle* pParentStyle) {
if (!pStyle) {
InitBreak(fLineWidth);
return;
}
- if (eDisplay == FDE_CSSDisplay::Block ||
- eDisplay == FDE_CSSDisplay::ListItem) {
+ if (eDisplay == CFX_CSSDisplay::Block ||
+ eDisplay == CFX_CSSDisplay::ListItem) {
CFX_RTFLineAlignment iAlign = CFX_RTFLineAlignment::Left;
switch (pStyle->GetTextAlign()) {
- case FDE_CSSTextAlign::Right:
+ case CFX_CSSTextAlign::Right:
iAlign = CFX_RTFLineAlignment::Right;
break;
- case FDE_CSSTextAlign::Center:
+ case CFX_CSSTextAlign::Center:
iAlign = CFX_RTFLineAlignment::Center;
break;
- case FDE_CSSTextAlign::Justify:
+ case CFX_CSSTextAlign::Justify:
iAlign = CFX_RTFLineAlignment::Justified;
break;
- case FDE_CSSTextAlign::JustifyAll:
+ case CFX_CSSTextAlign::JustifyAll:
iAlign = CFX_RTFLineAlignment::Distributed;
break;
default:
@@ -187,8 +187,8 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
m_pBreak->SetAlignment(iAlign);
float fStart = 0;
- const FDE_CSSRect* pRect = pStyle->GetMarginWidth();
- const FDE_CSSRect* pPaddingRect = pStyle->GetPaddingWidth();
+ const CFX_CSSRect* pRect = pStyle->GetMarginWidth();
+ const CFX_CSSRect* pPaddingRect = pStyle->GetPaddingWidth();
if (pRect) {
fStart = pRect->left.GetValue();
fLineWidth -= pRect->right.GetValue();
@@ -196,9 +196,9 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
fStart += pPaddingRect->left.GetValue();
fLineWidth -= pPaddingRect->right.GetValue();
}
- if (eDisplay == FDE_CSSDisplay::ListItem) {
- const FDE_CSSRect* pParRect = pParentStyle->GetMarginWidth();
- const FDE_CSSRect* pParPaddingRect = pParentStyle->GetPaddingWidth();
+ if (eDisplay == CFX_CSSDisplay::ListItem) {
+ const CFX_CSSRect* pParRect = pParentStyle->GetMarginWidth();
+ const CFX_CSSRect* pParPaddingRect = pParentStyle->GetPaddingWidth();
if (pParRect) {
fStart += pParRect->left.GetValue();
fLineWidth -= pParRect->right.GetValue();
@@ -207,11 +207,11 @@ void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
fLineWidth -= pParPaddingRect->right.GetValue();
}
}
- FDE_CSSRect pNewRect;
- pNewRect.left.Set(FDE_CSSLengthUnit::Point, fStart);
- 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());
+ CFX_CSSRect pNewRect;
+ pNewRect.left.Set(CFX_CSSLengthUnit::Point, fStart);
+ pNewRect.right.Set(CFX_CSSLengthUnit::Point, pRect->right.GetValue());
+ pNewRect.top.Set(CFX_CSSLengthUnit::Point, pRect->top.GetValue());
+ pNewRect.bottom.Set(CFX_CSSLengthUnit::Point, pRect->bottom.GetValue());
pStyle->SetMarginWidth(pNewRect);
}
}
@@ -696,7 +696,7 @@ bool CXFA_TextLayout::LoadRichText(
CFX_XMLNode* pXMLNode,
const CFX_SizeF& szText,
float& fLinePos,
- const CFX_RetainPtr<CFDE_CSSComputedStyle>& pParentStyle,
+ const CFX_RetainPtr<CFX_CSSComputedStyle>& pParentStyle,
bool bSavePieces,
CFX_RetainPtr<CXFA_LinkUserData> pLinkData,
bool bEndBreak,
@@ -707,10 +707,10 @@ bool CXFA_TextLayout::LoadRichText(
CXFA_TextParseContext* pContext =
m_textParser.GetParseContextFromMap(pXMLNode);
- FDE_CSSDisplay eDisplay = FDE_CSSDisplay::None;
+ CFX_CSSDisplay eDisplay = CFX_CSSDisplay::None;
bool bContentNode = false;
float fSpaceBelow = 0;
- CFX_RetainPtr<CFDE_CSSComputedStyle> pStyle;
+ CFX_RetainPtr<CFX_CSSComputedStyle> pStyle;
CFX_WideString wsName;
if (bEndBreak) {
bool bCurOl = false;
@@ -733,21 +733,21 @@ bool CXFA_TextLayout::LoadRichText(
}
if (m_bBlockContinue || bContentNode == false) {
eDisplay = pContext->GetDisplay();
- if (eDisplay != FDE_CSSDisplay::Block &&
- eDisplay != FDE_CSSDisplay::Inline &&
- eDisplay != FDE_CSSDisplay::ListItem) {
+ if (eDisplay != CFX_CSSDisplay::Block &&
+ eDisplay != CFX_CSSDisplay::Inline &&
+ eDisplay != CFX_CSSDisplay::ListItem) {
return true;
}
pStyle = m_textParser.ComputeStyle(pXMLNode, pParentStyle.Get());
InitBreak(bContentNode ? pParentStyle.Get() : pStyle.Get(), eDisplay,
szText.width, pXMLNode, pParentStyle.Get());
- if ((eDisplay == FDE_CSSDisplay::Block ||
- eDisplay == FDE_CSSDisplay::ListItem) &&
+ if ((eDisplay == CFX_CSSDisplay::Block ||
+ eDisplay == CFX_CSSDisplay::ListItem) &&
pStyle &&
(wsName.IsEmpty() || (wsName != L"body" && wsName != L"html" &&
wsName != L"ol" && wsName != L"ul"))) {
- const FDE_CSSRect* pRect = pStyle->GetMarginWidth();
+ const CFX_CSSRect* pRect = pStyle->GetMarginWidth();
if (pRect) {
fLinePos += pRect->top.GetValue();
fSpaceBelow = pRect->bottom.GetValue();
@@ -797,9 +797,9 @@ bool CXFA_TextLayout::LoadRichText(
(m_pLoader->m_dwFlags & XFA_LOADERCNTXTFLG_FILTERSPACE)) {
wsText.TrimLeft(0x20);
}
- if (FDE_CSSDisplay::Block == eDisplay) {
+ if (CFX_CSSDisplay::Block == eDisplay) {
m_pLoader->m_dwFlags |= XFA_LOADERCNTXTFLG_FILTERSPACE;
- } else if (FDE_CSSDisplay::Inline == eDisplay &&
+ } else if (CFX_CSSDisplay::Inline == eDisplay &&
(m_pLoader->m_dwFlags & XFA_LOADERCNTXTFLG_FILTERSPACE)) {
m_pLoader->m_dwFlags &= ~XFA_LOADERCNTXTFLG_FILTERSPACE;
} else if (wsText.GetLength() > 0 &&
@@ -847,7 +847,7 @@ bool CXFA_TextLayout::LoadRichText(
}
if (m_pLoader) {
- if (FDE_CSSDisplay::Block == eDisplay)
+ if (CFX_CSSDisplay::Block == eDisplay)
m_pLoader->m_dwFlags |= XFA_LOADERCNTXTFLG_FILTERSPACE;
}
if (bCurLi)
@@ -859,11 +859,11 @@ bool CXFA_TextLayout::LoadRichText(
if (m_bBlockContinue) {
if (pContext && !bContentNode) {
- CFX_BreakType dwStatus = (eDisplay == FDE_CSSDisplay::Block)
+ CFX_BreakType dwStatus = (eDisplay == CFX_CSSDisplay::Block)
? CFX_BreakType::Paragraph
: CFX_BreakType::Piece;
EndBreak(dwStatus, fLinePos, bSavePieces);
- if (eDisplay == FDE_CSSDisplay::Block) {
+ if (eDisplay == CFX_CSSDisplay::Block) {
fLinePos += fSpaceBelow;
if (m_pTabstopContext)
m_pTabstopContext->RemoveAll();
@@ -952,7 +952,7 @@ void CXFA_TextLayout::EndBreak(CFX_BreakType dwStatus,
AppendTextLine(dwStatus, fLinePos, bSavePieces, true);
}
-void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle,
+void CXFA_TextLayout::DoTabstops(CFX_CSSComputedStyle* pStyle,
CXFA_PieceLine* pPieceLine) {
if (!pStyle || !pPieceLine)
return;
@@ -1015,7 +1015,7 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus,
if (iPieces < 1)
return;
- CFX_RetainPtr<CFDE_CSSComputedStyle> pStyle;
+ CFX_RetainPtr<CFX_CSSComputedStyle> pStyle;
if (bSavePieces) {
auto pNew = pdfium::MakeUnique<CXFA_PieceLine>();
CXFA_PieceLine* pPieceLine = pNew.get();
@@ -1130,7 +1130,7 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus,
if (pStyle) {
float fStart = 0;
- const FDE_CSSRect* pRect = pStyle->GetMarginWidth();
+ const CFX_CSSRect* pRect = pStyle->GetMarginWidth();
if (pRect)
fStart = pRect->left.GetValue();
diff --git a/xfa/fxfa/cxfa_textlayout.h b/xfa/fxfa/cxfa_textlayout.h
index 079fff8fe2..642fa25dd9 100644
--- a/xfa/fxfa/cxfa_textlayout.h
+++ b/xfa/fxfa/cxfa_textlayout.h
@@ -10,15 +10,15 @@
#include <memory>
#include <vector>
+#include "core/fxcrt/css/cfx_css.h"
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
-#include "xfa/fde/css/fde_css.h"
#include "xfa/fgas/layout/cfx_rtfbreak.h"
#include "xfa/fxfa/cxfa_textparser.h"
class CFDE_Brush;
-class CFDE_CSSComputedStyle;
+class CFX_CSSComputedStyle;
class CFDE_Pen;
class CFDE_RenderDevice;
class CFX_XMLNode;
@@ -67,11 +67,11 @@ class CXFA_TextLayout {
CFX_XMLNode* GetXMLContainerNode();
std::unique_ptr<CFX_RTFBreak> CreateBreak(bool bDefault);
void InitBreak(float fLineWidth);
- void InitBreak(CFDE_CSSComputedStyle* pStyle,
- FDE_CSSDisplay eDisplay,
+ void InitBreak(CFX_CSSComputedStyle* pStyle,
+ CFX_CSSDisplay eDisplay,
float fLineWidth,
CFX_XMLNode* pXMLNode,
- CFDE_CSSComputedStyle* pParentStyle = nullptr);
+ CFX_CSSComputedStyle* pParentStyle = nullptr);
bool Loader(const CFX_SizeF& szText,
float& fLinePos,
bool bSavePieces = true);
@@ -82,7 +82,7 @@ class CXFA_TextLayout {
bool LoadRichText(CFX_XMLNode* pXMLNode,
const CFX_SizeF& szText,
float& fLinePos,
- const CFX_RetainPtr<CFDE_CSSComputedStyle>& pParentStyle,
+ const CFX_RetainPtr<CFX_CSSComputedStyle>& pParentStyle,
bool bSavePieces,
CFX_RetainPtr<CXFA_LinkUserData> pLinkData,
bool bEndBreak = true,
@@ -116,7 +116,7 @@ class CXFA_TextLayout {
FXTEXT_CHARPOS* pCharPos,
bool bCharCode = false);
bool ToRun(const CXFA_TextPiece* pPiece, FX_RTFTEXTOBJ* tr);
- void DoTabstops(CFDE_CSSComputedStyle* pStyle, CXFA_PieceLine* pPieceLine);
+ void DoTabstops(CFX_CSSComputedStyle* pStyle, CXFA_PieceLine* pPieceLine);
bool Layout(int32_t iBlock);
int32_t CountBlocks() const;
diff --git a/xfa/fxfa/cxfa_textparsecontext.cpp b/xfa/fxfa/cxfa_textparsecontext.cpp
index 7231f388e2..bd21afc864 100644
--- a/xfa/fxfa/cxfa_textparsecontext.cpp
+++ b/xfa/fxfa/cxfa_textparsecontext.cpp
@@ -6,11 +6,11 @@
#include "xfa/fxfa/cxfa_textparsecontext.h"
-#include "xfa/fde/css/cfde_csscomputedstyle.h"
-#include "xfa/fde/css/cfde_cssdeclaration.h"
-#include "xfa/fde/css/cfde_cssstyleselector.h"
+#include "core/fxcrt/css/cfx_csscomputedstyle.h"
+#include "core/fxcrt/css/cfx_cssdeclaration.h"
+#include "core/fxcrt/css/cfx_cssstyleselector.h"
CXFA_TextParseContext::CXFA_TextParseContext()
- : m_pParentStyle(nullptr), m_eDisplay(FDE_CSSDisplay::None) {}
+ : m_pParentStyle(nullptr), m_eDisplay(CFX_CSSDisplay::None) {}
CXFA_TextParseContext::~CXFA_TextParseContext() {}
diff --git a/xfa/fxfa/cxfa_textparsecontext.h b/xfa/fxfa/cxfa_textparsecontext.h
index c3236570e5..3cd5710728 100644
--- a/xfa/fxfa/cxfa_textparsecontext.h
+++ b/xfa/fxfa/cxfa_textparsecontext.h
@@ -10,30 +10,30 @@
#include <utility>
#include <vector>
+#include "core/fxcrt/css/cfx_css.h"
+#include "core/fxcrt/css/cfx_cssdeclaration.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/css/cfde_cssdeclaration.h"
-#include "xfa/fde/css/fde_css.h"
-class CFDE_CSSComputedStyle;
+class CFX_CSSComputedStyle;
class CXFA_TextParseContext {
public:
CXFA_TextParseContext();
~CXFA_TextParseContext();
- void SetDisplay(FDE_CSSDisplay eDisplay) { m_eDisplay = eDisplay; }
- FDE_CSSDisplay GetDisplay() const { return m_eDisplay; }
+ void SetDisplay(CFX_CSSDisplay eDisplay) { m_eDisplay = eDisplay; }
+ CFX_CSSDisplay GetDisplay() const { return m_eDisplay; }
- void SetDecls(std::vector<const CFDE_CSSDeclaration*>&& decl) {
+ void SetDecls(std::vector<const CFX_CSSDeclaration*>&& decl) {
decls_ = std::move(decl);
}
- const std::vector<const CFDE_CSSDeclaration*>& GetDecls() { return decls_; }
+ const std::vector<const CFX_CSSDeclaration*>& GetDecls() { return decls_; }
- CFX_RetainPtr<CFDE_CSSComputedStyle> m_pParentStyle;
+ CFX_RetainPtr<CFX_CSSComputedStyle> m_pParentStyle;
private:
- std::vector<const CFDE_CSSDeclaration*> decls_;
- FDE_CSSDisplay m_eDisplay;
+ std::vector<const CFX_CSSDeclaration*> decls_;
+ CFX_CSSDisplay m_eDisplay;
};
#endif // XFA_FXFA_CXFA_TEXTPARSECONTEXT_H_
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp
index de5490a766..7e16202b16 100644
--- a/xfa/fxfa/cxfa_textparser.cpp
+++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -10,14 +10,14 @@
#include <utility>
#include <vector>
+#include "core/fxcrt/css/cfx_css.h"
+#include "core/fxcrt/css/cfx_csscomputedstyle.h"
+#include "core/fxcrt/css/cfx_cssstyleselector.h"
+#include "core/fxcrt/css/cfx_cssstylesheet.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/css/cfde_csscomputedstyle.h"
-#include "xfa/fde/css/cfde_cssstyleselector.h"
-#include "xfa/fde/css/cfde_cssstylesheet.h"
-#include "xfa/fde/css/fde_css.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
@@ -56,7 +56,7 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) {
return;
if (!m_pSelector) {
- m_pSelector = pdfium::MakeUnique<CFDE_CSSStyleSelector>();
+ m_pSelector = pdfium::MakeUnique<CFX_CSSStyleSelector>();
CXFA_Font font = pTextProvider->GetFontNode();
m_pSelector->SetDefFontSize(font ? font.GetFontSize() : 10.0f);
@@ -71,7 +71,7 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) {
m_pSelector->UpdateStyleIndex();
}
-std::unique_ptr<CFDE_CSSStyleSheet> CXFA_TextParser::LoadDefaultSheetStyle() {
+std::unique_ptr<CFX_CSSStyleSheet> CXFA_TextParser::LoadDefaultSheetStyle() {
static const wchar_t s_pStyle[] =
L"html,body,ol,p,ul{display:block}"
L"li{display:list-item}"
@@ -83,12 +83,12 @@ std::unique_ptr<CFDE_CSSStyleSheet> CXFA_TextParser::LoadDefaultSheetStyle() {
L"sup{vertical-align:+15em;font-size:.66em}"
L"sub{vertical-align:-15em;font-size:.66em}";
- auto sheet = pdfium::MakeUnique<CFDE_CSSStyleSheet>();
+ auto sheet = pdfium::MakeUnique<CFX_CSSStyleSheet>();
return sheet->LoadBuffer(s_pStyle, FXSYS_wcslen(s_pStyle)) ? std::move(sheet)
: nullptr;
}
-CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::CreateRootStyle(
+CFX_RetainPtr<CFX_CSSComputedStyle> CXFA_TextParser::CreateRootStyle(
CXFA_TextProvider* pTextProvider) {
CXFA_Font font = pTextProvider->GetFontNode();
CXFA_Para para = pTextProvider->GetParaNode();
@@ -98,50 +98,50 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::CreateRootStyle(
if (para) {
fLineHeight = para.GetLineHeight();
- FDE_CSSLength indent;
- indent.Set(FDE_CSSLengthUnit::Point, para.GetTextIndent());
+ CFX_CSSLength indent;
+ indent.Set(CFX_CSSLengthUnit::Point, para.GetTextIndent());
pStyle->SetTextIndent(indent);
- FDE_CSSTextAlign hAlign = FDE_CSSTextAlign::Left;
+ CFX_CSSTextAlign hAlign = CFX_CSSTextAlign::Left;
switch (para.GetHorizontalAlign()) {
case XFA_ATTRIBUTEENUM_Center:
- hAlign = FDE_CSSTextAlign::Center;
+ hAlign = CFX_CSSTextAlign::Center;
break;
case XFA_ATTRIBUTEENUM_Right:
- hAlign = FDE_CSSTextAlign::Right;
+ hAlign = CFX_CSSTextAlign::Right;
break;
case XFA_ATTRIBUTEENUM_Justify:
- hAlign = FDE_CSSTextAlign::Justify;
+ hAlign = CFX_CSSTextAlign::Justify;
break;
case XFA_ATTRIBUTEENUM_JustifyAll:
- hAlign = FDE_CSSTextAlign::JustifyAll;
+ hAlign = CFX_CSSTextAlign::JustifyAll;
break;
}
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());
+ CFX_CSSRect rtMarginWidth;
+ rtMarginWidth.left.Set(CFX_CSSLengthUnit::Point, para.GetMarginLeft());
+ rtMarginWidth.top.Set(CFX_CSSLengthUnit::Point, para.GetSpaceAbove());
+ rtMarginWidth.right.Set(CFX_CSSLengthUnit::Point, para.GetMarginRight());
+ rtMarginWidth.bottom.Set(CFX_CSSLengthUnit::Point, para.GetSpaceBelow());
pStyle->SetMarginWidth(rtMarginWidth);
}
if (font) {
pStyle->SetColor(font.GetColor());
- pStyle->SetFontStyle(font.IsItalic() ? FDE_CSSFontStyle::Italic
- : FDE_CSSFontStyle::Normal);
+ pStyle->SetFontStyle(font.IsItalic() ? CFX_CSSFontStyle::Italic
+ : CFX_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());
+ CFX_CSSLength letterSpacing;
+ letterSpacing.Set(CFX_CSSLengthUnit::Point, font.GetLetterSpacing());
pStyle->SetLetterSpacing(letterSpacing);
uint32_t dwDecoration = 0;
if (font.GetLineThrough() > 0)
- dwDecoration |= FDE_CSSTEXTDECORATION_LineThrough;
+ dwDecoration |= CFX_CSSTEXTDECORATION_LineThrough;
if (font.GetUnderline() > 1)
- dwDecoration |= FDE_CSSTEXTDECORATION_Double;
+ dwDecoration |= CFX_CSSTEXTDECORATION_Double;
else if (font.GetUnderline() > 0)
- dwDecoration |= FDE_CSSTEXTDECORATION_Underline;
+ dwDecoration |= CFX_CSSTEXTDECORATION_Underline;
pStyle->SetTextDecoration(dwDecoration);
}
@@ -150,8 +150,8 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::CreateRootStyle(
return pStyle;
}
-CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::CreateStyle(
- CFDE_CSSComputedStyle* pParentStyle) {
+CFX_RetainPtr<CFX_CSSComputedStyle> CXFA_TextParser::CreateStyle(
+ CFX_CSSComputedStyle* pParentStyle) {
auto pNewStyle = m_pSelector->CreateComputedStyle(pParentStyle);
ASSERT(pNewStyle);
if (!pParentStyle)
@@ -159,21 +159,21 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::CreateStyle(
uint32_t dwDecoration = pParentStyle->GetTextDecoration();
float fBaseLine = 0;
- if (pParentStyle->GetVerticalAlign() == FDE_CSSVerticalAlign::Number)
+ if (pParentStyle->GetVerticalAlign() == CFX_CSSVerticalAlign::Number)
fBaseLine = pParentStyle->GetNumberVerticalAlign();
pNewStyle->SetTextDecoration(dwDecoration);
pNewStyle->SetNumberVerticalAlign(fBaseLine);
- const FDE_CSSRect* pRect = pParentStyle->GetMarginWidth();
+ const CFX_CSSRect* pRect = pParentStyle->GetMarginWidth();
if (pRect)
pNewStyle->SetMarginWidth(*pRect);
return pNewStyle;
}
-CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::ComputeStyle(
+CFX_RetainPtr<CFX_CSSComputedStyle> CXFA_TextParser::ComputeStyle(
CFX_XMLNode* pXMLNode,
- CFDE_CSSComputedStyle* pParentStyle) {
+ CFX_CSSComputedStyle* pParentStyle) {
auto it = m_mapXMLNodeToParseContext.find(pXMLNode);
if (it == m_mapXMLNodeToParseContext.end())
return nullptr;
@@ -207,7 +207,7 @@ void CXFA_TextParser::DoParse(CFX_XMLNode* pXMLContainer,
}
void CXFA_TextParser::ParseRichText(CFX_XMLNode* pXMLNode,
- CFDE_CSSComputedStyle* pParentStyle) {
+ CFX_CSSComputedStyle* pParentStyle) {
if (!pXMLNode)
return;
@@ -215,11 +215,11 @@ void CXFA_TextParser::ParseRichText(CFX_XMLNode* pXMLNode,
if (!tagProvider->m_bTagAvailable)
return;
- CFX_RetainPtr<CFDE_CSSComputedStyle> pNewStyle;
+ CFX_RetainPtr<CFX_CSSComputedStyle> pNewStyle;
if ((tagProvider->GetTagName() != L"body") ||
(tagProvider->GetTagName() != L"html")) {
auto pTextContext = pdfium::MakeUnique<CXFA_TextParseContext>();
- FDE_CSSDisplay eDisplay = FDE_CSSDisplay::Inline;
+ CFX_CSSDisplay eDisplay = CFX_CSSDisplay::Inline;
if (!tagProvider->m_bContent) {
auto declArray =
m_pSelector->MatchDeclarations(tagProvider->GetTagName());
@@ -292,21 +292,21 @@ int32_t CXFA_TextParser::GetVAlign(CXFA_TextProvider* pTextProvider) const {
return para ? para.GetVerticalAlign() : XFA_ATTRIBUTEENUM_Top;
}
-float CXFA_TextParser::GetTabInterval(CFDE_CSSComputedStyle* pStyle) const {
+float CXFA_TextParser::GetTabInterval(CFX_CSSComputedStyle* pStyle) const {
CFX_WideString wsValue;
if (pStyle && pStyle->GetCustomStyle(L"tab-interval", wsValue))
return CXFA_Measurement(wsValue.AsStringC()).ToUnit(XFA_UNIT_Pt);
return 36;
}
-int32_t CXFA_TextParser::CountTabs(CFDE_CSSComputedStyle* pStyle) const {
+int32_t CXFA_TextParser::CountTabs(CFX_CSSComputedStyle* pStyle) const {
CFX_WideString wsValue;
if (pStyle && pStyle->GetCustomStyle(L"xfa-tab-count", wsValue))
return wsValue.GetInteger();
return 0;
}
-bool CXFA_TextParser::IsSpaceRun(CFDE_CSSComputedStyle* pStyle) const {
+bool CXFA_TextParser::IsSpaceRun(CFX_CSSComputedStyle* pStyle) const {
CFX_WideString wsValue;
if (pStyle && pStyle->GetCustomStyle(L"xfa-spacerun", wsValue)) {
wsValue.MakeLower();
@@ -317,7 +317,7 @@ bool CXFA_TextParser::IsSpaceRun(CFDE_CSSComputedStyle* pStyle) const {
CFX_RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont(
CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const {
+ CFX_CSSComputedStyle* pStyle) const {
CFX_WideStringC wsFamily = L"Courier";
uint32_t dwStyle = 0;
CXFA_Font font = pTextProvider->GetFontNode();
@@ -337,7 +337,7 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont(
dwStyle = 0;
if (pStyle->GetFontWeight() > FXFONT_FW_NORMAL)
dwStyle |= FX_FONTSTYLE_Bold;
- if (pStyle->GetFontStyle() == FDE_CSSFontStyle::Italic)
+ if (pStyle->GetFontStyle() == CFX_CSSFontStyle::Italic)
dwStyle |= FX_FONTSTYLE_Italic;
}
@@ -347,7 +347,7 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont(
}
float CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const {
+ CFX_CSSComputedStyle* pStyle) const {
if (pStyle)
return pStyle->GetFontSize();
@@ -358,7 +358,7 @@ float CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider,
}
int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle,
+ CFX_CSSComputedStyle* pStyle,
CFX_XMLNode* pXMLNode) const {
if (pStyle) {
CFX_WideString wsValue;
@@ -385,7 +385,7 @@ int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider,
}
int32_t CXFA_TextParser::GetVerScale(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const {
+ CFX_CSSComputedStyle* pStyle) const {
if (pStyle) {
CFX_WideString wsValue;
if (pStyle->GetCustomStyle(L"xfa-font-vertical-scale", wsValue))
@@ -398,7 +398,7 @@ int32_t CXFA_TextParser::GetVerScale(CXFA_TextProvider* pTextProvider,
}
void CXFA_TextParser::GetUnderline(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle,
+ CFX_CSSComputedStyle* pStyle,
int32_t& iUnderline,
int32_t& iPeriod) const {
iUnderline = 0;
@@ -413,9 +413,9 @@ void CXFA_TextParser::GetUnderline(CXFA_TextProvider* pTextProvider,
}
uint32_t dwDecoration = pStyle->GetTextDecoration();
- if (dwDecoration & FDE_CSSTEXTDECORATION_Double)
+ if (dwDecoration & CFX_CSSTEXTDECORATION_Double)
iUnderline = 2;
- else if (dwDecoration & FDE_CSSTEXTDECORATION_Underline)
+ else if (dwDecoration & CFX_CSSTEXTDECORATION_Underline)
iUnderline = 1;
CFX_WideString wsValue;
@@ -428,11 +428,11 @@ void CXFA_TextParser::GetUnderline(CXFA_TextProvider* pTextProvider,
}
void CXFA_TextParser::GetLinethrough(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle,
+ CFX_CSSComputedStyle* pStyle,
int32_t& iLinethrough) const {
if (pStyle) {
uint32_t dwDecoration = pStyle->GetTextDecoration();
- iLinethrough = (dwDecoration & FDE_CSSTEXTDECORATION_LineThrough) ? 1 : 0;
+ iLinethrough = (dwDecoration & CFX_CSSTEXTDECORATION_LineThrough) ? 1 : 0;
return;
}
@@ -442,7 +442,7 @@ void CXFA_TextParser::GetLinethrough(CXFA_TextProvider* pTextProvider,
}
FX_ARGB CXFA_TextParser::GetColor(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const {
+ CFX_CSSComputedStyle* pStyle) const {
if (pStyle)
return pStyle->GetColor();
if (CXFA_Font font = pTextProvider->GetFontNode())
@@ -452,9 +452,9 @@ FX_ARGB CXFA_TextParser::GetColor(CXFA_TextProvider* pTextProvider,
}
float CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const {
+ CFX_CSSComputedStyle* pStyle) const {
if (pStyle) {
- if (pStyle->GetVerticalAlign() == FDE_CSSVerticalAlign::Number)
+ if (pStyle->GetVerticalAlign() == CFX_CSSVerticalAlign::Number)
return pStyle->GetNumberVerticalAlign();
} else if (CXFA_Font font = pTextProvider->GetFontNode()) {
return font.GetBaselineShift();
@@ -463,7 +463,7 @@ float CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider,
}
float CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle,
+ CFX_CSSComputedStyle* pStyle,
bool bFirst,
float fVerScale) const {
float fLineHeight = 0;
@@ -532,7 +532,7 @@ CXFA_TextParseContext* CXFA_TextParser::GetParseContextFromMap(
return it != m_mapXMLNodeToParseContext.end() ? it->second.get() : nullptr;
}
-bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle,
+bool CXFA_TextParser::GetTabstops(CFX_CSSComputedStyle* pStyle,
CXFA_TextTabstopsContext* pTabstopContext) {
if (!pStyle || !pTabstopContext)
return false;
diff --git a/xfa/fxfa/cxfa_textparser.h b/xfa/fxfa/cxfa_textparser.h
index 303b10ce07..567aff0189 100644
--- a/xfa/fxfa/cxfa_textparser.h
+++ b/xfa/fxfa/cxfa_textparser.h
@@ -16,9 +16,9 @@
#include "core/fxge/fx_dib.h"
#include "xfa/fgas/font/cfgas_gefont.h"
-class CFDE_CSSComputedStyle;
-class CFDE_CSSStyleSelector;
-class CFDE_CSSStyleSheet;
+class CFX_CSSComputedStyle;
+class CFX_CSSStyleSelector;
+class CFX_CSSStyleSheet;
class CFX_XMLNode;
class CXFA_TextParseContext;
class CXFA_TextProvider;
@@ -32,47 +32,47 @@ class CXFA_TextParser {
void Reset();
void DoParse(CFX_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider);
- CFX_RetainPtr<CFDE_CSSComputedStyle> CreateRootStyle(
+ CFX_RetainPtr<CFX_CSSComputedStyle> CreateRootStyle(
CXFA_TextProvider* pTextProvider);
- CFX_RetainPtr<CFDE_CSSComputedStyle> ComputeStyle(
+ CFX_RetainPtr<CFX_CSSComputedStyle> ComputeStyle(
CFX_XMLNode* pXMLNode,
- CFDE_CSSComputedStyle* pParentStyle);
+ CFX_CSSComputedStyle* pParentStyle);
bool IsParsed() const { return m_bParsed; }
int32_t GetVAlign(CXFA_TextProvider* pTextProvider) const;
- float GetTabInterval(CFDE_CSSComputedStyle* pStyle) const;
- int32_t CountTabs(CFDE_CSSComputedStyle* pStyle) const;
+ float GetTabInterval(CFX_CSSComputedStyle* pStyle) const;
+ int32_t CountTabs(CFX_CSSComputedStyle* pStyle) const;
- bool IsSpaceRun(CFDE_CSSComputedStyle* pStyle) const;
- bool GetTabstops(CFDE_CSSComputedStyle* pStyle,
+ bool IsSpaceRun(CFX_CSSComputedStyle* pStyle) const;
+ bool GetTabstops(CFX_CSSComputedStyle* pStyle,
CXFA_TextTabstopsContext* pTabstopContext);
CFX_RetainPtr<CFGAS_GEFont> GetFont(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const;
+ CFX_CSSComputedStyle* pStyle) const;
float GetFontSize(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const;
+ CFX_CSSComputedStyle* pStyle) const;
int32_t GetHorScale(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle,
+ CFX_CSSComputedStyle* pStyle,
CFX_XMLNode* pXMLNode) const;
int32_t GetVerScale(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const;
+ CFX_CSSComputedStyle* pStyle) const;
void GetUnderline(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle,
+ CFX_CSSComputedStyle* pStyle,
int32_t& iUnderline,
int32_t& iPeriod) const;
void GetLinethrough(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle,
+ CFX_CSSComputedStyle* pStyle,
int32_t& iLinethrough) const;
FX_ARGB GetColor(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const;
+ CFX_CSSComputedStyle* pStyle) const;
float GetBaseline(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle) const;
+ CFX_CSSComputedStyle* pStyle) const;
float GetLineHeight(CXFA_TextProvider* pTextProvider,
- CFDE_CSSComputedStyle* pStyle,
+ CFX_CSSComputedStyle* pStyle,
bool bFirst,
float fVerScale) const;
@@ -111,16 +111,15 @@ class CXFA_TextParser {
};
void InitCSSData(CXFA_TextProvider* pTextProvider);
- void ParseRichText(CFX_XMLNode* pXMLNode,
- CFDE_CSSComputedStyle* pParentStyle);
+ void ParseRichText(CFX_XMLNode* pXMLNode, CFX_CSSComputedStyle* pParentStyle);
std::unique_ptr<TagProvider> ParseTagInfo(CFX_XMLNode* pXMLNode);
- std::unique_ptr<CFDE_CSSStyleSheet> LoadDefaultSheetStyle();
- CFX_RetainPtr<CFDE_CSSComputedStyle> CreateStyle(
- CFDE_CSSComputedStyle* pParentStyle);
+ std::unique_ptr<CFX_CSSStyleSheet> LoadDefaultSheetStyle();
+ CFX_RetainPtr<CFX_CSSComputedStyle> CreateStyle(
+ CFX_CSSComputedStyle* pParentStyle);
bool m_bParsed;
bool m_cssInitialized;
- std::unique_ptr<CFDE_CSSStyleSelector> m_pSelector;
+ std::unique_ptr<CFX_CSSStyleSelector> m_pSelector;
std::map<CFX_XMLNode*, std::unique_ptr<CXFA_TextParseContext>>
m_mapXMLNodeToParseContext;
};
diff --git a/xfa/fxfa/cxfa_textuserdata.cpp b/xfa/fxfa/cxfa_textuserdata.cpp
index 4cec6b300a..51a2f43194 100644
--- a/xfa/fxfa/cxfa_textuserdata.cpp
+++ b/xfa/fxfa/cxfa_textuserdata.cpp
@@ -6,17 +6,17 @@
#include "xfa/fxfa/cxfa_textuserdata.h"
-#include "xfa/fde/css/cfde_csscomputedstyle.h"
-#include "xfa/fde/css/cfde_cssstyleselector.h"
-#include "xfa/fde/css/fde_css.h"
+#include "core/fxcrt/css/cfx_css.h"
+#include "core/fxcrt/css/cfx_csscomputedstyle.h"
+#include "core/fxcrt/css/cfx_cssstyleselector.h"
#include "xfa/fxfa/cxfa_linkuserdata.h"
CXFA_TextUserData::CXFA_TextUserData(
- const CFX_RetainPtr<CFDE_CSSComputedStyle>& pStyle)
+ const CFX_RetainPtr<CFX_CSSComputedStyle>& pStyle)
: m_pStyle(pStyle) {}
CXFA_TextUserData::CXFA_TextUserData(
- const CFX_RetainPtr<CFDE_CSSComputedStyle>& pStyle,
+ const CFX_RetainPtr<CFX_CSSComputedStyle>& pStyle,
const CFX_RetainPtr<CXFA_LinkUserData>& pLinkData)
: m_pStyle(pStyle), m_pLinkData(pLinkData) {}
diff --git a/xfa/fxfa/cxfa_textuserdata.h b/xfa/fxfa/cxfa_textuserdata.h
index c9e90aa40f..f84e768166 100644
--- a/xfa/fxfa/cxfa_textuserdata.h
+++ b/xfa/fxfa/cxfa_textuserdata.h
@@ -10,7 +10,7 @@
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_basic.h"
-class CFDE_CSSComputedStyle;
+class CFX_CSSComputedStyle;
class CXFA_LinkUserData;
class CXFA_TextUserData : public CFX_Retainable {
@@ -18,13 +18,12 @@ class CXFA_TextUserData : public CFX_Retainable {
template <typename T, typename... Args>
friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- CFX_RetainPtr<CFDE_CSSComputedStyle> m_pStyle;
+ CFX_RetainPtr<CFX_CSSComputedStyle> m_pStyle;
CFX_RetainPtr<CXFA_LinkUserData> m_pLinkData;
private:
- explicit CXFA_TextUserData(
- const CFX_RetainPtr<CFDE_CSSComputedStyle>& pStyle);
- CXFA_TextUserData(const CFX_RetainPtr<CFDE_CSSComputedStyle>& pStyle,
+ explicit CXFA_TextUserData(const CFX_RetainPtr<CFX_CSSComputedStyle>& pStyle);
+ CXFA_TextUserData(const CFX_RetainPtr<CFX_CSSComputedStyle>& pStyle,
const CFX_RetainPtr<CXFA_LinkUserData>& pLinkData);
~CXFA_TextUserData() override;
};