summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-12-14 20:51:03 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-14 20:51:03 +0000
commitdf4f30eaaa469c3703118f89579d506209a49237 (patch)
tree881eb4c93dadd3b07414cc950ed5cbbbb3c9693a /fxjs
parent51ef4a6ca3b4ae9b618cb1c96f84697a2bf4a2b1 (diff)
downloadpdfium-df4f30eaaa469c3703118f89579d506209a49237.tar.xz
Add types to the CXFA_Node::Get*{Child|Sibling}* methods
This CL templates the various Get methods in CXFA_Node in order to return the correct node type. Change-Id: I4f50df6dd9213873deb8f8f262eaf579c6c4ca7d Reviewed-on: https://pdfium-review.googlesource.com/21230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/xfa/cjx_layoutpseudomodel.cpp4
-rw-r--r--fxjs/xfa/cjx_object.cpp9
2 files changed, 9 insertions, 4 deletions
diff --git a/fxjs/xfa/cjx_layoutpseudomodel.cpp b/fxjs/xfa/cjx_layoutpseudomodel.cpp
index 638da41eea..c275970744 100644
--- a/fxjs/xfa/cjx_layoutpseudomodel.cpp
+++ b/fxjs/xfa/cjx_layoutpseudomodel.cpp
@@ -17,6 +17,7 @@
#include "xfa/fxfa/parser/cxfa_arraynodelist.h"
#include "xfa/fxfa/parser/cxfa_containerlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_document.h"
+#include "xfa/fxfa/parser/cxfa_form.h"
#include "xfa/fxfa/parser/cxfa_layoutitem.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
@@ -400,7 +401,8 @@ CJS_Return CJX_LayoutPseudoModel::relayout(
CJS_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
CXFA_Node* pRootNode = GetDocument()->GetRoot();
- CXFA_Node* pFormRoot = pRootNode->GetFirstChildByClass(XFA_Element::Form);
+ CXFA_Form* pFormRoot =
+ pRootNode->GetFirstChildByClass<CXFA_Form>(XFA_Element::Form);
CXFA_Node* pContentRootNode = pFormRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
CXFA_LayoutProcessor* pLayoutProcessor = GetDocument()->GetLayoutProcessor();
if (pContentRootNode)
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index c49cc5bbce..fcf77d434d 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -26,7 +26,10 @@
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_object.h"
+#include "xfa/fxfa/parser/cxfa_occur.h"
#include "xfa/fxfa/parser/cxfa_occurdata.h"
+#include "xfa/fxfa/parser/cxfa_proto.h"
+#include "xfa/fxfa/parser/cxfa_subform.h"
#include "xfa/fxfa/parser/cxfa_validate.h"
#include "xfa/fxfa/parser/cxfa_value.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -1217,9 +1220,9 @@ void CJX_Object::Script_Attribute_String(CFXJSE_Value* pValue,
CXFA_Node* pTemplateNode =
ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Template));
- CXFA_Node* pProtoRoot =
- pTemplateNode->GetFirstChildByClass(XFA_Element::Subform)
- ->GetFirstChildByClass(XFA_Element::Proto);
+ CXFA_Proto* pProtoRoot =
+ pTemplateNode->GetFirstChildByClass<CXFA_Subform>(XFA_Element::Subform)
+ ->GetFirstChildByClass<CXFA_Proto>(XFA_Element::Proto);
WideString wsID;
WideString wsSOM;