summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-12-14 21:14:14 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-14 21:14:14 +0000
commit9a2c6552460c82417de13e86f07e23dc8c8cef74 (patch)
tree9b1971968c9d371b226457090ab0f73efe45bca4 /xfa/fxfa/parser
parent8eb2722e764fff0a39d0d1dc0c59473aa938b31f (diff)
downloadpdfium-9a2c6552460c82417de13e86f07e23dc8c8cef74.tar.xz
Fold CXFA_ParaData into CXFA_Para
This CL removes the CXFA_ParaData wrapper and folds the code into CXFA_Para. Change-Id: I86d139f1df48dcc80d28c7516b1bda95a59e94bd Reviewed-on: https://pdfium-review.googlesource.com/21270 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_para.cpp39
-rw-r--r--xfa/fxfa/parser/cxfa_para.h9
-rw-r--r--xfa/fxfa/parser/cxfa_paradata.cpp60
-rw-r--r--xfa/fxfa/parser/cxfa_paradata.h29
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.h4
6 files changed, 53 insertions, 94 deletions
diff --git a/xfa/fxfa/parser/cxfa_para.cpp b/xfa/fxfa/parser/cxfa_para.cpp
index fa91eb6a3d..ad7190dd1f 100644
--- a/xfa/fxfa/parser/cxfa_para.cpp
+++ b/xfa/fxfa/parser/cxfa_para.cpp
@@ -8,6 +8,7 @@
#include "fxjs/xfa/cjx_para.h"
#include "third_party/base/ptr_util.h"
+#include "xfa/fxfa/parser/cxfa_measurement.h"
namespace {
@@ -52,3 +53,41 @@ CXFA_Para::CXFA_Para(CXFA_Document* doc, XFA_PacketType packet)
pdfium::MakeUnique<CJX_Para>(this)) {}
CXFA_Para::~CXFA_Para() {}
+
+XFA_AttributeEnum CXFA_Para::GetHorizontalAlign() {
+ return JSObject()
+ ->TryEnum(XFA_Attribute::HAlign, true)
+ .value_or(XFA_AttributeEnum::Left);
+}
+
+XFA_AttributeEnum CXFA_Para::GetVerticalAlign() {
+ return JSObject()
+ ->TryEnum(XFA_Attribute::VAlign, true)
+ .value_or(XFA_AttributeEnum::Top);
+}
+
+float CXFA_Para::GetLineHeight() {
+ return JSObject()->GetMeasure(XFA_Attribute::LineHeight).ToUnit(XFA_Unit::Pt);
+}
+
+float CXFA_Para::GetMarginLeft() {
+ return JSObject()->GetMeasure(XFA_Attribute::MarginLeft).ToUnit(XFA_Unit::Pt);
+}
+
+float CXFA_Para::GetMarginRight() {
+ return JSObject()
+ ->GetMeasure(XFA_Attribute::MarginRight)
+ .ToUnit(XFA_Unit::Pt);
+}
+
+float CXFA_Para::GetSpaceAbove() {
+ return JSObject()->GetMeasure(XFA_Attribute::SpaceAbove).ToUnit(XFA_Unit::Pt);
+}
+
+float CXFA_Para::GetSpaceBelow() {
+ return JSObject()->GetMeasure(XFA_Attribute::SpaceBelow).ToUnit(XFA_Unit::Pt);
+}
+
+float CXFA_Para::GetTextIndent() {
+ return JSObject()->GetMeasure(XFA_Attribute::TextIndent).ToUnit(XFA_Unit::Pt);
+}
diff --git a/xfa/fxfa/parser/cxfa_para.h b/xfa/fxfa/parser/cxfa_para.h
index 47c4d85eb8..afb48ce819 100644
--- a/xfa/fxfa/parser/cxfa_para.h
+++ b/xfa/fxfa/parser/cxfa_para.h
@@ -13,6 +13,15 @@ class CXFA_Para : public CXFA_Node {
public:
CXFA_Para(CXFA_Document* doc, XFA_PacketType packet);
~CXFA_Para() override;
+
+ XFA_AttributeEnum GetHorizontalAlign();
+ XFA_AttributeEnum GetVerticalAlign();
+ float GetLineHeight();
+ float GetMarginLeft();
+ float GetMarginRight();
+ float GetSpaceAbove();
+ float GetSpaceBelow();
+ float GetTextIndent();
};
#endif // XFA_FXFA_PARSER_CXFA_PARA_H_
diff --git a/xfa/fxfa/parser/cxfa_paradata.cpp b/xfa/fxfa/parser/cxfa_paradata.cpp
deleted file mode 100644
index 7dfd924675..0000000000
--- a/xfa/fxfa/parser/cxfa_paradata.cpp
+++ /dev/null
@@ -1,60 +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_paradata.h"
-
-#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/parser/cxfa_node.h"
-
-CXFA_ParaData::CXFA_ParaData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}
-
-XFA_AttributeEnum CXFA_ParaData::GetHorizontalAlign() const {
- return m_pNode->JSObject()
- ->TryEnum(XFA_Attribute::HAlign, true)
- .value_or(XFA_AttributeEnum::Left);
-}
-
-XFA_AttributeEnum CXFA_ParaData::GetVerticalAlign() const {
- return m_pNode->JSObject()
- ->TryEnum(XFA_Attribute::VAlign, true)
- .value_or(XFA_AttributeEnum::Top);
-}
-
-float CXFA_ParaData::GetLineHeight() const {
- return m_pNode->JSObject()
- ->GetMeasure(XFA_Attribute::LineHeight)
- .ToUnit(XFA_Unit::Pt);
-}
-
-float CXFA_ParaData::GetMarginLeft() const {
- return m_pNode->JSObject()
- ->GetMeasure(XFA_Attribute::MarginLeft)
- .ToUnit(XFA_Unit::Pt);
-}
-
-float CXFA_ParaData::GetMarginRight() const {
- return m_pNode->JSObject()
- ->GetMeasure(XFA_Attribute::MarginRight)
- .ToUnit(XFA_Unit::Pt);
-}
-
-float CXFA_ParaData::GetSpaceAbove() const {
- return m_pNode->JSObject()
- ->GetMeasure(XFA_Attribute::SpaceAbove)
- .ToUnit(XFA_Unit::Pt);
-}
-
-float CXFA_ParaData::GetSpaceBelow() const {
- return m_pNode->JSObject()
- ->GetMeasure(XFA_Attribute::SpaceBelow)
- .ToUnit(XFA_Unit::Pt);
-}
-
-float CXFA_ParaData::GetTextIndent() const {
- return m_pNode->JSObject()
- ->GetMeasure(XFA_Attribute::TextIndent)
- .ToUnit(XFA_Unit::Pt);
-}
diff --git a/xfa/fxfa/parser/cxfa_paradata.h b/xfa/fxfa/parser/cxfa_paradata.h
deleted file mode 100644
index f5859f3e5d..0000000000
--- a/xfa/fxfa/parser/cxfa_paradata.h
+++ /dev/null
@@ -1,29 +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_PARADATA_H_
-#define XFA_FXFA_PARSER_CXFA_PARADATA_H_
-
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fxfa/parser/cxfa_datadata.h"
-
-class CXFA_Node;
-
-class CXFA_ParaData : public CXFA_DataData {
- public:
- explicit CXFA_ParaData(CXFA_Node* pNode);
-
- XFA_AttributeEnum GetHorizontalAlign() const;
- XFA_AttributeEnum GetVerticalAlign() const;
- float GetLineHeight() const;
- float GetMarginLeft() const;
- float GetMarginRight() const;
- float GetSpaceAbove() const;
- float GetSpaceBelow() const;
- float GetTextIndent() const;
-};
-
-#endif // XFA_FXFA_PARSER_CXFA_PARADATA_H_
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index fd722ad464..6e68ee356b 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -280,9 +280,9 @@ CXFA_MarginData CXFA_WidgetData::GetMarginData() {
0, XFA_Element::Margin, false));
}
-CXFA_ParaData CXFA_WidgetData::GetParaData() {
- return CXFA_ParaData(
- m_pNode->JSObject()->GetProperty<CXFA_Para>(0, XFA_Element::Para, false));
+CXFA_Para* CXFA_WidgetData::GetPara() {
+ return m_pNode->JSObject()->GetProperty<CXFA_Para>(0, XFA_Element::Para,
+ false);
}
std::vector<CXFA_Node*> CXFA_WidgetData::GetEventList() {
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h
index 21e4e848ec..2873ff9bc1 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.h
+++ b/xfa/fxfa/parser/cxfa_widgetdata.h
@@ -21,7 +21,6 @@
#include "xfa/fxfa/parser/cxfa_datadata.h"
#include "xfa/fxfa/parser/cxfa_fontdata.h"
#include "xfa/fxfa/parser/cxfa_margindata.h"
-#include "xfa/fxfa/parser/cxfa_paradata.h"
enum XFA_CHECKSTATE {
XFA_CHECKSTATE_On = 0,
@@ -37,6 +36,7 @@ enum XFA_VALUEPICTURE {
};
class CXFA_Node;
+class CXFA_Para;
class CXFA_Validate;
class IFX_Locale;
@@ -62,7 +62,7 @@ class CXFA_WidgetData : public CXFA_DataData {
CXFA_CaptionData GetCaptionData();
CXFA_FontData GetFontData(bool bModified);
CXFA_MarginData GetMarginData();
- CXFA_ParaData GetParaData();
+ CXFA_Para* GetPara();
CXFA_Value* GetDefaultValue();
CXFA_Value* GetFormValue();
CXFA_CalculateData GetCalculateData();