summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-22 22:01:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-22 22:01:57 +0000
commit1ca42167e5913eddf57f137fd7b4cc2110b6cd1f (patch)
tree33f018384bc7b974270cfcb19065815beb54a126 /xfa/fxfa/parser
parent9ccf4047a6f36e9c0863541437af7734a04ca676 (diff)
downloadpdfium-1ca42167e5913eddf57f137fd7b4cc2110b6cd1f.tar.xz
Convert CXFA_FFWidgetHandler to use CXFA_Node
This CL removes CXFA_WidgetAcc from CXFA_FFWidgetHandler and uses CXFA_Node directly. Change-Id: I88cf1edc53f4489aeac018a95e9d5936d85106db Reviewed-on: https://pdfium-review.googlesource.com/23450 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp31
-rw-r--r--xfa/fxfa/parser/cxfa_node.h3
2 files changed, 32 insertions, 2 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 026e013dae..6d670c462d 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1840,8 +1840,8 @@ int32_t CXFA_Node::ProcessEvent(CXFA_FFDocView* docView,
if (GetElementType() == XFA_Element::Draw)
return XFA_EVENTERROR_NotExist;
- std::vector<CXFA_Event*> eventArray = GetWidgetAcc()->GetEventByActivity(
- iActivity, pEventParam->m_bIsFormReady);
+ std::vector<CXFA_Event*> eventArray =
+ GetEventByActivity(iActivity, pEventParam->m_bIsFormReady);
bool first = true;
int32_t iRet = XFA_EVENTERROR_NotExist;
for (CXFA_Event* event : eventArray) {
@@ -2430,3 +2430,30 @@ CFX_RectF CXFA_Node::GetUIMargin() {
return CFX_RectF(left.value_or(0.0), top.value_or(0.0), right.value_or(0.0),
bottom.value_or(0.0));
}
+
+std::vector<CXFA_Event*> CXFA_Node::GetEventByActivity(
+ XFA_AttributeEnum iActivity,
+ bool bIsFormReady) {
+ std::vector<CXFA_Event*> events;
+ for (CXFA_Node* node : GetNodeList(0, XFA_Element::Event)) {
+ auto* event = static_cast<CXFA_Event*>(node);
+ if (event->GetActivity() != iActivity)
+ continue;
+
+ if (iActivity != XFA_AttributeEnum::Ready) {
+ events.push_back(event);
+ continue;
+ }
+
+ WideString wsRef = event->GetRef();
+ if (bIsFormReady) {
+ if (wsRef == WideStringView(L"$form"))
+ events.push_back(event);
+ continue;
+ }
+
+ if (wsRef == WideStringView(L"$layout"))
+ events.push_back(event);
+ }
+ return events;
+}
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 9cda17c527..0991a533c8 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -312,6 +312,9 @@ class CXFA_Node : public CXFA_Object {
return acc_.get();
}
+ std::vector<CXFA_Event*> GetEventByActivity(XFA_AttributeEnum iActivity,
+ bool bIsFormReady);
+
protected:
CXFA_Node(CXFA_Document* pDoc,
XFA_PacketType ePacket,