summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-07 20:49:20 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-07 20:49:20 +0000
commit2a69b9ef97ddf46fe01de432bd0ccc1b7ce92bcb (patch)
treed0138d82b52cc63e0956a12faebf6433dd9303fd
parentc5a729ec5ada8ef0edc3f4d9976e96865f516598 (diff)
downloadpdfium-2a69b9ef97ddf46fe01de432bd0ccc1b7ce92bcb.tar.xz
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 <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r--BUILD.gn4
-rw-r--r--xfa/fxfa/cxfa_ffarc.cpp4
-rw-r--r--xfa/fxfa/cxfa_ffcheckbutton.cpp27
-rw-r--r--xfa/fxfa/cxfa_ffcheckbutton.h2
-rw-r--r--xfa/fxfa/cxfa_fffield.cpp28
-rw-r--r--xfa/fxfa/cxfa_ffimage.cpp4
-rw-r--r--xfa/fxfa/cxfa_ffline.cpp4
-rw-r--r--xfa/fxfa/cxfa_ffpushbutton.cpp8
-rw-r--r--xfa/fxfa/cxfa_ffrectangle.cpp4
-rw-r--r--xfa/fxfa/cxfa_fftext.cpp18
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp27
-rw-r--r--xfa/fxfa/cxfa_ffwidget.h2
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp87
-rw-r--r--xfa/fxfa/cxfa_widgetacc.h2
-rw-r--r--xfa/fxfa/parser/cxfa_boxdata.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_boxdata.h4
-rw-r--r--xfa/fxfa/parser/cxfa_captiondata.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_captiondata.h4
-rw-r--r--xfa/fxfa/parser/cxfa_margindata.cpp (renamed from xfa/fxfa/parser/cxfa_margin.cpp)12
-rw-r--r--xfa/fxfa/parser/cxfa_margindata.h (renamed from xfa/fxfa/parser/cxfa_margin.h)10
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp11
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.h4
22 files changed, 146 insertions, 132 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 56f7bc0ee1..72a526d6fa 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1844,8 +1844,8 @@ if (pdf_enable_xfa) {
"xfa/fxfa/parser/cxfa_localemgr.h",
"xfa/fxfa/parser/cxfa_localevalue.cpp",
"xfa/fxfa/parser/cxfa_localevalue.h",
- "xfa/fxfa/parser/cxfa_margin.cpp",
- "xfa/fxfa/parser/cxfa_margin.h",
+ "xfa/fxfa/parser/cxfa_margindata.cpp",
+ "xfa/fxfa/parser/cxfa_margindata.h",
"xfa/fxfa/parser/cxfa_measurement.cpp",
"xfa/fxfa/parser/cxfa_measurement.h",
"xfa/fxfa/parser/cxfa_node.cpp",
diff --git a/xfa/fxfa/cxfa_ffarc.cpp b/xfa/fxfa/cxfa_ffarc.cpp
index ddfa1b0b0d..8802febc93 100644
--- a/xfa/fxfa/cxfa_ffarc.cpp
+++ b/xfa/fxfa/cxfa_ffarc.cpp
@@ -21,8 +21,8 @@ void CXFA_FFArc::RenderWidget(CXFA_Graphics* pGS,
return;
CFX_RectF rtArc = GetRectWithoutRotate();
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
- XFA_RectWidthoutMargin(rtArc, mgWidget);
+ if (CXFA_MarginData marginData = m_pDataAcc->GetMarginData())
+ XFA_RectWidthoutMargin(rtArc, marginData);
CFX_Matrix mtRotate = GetRotateMatrix();
mtRotate.Concat(matrix);
diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp
index 87fa41f3b7..e048598947 100644
--- a/xfa/fxfa/cxfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp
@@ -91,10 +91,10 @@ bool CXFA_FFCheckButton::PerformLayout() {
CXFA_FFWidget::PerformLayout();
float fCheckSize = m_pDataAcc->GetCheckButtonSize();
- CXFA_Margin mgWidget = m_pDataAcc->GetMargin();
+ CXFA_MarginData marginData = m_pDataAcc->GetMarginData();
CFX_RectF rtWidget = GetRectWithoutRotate();
- if (mgWidget)
- XFA_RectWidthoutMargin(rtWidget, mgWidget);
+ if (marginData)
+ XFA_RectWidthoutMargin(rtWidget, marginData);
int32_t iCapPlacement = -1;
float fCapReserve = 0;
@@ -121,18 +121,18 @@ bool CXFA_FFCheckButton::PerformLayout() {
}
m_rtUI = rtWidget;
- CXFA_Margin mgCap = captionData.GetMargin();
+ CXFA_MarginData captionMarginData = captionData.GetMarginData();
switch (iCapPlacement) {
case XFA_ATTRIBUTEENUM_Left: {
m_rtCaption.width = fCapReserve;
- CapLeftRightPlacement(mgCap);
+ CapLeftRightPlacement(captionMarginData);
m_rtUI.width -= fCapReserve;
m_rtUI.left += fCapReserve;
break;
}
case XFA_ATTRIBUTEENUM_Top: {
m_rtCaption.height = fCapReserve;
- XFA_RectWidthoutMargin(m_rtCaption, mgCap);
+ XFA_RectWidthoutMargin(m_rtCaption, captionMarginData);
m_rtUI.height -= fCapReserve;
m_rtUI.top += fCapReserve;
break;
@@ -140,14 +140,14 @@ bool CXFA_FFCheckButton::PerformLayout() {
case XFA_ATTRIBUTEENUM_Right: {
m_rtCaption.left = m_rtCaption.right() - fCapReserve;
m_rtCaption.width = fCapReserve;
- CapLeftRightPlacement(mgCap);
+ CapLeftRightPlacement(captionMarginData);
m_rtUI.width -= fCapReserve;
break;
}
case XFA_ATTRIBUTEENUM_Bottom: {
m_rtCaption.top = m_rtCaption.bottom() - fCapReserve;
m_rtCaption.height = fCapReserve;
- XFA_RectWidthoutMargin(m_rtCaption, mgCap);
+ XFA_RectWidthoutMargin(m_rtCaption, captionMarginData);
m_rtUI.height -= fCapReserve;
break;
}
@@ -174,9 +174,9 @@ bool CXFA_FFCheckButton::PerformLayout() {
m_rtCheckBox = m_rtUI;
CXFA_BorderData borderUIData = m_pDataAcc->GetUIBorderData();
if (borderUIData) {
- CXFA_Margin margin = borderUIData.GetMargin();
- if (margin)
- XFA_RectWidthoutMargin(m_rtUI, margin);
+ CXFA_MarginData borderMarginData = borderUIData.GetMarginData();
+ if (borderMarginData)
+ XFA_RectWidthoutMargin(m_rtUI, borderMarginData);
}
m_rtUI.Normalize();
@@ -188,8 +188,9 @@ bool CXFA_FFCheckButton::PerformLayout() {
return true;
}
-void CXFA_FFCheckButton::CapLeftRightPlacement(CXFA_Margin mgCap) {
- XFA_RectWidthoutMargin(m_rtCaption, mgCap);
+void CXFA_FFCheckButton::CapLeftRightPlacement(
+ CXFA_MarginData captionMarginData) {
+ XFA_RectWidthoutMargin(m_rtCaption, captionMarginData);
if (m_rtCaption.height < 0)
m_rtCaption.top += m_rtCaption.height;
if (m_rtCaption.width < 0) {
diff --git a/xfa/fxfa/cxfa_ffcheckbutton.h b/xfa/fxfa/cxfa_ffcheckbutton.h
index e405381fc8..4154852788 100644
--- a/xfa/fxfa/cxfa_ffcheckbutton.h
+++ b/xfa/fxfa/cxfa_ffcheckbutton.h
@@ -35,7 +35,7 @@ class CXFA_FFCheckButton : public CXFA_FFField {
private:
bool CommitData() override;
bool IsDataChanged() override;
- void CapLeftRightPlacement(CXFA_Margin mgCap);
+ void CapLeftRightPlacement(CXFA_MarginData captionMarginData);
void AddUIMargin(int32_t iCapPlacement);
XFA_CHECKSTATE FWLState2XFAState();
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index b1f4f20861..010af86897 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -169,14 +169,14 @@ bool CXFA_FFField::PerformLayout() {
void CXFA_FFField::CapPlacement() {
CFX_RectF rtWidget = GetRectWithoutRotate();
- CXFA_Margin mgWidget = m_pDataAcc->GetMargin();
- if (mgWidget) {
+ CXFA_MarginData marginData = m_pDataAcc->GetMarginData();
+ if (marginData) {
CXFA_LayoutItem* pItem = this;
float fLeftInset = 0, fRightInset = 0, fTopInset = 0, fBottomInset = 0;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetRightInset(fRightInset);
- mgWidget.GetTopInset(fTopInset);
- mgWidget.GetBottomInset(fBottomInset);
+ marginData.GetLeftInset(fLeftInset);
+ marginData.GetRightInset(fRightInset);
+ marginData.GetTopInset(fTopInset);
+ marginData.GetBottomInset(fBottomInset);
if (!pItem->GetPrev() && !pItem->GetNext()) {
rtWidget.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
} else {
@@ -211,7 +211,7 @@ void CXFA_FFField::CapPlacement() {
m_rtCaption.height += pItem->GetRect(false).Height();
pItem = pItem->GetNext();
}
- XFA_RectWidthoutMargin(m_rtCaption, mgWidget);
+ XFA_RectWidthoutMargin(m_rtCaption, marginData);
}
CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout();
@@ -268,9 +268,9 @@ void CXFA_FFField::CapPlacement() {
CXFA_BorderData borderUIData = m_pDataAcc->GetUIBorderData();
if (borderUIData) {
- CXFA_Margin margin = borderUIData.GetMargin();
- if (margin)
- XFA_RectWidthoutMargin(m_rtUI, margin);
+ CXFA_MarginData borderMarginData = borderUIData.GetMarginData();
+ if (borderMarginData)
+ XFA_RectWidthoutMargin(m_rtUI, borderMarginData);
}
m_rtUI.Normalize();
}
@@ -280,8 +280,8 @@ void CXFA_FFField::CapTopBottomPlacement(CXFA_CaptionData captionData,
int32_t iCapPlacement) {
CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin();
m_rtCaption.left += rtUIMargin.left;
- if (CXFA_Margin mgCap = captionData.GetMargin()) {
- XFA_RectWidthoutMargin(m_rtCaption, mgCap);
+ if (CXFA_MarginData captionMarginData = captionData.GetMarginData()) {
+ XFA_RectWidthoutMargin(m_rtCaption, captionMarginData);
if (m_rtCaption.height < 0)
m_rtCaption.top += m_rtCaption.height;
}
@@ -307,8 +307,8 @@ void CXFA_FFField::CapLeftRightPlacement(CXFA_CaptionData captionData,
CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin();
m_rtCaption.top += rtUIMargin.top;
m_rtCaption.height -= rtUIMargin.top;
- if (CXFA_Margin mgCap = captionData.GetMargin()) {
- XFA_RectWidthoutMargin(m_rtCaption, mgCap);
+ if (CXFA_MarginData captionMarginData = captionData.GetMarginData()) {
+ XFA_RectWidthoutMargin(m_rtCaption, captionMarginData);
if (m_rtCaption.height < 0)
m_rtCaption.top += m_rtCaption.height;
}
diff --git a/xfa/fxfa/cxfa_ffimage.cpp b/xfa/fxfa/cxfa_ffimage.cpp
index 6dda044194..f385d7ba01 100644
--- a/xfa/fxfa/cxfa_ffimage.cpp
+++ b/xfa/fxfa/cxfa_ffimage.cpp
@@ -49,8 +49,8 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS,
return;
CFX_RectF rtImage = GetRectWithoutRotate();
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
- XFA_RectWidthoutMargin(rtImage, mgWidget);
+ if (CXFA_MarginData marginData = m_pDataAcc->GetMarginData())
+ XFA_RectWidthoutMargin(rtImage, marginData);
int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left;
int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top;
diff --git a/xfa/fxfa/cxfa_ffline.cpp b/xfa/fxfa/cxfa_ffline.cpp
index a5e9441061..97afaea462 100644
--- a/xfa/fxfa/cxfa_ffline.cpp
+++ b/xfa/fxfa/cxfa_ffline.cpp
@@ -77,8 +77,8 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS,
mtRotate.Concat(matrix);
CFX_RectF rtLine = GetRectWithoutRotate();
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
- XFA_RectWidthoutMargin(rtLine, mgWidget);
+ if (CXFA_MarginData marginData = m_pDataAcc->GetMarginData())
+ XFA_RectWidthoutMargin(rtLine, marginData);
GetRectFromHand(rtLine, lineData.GetHand(), fLineWidth);
CXFA_Path linePath;
diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp
index 54725ad794..fbadfcecd2 100644
--- a/xfa/fxfa/cxfa_ffpushbutton.cpp
+++ b/xfa/fxfa/cxfa_ffpushbutton.cpp
@@ -97,13 +97,13 @@ bool CXFA_FFPushButton::PerformLayout() {
CFX_RectF rtWidget = GetRectWithoutRotate();
m_rtUI = rtWidget;
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
- XFA_RectWidthoutMargin(rtWidget, mgWidget);
+ if (CXFA_MarginData marginData = m_pDataAcc->GetMarginData())
+ XFA_RectWidthoutMargin(rtWidget, marginData);
CXFA_CaptionData captionData = m_pDataAcc->GetCaptionData();
m_rtCaption = rtWidget;
- if (CXFA_Margin mgCap = captionData.GetMargin())
- XFA_RectWidthoutMargin(m_rtCaption, mgCap);
+ if (CXFA_MarginData captionMarginData = captionData.GetMarginData())
+ XFA_RectWidthoutMargin(m_rtCaption, captionMarginData);
LayoutHighlightCaption();
SetFWLRect();
diff --git a/xfa/fxfa/cxfa_ffrectangle.cpp b/xfa/fxfa/cxfa_ffrectangle.cpp
index fe71048bc7..7c6035cd07 100644
--- a/xfa/fxfa/cxfa_ffrectangle.cpp
+++ b/xfa/fxfa/cxfa_ffrectangle.cpp
@@ -23,8 +23,8 @@ void CXFA_FFRectangle::RenderWidget(CXFA_Graphics* pGS,
CXFA_Rectangle rtObj = value.GetRectangle();
CFX_RectF rect = GetRectWithoutRotate();
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
- XFA_RectWidthoutMargin(rect, mgWidget);
+ if (CXFA_MarginData marginData = m_pDataAcc->GetMarginData())
+ XFA_RectWidthoutMargin(rect, marginData);
CFX_Matrix mtRotate = GetRotateMatrix();
mtRotate.Concat(matrix);
diff --git a/xfa/fxfa/cxfa_fftext.cpp b/xfa/fxfa/cxfa_fftext.cpp
index 274f3bfb61..18eb20001a 100644
--- a/xfa/fxfa/cxfa_fftext.cpp
+++ b/xfa/fxfa/cxfa_fftext.cpp
@@ -40,21 +40,21 @@ void CXFA_FFText::RenderWidget(CXFA_Graphics* pGS,
CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
CFX_RectF rtText = GetRectWithoutRotate();
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
+ if (CXFA_MarginData marginData = m_pDataAcc->GetMarginData()) {
CXFA_LayoutItem* pItem = this;
if (!pItem->GetPrev() && !pItem->GetNext()) {
- XFA_RectWidthoutMargin(rtText, mgWidget);
+ XFA_RectWidthoutMargin(rtText, marginData);
} else {
float fLeftInset;
float fRightInset;
float fTopInset = 0;
float fBottomInset = 0;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetRightInset(fRightInset);
+ marginData.GetLeftInset(fLeftInset);
+ marginData.GetRightInset(fRightInset);
if (!pItem->GetPrev())
- mgWidget.GetTopInset(fTopInset);
+ marginData.GetTopInset(fTopInset);
else if (!pItem->GetNext())
- mgWidget.GetBottomInset(fBottomInset);
+ marginData.GetBottomInset(fBottomInset);
rtText.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
}
@@ -87,14 +87,14 @@ bool CXFA_FFText::PerformLayout() {
pItem = pItem->GetFirst();
while (pItem) {
CFX_RectF rtText = pItem->GetRect(false);
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
+ if (CXFA_MarginData marginData = m_pDataAcc->GetMarginData()) {
if (!pItem->GetPrev()) {
float fTopInset;
- mgWidget.GetTopInset(fTopInset);
+ marginData.GetTopInset(fTopInset);
rtText.height -= fTopInset;
} else if (!pItem->GetNext()) {
float fBottomInset;
- mgWidget.GetBottomInset(fBottomInset);
+ marginData.GetBottomInset(fBottomInset);
rtText.height -= fBottomInset;
}
}
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index 48e7ae49ac..6ca1710298 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -991,9 +991,9 @@ void CXFA_FFWidget::RenderWidget(CXFA_Graphics* pGS,
return;
CFX_RectF rtBorder = GetRectWithoutRotate();
- CXFA_Margin margin = borderData.GetMargin();
- if (margin)
- XFA_RectWidthoutMargin(rtBorder, margin);
+ CXFA_MarginData marginData = borderData.GetMarginData();
+ if (marginData)
+ XFA_RectWidthoutMargin(rtBorder, marginData);
rtBorder.Normalize();
DrawBorder(pGS, borderData, rtBorder, matrix);
@@ -2033,15 +2033,20 @@ RetainPtr<CFX_DIBitmap> XFA_LoadImageFromBuffer(
return pBitmap;
}
-void XFA_RectWidthoutMargin(CFX_RectF& rt, const CXFA_Margin& mg, bool bUI) {
- if (!mg) {
+void XFA_RectWidthoutMargin(CFX_RectF& rt,
+ const CXFA_MarginData& marginData,
+ bool bUI) {
+ if (!marginData)
return;
- }
- float fLeftInset, fTopInset, fRightInset, fBottomInset;
- mg.GetLeftInset(fLeftInset);
- mg.GetTopInset(fTopInset);
- mg.GetRightInset(fRightInset);
- mg.GetBottomInset(fBottomInset);
+
+ float fLeftInset;
+ float fTopInset;
+ float fRightInset;
+ float fBottomInset;
+ marginData.GetLeftInset(fLeftInset);
+ marginData.GetTopInset(fTopInset);
+ marginData.GetRightInset(fRightInset);
+ marginData.GetBottomInset(fBottomInset);
rt.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
}
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index 3f5181792d..900369b823 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -64,7 +64,7 @@ RetainPtr<CFX_DIBitmap> XFA_LoadImageFromBuffer(
FXCODEC_IMAGE_TYPE XFA_GetImageType(const WideString& wsType);
char* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len);
void XFA_RectWidthoutMargin(CFX_RectF& rt,
- const CXFA_Margin& mg,
+ const CXFA_MarginData& marginData,
bool bUI = false);
CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem);
bool XFA_IsCreateWidget(XFA_Element iType);
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index c28f6d4185..7453a145b3 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -726,12 +726,12 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) {
szCap.height = fFontSize;
}
}
- if (CXFA_Margin mgCap = captionData.GetMargin()) {
+ if (CXFA_MarginData captionMarginData = captionData.GetMarginData()) {
float fLeftInset, fTopInset, fRightInset, fBottomInset;
- mgCap.GetLeftInset(fLeftInset);
- mgCap.GetTopInset(fTopInset);
- mgCap.GetRightInset(fRightInset);
- mgCap.GetBottomInset(fBottomInset);
+ captionMarginData.GetLeftInset(fLeftInset);
+ captionMarginData.GetTopInset(fTopInset);
+ captionMarginData.GetRightInset(fRightInset);
+ captionMarginData.GetBottomInset(fBottomInset);
if (bReserveExit) {
bVert ? (szCap.width += fLeftInset + fRightInset)
: (szCap.height += fTopInset + fBottomInset);
@@ -770,16 +770,17 @@ bool CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) {
}
bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
+ CXFA_MarginData marginData = GetMarginData();
+ if (marginData) {
float fLeftInset, fTopInset, fRightInset, fBottomInset;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetTopInset(fTopInset);
- mgWidget.GetRightInset(fRightInset);
- mgWidget.GetBottomInset(fBottomInset);
+ marginData.GetLeftInset(fLeftInset);
+ marginData.GetTopInset(fTopInset);
+ marginData.GetRightInset(fRightInset);
+ marginData.GetBottomInset(fBottomInset);
size.width += fLeftInset + fRightInset;
size.height += fTopInset + fBottomInset;
}
+
CXFA_Para para = GetPara();
if (para)
size.width += para.GetMarginLeft() + para.GetTextIndent();
@@ -864,11 +865,12 @@ bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) {
}
CFX_RectF rtUIMargin = GetUIMargin();
size.width -= rtUIMargin.left + rtUIMargin.width;
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- float fLeftInset, fRightInset;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetRightInset(fRightInset);
+ CXFA_MarginData marginData = GetMarginData();
+ if (marginData) {
+ float fLeftInset;
+ float fRightInset;
+ marginData.GetLeftInset(fLeftInset);
+ marginData.GetRightInset(fRightInset);
size.width -= fLeftInset + fRightInset;
}
CalculateTextContentSize(size);
@@ -1010,11 +1012,12 @@ void CXFA_WidgetAcc::LoadText() {
}
float CXFA_WidgetAcc::CalculateWidgetAutoWidth(float fWidthCalc) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- float fLeftInset, fRightInset;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetRightInset(fRightInset);
+ CXFA_MarginData marginData = GetMarginData();
+ if (marginData) {
+ float fLeftInset;
+ float fRightInset;
+ marginData.GetLeftInset(fLeftInset);
+ marginData.GetRightInset(fRightInset);
fWidthCalc += fLeftInset + fRightInset;
}
@@ -1028,22 +1031,24 @@ float CXFA_WidgetAcc::CalculateWidgetAutoWidth(float fWidthCalc) {
}
float CXFA_WidgetAcc::GetWidthWithoutMargin(float fWidthCalc) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- float fLeftInset, fRightInset;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetRightInset(fRightInset);
+ CXFA_MarginData marginData = GetMarginData();
+ if (marginData) {
+ float fLeftInset;
+ float fRightInset;
+ marginData.GetLeftInset(fLeftInset);
+ marginData.GetRightInset(fRightInset);
fWidthCalc -= fLeftInset + fRightInset;
}
return fWidthCalc;
}
float CXFA_WidgetAcc::CalculateWidgetAutoHeight(float fHeightCalc) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- float fTopInset, fBottomInset;
- mgWidget.GetTopInset(fTopInset);
- mgWidget.GetBottomInset(fBottomInset);
+ CXFA_MarginData marginData = GetMarginData();
+ if (marginData) {
+ float fTopInset;
+ float fBottomInset;
+ marginData.GetTopInset(fTopInset);
+ marginData.GetBottomInset(fBottomInset);
fHeightCalc += fTopInset + fBottomInset;
}
@@ -1057,11 +1062,12 @@ float CXFA_WidgetAcc::CalculateWidgetAutoHeight(float fHeightCalc) {
}
float CXFA_WidgetAcc::GetHeightWithoutMargin(float fHeightCalc) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- float fTopInset, fBottomInset;
- mgWidget.GetTopInset(fTopInset);
- mgWidget.GetBottomInset(fBottomInset);
+ CXFA_MarginData marginData = GetMarginData();
+ if (marginData) {
+ float fTopInset;
+ float fBottomInset;
+ marginData.GetTopInset(fTopInset);
+ marginData.GetBottomInset(fBottomInset);
fHeightCalc -= fTopInset + fBottomInset;
}
return fHeightCalc;
@@ -1155,11 +1161,12 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, float& fCalcHeight) {
float fTopInset = 0;
float fBottomInset = 0;
if (iBlockIndex == 0) {
- CXFA_Margin mgWidget = GetMargin();
- if (mgWidget) {
- mgWidget.GetTopInset(fTopInset);
- mgWidget.GetBottomInset(fBottomInset);
+ CXFA_MarginData marginData = GetMarginData();
+ if (marginData) {
+ marginData.GetTopInset(fTopInset);
+ marginData.GetBottomInset(fBottomInset);
}
+
CFX_RectF rtUIMargin = GetUIMargin();
fTopInset += rtUIMargin.top;
fBottomInset += rtUIMargin.width;
diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h
index 980a38175e..8b750a2b9e 100644
--- a/xfa/fxfa/cxfa_widgetacc.h
+++ b/xfa/fxfa/cxfa_widgetacc.h
@@ -17,7 +17,7 @@
#include "xfa/fxfa/parser/cxfa_boxdata.h"
#include "xfa/fxfa/parser/cxfa_eventdata.h"
#include "xfa/fxfa/parser/cxfa_imagedata.h"
-#include "xfa/fxfa/parser/cxfa_margin.h"
+#include "xfa/fxfa/parser/cxfa_margindata.h"
#include "xfa/fxfa/parser/cxfa_script.h"
#include "xfa/fxfa/parser/cxfa_value.h"
#include "xfa/fxfa/parser/cxfa_widgetdata.h"
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_margindata.cpp
index e3153f2671..9227668a68 100644
--- a/xfa/fxfa/parser/cxfa_margin.cpp
+++ b/xfa/fxfa/parser/cxfa_margindata.cpp
@@ -4,26 +4,26 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/cxfa_margin.h"
+#include "xfa/fxfa/parser/cxfa_margindata.h"
-CXFA_Margin::CXFA_Margin(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+CXFA_MarginData::CXFA_MarginData(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-bool CXFA_Margin::GetLeftInset(float& fInset, float fDefInset) const {
+bool CXFA_MarginData::GetLeftInset(float& fInset, float fDefInset) const {
fInset = fDefInset;
return TryMeasure(XFA_ATTRIBUTE_LeftInset, fInset);
}
-bool CXFA_Margin::GetTopInset(float& fInset, float fDefInset) const {
+bool CXFA_MarginData::GetTopInset(float& fInset, float fDefInset) const {
fInset = fDefInset;
return TryMeasure(XFA_ATTRIBUTE_TopInset, fInset);
}
-bool CXFA_Margin::GetRightInset(float& fInset, float fDefInset) const {
+bool CXFA_MarginData::GetRightInset(float& fInset, float fDefInset) const {
fInset = fDefInset;
return TryMeasure(XFA_ATTRIBUTE_RightInset, fInset);
}
-bool CXFA_Margin::GetBottomInset(float& fInset, float fDefInset) const {
+bool CXFA_MarginData::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_margindata.h
index 89fc4ce38a..fda823945c 100644
--- a/xfa/fxfa/parser/cxfa_margin.h
+++ b/xfa/fxfa/parser/cxfa_margindata.h
@@ -4,17 +4,17 @@
// 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_
+#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_Margin : public CXFA_Data {
+class CXFA_MarginData : public CXFA_Data {
public:
- explicit CXFA_Margin(CXFA_Node* pNode);
+ explicit CXFA_MarginData(CXFA_Node* pNode);
bool GetLeftInset(float& fInset, float fDefInset = 0) const;
bool GetTopInset(float& fInset, float fDefInset = 0) const;
@@ -22,4 +22,4 @@ class CXFA_Margin : public CXFA_Data {
bool GetBottomInset(float& fInset, float fDefInset = 0) const;
};
-#endif // XFA_FXFA_PARSER_CXFA_MARGIN_H_
+#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<CXFA_Node*> GetEventList();
std::vector<CXFA_Node*> GetEventByActivity(int32_t iActivity,