diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-12-14 20:14:54 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-12-14 20:14:54 +0000 |
commit | 2eeb42b74b1d29b3cf7fb7344530137debb680dd (patch) | |
tree | b7eefd640caca6ba4556208d210ed51a01d4d522 | |
parent | 0821c95ee9f132f77f3670a7dbbf114a82a6b9a0 (diff) | |
download | pdfium-2eeb42b74b1d29b3cf7fb7344530137debb680dd.tar.xz |
Fold CXFA_TextData into CXFA_Text
This CL folds the CXFA_TextData back into CXFA_Text. CXFA_TextData is a
thin wrapper around the CXFA_Text object.
Change-Id: I4edc37f2ac66fc9b662942d3351fce6b697f27c7
Reviewed-on: https://pdfium-review.googlesource.com/21172
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
-rw-r--r-- | BUILD.gn | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_calculatedata.cpp | 9 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_text.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_text.h | 3 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_textdata.cpp | 15 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_textdata.h | 22 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_value.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_value.h | 4 |
9 files changed, 18 insertions, 51 deletions
@@ -2681,8 +2681,6 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_templatecache.h", "xfa/fxfa/parser/cxfa_text.cpp", "xfa/fxfa/parser/cxfa_text.h", - "xfa/fxfa/parser/cxfa_textdata.cpp", - "xfa/fxfa/parser/cxfa_textdata.h", "xfa/fxfa/parser/cxfa_textedit.cpp", "xfa/fxfa/parser/cxfa_textedit.h", "xfa/fxfa/parser/cxfa_thisproxy.cpp", diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 65c4649fed..f8ea037bf3 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -502,9 +502,9 @@ WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) { if (captionData.HasValidNode()) { CXFA_Value* capValue = captionData.GetValue(); if (capValue) { - CXFA_TextData captionTextData = capValue->GetTextData(); - if (captionTextData.HasValidNode()) - wsCaptionName = captionTextData.GetContent(); + CXFA_Text* captionText = capValue->GetText(); + if (captionText) + wsCaptionName = captionText->GetContent(); } } } diff --git a/xfa/fxfa/parser/cxfa_calculatedata.cpp b/xfa/fxfa/parser/cxfa_calculatedata.cpp index b0feb59fd4..32dc8ef5b7 100644 --- a/xfa/fxfa/parser/cxfa_calculatedata.cpp +++ b/xfa/fxfa/parser/cxfa_calculatedata.cpp @@ -7,7 +7,7 @@ #include "xfa/fxfa/parser/cxfa_calculatedata.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_textdata.h" +#include "xfa/fxfa/parser/cxfa_text.h" CXFA_CalculateData::CXFA_CalculateData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} @@ -27,8 +27,7 @@ WideString CXFA_CalculateData::GetMessageText() const { if (!pNode) return L""; - CXFA_TextData textData(pNode->GetChild(0, XFA_Element::Text, false)); - if (!textData.HasValidNode()) - return L""; - return textData.GetContent(); + CXFA_Text* text = + static_cast<CXFA_Text*>(pNode->GetChild(0, XFA_Element::Text, false)); + return text ? text->GetContent() : L""; } diff --git a/xfa/fxfa/parser/cxfa_text.cpp b/xfa/fxfa/parser/cxfa_text.cpp index e890aca7ec..e000493446 100644 --- a/xfa/fxfa/parser/cxfa_text.cpp +++ b/xfa/fxfa/parser/cxfa_text.cpp @@ -37,3 +37,7 @@ CXFA_Text::CXFA_Text(CXFA_Document* doc, XFA_PacketType packet) pdfium::MakeUnique<CJX_Text>(this)) {} CXFA_Text::~CXFA_Text() {} + +WideString CXFA_Text::GetContent() { + return JSObject()->GetContent(false); +} diff --git a/xfa/fxfa/parser/cxfa_text.h b/xfa/fxfa/parser/cxfa_text.h index 6883904b55..a75aef2b01 100644 --- a/xfa/fxfa/parser/cxfa_text.h +++ b/xfa/fxfa/parser/cxfa_text.h @@ -7,12 +7,15 @@ #ifndef XFA_FXFA_PARSER_CXFA_TEXT_H_ #define XFA_FXFA_PARSER_CXFA_TEXT_H_ +#include "core/fxcrt/fx_string.h" #include "xfa/fxfa/parser/cxfa_node.h" class CXFA_Text : public CXFA_Node { public: CXFA_Text(CXFA_Document* doc, XFA_PacketType packet); ~CXFA_Text() override; + + WideString GetContent(); }; #endif // XFA_FXFA_PARSER_CXFA_TEXT_H_ diff --git a/xfa/fxfa/parser/cxfa_textdata.cpp b/xfa/fxfa/parser/cxfa_textdata.cpp deleted file mode 100644 index 2ce6c0368e..0000000000 --- a/xfa/fxfa/parser/cxfa_textdata.cpp +++ /dev/null @@ -1,15 +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_textdata.h" - -#include "xfa/fxfa/parser/cxfa_node.h" - -CXFA_TextData::CXFA_TextData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} - -WideString CXFA_TextData::GetContent() const { - return m_pNode->JSObject()->GetContent(false); -} diff --git a/xfa/fxfa/parser/cxfa_textdata.h b/xfa/fxfa/parser/cxfa_textdata.h deleted file mode 100644 index 4a28a88d59..0000000000 --- a/xfa/fxfa/parser/cxfa_textdata.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_TEXTDATA_H_ -#define XFA_FXFA_PARSER_CXFA_TEXTDATA_H_ - -#include "core/fxcrt/fx_string.h" -#include "xfa/fxfa/parser/cxfa_datadata.h" - -class CXFA_Node; - -class CXFA_TextData : public CXFA_DataData { - public: - explicit CXFA_TextData(CXFA_Node* pNode); - - WideString GetContent() const; -}; - -#endif // XFA_FXFA_PARSER_CXFA_TEXTDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp index aae11da211..d4911c56db 100644 --- a/xfa/fxfa/parser/cxfa_value.cpp +++ b/xfa/fxfa/parser/cxfa_value.cpp @@ -75,8 +75,8 @@ CXFA_RectangleData CXFA_Value::GetRectangleData() const { return CXFA_RectangleData(GetNodeItem(XFA_NODEITEM_FirstChild)); } -CXFA_TextData CXFA_Value::GetTextData() const { - return CXFA_TextData(GetNodeItem(XFA_NODEITEM_FirstChild)); +CXFA_Text* CXFA_Value::GetText() const { + return static_cast<CXFA_Text*>(GetNodeItem(XFA_NODEITEM_FirstChild)); } CXFA_ExDataData CXFA_Value::GetExData() const { diff --git a/xfa/fxfa/parser/cxfa_value.h b/xfa/fxfa/parser/cxfa_value.h index 0a964ff353..f510446d11 100644 --- a/xfa/fxfa/parser/cxfa_value.h +++ b/xfa/fxfa/parser/cxfa_value.h @@ -15,7 +15,7 @@ #include "xfa/fxfa/parser/cxfa_linedata.h" #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_rectangledata.h" -#include "xfa/fxfa/parser/cxfa_textdata.h" +#include "xfa/fxfa/parser/cxfa_text.h" class CXFA_Value : public CXFA_Node { public: @@ -27,7 +27,7 @@ class CXFA_Value : public CXFA_Node { CXFA_ArcData GetArcData() const; CXFA_LineData GetLineData() const; CXFA_RectangleData GetRectangleData() const; - CXFA_TextData GetTextData() const; + CXFA_Text* GetText() const; CXFA_ExDataData GetExData() const; CXFA_ImageData GetImageData() const; }; |