summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-06-04 14:01:27 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-04 14:01:27 +0000
commit714bf7821d2de6249d2779424c47027a981d5032 (patch)
tree860b3365aff4723ba1a2ed85e7621eb508240e9e /xfa/fxfa
parent38cb7263a0923dd5613da24b18d3d7ef052ff5e3 (diff)
downloadpdfium-714bf7821d2de6249d2779424c47027a981d5032.tar.xz
[xfa] Get properties from the non-xfa global if possible
When script variables are used the methods are set on the non-xfa global object. This CL updates the NormalPropertyGetter to check the non-xfa global object for methods which allows the variables methods to be found. Bug: pdfium:1097 Change-Id: I13d9d49ad654cad776883aef74de6250de5e756b Reviewed-on: https://pdfium-review.googlesource.com/33433 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/parser/cxfa_value.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp
index ecb380f9c8..24bd338fe2 100644
--- a/xfa/fxfa/parser/cxfa_value.cpp
+++ b/xfa/fxfa/parser/cxfa_value.cpp
@@ -69,36 +69,42 @@ WideString CXFA_Value::GetChildValueContent() const {
CXFA_Arc* CXFA_Value::GetArcIfExists() const {
CXFA_Node* node = GetFirstChild();
- ASSERT(!node || node->GetElementType() == XFA_Element::Arc);
+ if (!node || node->GetElementType() != XFA_Element::Arc)
+ return nullptr;
return static_cast<CXFA_Arc*>(node);
}
CXFA_Line* CXFA_Value::GetLineIfExists() const {
CXFA_Node* node = GetFirstChild();
- ASSERT(!node || node->GetElementType() == XFA_Element::Line);
+ if (!node || node->GetElementType() != XFA_Element::Line)
+ return nullptr;
return static_cast<CXFA_Line*>(node);
}
CXFA_Rectangle* CXFA_Value::GetRectangleIfExists() const {
CXFA_Node* node = GetFirstChild();
- ASSERT(!node || node->GetElementType() == XFA_Element::Rectangle);
+ if (!node || node->GetElementType() != XFA_Element::Rectangle)
+ return nullptr;
return static_cast<CXFA_Rectangle*>(node);
}
CXFA_Text* CXFA_Value::GetTextIfExists() const {
CXFA_Node* node = GetFirstChild();
- ASSERT(!node || node->GetElementType() == XFA_Element::Text);
+ if (!node || node->GetElementType() != XFA_Element::Text)
+ return nullptr;
return static_cast<CXFA_Text*>(node);
}
CXFA_ExData* CXFA_Value::GetExDataIfExists() const {
CXFA_Node* node = GetFirstChild();
- ASSERT(!node || node->GetElementType() == XFA_Element::ExData);
+ if (!node || node->GetElementType() != XFA_Element::ExData)
+ return nullptr;
return static_cast<CXFA_ExData*>(node);
}
CXFA_Image* CXFA_Value::GetImageIfExists() const {
CXFA_Node* node = GetFirstChild();
- ASSERT(!node || node->GetElementType() == XFA_Element::Image);
+ if (!node || node->GetElementType() != XFA_Element::Image)
+ return nullptr;
return static_cast<CXFA_Image*>(node);
}