summaryrefslogtreecommitdiff
path: root/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/formfiller/cffl_interactiveformfiller.cpp')
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.cpp52
1 files changed, 21 insertions, 31 deletions
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index 5a35852005..491186e39c 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -23,6 +23,7 @@
#include "fpdfsdk/formfiller/cffl_radiobutton.h"
#include "fpdfsdk/formfiller/cffl_textfield.h"
#include "fpdfsdk/pdfwindow/PWL_Utils.h"
+#include "third_party/base/stl_util.h"
#define FFL_MAXLISTBOXHEIGHT 140.0f
@@ -528,8 +529,8 @@ void CFFL_InteractiveFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) {
void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData,
float fPopupMin,
float fPopupMax,
- int32_t& nRet,
- float& fPopupRet) {
+ bool* bBottom,
+ float* fPopupRet) {
CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
CFX_FloatRect rcPageView(0, 0, 0, 0);
@@ -563,39 +564,28 @@ void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData,
break;
}
- float fFactHeight = 0;
- bool bBottom = true;
- float fMaxListBoxHeight = 0;
- if (fPopupMax > FFL_MAXLISTBOXHEIGHT) {
- if (fPopupMin > FFL_MAXLISTBOXHEIGHT) {
- fMaxListBoxHeight = fPopupMin;
- } else {
- fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT;
- }
- } else {
- fMaxListBoxHeight = fPopupMax;
- }
+ const float fMaxListBoxHeight =
+ pdfium::clamp(FFL_MAXLISTBOXHEIGHT, fPopupMin, fPopupMax);
if (fBottom > fMaxListBoxHeight) {
- fFactHeight = fMaxListBoxHeight;
- bBottom = true;
- } else {
- if (fTop > fMaxListBoxHeight) {
- fFactHeight = fMaxListBoxHeight;
- bBottom = false;
- } else {
- if (fTop > fBottom) {
- fFactHeight = fTop;
- bBottom = false;
- } else {
- fFactHeight = fBottom;
- bBottom = true;
- }
- }
+ *fPopupRet = fMaxListBoxHeight;
+ *bBottom = true;
+ return;
+ }
+
+ if (fTop > fMaxListBoxHeight) {
+ *fPopupRet = fMaxListBoxHeight;
+ *bBottom = false;
+ return;
}
- nRet = bBottom ? 0 : 1;
- fPopupRet = fFactHeight;
+ if (fTop > fBottom) {
+ *fPopupRet = fTop;
+ *bBottom = false;
+ } else {
+ *fPopupRet = fBottom;
+ *bBottom = true;
+ }
}
void CFFL_InteractiveFormFiller::OnKeyStrokeCommit(