From 44820980f762797f1ffba61b9f5b8cf0922489a3 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 3 Jan 2018 15:11:52 -0500 Subject: Fold CXFA_BindData into CXFA_Bind This CL merges the CXFA_BindData wrapper into CXFA_Bind. Change-Id: I621955be2673938bf08c7897779311b776d0bf8b Reviewed-on: https://pdfium-review.googlesource.com/22131 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_bind.cpp | 7 +++++++ xfa/fxfa/parser/cxfa_bind.h | 2 ++ xfa/fxfa/parser/cxfa_binddata.cpp | 18 ------------------ xfa/fxfa/parser/cxfa_binddata.h | 22 ---------------------- xfa/fxfa/parser/cxfa_widgetdata.cpp | 12 ++++++------ xfa/fxfa/parser/cxfa_widgetdata.h | 4 ++-- 6 files changed, 17 insertions(+), 48 deletions(-) delete mode 100644 xfa/fxfa/parser/cxfa_binddata.cpp delete mode 100644 xfa/fxfa/parser/cxfa_binddata.h (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/parser/cxfa_bind.cpp b/xfa/fxfa/parser/cxfa_bind.cpp index e93b3696df..a9779f2514 100644 --- a/xfa/fxfa/parser/cxfa_bind.cpp +++ b/xfa/fxfa/parser/cxfa_bind.cpp @@ -8,6 +8,7 @@ #include "fxjs/xfa/cjx_bind.h" #include "third_party/base/ptr_util.h" +#include "xfa/fxfa/parser/cxfa_picture.h" namespace { @@ -43,3 +44,9 @@ CXFA_Bind::CXFA_Bind(CXFA_Document* doc, XFA_PacketType packet) pdfium::MakeUnique(this)) {} CXFA_Bind::~CXFA_Bind() {} + +WideString CXFA_Bind::GetPicture() { + CXFA_Picture* pPicture = + GetChild(0, XFA_Element::Picture, false); + return pPicture ? pPicture->JSObject()->GetContent(false) : L""; +} diff --git a/xfa/fxfa/parser/cxfa_bind.h b/xfa/fxfa/parser/cxfa_bind.h index 9c457bb536..1924cb6f78 100644 --- a/xfa/fxfa/parser/cxfa_bind.h +++ b/xfa/fxfa/parser/cxfa_bind.h @@ -13,6 +13,8 @@ class CXFA_Bind : public CXFA_Node { public: CXFA_Bind(CXFA_Document* doc, XFA_PacketType packet); ~CXFA_Bind() override; + + WideString GetPicture(); }; #endif // XFA_FXFA_PARSER_CXFA_BIND_H_ diff --git a/xfa/fxfa/parser/cxfa_binddata.cpp b/xfa/fxfa/parser/cxfa_binddata.cpp deleted file mode 100644 index 7a7e2eef86..0000000000 --- a/xfa/fxfa/parser/cxfa_binddata.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fxfa/parser/cxfa_binddata.h" - -#include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_picture.h" - -CXFA_BindData::CXFA_BindData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} - -WideString CXFA_BindData::GetPicture() { - CXFA_Picture* pPicture = - m_pNode->GetChild(0, XFA_Element::Picture, false); - return pPicture ? pPicture->JSObject()->GetContent(false) : L""; -} diff --git a/xfa/fxfa/parser/cxfa_binddata.h b/xfa/fxfa/parser/cxfa_binddata.h deleted file mode 100644 index fde030fc50..0000000000 --- a/xfa/fxfa/parser/cxfa_binddata.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_PARSER_CXFA_BINDDATA_H_ -#define XFA_FXFA_PARSER_CXFA_BINDDATA_H_ - -#include "core/fxcrt/fx_string.h" -#include "xfa/fxfa/parser/cxfa_datadata.h" - -class CXFA_Node; - -class CXFA_BindData : public CXFA_DataData { - public: - explicit CXFA_BindData(CXFA_Node* pNode); - - WideString GetPicture(); -}; - -#endif // XFA_FXFA_PARSER_CXFA_BINDDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index a7f157d0a2..9c08c1ac43 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -336,9 +336,9 @@ CXFA_Validate* CXFA_WidgetData::GetValidate(bool bModified) { 0, XFA_Element::Validate, bModified); } -CXFA_BindData CXFA_WidgetData::GetBindData() { - return CXFA_BindData( - m_pNode->JSObject()->GetProperty(0, XFA_Element::Bind, false)); +CXFA_Bind* CXFA_WidgetData::GetBind() { + return m_pNode->JSObject()->GetProperty(0, XFA_Element::Bind, + false); } pdfium::Optional CXFA_WidgetData::TryWidth() { @@ -1489,9 +1489,9 @@ WideString CXFA_WidgetData::GetPictureContent(XFA_VALUEPICTURE ePicture) { } } case XFA_VALUEPICTURE_DataBind: { - CXFA_BindData bindData = GetBindData(); - if (bindData.HasValidNode()) - return bindData.GetPicture(); + CXFA_Bind* bind = GetBind(); + if (bind) + return bind->GetPicture(); break; } default: diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index 57548e329c..c75225b5fe 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -14,7 +14,6 @@ #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" #include "fxbarcode/BC_Library.h" -#include "xfa/fxfa/parser/cxfa_binddata.h" #include "xfa/fxfa/parser/cxfa_datadata.h" #include "xfa/fxfa/parser/cxfa_fontdata.h" @@ -31,6 +30,7 @@ enum XFA_VALUEPICTURE { XFA_VALUEPICTURE_DataBind, }; +class CXFA_Bind; class CXFA_Border; class CXFA_Calculate; class CXFA_Caption; @@ -174,7 +174,7 @@ class CXFA_WidgetData : public CXFA_DataData { void SetIsNull(bool val) { m_bIsNull = val; } private: - CXFA_BindData GetBindData(); + CXFA_Bind* GetBind(); void SyncValue(const WideString& wsValue, bool bNotify); void InsertListTextItem(CXFA_Node* pItems, const WideString& wsText, -- cgit v1.2.3