summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/cxfa_ffcheckbutton.cpp2
-rw-r--r--xfa/fxfa/cxfa_fffield.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffpushbutton.cpp2
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp29
-rw-r--r--xfa/fxfa/parser/cxfa_caption.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_caption.h6
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp2
7 files changed, 25 insertions, 24 deletions
diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp
index b50349f211..699f3fe988 100644
--- a/xfa/fxfa/cxfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp
@@ -122,7 +122,7 @@ bool CXFA_FFCheckButton::PerformLayout() {
}
m_rtUI = rtWidget;
- CXFA_Margin* captionMargin = caption ? caption->GetMargin() : nullptr;
+ CXFA_Margin* captionMargin = caption ? caption->GetMarginIfExists() : nullptr;
switch (iCapPlacement) {
case XFA_AttributeEnum::Left: {
m_rtCaption.width = fCapReserve;
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index 5f26d4c8b6..cd4359d7eb 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -231,7 +231,7 @@ void CXFA_FFField::CapPlacement() {
}
m_rtUI = rtWidget;
- CXFA_Margin* capMargin = caption ? caption->GetMargin() : nullptr;
+ CXFA_Margin* capMargin = caption ? caption->GetMarginIfExists() : nullptr;
switch (iCapPlacement) {
case XFA_AttributeEnum::Left: {
m_rtCaption.width = fCapReserve;
diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp
index 85805b4d76..97078a6f75 100644
--- a/xfa/fxfa/cxfa_ffpushbutton.cpp
+++ b/xfa/fxfa/cxfa_ffpushbutton.cpp
@@ -107,7 +107,7 @@ bool CXFA_FFPushButton::PerformLayout() {
m_rtCaption = rtWidget;
CXFA_Caption* caption = m_pNode->GetCaptionIfExists();
- CXFA_Margin* captionMargin = caption ? caption->GetMargin() : nullptr;
+ CXFA_Margin* captionMargin = caption ? caption->GetMarginIfExists() : nullptr;
if (captionMargin)
XFA_RectWithoutMargin(m_rtCaption, captionMargin);
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index 39aa378a52..d61d8989fb 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -510,7 +510,7 @@ void CXFA_WidgetAcc::CalcCaptionSize(CXFA_FFDoc* doc, CFX_SizeF& szCap) {
bVert ? szCap.height = fCapReserve : szCap.width = fCapReserve;
} else {
float fFontSize = 10.0f;
- CXFA_Font* font = caption->GetFont();
+ CXFA_Font* font = caption->GetFontIfExists();
if (font) {
fFontSize = font->GetFontSize();
} else {
@@ -527,19 +527,20 @@ void CXFA_WidgetAcc::CalcCaptionSize(CXFA_FFDoc* doc, CFX_SizeF& szCap) {
}
}
- CXFA_Margin* captionMargin = caption->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);
- } else {
- szCap.width += fLeftInset + fRightInset;
- szCap.height += fTopInset + fBottomInset;
- }
+ CXFA_Margin* captionMargin = caption->GetMarginIfExists();
+ if (!captionMargin)
+ return;
+
+ 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);
+ } else {
+ szCap.width += fLeftInset + fRightInset;
+ szCap.height += fTopInset + fBottomInset;
}
}
diff --git a/xfa/fxfa/parser/cxfa_caption.cpp b/xfa/fxfa/parser/cxfa_caption.cpp
index 4d4dde57e9..a54605a48c 100644
--- a/xfa/fxfa/parser/cxfa_caption.cpp
+++ b/xfa/fxfa/parser/cxfa_caption.cpp
@@ -70,14 +70,14 @@ float CXFA_Caption::GetReserve() const {
return JSObject()->GetMeasure(XFA_Attribute::Reserve).ToUnit(XFA_Unit::Pt);
}
-CXFA_Margin* CXFA_Caption::GetMargin() {
+CXFA_Margin* CXFA_Caption::GetMarginIfExists() {
return GetChild<CXFA_Margin>(0, XFA_Element::Margin, false);
}
-CXFA_Font* CXFA_Caption::GetFont() {
+CXFA_Font* CXFA_Caption::GetFontIfExists() {
return GetChild<CXFA_Font>(0, XFA_Element::Font, false);
}
-CXFA_Value* CXFA_Caption::GetValue() {
+CXFA_Value* CXFA_Caption::GetValueIfExists() {
return GetChild<CXFA_Value>(0, XFA_Element::Value, false);
}
diff --git a/xfa/fxfa/parser/cxfa_caption.h b/xfa/fxfa/parser/cxfa_caption.h
index 1b634d8f5c..c790787e9a 100644
--- a/xfa/fxfa/parser/cxfa_caption.h
+++ b/xfa/fxfa/parser/cxfa_caption.h
@@ -25,9 +25,9 @@ class CXFA_Caption : public CXFA_Node {
bool IsHidden();
XFA_AttributeEnum GetPlacementType();
float GetReserve() const;
- CXFA_Margin* GetMargin();
- CXFA_Font* GetFont();
- CXFA_Value* GetValue();
+ CXFA_Margin* GetMarginIfExists();
+ CXFA_Font* GetFontIfExists();
+ CXFA_Value* GetValueIfExists();
};
#endif // XFA_FXFA_PARSER_CXFA_CAPTION_H_
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index c7a0bb1668..e6cdf98d49 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1934,7 +1934,7 @@ WideString CXFA_Node::GetValidateCaptionName(bool bVersionFlag) {
if (!bVersionFlag) {
CXFA_Caption* caption = GetCaptionIfExists();
if (caption) {
- CXFA_Value* capValue = caption->GetValue();
+ CXFA_Value* capValue = caption->GetValueIfExists();
if (capValue) {
CXFA_Text* captionText = capValue->GetText();
if (captionText)