summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2018-04-16 21:24:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-16 21:24:57 +0000
commit8b0cf76f00c6e89e8bb7bf4bcf2189b27baac31c (patch)
treeec18d4aa800ccd9d32f113f8ec41d89948479ab3 /xfa/fxfa
parent262b496f25be27978abe7d98f20978820ecaeec8 (diff)
downloadpdfium-8b0cf76f00c6e89e8bb7bf4bcf2189b27baac31c.tar.xz
Merge CFX_XMLElement and CFX_XMLAttributeNode
CFX_XMLElement is the only subclass of CFX_XMLAttributeNode. This CL merges the two classes together. The {Set|Get}String method has been renamed to {Set|Get}Attribute to make it clearer what you're retrieving. Change-Id: I158c961d4d8c5f563d937a3e7a35321a33622562 Reviewed-on: https://pdfium-review.googlesource.com/30710 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/cxfa_textlayout.cpp2
-rw-r--r--xfa/fxfa/cxfa_textparser.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp3
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp14
-rw-r--r--xfa/fxfa/parser/cxfa_document_parser.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_xmllocale.cpp6
-rw-r--r--xfa/fxfa/parser/xfa_utils.cpp6
8 files changed, 24 insertions, 23 deletions
diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp
index e360c16dde..e066380f77 100644
--- a/xfa/fxfa/cxfa_textlayout.cpp
+++ b/xfa/fxfa/cxfa_textlayout.cpp
@@ -744,7 +744,7 @@ bool CXFA_TextLayout::LoadRichText(
if (wsName == L"a") {
ASSERT(pElement);
- WideString wsLinkContent = pElement->GetString(L"href");
+ WideString wsLinkContent = pElement->GetAttribute(L"href");
if (!wsLinkContent.IsEmpty()) {
pLinkData =
pdfium::MakeRetain<CXFA_LinkUserData>(wsLinkContent.c_str());
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp
index a957147762..f0a6dd2af1 100644
--- a/xfa/fxfa/cxfa_textparser.cpp
+++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -284,7 +284,7 @@ std::unique_ptr<CXFA_TextParser::TagProvider> CXFA_TextParser::ParseTagInfo(
tagProvider->SetTagName(wsName);
tagProvider->m_bTagAvailable = TagValidate(wsName);
- WideString wsValue = pXMLElement->GetString(L"style");
+ WideString wsValue = pXMLElement->GetAttribute(L"style");
if (!wsValue.IsEmpty())
tagProvider->SetAttribute(L"style", wsValue);
} else if (pXMLNode->GetType() == FX_XMLNODE_Text) {
@@ -505,13 +505,13 @@ bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider,
bool bRet = false;
if (pXMLNode->GetType() == FX_XMLNODE_Element) {
CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(pXMLNode);
- WideString wsAttr = pElement->GetString(L"xfa:embed");
+ WideString wsAttr = pElement->GetAttribute(L"xfa:embed");
if (wsAttr.IsEmpty())
return false;
if (wsAttr[0] == L'#')
wsAttr.Delete(0);
- WideString ws = pElement->GetString(L"xfa:embedType");
+ WideString ws = pElement->GetAttribute(L"xfa:embedType");
if (ws.IsEmpty())
ws = L"som";
else
@@ -521,7 +521,7 @@ bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider,
if (!bURI && ws != L"som")
return false;
- ws = pElement->GetString(L"xfa:embedMode");
+ ws = pElement->GetAttribute(L"xfa:embedMode");
if (ws.IsEmpty())
ws = L"formatted";
else
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index 1418d030b5..389b9dbacb 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -89,7 +89,8 @@ bool CXFA_DataExporter::Export(
return false;
XFA_DataExporter_DealWithDataGroupNode(pExportNode);
- pElement->SetString(L"xmlns:xfa", L"http://www.xfa.org/schema/xfa-data/1.0/");
+ pElement->SetAttribute(L"xmlns:xfa",
+ L"http://www.xfa.org/schema/xfa-data/1.0/");
pElement->Save(pStream);
pElement->RemoveAttribute(L"xmlns:xfa");
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index cdfb7b45a6..713e15c4fa 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -514,7 +514,7 @@ void CreateDataBinding(CXFA_Node* pFormNode,
pDataNode->JSObject()->SetCData(XFA_Attribute::ContentType,
wsContentType, false, false);
if (!wsHref.IsEmpty())
- pXMLDataElement->SetString(L"href", wsHref);
+ pXMLDataElement->SetAttribute(L"href", wsHref);
break;
}
@@ -537,8 +537,8 @@ void CreateDataBinding(CXFA_Node* pFormNode,
} else {
CFX_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode();
ASSERT(pXMLNode->GetType() == FX_XMLNODE_Element);
- static_cast<CFX_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode",
- L"dataGroup");
+ static_cast<CFX_XMLElement*>(pXMLNode)->SetAttribute(
+ L"xfa:dataNode", L"dataGroup");
}
} else if (!wsValue.IsEmpty()) {
pDataNode->JSObject()->SetAttributeValue(
@@ -657,14 +657,14 @@ void CreateDataBinding(CXFA_Node* pFormNode,
ASSERT(pXMLDataElement);
WideString wsContentType =
- pXMLDataElement->GetString(L"xfa:contentType");
+ pXMLDataElement->GetAttribute(L"xfa:contentType");
if (!wsContentType.IsEmpty()) {
pDataNode->JSObject()->SetCData(XFA_Attribute::ContentType,
wsContentType, false, false);
image->SetContentType(wsContentType);
}
- WideString wsHref = pXMLDataElement->GetString(L"href");
+ WideString wsHref = pXMLDataElement->GetAttribute(L"href");
if (!wsHref.IsEmpty())
image->SetHref(wsHref);
}
@@ -1625,8 +1625,8 @@ void CXFA_Document::DoDataMerge() {
if (!pDatasetsRoot) {
// Ownership will be passed in the AppendChild below to the XML tree.
auto pDatasetsXMLNode = pdfium::MakeUnique<CFX_XMLElement>(L"xfa:datasets");
- pDatasetsXMLNode->SetString(L"xmlns:xfa",
- L"http://www.xfa.org/schema/xfa-data/1.0/");
+ pDatasetsXMLNode->SetAttribute(L"xmlns:xfa",
+ L"http://www.xfa.org/schema/xfa-data/1.0/");
pDatasetsRoot =
CreateNode(XFA_PacketType::Datasets, XFA_Element::DataModel);
pDatasetsRoot->JSObject()->SetCData(XFA_Attribute::Name, L"datasets", false,
diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp
index 98ac38065d..32bcba0609 100644
--- a/xfa/fxfa/parser/cxfa_document_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_document_parser.cpp
@@ -602,7 +602,7 @@ CXFA_Node* CXFA_DocumentParser::ParseAsXDPPacket_Template(
static_cast<CFX_XMLElement*>(pXMLDocumentNode);
WideString wsNamespaceURI = pXMLDocumentElement->GetNamespaceURI();
if (wsNamespaceURI.IsEmpty())
- wsNamespaceURI = pXMLDocumentElement->GetString(L"xmlns:xfa");
+ wsNamespaceURI = pXMLDocumentElement->GetAttribute(L"xmlns:xfa");
pNode->GetDocument()->RecognizeXFAVersionNumber(wsNamespaceURI);
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 10f0a40017..7da4ed551d 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -2662,7 +2662,7 @@ void CXFA_Node::SetImageEdit(const WideString& wsContentType,
} else {
CFX_XMLNode* pXMLNode = pBind->GetXMLMappingNode();
ASSERT(pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element);
- static_cast<CFX_XMLElement*>(pXMLNode)->SetString(L"href", wsHref);
+ static_cast<CFX_XMLElement*>(pXMLNode)->SetAttribute(L"href", wsHref);
}
}
@@ -4662,8 +4662,8 @@ void CXFA_Node::SetToXML(const WideString& value) {
switch (eXMLType) {
case FX_XMLNODE_Element: {
if (IsAttributeInXML()) {
- elem->SetString(JSObject()->GetCData(XFA_Attribute::QualifiedName),
- value);
+ elem->SetAttribute(JSObject()->GetCData(XFA_Attribute::QualifiedName),
+ value);
return;
}
diff --git a/xfa/fxfa/parser/cxfa_xmllocale.cpp b/xfa/fxfa/parser/cxfa_xmllocale.cpp
index 6720d56cba..4354ed98de 100644
--- a/xfa/fxfa/parser/cxfa_xmllocale.cpp
+++ b/xfa/fxfa/parser/cxfa_xmllocale.cpp
@@ -65,7 +65,7 @@ CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr<CFX_XMLElement> root,
CXFA_XMLLocale::~CXFA_XMLLocale() {}
WideString CXFA_XMLLocale::GetName() const {
- return locale_->GetString(L"name");
+ return locale_->GetAttribute(L"name");
}
WideString CXFA_XMLLocale::GetDecimalSymbol() const {
@@ -136,7 +136,7 @@ WideString CXFA_XMLLocale::GetCalendarSymbol(const WideStringView& symbol,
if (elem->GetName() != pstrSymbolNames)
continue;
- WideString abbr = elem->GetString(L"abbr");
+ WideString abbr = elem->GetAttribute(L"abbr");
bool abbr_value = false;
if (!abbr.IsEmpty())
abbr_value = abbr == L"1";
@@ -219,7 +219,7 @@ WideString CXFA_XMLLocale::GetPattern(CFX_XMLElement* patterns,
CFX_XMLElement* pattern = static_cast<CFX_XMLElement*>(child);
if (pattern->GetName() != bsTag)
continue;
- if (pattern->GetString(L"name") != wsName)
+ if (pattern->GetAttribute(L"name") != wsName)
continue;
return pattern->GetTextData();
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index 7b4e4b1989..ebe087aa64 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -479,7 +479,7 @@ bool XFA_FDEExtension_ResolveNamespaceQualifier(CFX_XMLElement* pNode,
auto* pElement = static_cast<CFX_XMLElement*>(pParent);
if (pElement->HasAttribute(wsNSAttribute.c_str())) {
- *wsNamespaceURI = pElement->GetString(wsNSAttribute.c_str());
+ *wsNamespaceURI = pElement->GetAttribute(wsNSAttribute.c_str());
return true;
}
}
@@ -513,8 +513,8 @@ void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode) {
CFX_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode();
ASSERT(pXMLNode->GetType() == FX_XMLNODE_Element);
- static_cast<CFX_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode",
- L"dataGroup");
+ static_cast<CFX_XMLElement*>(pXMLNode)->SetAttribute(L"xfa:dataNode",
+ L"dataGroup");
}
void XFA_DataExporter_RegenerateFormFile(