#include "xfa/fxfa/cxfa_textparser.h"
#include <algorithm>
#include <utility>
#include "core/fxcrt/check.h"
#include "core/fxcrt/css/cfx_css.h"
#include "core/fxcrt/css/cfx_csscomputedstyle.h"
#include "core/fxcrt/css/cfx_cssdeclaration.h"
#include "core/fxcrt/css/cfx_cssstyleselector.h"
#include "core/fxcrt/css/cfx_cssstylesheet.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/notreached.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "core/fxge/fx_font.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_fontmgr.h"
#include "xfa/fxfa/cxfa_textprovider.h"
#include "xfa/fxfa/cxfa_texttabstopscontext.h"
#include "xfa/fxfa/parser/cxfa_font.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/cxfa_para.h"
namespace {
enum class TabStopStatus { … };
WideString GetLowerCaseElementAttributeOrDefault(
const CFX_XMLElement* pElement,
const WideString& wsName,
const WideString& wsDefaultValue) { … }
}
CXFA_TextParser::CXFA_TextParser() = default;
CXFA_TextParser::~CXFA_TextParser() = default;
void CXFA_TextParser::Reset() { … }
void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) { … }
std::unique_ptr<CFX_CSSStyleSheet> CXFA_TextParser::LoadDefaultSheetStyle() { … }
RetainPtr<CFX_CSSComputedStyle> CXFA_TextParser::CreateRootStyle(
CXFA_TextProvider* pTextProvider) { … }
RetainPtr<CFX_CSSComputedStyle> CXFA_TextParser::CreateStyle(
const CFX_CSSComputedStyle* pParentStyle) { … }
RetainPtr<CFX_CSSComputedStyle> CXFA_TextParser::ComputeStyle(
const CFX_XMLNode* pXMLNode,
RetainPtr<const CFX_CSSComputedStyle> pParentStyle) { … }
void CXFA_TextParser::DoParse(const CFX_XMLNode* pXMLContainer,
CXFA_TextProvider* pTextProvider) { … }
void CXFA_TextParser::ParseRichText(const CFX_XMLNode* pXMLNode,
const CFX_CSSComputedStyle* pParentStyle) { … }
bool CXFA_TextParser::TagValidate(const WideString& wsName) const { … }
std::unique_ptr<CXFA_TextParser::TagProvider> CXFA_TextParser::ParseTagInfo(
const CFX_XMLNode* pXMLNode) { … }
XFA_AttributeValue CXFA_TextParser::GetVAlign(
CXFA_TextProvider* pTextProvider) const { … }
float CXFA_TextParser::GetTabInterval(
const CFX_CSSComputedStyle* pStyle) const { … }
int32_t CXFA_TextParser::CountTabs(const CFX_CSSComputedStyle* pStyle) const { … }
bool CXFA_TextParser::IsSpaceRun(const CFX_CSSComputedStyle* pStyle) const { … }
RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont(
CXFA_FFDoc* doc,
CXFA_TextProvider* pTextProvider,
const CFX_CSSComputedStyle* pStyle) const { … }
float CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider,
const CFX_CSSComputedStyle* pStyle) const { … }
int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider,
const CFX_CSSComputedStyle* pStyle,
const CFX_XMLNode* pXMLNode) const { … }
int32_t CXFA_TextParser::GetVerScale(CXFA_TextProvider* pTextProvider,
const CFX_CSSComputedStyle* pStyle) const { … }
int32_t CXFA_TextParser::GetUnderline(
CXFA_TextProvider* pTextProvider,
const CFX_CSSComputedStyle* pStyle) const { … }
XFA_AttributeValue CXFA_TextParser::GetUnderlinePeriod(
CXFA_TextProvider* pTextProvider,
const CFX_CSSComputedStyle* pStyle) const { … }
int32_t CXFA_TextParser::GetLinethrough(
CXFA_TextProvider* pTextProvider,
const CFX_CSSComputedStyle* pStyle) const { … }
FX_ARGB CXFA_TextParser::GetColor(CXFA_TextProvider* pTextProvider,
const CFX_CSSComputedStyle* pStyle) const { … }
float CXFA_TextParser::GetBaseline(CXFA_TextProvider* pTextProvider,
const CFX_CSSComputedStyle* pStyle) const { … }
float CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider,
const CFX_CSSComputedStyle* pStyle,
bool bFirst,
float fVerScale) const { … }
std::optional<WideString> CXFA_TextParser::GetEmbeddedObj(
const CXFA_TextProvider* pTextProvider,
const CFX_XMLNode* pXMLNode) { … }
CXFA_TextParser::Context* CXFA_TextParser::GetParseContextFromMap(
const CFX_XMLNode* pXMLNode) { … }
bool CXFA_TextParser::GetTabstops(const CFX_CSSComputedStyle* pStyle,
CXFA_TextTabstopsContext* pTabstopContext) { … }
CXFA_TextParser::TagProvider::TagProvider() = default;
CXFA_TextParser::TagProvider::~TagProvider() = default;
CXFA_TextParser::Context::Context() = default;
CXFA_TextParser::Context::~Context() = default;
void CXFA_TextParser::Context::SetParentStyle(
RetainPtr<const CFX_CSSComputedStyle> style) { … }
void CXFA_TextParser::Context::SetDecls(
std::vector<const CFX_CSSDeclaration*>&& decl) { … }