summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_fffield.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-20 21:19:13 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-20 21:19:13 +0000
commit2501ae2474c1f097a06634d647de2eb3fb730864 (patch)
tree3ac7d386a3e73f3c848c203c3f0e61af9d284c1f /xfa/fxfa/cxfa_fffield.cpp
parent89453e92d5d0b7aaf9e0c3890a90a21adc94a0ce (diff)
downloadpdfium-2501ae2474c1f097a06634d647de2eb3fb730864.tar.xz
Remove CXFA_DataData operator bool override
This CL removes CXFA_DataData::operator bool in favour of an explicit HasValidNode method. This makes the call sites a lot clearer. Change-Id: I6fae14fdeec4674ca7916e21b9e5703070fc3069 Reviewed-on: https://pdfium-review.googlesource.com/18830 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_fffield.cpp')
-rw-r--r--xfa/fxfa/cxfa_fffield.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index e2f7b6a2f2..7e36fea2cf 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -170,7 +170,7 @@ bool CXFA_FFField::PerformLayout() {
void CXFA_FFField::CapPlacement() {
CFX_RectF rtWidget = GetRectWithoutRotate();
CXFA_MarginData marginData = m_pDataAcc->GetMarginData();
- if (marginData) {
+ if (marginData.HasValidNode()) {
CXFA_LayoutItem* pItem = this;
float fLeftInset = 0, fRightInset = 0, fTopInset = 0, fBottomInset = 0;
marginData.GetLeftInset(fLeftInset);
@@ -192,7 +192,8 @@ void CXFA_FFField::CapPlacement() {
XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
float fCapReserve = 0;
CXFA_CaptionData captionData = m_pDataAcc->GetCaptionData();
- if (captionData && captionData.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) {
+ if (captionData.HasValidNode() &&
+ captionData.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) {
iCapPlacement = (XFA_ATTRIBUTEENUM)captionData.GetPlacementType();
if (iCapPlacement == XFA_ATTRIBUTEENUM_Top && GetPrev()) {
m_rtCaption.Reset();
@@ -270,9 +271,9 @@ void CXFA_FFField::CapPlacement() {
}
CXFA_BorderData borderUIData = m_pDataAcc->GetUIBorderData();
- if (borderUIData) {
+ if (borderUIData.HasValidNode()) {
CXFA_MarginData borderMarginData = borderUIData.GetMarginData();
- if (borderMarginData)
+ if (borderMarginData.HasValidNode())
XFA_RectWidthoutMargin(m_rtUI, borderMarginData);
}
m_rtUI.Normalize();
@@ -283,7 +284,7 @@ void CXFA_FFField::CapTopBottomPlacement(const CXFA_MarginData& marginData,
int32_t iCapPlacement) {
CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin();
m_rtCaption.left += rtUIMargin.left;
- if (marginData) {
+ if (marginData.HasValidNode()) {
XFA_RectWidthoutMargin(m_rtCaption, marginData);
if (m_rtCaption.height < 0)
m_rtCaption.top += m_rtCaption.height;
@@ -310,7 +311,7 @@ void CXFA_FFField::CapLeftRightPlacement(const CXFA_MarginData& marginData,
CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin();
m_rtCaption.top += rtUIMargin.top;
m_rtCaption.height -= rtUIMargin.top;
- if (marginData) {
+ if (marginData.HasValidNode()) {
XFA_RectWidthoutMargin(m_rtCaption, marginData);
if (m_rtCaption.height < 0)
m_rtCaption.top += m_rtCaption.height;
@@ -607,8 +608,10 @@ void CXFA_FFField::RenderCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) {
return;
CXFA_CaptionData captionData = m_pDataAcc->GetCaptionData();
- if (!captionData || captionData.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
+ if (!captionData.HasValidNode() ||
+ captionData.GetPresence() != XFA_ATTRIBUTEENUM_Visible) {
return;
+ }
if (!pCapTextLayout->IsLoaded())
pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height));
@@ -665,7 +668,7 @@ int32_t CXFA_FFField::CalculateOverride() {
int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) {
CXFA_CalculateData calcData = pAcc->GetCalculateData();
- if (!calcData)
+ if (!calcData.HasValidNode())
return 1;
XFA_VERSION version = pAcc->GetDoc()->GetXFADoc()->GetCurVersionMode();
@@ -685,7 +688,7 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) {
case XFA_ATTRIBUTEENUM_Warning: {
if (version <= XFA_VERSION_204) {
CXFA_ScriptData scriptData = calcData.GetScriptData();
- if (!scriptData)
+ if (!scriptData.HasValidNode())
return 1;
WideString wsExpression;