summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_fffield.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-03 12:15:53 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-03 18:22:31 +0000
commitfa50df5605a14ca4c9ba440506685981f1c8b04b (patch)
tree993f3af23213e8c86c62314b502f6144ce13688b /xfa/fxfa/cxfa_fffield.cpp
parent39628b04bc86461426f2dcf5a568f5e9e70ad997 (diff)
downloadpdfium-fa50df5605a14ca4c9ba440506685981f1c8b04b.tar.xz
Fold CXFA_CaptionData into CXFA_Caption
This CL folds the CXFA_CaptionData wrapper class into CXFA_Caption. Change-Id: I65302656a89985dec4d0ec1f42b5eaa95d22aae2 Reviewed-on: https://pdfium-review.googlesource.com/22150 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_fffield.cpp')
-rw-r--r--xfa/fxfa/cxfa_fffield.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index 678b9f0d9a..ff5cc76138 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -24,6 +24,7 @@
#include "xfa/fxfa/cxfa_textlayout.h"
#include "xfa/fxfa/parser/cxfa_border.h"
#include "xfa/fxfa/parser/cxfa_calculate.h"
+#include "xfa/fxfa/parser/cxfa_caption.h"
#include "xfa/fxfa/parser/cxfa_margin.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_script.h"
@@ -191,15 +192,15 @@ void CXFA_FFField::CapPlacement() {
XFA_AttributeEnum iCapPlacement = XFA_AttributeEnum::Unknown;
float fCapReserve = 0;
- CXFA_CaptionData captionData = m_pDataAcc->GetCaptionData();
- if (captionData.HasValidNode() && !captionData.IsHidden()) {
- iCapPlacement = captionData.GetPlacementType();
+ CXFA_Caption* caption = m_pDataAcc->GetCaption();
+ if (caption && !caption->IsHidden()) {
+ iCapPlacement = caption->GetPlacementType();
if (iCapPlacement == XFA_AttributeEnum::Top && GetPrev()) {
m_rtCaption.Reset();
} else if (iCapPlacement == XFA_AttributeEnum::Bottom && GetNext()) {
m_rtCaption.Reset();
} else {
- fCapReserve = captionData.GetReserve();
+ fCapReserve = caption->GetReserve();
CXFA_LayoutItem* pItem = this;
if (!pItem->GetPrev() && !pItem->GetNext()) {
m_rtCaption = rtWidget;
@@ -233,14 +234,14 @@ void CXFA_FFField::CapPlacement() {
switch (iCapPlacement) {
case XFA_AttributeEnum::Left: {
m_rtCaption.width = fCapReserve;
- CapLeftRightPlacement(captionData.GetMargin(), rtWidget, iCapPlacement);
+ CapLeftRightPlacement(caption->GetMargin(), rtWidget, iCapPlacement);
m_rtUI.width -= fCapReserve;
m_rtUI.left += fCapReserve;
break;
}
case XFA_AttributeEnum::Top: {
m_rtCaption.height = fCapReserve;
- CapTopBottomPlacement(captionData.GetMargin(), rtWidget, iCapPlacement);
+ CapTopBottomPlacement(caption->GetMargin(), rtWidget, iCapPlacement);
m_rtUI.top += fCapReserve;
m_rtUI.height -= fCapReserve;
break;
@@ -248,14 +249,14 @@ void CXFA_FFField::CapPlacement() {
case XFA_AttributeEnum::Right: {
m_rtCaption.left = m_rtCaption.right() - fCapReserve;
m_rtCaption.width = fCapReserve;
- CapLeftRightPlacement(captionData.GetMargin(), rtWidget, iCapPlacement);
+ CapLeftRightPlacement(caption->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.GetMargin(), rtWidget, iCapPlacement);
+ CapTopBottomPlacement(caption->GetMargin(), rtWidget, iCapPlacement);
m_rtUI.height -= fCapReserve;
break;
}
@@ -602,8 +603,8 @@ void CXFA_FFField::RenderCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) {
if (!pCapTextLayout)
return;
- CXFA_CaptionData captionData = m_pDataAcc->GetCaptionData();
- if (!captionData.HasValidNode() || !captionData.IsVisible())
+ CXFA_Caption* caption = m_pDataAcc->GetCaption();
+ if (!caption || !caption->IsVisible())
return;
if (!pCapTextLayout->IsLoaded())