Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Unified Diff: xfa/fxfa/parser/cxfa_node.cpp

Issue 2165993002: Move xfa_basic_imp to cxfa_widetextread. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Review feedback Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/parser/cxfa_measurement.cpp ('k') | xfa/fxfa/parser/cxfa_para.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/cxfa_node.cpp
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 8f352d35accd6be6095ce531023361a2e80c049b..44b7e2fb1ccc686bc1290d8c19cc2a45574ecc74 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -17,6 +17,7 @@
#include "xfa/fgas/crt/fgas_system.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/include/cxfa_eventparam.h"
+#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/cxfa_occur.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
#include "xfa/fxfa/parser/cxfa_simple_parser.h"
@@ -445,6 +446,28 @@ void* GetMapKey_Element(XFA_Element eType, XFA_ATTRIBUTE eAttribute) {
(eAttribute << 8) | XFA_KEYTYPE_Element);
}
+const XFA_ATTRIBUTEINFO* GetAttributeOfElement(XFA_Element eElement,
+ XFA_ATTRIBUTE eAttribute,
+ uint32_t dwPacket) {
+ int32_t iCount = 0;
+ const uint8_t* pAttr = XFA_GetElementAttributes(eElement, iCount);
+ if (!pAttr || iCount < 1)
+ return nullptr;
+
+ if (!std::binary_search(pAttr, pAttr + iCount, eAttribute))
+ return nullptr;
+
+ const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute);
+ ASSERT(pInfo);
+ if (dwPacket == XFA_XDPPACKET_UNKNOWN)
+ return pInfo;
+ return (dwPacket & pInfo->dwPackets) ? pInfo : nullptr;
+}
+
+const XFA_ATTRIBUTEENUMINFO* GetAttributeEnumByID(XFA_ATTRIBUTEENUM eName) {
+ return g_XFAEnumData + eName;
+}
+
} // namespace
static void XFA_DefaultFreeData(void* pData) {}
@@ -2335,7 +2358,7 @@ void CXFA_Node::Script_Som_Mandatory(CFXJSE_Value* pValue,
} else {
int32_t iValue = validate.GetNullTest();
const XFA_ATTRIBUTEENUMINFO* pInfo =
- XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)iValue);
+ GetAttributeEnumByID((XFA_ATTRIBUTEENUM)iValue);
CFX_WideString wsValue;
if (pInfo)
wsValue = pInfo->pName;
@@ -2920,8 +2943,8 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) {
pArguments->GetReturnValue()->SetNull();
} else {
if (!strName.IsEmpty()) {
- if (XFA_GetAttributeOfElement(eType, XFA_ATTRIBUTE_Name,
- XFA_XDPPACKET_UNKNOWN)) {
+ if (GetAttributeOfElement(eType, XFA_ATTRIBUTE_Name,
+ XFA_XDPPACKET_UNKNOWN)) {
pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringC(), true);
if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) {
pNewNode->CreateXMLMappingNode();
@@ -3709,7 +3732,7 @@ FX_BOOL CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr,
if (!TryEnum(pAttr->eName, eValue, bUseDefault)) {
return FALSE;
}
- wsValue = XFA_GetAttributeEnumByID(eValue)->pName;
+ wsValue = GetAttributeEnumByID(eValue)->pName;
return TRUE;
} break;
case XFA_ATTRIBUTETYPE_Cdata: {
@@ -4058,7 +4081,7 @@ FX_BOOL CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr,
static_cast<CFDE_XMLElement*>(m_pXMLNode)
->SetString(
pInfo->pName,
- XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)(uintptr_t)pValue)
+ GetAttributeEnumByID((XFA_ATTRIBUTEENUM)(uintptr_t)pValue)
->pName);
break;
case XFA_ATTRIBUTETYPE_Boolean:
@@ -4891,7 +4914,7 @@ void CXFA_Node::UpdateNameHash() {
wsName = GetCData(XFA_ATTRIBUTE_Name);
m_dwNameHash = FX_HashCode_GetW(wsName, false);
} else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) {
- wsName = XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName;
+ wsName = GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName;
m_dwNameHash = FX_HashCode_GetW(wsName, false);
}
}
« no previous file with comments | « xfa/fxfa/parser/cxfa_measurement.cpp ('k') | xfa/fxfa/parser/cxfa_para.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698