diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-03 10:43:51 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-03 17:21:30 +0000 |
commit | cf3d40d10276686f972761bafd005a7715f6eb1c (patch) | |
tree | d183076a13b494f0cd003c28eb13f3e12b0c5810 /xfa/fxfa/parser/cxfa_calculate.cpp | |
parent | 05dcbc931eacb72f1a11835ae282fc8434b7a434 (diff) | |
download | pdfium-cf3d40d10276686f972761bafd005a7715f6eb1c.tar.xz |
Fold CXFA_CalculateData into CXFA_Calculate
This CL folds CXFA_CalculateData into CXFA_Calculate as it is just a
thin wrapper.
Change-Id: I35efbee6c0244139a7ece19f3e8ee18bfb931dda
Reviewed-on: https://pdfium-review.googlesource.com/22090
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_calculate.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_calculate.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/xfa/fxfa/parser/cxfa_calculate.cpp b/xfa/fxfa/parser/cxfa_calculate.cpp index 714dfdecd7..cacb326f0f 100644 --- a/xfa/fxfa/parser/cxfa_calculate.cpp +++ b/xfa/fxfa/parser/cxfa_calculate.cpp @@ -8,6 +8,9 @@ #include "fxjs/xfa/cjx_calculate.h" #include "third_party/base/ptr_util.h" +#include "xfa/fxfa/parser/cxfa_message.h" +#include "xfa/fxfa/parser/cxfa_script.h" +#include "xfa/fxfa/parser/cxfa_text.h" namespace { @@ -39,3 +42,22 @@ CXFA_Calculate::CXFA_Calculate(CXFA_Document* doc, XFA_PacketType packet) pdfium::MakeUnique<CJX_Calculate>(this)) {} CXFA_Calculate::~CXFA_Calculate() {} + +XFA_AttributeEnum CXFA_Calculate::GetOverride() { + return JSObject() + ->TryEnum(XFA_Attribute::Override, false) + .value_or(XFA_AttributeEnum::Error); +} + +CXFA_Script* CXFA_Calculate::GetScript() { + return GetChild<CXFA_Script>(0, XFA_Element::Script, false); +} + +WideString CXFA_Calculate::GetMessageText() { + CXFA_Message* pNode = GetChild<CXFA_Message>(0, XFA_Element::Message, false); + if (!pNode) + return L""; + + CXFA_Text* text = pNode->GetChild<CXFA_Text>(0, XFA_Element::Text, false); + return text ? text->GetContent() : L""; +} |