diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-20 22:23:50 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-20 22:23:50 +0000 |
commit | 120c19b6a19377c341658c342c4351eccbb59741 (patch) | |
tree | 6799a4d504efd2eb1c7a036bf7959a9352c199e4 /xfa/fxfa/cxfa_widgetacc.cpp | |
parent | 2501ae2474c1f097a06634d647de2eb3fb730864 (diff) | |
download | pdfium-120c19b6a19377c341658c342c4351eccbb59741.tar.xz |
Rename CXFA_MarginData methodschromium/3274
This CL renames the CXFA_MarginData::Get*Inset methods to
CXFA_MarginData::Try*Inset to match the fact that they may fail. The
default value has been removed and all the callers correctly set the
default values.
Change-Id: Ib0dc8dc35807b60a0ddc0e5724604cb39845fcea
Reviewed-on: https://pdfium-review.googlesource.com/18771
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.cpp | 73 |
1 files changed, 38 insertions, 35 deletions
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 4adc447aaa..b55adc04a4 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -731,14 +731,14 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { CXFA_MarginData captionMarginData = captionData.GetMarginData(); if (captionMarginData.HasValidNode()) { - float fLeftInset; - float fTopInset; - float fRightInset; - float fBottomInset; - captionMarginData.GetLeftInset(fLeftInset); - captionMarginData.GetTopInset(fTopInset); - captionMarginData.GetRightInset(fRightInset); - captionMarginData.GetBottomInset(fBottomInset); + float fLeftInset = 0; + float fTopInset = 0; + float fRightInset = 0; + float fBottomInset = 0; + captionMarginData.TryLeftInset(fLeftInset); + captionMarginData.TryTopInset(fTopInset); + captionMarginData.TryRightInset(fRightInset); + captionMarginData.TryBottomInset(fBottomInset); if (bReserveExit) { bVert ? (szCap.width += fLeftInset + fRightInset) : (szCap.height += fTopInset + fBottomInset); @@ -779,11 +779,14 @@ bool CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) { bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { CXFA_MarginData marginData = GetMarginData(); if (marginData.HasValidNode()) { - float fLeftInset, fTopInset, fRightInset, fBottomInset; - marginData.GetLeftInset(fLeftInset); - marginData.GetTopInset(fTopInset); - marginData.GetRightInset(fRightInset); - marginData.GetBottomInset(fBottomInset); + float fLeftInset = 0; + float fTopInset = 0; + float fRightInset = 0; + float fBottomInset = 0; + marginData.TryLeftInset(fLeftInset); + marginData.TryTopInset(fTopInset); + marginData.TryRightInset(fRightInset); + marginData.TryBottomInset(fBottomInset); size.width += fLeftInset + fRightInset; size.height += fTopInset + fBottomInset; } @@ -874,10 +877,10 @@ bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { size.width -= rtUIMargin.left + rtUIMargin.width; CXFA_MarginData marginData = GetMarginData(); if (marginData.HasValidNode()) { - float fLeftInset; - float fRightInset; - marginData.GetLeftInset(fLeftInset); - marginData.GetRightInset(fRightInset); + float fLeftInset = 0; + float fRightInset = 0; + marginData.TryLeftInset(fLeftInset); + marginData.TryRightInset(fRightInset); size.width -= fLeftInset + fRightInset; } CalculateTextContentSize(size); @@ -1021,10 +1024,10 @@ void CXFA_WidgetAcc::LoadText() { float CXFA_WidgetAcc::CalculateWidgetAutoWidth(float fWidthCalc) { CXFA_MarginData marginData = GetMarginData(); if (marginData.HasValidNode()) { - float fLeftInset; - float fRightInset; - marginData.GetLeftInset(fLeftInset); - marginData.GetRightInset(fRightInset); + float fLeftInset = 0; + float fRightInset = 0; + marginData.TryLeftInset(fLeftInset); + marginData.TryRightInset(fRightInset); fWidthCalc += fLeftInset + fRightInset; } @@ -1040,10 +1043,10 @@ float CXFA_WidgetAcc::CalculateWidgetAutoWidth(float fWidthCalc) { float CXFA_WidgetAcc::GetWidthWithoutMargin(float fWidthCalc) { CXFA_MarginData marginData = GetMarginData(); if (marginData.HasValidNode()) { - float fLeftInset; - float fRightInset; - marginData.GetLeftInset(fLeftInset); - marginData.GetRightInset(fRightInset); + float fLeftInset = 0; + float fRightInset = 0; + marginData.TryLeftInset(fLeftInset); + marginData.TryRightInset(fRightInset); fWidthCalc -= fLeftInset + fRightInset; } return fWidthCalc; @@ -1052,10 +1055,10 @@ float CXFA_WidgetAcc::GetWidthWithoutMargin(float fWidthCalc) { float CXFA_WidgetAcc::CalculateWidgetAutoHeight(float fHeightCalc) { CXFA_MarginData marginData = GetMarginData(); if (marginData.HasValidNode()) { - float fTopInset; - float fBottomInset; - marginData.GetTopInset(fTopInset); - marginData.GetBottomInset(fBottomInset); + float fTopInset = 0; + float fBottomInset = 0; + marginData.TryTopInset(fTopInset); + marginData.TryBottomInset(fBottomInset); fHeightCalc += fTopInset + fBottomInset; } @@ -1071,10 +1074,10 @@ float CXFA_WidgetAcc::CalculateWidgetAutoHeight(float fHeightCalc) { float CXFA_WidgetAcc::GetHeightWithoutMargin(float fHeightCalc) { CXFA_MarginData marginData = GetMarginData(); if (marginData.HasValidNode()) { - float fTopInset; - float fBottomInset; - marginData.GetTopInset(fTopInset); - marginData.GetBottomInset(fBottomInset); + float fTopInset = 0; + float fBottomInset = 0; + marginData.TryTopInset(fTopInset); + marginData.TryBottomInset(fBottomInset); fHeightCalc -= fTopInset + fBottomInset; } return fHeightCalc; @@ -1170,8 +1173,8 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, float& fCalcHeight) { if (iBlockIndex == 0) { CXFA_MarginData marginData = GetMarginData(); if (marginData.HasValidNode()) { - marginData.GetTopInset(fTopInset); - marginData.GetBottomInset(fBottomInset); + marginData.TryTopInset(fTopInset); + marginData.TryBottomInset(fBottomInset); } CFX_RectF rtUIMargin = GetUIMargin(); |