From 2a69b9ef97ddf46fe01de432bd0ccc1b7ce92bcb Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 7 Nov 2017 20:49:20 +0000 Subject: Rename CXFA_Margin to CXFA_MarginData This CL renames CXFA_Margin to CXFA_MarginData to reflect the fact this is part of the data hierarchy. Change-Id: I50d82d01fcaf35c621f13b8b68bc04d850ec885a Reviewed-on: https://pdfium-review.googlesource.com/17986 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fxfa/parser/cxfa_boxdata.cpp | 6 +++--- xfa/fxfa/parser/cxfa_boxdata.h | 4 ++-- xfa/fxfa/parser/cxfa_captiondata.cpp | 6 +++--- xfa/fxfa/parser/cxfa_captiondata.h | 4 ++-- xfa/fxfa/parser/cxfa_margin.cpp | 29 ----------------------------- xfa/fxfa/parser/cxfa_margin.h | 25 ------------------------- xfa/fxfa/parser/cxfa_margindata.cpp | 29 +++++++++++++++++++++++++++++ xfa/fxfa/parser/cxfa_margindata.h | 25 +++++++++++++++++++++++++ xfa/fxfa/parser/cxfa_widgetdata.cpp | 11 ++++++----- xfa/fxfa/parser/cxfa_widgetdata.h | 4 ++-- 10 files changed, 72 insertions(+), 71 deletions(-) delete mode 100644 xfa/fxfa/parser/cxfa_margin.cpp delete mode 100644 xfa/fxfa/parser/cxfa_margin.h create mode 100644 xfa/fxfa/parser/cxfa_margindata.cpp create mode 100644 xfa/fxfa/parser/cxfa_margindata.h (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/cxfa_boxdata.cpp b/xfa/fxfa/parser/cxfa_boxdata.cpp index d0c264e3b2..b7c9561bd0 100644 --- a/xfa/fxfa/parser/cxfa_boxdata.cpp +++ b/xfa/fxfa/parser/cxfa_boxdata.cpp @@ -146,9 +146,9 @@ CXFA_FillData CXFA_BoxData::GetFillData(bool bModified) const { return CXFA_FillData(pFillNode); } -CXFA_Margin CXFA_BoxData::GetMargin() const { - return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin, false) - : nullptr); +CXFA_MarginData CXFA_BoxData::GetMarginData() const { + return CXFA_MarginData( + m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin, false) : nullptr); } int32_t CXFA_BoxData::Get3DStyle(bool& bVisible, float& fThickness) const { diff --git a/xfa/fxfa/parser/cxfa_boxdata.h b/xfa/fxfa/parser/cxfa_boxdata.h index 80a39222e2..af8b26bfed 100644 --- a/xfa/fxfa/parser/cxfa_boxdata.h +++ b/xfa/fxfa/parser/cxfa_boxdata.h @@ -13,7 +13,7 @@ #include "xfa/fxfa/parser/cxfa_data.h" #include "xfa/fxfa/parser/cxfa_edgedata.h" #include "xfa/fxfa/parser/cxfa_filldata.h" -#include "xfa/fxfa/parser/cxfa_margin.h" +#include "xfa/fxfa/parser/cxfa_margindata.h" class CXFA_Node; @@ -47,7 +47,7 @@ class CXFA_BoxData : public CXFA_Data { } CXFA_FillData GetFillData(bool bModified = false) const; - CXFA_Margin GetMargin() const; + CXFA_MarginData GetMarginData() const; int32_t Get3DStyle(bool& bVisible, float& fThickness) const; }; diff --git a/xfa/fxfa/parser/cxfa_captiondata.cpp b/xfa/fxfa/parser/cxfa_captiondata.cpp index 1f84959d05..dfaba57313 100644 --- a/xfa/fxfa/parser/cxfa_captiondata.cpp +++ b/xfa/fxfa/parser/cxfa_captiondata.cpp @@ -29,9 +29,9 @@ float CXFA_CaptionData::GetReserve() { return ms.ToUnit(XFA_UNIT_Pt); } -CXFA_Margin CXFA_CaptionData::GetMargin() { - return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin, false) - : nullptr); +CXFA_MarginData CXFA_CaptionData::GetMarginData() { + return CXFA_MarginData( + m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin, false) : nullptr); } CXFA_FontData CXFA_CaptionData::GetFontData() { diff --git a/xfa/fxfa/parser/cxfa_captiondata.h b/xfa/fxfa/parser/cxfa_captiondata.h index 0a14c1f8fa..6c4837fbd1 100644 --- a/xfa/fxfa/parser/cxfa_captiondata.h +++ b/xfa/fxfa/parser/cxfa_captiondata.h @@ -9,7 +9,7 @@ #include "xfa/fxfa/parser/cxfa_data.h" #include "xfa/fxfa/parser/cxfa_fontdata.h" -#include "xfa/fxfa/parser/cxfa_margin.h" +#include "xfa/fxfa/parser/cxfa_margindata.h" #include "xfa/fxfa/parser/cxfa_value.h" class CXFA_Node; @@ -21,7 +21,7 @@ class CXFA_CaptionData : public CXFA_Data { int32_t GetPresence(); int32_t GetPlacementType(); float GetReserve(); - CXFA_Margin GetMargin(); + CXFA_MarginData GetMarginData(); CXFA_FontData GetFontData(); CXFA_Value GetValue(); }; diff --git a/xfa/fxfa/parser/cxfa_margin.cpp b/xfa/fxfa/parser/cxfa_margin.cpp deleted file mode 100644 index e3153f2671..0000000000 --- a/xfa/fxfa/parser/cxfa_margin.cpp +++ /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 - -#include "xfa/fxfa/parser/cxfa_margin.h" - -CXFA_Margin::CXFA_Margin(CXFA_Node* pNode) : CXFA_Data(pNode) {} - -bool CXFA_Margin::GetLeftInset(float& fInset, float fDefInset) const { - fInset = fDefInset; - return TryMeasure(XFA_ATTRIBUTE_LeftInset, fInset); -} - -bool CXFA_Margin::GetTopInset(float& fInset, float fDefInset) const { - fInset = fDefInset; - return TryMeasure(XFA_ATTRIBUTE_TopInset, fInset); -} - -bool CXFA_Margin::GetRightInset(float& fInset, float fDefInset) const { - fInset = fDefInset; - return TryMeasure(XFA_ATTRIBUTE_RightInset, fInset); -} - -bool CXFA_Margin::GetBottomInset(float& fInset, float fDefInset) const { - fInset = fDefInset; - return TryMeasure(XFA_ATTRIBUTE_BottomInset, fInset); -} diff --git a/xfa/fxfa/parser/cxfa_margin.h b/xfa/fxfa/parser/cxfa_margin.h deleted file mode 100644 index 89fc4ce38a..0000000000 --- a/xfa/fxfa/parser/cxfa_margin.h +++ /dev/null @@ -1,25 +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_MARGIN_H_ -#define XFA_FXFA_PARSER_CXFA_MARGIN_H_ - -#include "core/fxcrt/fx_system.h" -#include "xfa/fxfa/parser/cxfa_data.h" - -class CXFA_Node; - -class CXFA_Margin : public CXFA_Data { - public: - explicit CXFA_Margin(CXFA_Node* pNode); - - bool GetLeftInset(float& fInset, float fDefInset = 0) const; - bool GetTopInset(float& fInset, float fDefInset = 0) const; - bool GetRightInset(float& fInset, float fDefInset = 0) const; - bool GetBottomInset(float& fInset, float fDefInset = 0) const; -}; - -#endif // XFA_FXFA_PARSER_CXFA_MARGIN_H_ diff --git a/xfa/fxfa/parser/cxfa_margindata.cpp b/xfa/fxfa/parser/cxfa_margindata.cpp new file mode 100644 index 0000000000..9227668a68 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_margindata.cpp @@ -0,0 +1,29 @@ +// 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_margindata.h" + +CXFA_MarginData::CXFA_MarginData(CXFA_Node* pNode) : CXFA_Data(pNode) {} + +bool CXFA_MarginData::GetLeftInset(float& fInset, float fDefInset) const { + fInset = fDefInset; + return TryMeasure(XFA_ATTRIBUTE_LeftInset, fInset); +} + +bool CXFA_MarginData::GetTopInset(float& fInset, float fDefInset) const { + fInset = fDefInset; + return TryMeasure(XFA_ATTRIBUTE_TopInset, fInset); +} + +bool CXFA_MarginData::GetRightInset(float& fInset, float fDefInset) const { + fInset = fDefInset; + return TryMeasure(XFA_ATTRIBUTE_RightInset, fInset); +} + +bool CXFA_MarginData::GetBottomInset(float& fInset, float fDefInset) const { + fInset = fDefInset; + return TryMeasure(XFA_ATTRIBUTE_BottomInset, fInset); +} diff --git a/xfa/fxfa/parser/cxfa_margindata.h b/xfa/fxfa/parser/cxfa_margindata.h new file mode 100644 index 0000000000..fda823945c --- /dev/null +++ b/xfa/fxfa/parser/cxfa_margindata.h @@ -0,0 +1,25 @@ +// 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_MARGINDATA_H_ +#define XFA_FXFA_PARSER_CXFA_MARGINDATA_H_ + +#include "core/fxcrt/fx_system.h" +#include "xfa/fxfa/parser/cxfa_data.h" + +class CXFA_Node; + +class CXFA_MarginData : public CXFA_Data { + public: + explicit CXFA_MarginData(CXFA_Node* pNode); + + bool GetLeftInset(float& fInset, float fDefInset = 0) const; + bool GetTopInset(float& fInset, float fDefInset = 0) const; + bool GetRightInset(float& fInset, float fDefInset = 0) const; + bool GetBottomInset(float& fInset, float fDefInset = 0) const; +}; + +#endif // XFA_FXFA_PARSER_CXFA_MARGINDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 305ead26d9..5edbc7fad4 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -294,8 +294,8 @@ CXFA_FontData CXFA_WidgetData::GetFontData(bool bModified) { m_pNode->JSNode()->GetProperty(0, XFA_Element::Font, bModified)); } -CXFA_Margin CXFA_WidgetData::GetMargin() { - return CXFA_Margin( +CXFA_MarginData CXFA_WidgetData::GetMarginData() { + return CXFA_MarginData( m_pNode->JSNode()->GetProperty(0, XFA_Element::Margin, false)); } @@ -396,10 +396,11 @@ CXFA_BorderData CXFA_WidgetData::GetUIBorderData() { CFX_RectF CXFA_WidgetData::GetUIMargin() { CXFA_Node* pUIChild = GetUIChild(); - CXFA_Margin mgUI = CXFA_Margin( - pUIChild ? pUIChild->JSNode()->GetProperty(0, XFA_Element::Margin, false) - : nullptr); + if (!pUIChild) + return CFX_RectF(); + CXFA_MarginData mgUI = CXFA_MarginData( + pUIChild->JSNode()->GetProperty(0, XFA_Element::Margin, false)); if (!mgUI) return CFX_RectF(); diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index b2cb214ccc..3df30dc5f1 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -19,7 +19,7 @@ #include "xfa/fxfa/parser/cxfa_captiondata.h" #include "xfa/fxfa/parser/cxfa_data.h" #include "xfa/fxfa/parser/cxfa_fontdata.h" -#include "xfa/fxfa/parser/cxfa_margin.h" +#include "xfa/fxfa/parser/cxfa_margindata.h" #include "xfa/fxfa/parser/cxfa_para.h" #include "xfa/fxfa/parser/cxfa_validate.h" @@ -53,7 +53,7 @@ class CXFA_WidgetData : public CXFA_Data { CXFA_BorderData GetBorderData(bool bModified); CXFA_CaptionData GetCaptionData(); CXFA_FontData GetFontData(bool bModified); - CXFA_Margin GetMargin(); + CXFA_MarginData GetMarginData(); CXFA_Para GetPara(); std::vector GetEventList(); std::vector GetEventByActivity(int32_t iActivity, -- cgit v1.2.3