summaryrefslogtreecommitdiff
path: root/fxjs/cjx_node.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-20 20:27:43 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-20 20:27:43 +0000
commit68c77592f25f9173d2166fa01fb34b4155f4cfcb (patch)
treeced2e1308f8b1e6b4c0934dc5f3b1c697223de61 /fxjs/cjx_node.h
parentfae5e26d983848089e35e2b53e9da24036661b08 (diff)
downloadpdfium-68c77592f25f9173d2166fa01fb34b4155f4cfcb.tar.xz
Remove {Set|Get|Try}Object methods
The CJX_Node::{Set|Get|Try}Object methods are used to set CXFA_WidgetData and CXFA_Node objects into the CJX_Node. This is stored in the node as void* data and custom delete methods are passed when needed. Instead, this CL just stores the two types of things we need on the CJX_Node and returns the correct types. This uses a bit more space on the CJX_Node, but it makes the code a lot clearer and simpler. Change-Id: I8546ea6456a1c1f5f8b602a6a420a0e85f3fac29 Reviewed-on: https://pdfium-review.googlesource.com/18570 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/cjx_node.h')
-rw-r--r--fxjs/cjx_node.h31
1 files changed, 26 insertions, 5 deletions
diff --git a/fxjs/cjx_node.h b/fxjs/cjx_node.h
index 686c54c164..3393a52406 100644
--- a/fxjs/cjx_node.h
+++ b/fxjs/cjx_node.h
@@ -8,6 +8,8 @@
#define FXJS_CJX_NODE_H_
#include <memory>
+#include <utility>
+#include <vector>
#include "core/fxcrt/unowned_ptr.h"
#include "fxjs/cjx_object.h"
@@ -29,6 +31,7 @@ enum XFA_SOM_MESSAGETYPE {
class CFXJSE_Arguments;
class CXFA_Node;
+class CXFA_WidgetData;
struct XFA_MAPMODULEDATA;
@@ -102,11 +105,27 @@ class CJX_Node : public CJX_Object {
XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo);
void* GetUserData(void* pKey, bool bProtoAlso);
- bool TryObject(XFA_Attribute eAttr, void*& pData);
- bool SetObject(XFA_Attribute eAttr,
- void* pData,
- XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo);
- void* GetObject(XFA_Attribute eAttr);
+ void SetBindingNodes(std::vector<UnownedPtr<CXFA_Node>> nodes) {
+ binding_nodes_ = std::move(nodes);
+ }
+ std::vector<UnownedPtr<CXFA_Node>>* GetBindingNodes() {
+ return &binding_nodes_;
+ }
+ void ReleaseBindingNodes();
+
+ void SetBindingNode(CXFA_Node* node) {
+ binding_nodes_.clear();
+ if (node)
+ binding_nodes_.emplace_back(node);
+ }
+ CXFA_Node* GetBindingNode() const {
+ if (binding_nodes_.empty())
+ return nullptr;
+ return binding_nodes_[0].Get();
+ }
+
+ void SetWidgetData(std::unique_ptr<CXFA_WidgetData> data);
+ CXFA_WidgetData* GetWidgetData() const { return widget_data_.get(); }
pdfium::Optional<WideString> TryNamespace();
@@ -437,6 +456,8 @@ class CJX_Node : public CJX_Object {
XFA_Element eType);
std::unique_ptr<XFA_MAPMODULEDATA> map_module_data_;
+ std::unique_ptr<CXFA_WidgetData> widget_data_;
+ std::vector<UnownedPtr<CXFA_Node>> binding_nodes_;
};
#endif // FXJS_CJX_NODE_H_