diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-22 22:01:57 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-22 22:01:57 +0000 |
commit | 1ca42167e5913eddf57f137fd7b4cc2110b6cd1f (patch) | |
tree | 33f018384bc7b974270cfcb19065815beb54a126 /xfa/fxfa/parser/cxfa_node.cpp | |
parent | 9ccf4047a6f36e9c0863541437af7734a04ca676 (diff) | |
download | pdfium-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/cxfa_node.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 31 |
1 files changed, 29 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; +} |