summaryrefslogtreecommitdiff
path: root/xfa/src/fwl
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-01-11 11:59:17 -0800
committerLei Zhang <thestig@chromium.org>2016-01-11 11:59:17 -0800
commit375a86403b7fa8d17d7b142c270e2d8e33bb924f (patch)
tree1db1ffddb2bbbcd429cd1d7954b1949bfa54e1ab /xfa/src/fwl
parent492961df3011ccc25646eae12ac6e6dcfe7f26da (diff)
downloadpdfium-375a86403b7fa8d17d7b142c270e2d8e33bb924f.tar.xz
Merge to XFA: Switch most min/max macros to std::min/max.
Fix lint errors along the way. R=tsepez@chromium.org TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1567343002 . (cherry picked from commit 9adfbb0920a258e916003b1ee9515e97879db82a) Review URL: https://codereview.chromium.org/1577503002 .
Diffstat (limited to 'xfa/src/fwl')
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp6
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_editimp.cpp16
-rw-r--r--xfa/src/fwl/src/core/fwl_widgetimp.cpp4
-rw-r--r--xfa/src/fwl/src/theme/widgettp.cpp4
4 files changed, 19 insertions, 11 deletions
diff --git a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp
index 3df1f21391..3fa2119b02 100644
--- a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "xfa/src/fwl/src/core/include/fwl_targetimp.h"
#include "xfa/src/fwl/src/core/include/fwl_noteimp.h"
@@ -245,8 +247,8 @@ void CFWL_CheckBoxImp::Layout() {
CalcTextRect(wsCaption, m_pProperties->m_pThemeProvider, m_dwTTOStyles,
m_iTTOAlign, rtFocus);
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_MultiLine) == 0) {
- FX_FLOAT fWidth = FX_MAX(m_rtCaption.width, rtFocus.width);
- FX_FLOAT fHeight = FX_MIN(m_rtCaption.height, rtFocus.height);
+ FX_FLOAT fWidth = std::max(m_rtCaption.width, rtFocus.width);
+ FX_FLOAT fHeight = std::min(m_rtCaption.height, rtFocus.height);
FX_FLOAT fLeft = m_rtCaption.left;
FX_FLOAT fTop = m_rtCaption.top;
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_HLayoutMask) ==
diff --git a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
index 9b652a79fc..06e185e5a2 100644
--- a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "xfa/src/fwl/src/core/include/fwl_threadimp.h"
#include "xfa/src/fwl/src/core/include/fwl_appimp.h"
@@ -887,11 +889,11 @@ void CFWL_EditImp::On_TextChanged(IFDE_TxtEdtEngine* pEdit,
fContentHeight1 = page1->GetContentsBox().height;
}
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_HSelfAdaption) {
- rtTemp.width = FX_MAX(m_pProperties->m_rtWidget.width, fContentWidth1);
+ rtTemp.width = std::max(m_pProperties->m_rtWidget.width, fContentWidth1);
m_pProperties->m_rtWidget.width = fContentWidth1;
}
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_VSelfAdaption) {
- rtTemp.height = FX_MAX(m_pProperties->m_rtWidget.height, fContentHeight1);
+ rtTemp.height = std::max(m_pProperties->m_rtWidget.height, fContentHeight1);
m_pProperties->m_rtWidget.height = fContentHeight1;
}
CFWL_EvtEdtTextChanged event;
@@ -1062,8 +1064,8 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics,
if (nCharEnd < nPageCharStart || nCharStart > nPageCharEnd) {
continue;
}
- int32_t nBgn = FX_MAX(nCharStart, nPageCharStart);
- int32_t nEnd = FX_MIN(nCharEnd, nPageCharEnd);
+ int32_t nBgn = std::max(nCharStart, nPageCharStart);
+ int32_t nEnd = std::min(nCharEnd, nPageCharEnd);
pPage->CalcRangeRectArray(nBgn - nPageCharStart, nEnd - nBgn + 1,
rectArr);
}
@@ -1926,8 +1928,8 @@ void CFWL_EditImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
}
FX_BOOL bShift = pMsg->m_dwFlags & FWL_KEYFLAG_Shift;
if (bShift && m_pOwner->m_nSelStart != nIndex) {
- int32_t iStart = FX_MIN(m_pOwner->m_nSelStart, nIndex);
- int32_t iEnd = FX_MAX(m_pOwner->m_nSelStart, nIndex);
+ int32_t iStart = std::min(m_pOwner->m_nSelStart, nIndex);
+ int32_t iEnd = std::max(m_pOwner->m_nSelStart, nIndex);
m_pOwner->m_pEdtEngine->AddSelRange(iStart, iEnd - iStart);
bRepaint = TRUE;
} else {
@@ -1985,7 +1987,7 @@ void CFWL_EditImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
m_pOwner->m_nSelStart = nLen;
}
m_pOwner->m_pEdtEngine->AddSelRange(
- FX_MIN(m_pOwner->m_nSelStart, nIndex),
+ std::min(m_pOwner->m_nSelStart, nIndex),
FXSYS_abs(nIndex - m_pOwner->m_nSelStart));
}
}
diff --git a/xfa/src/fwl/src/core/fwl_widgetimp.cpp b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
index 88db9b30e2..3872def983 100644
--- a/xfa/src/fwl/src/core/fwl_widgetimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
#include "xfa/src/fwl/src/core/include/fwl_targetimp.h"
#include "xfa/src/fwl/src/core/include/fwl_noteimp.h"
@@ -769,7 +771,7 @@ FX_BOOL CFWL_WidgetImp::GetPopupPosComboBox(FX_FLOAT fMinHeight,
} else if (rtPopup.height < fMinHeight) {
fPopHeight = fMinHeight;
}
- FX_FLOAT fWidth = FX_MAX(rtAnchor.width, rtPopup.width);
+ FX_FLOAT fWidth = std::max(rtAnchor.width, rtPopup.width);
FX_FLOAT fBottom = rtAnchor.bottom() + fPopHeight;
TransformTo(NULL, fx, fy);
if (fBottom + fy > fScreenHeight) {
diff --git a/xfa/src/fwl/src/theme/widgettp.cpp b/xfa/src/fwl/src/theme/widgettp.cpp
index 7eaf6e881b..e1351b5a21 100644
--- a/xfa/src/fwl/src/theme/widgettp.cpp
+++ b/xfa/src/fwl/src/theme/widgettp.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "xfa/src/foxitlib.h"
static void FWL_SetChildThemeID(IFWL_Widget* pParent, FX_DWORD dwThemeID) {
IFWL_WidgetMgr* pWidgetMgr = FWL_GetWidgetMgr();
@@ -528,7 +530,7 @@ void CFWL_WidgetTP::DrawArrow(CFX_Graphics* pGraphics,
CFX_Path path;
path.Create();
FX_FLOAT fBtn =
- FX_MIN(pRect->width, pRect->height) / FWLTHEME_ARROW_Denominator;
+ std::min(pRect->width, pRect->height) / FWLTHEME_ARROW_Denominator;
rtArrow.left = pRect->left + (pRect->width - fBtn) / 2;
rtArrow.top = pRect->top + (pRect->height - fBtn) / 2;
rtArrow.width = fBtn;