summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_widgetacc.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_widgetacc.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_widgetacc.cpp')
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp59
1 files changed, 30 insertions, 29 deletions
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index dcf621f442..ec33159055 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -25,6 +25,7 @@
#include "xfa/fxfa/parser/cxfa_items.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_localevalue.h"
+#include "xfa/fxfa/parser/cxfa_margin.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_para.h"
#include "xfa/fxfa/parser/cxfa_script.h"
@@ -725,12 +726,12 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) {
}
}
- CXFA_MarginData captionMarginData = captionData.GetMarginData();
- if (captionMarginData.HasValidNode()) {
- float fLeftInset = captionMarginData.GetLeftInset();
- float fTopInset = captionMarginData.GetTopInset();
- float fRightInset = captionMarginData.GetRightInset();
- float fBottomInset = captionMarginData.GetBottomInset();
+ CXFA_Margin* captionMargin = captionData.GetMargin();
+ if (captionMargin) {
+ float fLeftInset = captionMargin->GetLeftInset();
+ float fTopInset = captionMargin->GetTopInset();
+ float fRightInset = captionMargin->GetRightInset();
+ float fBottomInset = captionMargin->GetBottomInset();
if (bReserveExit) {
bVert ? (szCap.width += fLeftInset + fRightInset)
: (szCap.height += fTopInset + fBottomInset);
@@ -768,10 +769,10 @@ bool CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) {
}
bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) {
- CXFA_MarginData marginData = GetMarginData();
- if (marginData.HasValidNode()) {
- size.width += marginData.GetLeftInset() + marginData.GetRightInset();
- size.height += marginData.GetTopInset() + marginData.GetBottomInset();
+ CXFA_Margin* margin = GetMargin();
+ if (margin) {
+ size.width += margin->GetLeftInset() + margin->GetRightInset();
+ size.height += margin->GetTopInset() + margin->GetBottomInset();
}
CXFA_Para* para = GetPara();
@@ -860,9 +861,9 @@ bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) {
}
CFX_RectF rtUIMargin = GetUIMargin();
size.width -= rtUIMargin.left + rtUIMargin.width;
- CXFA_MarginData marginData = GetMarginData();
- if (marginData.HasValidNode())
- size.width -= marginData.GetLeftInset() + marginData.GetRightInset();
+ CXFA_Margin* margin = GetMargin();
+ if (margin)
+ size.width -= margin->GetLeftInset() + margin->GetRightInset();
CalculateTextContentSize(size);
size.height += rtUIMargin.top + rtUIMargin.height;
@@ -1005,9 +1006,9 @@ void CXFA_WidgetAcc::LoadText() {
}
float CXFA_WidgetAcc::CalculateWidgetAutoWidth(float fWidthCalc) {
- CXFA_MarginData marginData = GetMarginData();
- if (marginData.HasValidNode())
- fWidthCalc += marginData.GetLeftInset() + marginData.GetRightInset();
+ CXFA_Margin* margin = GetMargin();
+ if (margin)
+ fWidthCalc += margin->GetLeftInset() + margin->GetRightInset();
pdfium::Optional<float> min = TryMinWidth();
if (min)
@@ -1021,16 +1022,16 @@ float CXFA_WidgetAcc::CalculateWidgetAutoWidth(float fWidthCalc) {
}
float CXFA_WidgetAcc::GetWidthWithoutMargin(float fWidthCalc) {
- CXFA_MarginData marginData = GetMarginData();
- if (marginData.HasValidNode())
- fWidthCalc -= marginData.GetLeftInset() + marginData.GetRightInset();
+ CXFA_Margin* margin = GetMargin();
+ if (margin)
+ fWidthCalc -= margin->GetLeftInset() + margin->GetRightInset();
return fWidthCalc;
}
float CXFA_WidgetAcc::CalculateWidgetAutoHeight(float fHeightCalc) {
- CXFA_MarginData marginData = GetMarginData();
- if (marginData.HasValidNode())
- fHeightCalc += marginData.GetTopInset() + marginData.GetBottomInset();
+ CXFA_Margin* margin = GetMargin();
+ if (margin)
+ fHeightCalc += margin->GetTopInset() + margin->GetBottomInset();
pdfium::Optional<float> min = TryMinHeight();
if (min)
@@ -1044,9 +1045,9 @@ float CXFA_WidgetAcc::CalculateWidgetAutoHeight(float fHeightCalc) {
}
float CXFA_WidgetAcc::GetHeightWithoutMargin(float fHeightCalc) {
- CXFA_MarginData marginData = GetMarginData();
- if (marginData.HasValidNode())
- fHeightCalc -= marginData.GetTopInset() + marginData.GetBottomInset();
+ CXFA_Margin* margin = GetMargin();
+ if (margin)
+ fHeightCalc -= margin->GetTopInset() + margin->GetBottomInset();
return fHeightCalc;
}
@@ -1149,10 +1150,10 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, float& fCalcHeight) {
float fTopInset = 0;
float fBottomInset = 0;
if (iBlockIndex == 0) {
- CXFA_MarginData marginData = GetMarginData();
- if (marginData.HasValidNode()) {
- fTopInset = marginData.GetTopInset();
- fBottomInset = marginData.GetBottomInset();
+ CXFA_Margin* margin = GetMargin();
+ if (margin) {
+ fTopInset = margin->GetTopInset();
+ fBottomInset = margin->GetBottomInset();
}
CFX_RectF rtUIMargin = GetUIMargin();