From 4cf0589c4bc388781cbfc8459c4904bb2bd947bf Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 3 Jan 2018 16:58:06 -0500 Subject: Fold CXFA_ExDataData into CXFA_ExData This CL removes the CXFA_ExDataData wrapper and puts the code in CXFA_ExData directly. Change-Id: I9406d615a09fb431b5c620ed348f9976cf8dc72a Reviewed-on: https://pdfium-review.googlesource.com/22230 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_exdata.cpp | 4 ++++ xfa/fxfa/parser/cxfa_exdata.h | 2 ++ xfa/fxfa/parser/cxfa_exdatadata.cpp | 16 ---------------- xfa/fxfa/parser/cxfa_exdatadata.h | 22 ---------------------- xfa/fxfa/parser/cxfa_value.cpp | 5 +++-- xfa/fxfa/parser/cxfa_value.h | 4 ++-- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 8 ++++---- 7 files changed, 15 insertions(+), 46 deletions(-) delete mode 100644 xfa/fxfa/parser/cxfa_exdatadata.cpp delete mode 100644 xfa/fxfa/parser/cxfa_exdatadata.h (limited to 'xfa') diff --git a/xfa/fxfa/parser/cxfa_exdata.cpp b/xfa/fxfa/parser/cxfa_exdata.cpp index 2c4571d101..cf57796ccc 100644 --- a/xfa/fxfa/parser/cxfa_exdata.cpp +++ b/xfa/fxfa/parser/cxfa_exdata.cpp @@ -40,3 +40,7 @@ CXFA_ExData::CXFA_ExData(CXFA_Document* doc, XFA_PacketType packet) pdfium::MakeUnique(this)) {} CXFA_ExData::~CXFA_ExData() {} + +void CXFA_ExData::SetContentType(const WideString& wsContentType) { + JSObject()->SetCData(XFA_Attribute::ContentType, wsContentType, false, false); +} diff --git a/xfa/fxfa/parser/cxfa_exdata.h b/xfa/fxfa/parser/cxfa_exdata.h index 92ea0e6c48..8eb3caf76b 100644 --- a/xfa/fxfa/parser/cxfa_exdata.h +++ b/xfa/fxfa/parser/cxfa_exdata.h @@ -13,6 +13,8 @@ class CXFA_ExData : public CXFA_Node { public: CXFA_ExData(CXFA_Document* doc, XFA_PacketType packet); ~CXFA_ExData() override; + + void SetContentType(const WideString& wsContentType); }; #endif // XFA_FXFA_PARSER_CXFA_EXDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_exdatadata.cpp b/xfa/fxfa/parser/cxfa_exdatadata.cpp deleted file mode 100644 index 41a1b03ec0..0000000000 --- a/xfa/fxfa/parser/cxfa_exdatadata.cpp +++ /dev/null @@ -1,16 +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_exdatadata.h" - -#include "xfa/fxfa/parser/cxfa_node.h" - -CXFA_ExDataData::CXFA_ExDataData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} - -void CXFA_ExDataData::SetContentType(const WideString& wsContentType) { - m_pNode->JSObject()->SetCData(XFA_Attribute::ContentType, wsContentType, - false, false); -} diff --git a/xfa/fxfa/parser/cxfa_exdatadata.h b/xfa/fxfa/parser/cxfa_exdatadata.h deleted file mode 100644 index 0def98b92a..0000000000 --- a/xfa/fxfa/parser/cxfa_exdatadata.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_EXDATADATA_H_ -#define XFA_FXFA_PARSER_CXFA_EXDATADATA_H_ - -#include "core/fxcrt/fx_string.h" -#include "xfa/fxfa/parser/cxfa_datadata.h" - -class CXFA_Node; - -class CXFA_ExDataData : public CXFA_DataData { - public: - explicit CXFA_ExDataData(CXFA_Node* pNode); - - void SetContentType(const WideString& wsContentType); -}; - -#endif // XFA_FXFA_PARSER_CXFA_EXDATADATA_H_ diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp index 99cca777dc..0998c06364 100644 --- a/xfa/fxfa/parser/cxfa_value.cpp +++ b/xfa/fxfa/parser/cxfa_value.cpp @@ -9,6 +9,7 @@ #include "fxjs/xfa/cjx_value.h" #include "third_party/base/ptr_util.h" #include "xfa/fxfa/parser/cxfa_arc.h" +#include "xfa/fxfa/parser/cxfa_exdata.h" #include "xfa/fxfa/parser/cxfa_image.h" #include "xfa/fxfa/parser/cxfa_line.h" #include "xfa/fxfa/parser/cxfa_rectangle.h" @@ -83,8 +84,8 @@ CXFA_Text* CXFA_Value::GetText() const { return static_cast(GetNodeItem(XFA_NODEITEM_FirstChild)); } -CXFA_ExDataData CXFA_Value::GetExData() const { - return CXFA_ExDataData(GetNodeItem(XFA_NODEITEM_FirstChild)); +CXFA_ExData* CXFA_Value::GetExData() const { + return static_cast(GetNodeItem(XFA_NODEITEM_FirstChild)); } CXFA_Image* CXFA_Value::GetImage() const { diff --git a/xfa/fxfa/parser/cxfa_value.h b/xfa/fxfa/parser/cxfa_value.h index 91483b8832..92400aa380 100644 --- a/xfa/fxfa/parser/cxfa_value.h +++ b/xfa/fxfa/parser/cxfa_value.h @@ -9,11 +9,11 @@ #include "core/fxcrt/fx_string.h" #include "xfa/fxfa/parser/cxfa_datadata.h" -#include "xfa/fxfa/parser/cxfa_exdatadata.h" #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_text.h" class CXFA_Arc; +class CXFA_ExData; class CXFA_Image; class CXFA_Line; class CXFA_Rectangle; @@ -29,7 +29,7 @@ class CXFA_Value : public CXFA_Node { CXFA_Line* GetLine() const; CXFA_Rectangle* GetRectangle() const; CXFA_Text* GetText() const; - CXFA_ExDataData GetExData() const; + CXFA_ExData* GetExData() const; CXFA_Image* GetImage() const; }; diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index c98597f78e..8de905278e 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -18,6 +18,7 @@ #include "xfa/fxfa/parser/cxfa_bind.h" #include "xfa/fxfa/parser/cxfa_datagroup.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_exdata.h" #include "xfa/fxfa/parser/cxfa_form.h" #include "xfa/fxfa/parser/cxfa_image.h" #include "xfa/fxfa/parser/cxfa_items.h" @@ -326,11 +327,10 @@ void CreateDataBinding(CXFA_Node* pFormNode, wsNormalizeValue += wsItem; } - CXFA_ExDataData exData = - defValue ? defValue->GetExData() : CXFA_ExDataData(nullptr); - ASSERT(exData.HasValidNode()); + CXFA_ExData* exData = defValue ? defValue->GetExData() : nullptr; + ASSERT(exData); - exData.SetContentType(single ? L"text/plain" : L"text/xml"); + exData->SetContentType(single ? L"text/plain" : L"text/xml"); } FormValueNode_SetChildContent(defValue, wsNormalizeValue, XFA_Element::ExData); -- cgit v1.2.3