summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_fffield.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-03 11:11:16 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-03 17:21:40 +0000
commitcbd4410908e2a4898fdd5e0d6d17591fc2c71f54 (patch)
tree85ee81736d4c8de97e117a6500fafe6ac3c726fb /xfa/fxfa/cxfa_fffield.cpp
parentcf3d40d10276686f972761bafd005a7715f6eb1c (diff)
downloadpdfium-cbd4410908e2a4898fdd5e0d6d17591fc2c71f54.tar.xz
Fold CXFA_MarginData into CXFA_Marginchromium/3311
This CL removes the CXFA_MarginData wrapper and moves the methods directly to CXFA_Margin. Change-Id: I7c9e979fb78d0d356605f1318489daabcb8c32cd Reviewed-on: https://pdfium-review.googlesource.com/22110 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_fffield.cpp')
-rw-r--r--xfa/fxfa/cxfa_fffield.cpp45
1 files changed, 21 insertions, 24 deletions
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index 827d38d8c3..75bd064e29 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -23,6 +23,7 @@
#include "xfa/fxfa/cxfa_fwltheme.h"
#include "xfa/fxfa/cxfa_textlayout.h"
#include "xfa/fxfa/parser/cxfa_calculate.h"
+#include "xfa/fxfa/parser/cxfa_margin.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_script.h"
#include "xfa/fxgraphics/cxfa_gecolor.h"
@@ -168,13 +169,13 @@ bool CXFA_FFField::PerformLayout() {
void CXFA_FFField::CapPlacement() {
CFX_RectF rtWidget = GetRectWithoutRotate();
- CXFA_MarginData marginData = m_pDataAcc->GetMarginData();
- if (marginData.HasValidNode()) {
+ CXFA_Margin* margin = m_pDataAcc->GetMargin();
+ if (margin) {
CXFA_LayoutItem* pItem = this;
- float fLeftInset = marginData.GetLeftInset();
- float fRightInset = marginData.GetRightInset();
- float fTopInset = marginData.GetTopInset();
- float fBottomInset = marginData.GetBottomInset();
+ float fLeftInset = margin->GetLeftInset();
+ float fRightInset = margin->GetRightInset();
+ float fTopInset = margin->GetTopInset();
+ float fBottomInset = margin->GetBottomInset();
if (!pItem->GetPrev() && !pItem->GetNext()) {
rtWidget.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
} else {
@@ -209,7 +210,7 @@ void CXFA_FFField::CapPlacement() {
m_rtCaption.height += pItem->GetRect(false).Height();
pItem = pItem->GetNext();
}
- XFA_RectWidthoutMargin(m_rtCaption, marginData);
+ XFA_RectWidthoutMargin(m_rtCaption, margin);
}
CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout();
@@ -231,16 +232,14 @@ void CXFA_FFField::CapPlacement() {
switch (iCapPlacement) {
case XFA_AttributeEnum::Left: {
m_rtCaption.width = fCapReserve;
- CapLeftRightPlacement(captionData.GetMarginData(), rtWidget,
- iCapPlacement);
+ CapLeftRightPlacement(captionData.GetMargin(), rtWidget, iCapPlacement);
m_rtUI.width -= fCapReserve;
m_rtUI.left += fCapReserve;
break;
}
case XFA_AttributeEnum::Top: {
m_rtCaption.height = fCapReserve;
- CapTopBottomPlacement(captionData.GetMarginData(), rtWidget,
- iCapPlacement);
+ CapTopBottomPlacement(captionData.GetMargin(), rtWidget, iCapPlacement);
m_rtUI.top += fCapReserve;
m_rtUI.height -= fCapReserve;
break;
@@ -248,16 +247,14 @@ void CXFA_FFField::CapPlacement() {
case XFA_AttributeEnum::Right: {
m_rtCaption.left = m_rtCaption.right() - fCapReserve;
m_rtCaption.width = fCapReserve;
- CapLeftRightPlacement(captionData.GetMarginData(), rtWidget,
- iCapPlacement);
+ CapLeftRightPlacement(captionData.GetMargin(), rtWidget, iCapPlacement);
m_rtUI.width -= fCapReserve;
break;
}
case XFA_AttributeEnum::Bottom: {
m_rtCaption.top = m_rtCaption.bottom() - fCapReserve;
m_rtCaption.height = fCapReserve;
- CapTopBottomPlacement(captionData.GetMarginData(), rtWidget,
- iCapPlacement);
+ CapTopBottomPlacement(captionData.GetMargin(), rtWidget, iCapPlacement);
m_rtUI.height -= fCapReserve;
break;
}
@@ -269,20 +266,20 @@ void CXFA_FFField::CapPlacement() {
CXFA_BorderData borderUIData = m_pDataAcc->GetUIBorderData();
if (borderUIData.HasValidNode()) {
- CXFA_MarginData borderMarginData = borderUIData.GetMarginData();
- if (borderMarginData.HasValidNode())
- XFA_RectWidthoutMargin(m_rtUI, borderMarginData);
+ CXFA_Margin* borderMargin = borderUIData.GetMargin();
+ if (borderMargin)
+ XFA_RectWidthoutMargin(m_rtUI, borderMargin);
}
m_rtUI.Normalize();
}
-void CXFA_FFField::CapTopBottomPlacement(const CXFA_MarginData& marginData,
+void CXFA_FFField::CapTopBottomPlacement(const CXFA_Margin* margin,
const CFX_RectF& rtWidget,
XFA_AttributeEnum iCapPlacement) {
CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin();
m_rtCaption.left += rtUIMargin.left;
- if (marginData.HasValidNode()) {
- XFA_RectWidthoutMargin(m_rtCaption, marginData);
+ if (margin) {
+ XFA_RectWidthoutMargin(m_rtCaption, margin);
if (m_rtCaption.height < 0)
m_rtCaption.top += m_rtCaption.height;
}
@@ -302,14 +299,14 @@ void CXFA_FFField::CapTopBottomPlacement(const CXFA_MarginData& marginData,
}
}
-void CXFA_FFField::CapLeftRightPlacement(const CXFA_MarginData& marginData,
+void CXFA_FFField::CapLeftRightPlacement(const CXFA_Margin* margin,
const CFX_RectF& rtWidget,
XFA_AttributeEnum iCapPlacement) {
CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin();
m_rtCaption.top += rtUIMargin.top;
m_rtCaption.height -= rtUIMargin.top;
- if (marginData.HasValidNode()) {
- XFA_RectWidthoutMargin(m_rtCaption, marginData);
+ if (margin) {
+ XFA_RectWidthoutMargin(m_rtCaption, margin);
if (m_rtCaption.height < 0)
m_rtCaption.top += m_rtCaption.height;
}