summaryrefslogtreecommitdiff
path: root/fpdfsdk/formfiller
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/formfiller')
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.cpp52
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.h4
2 files changed, 23 insertions, 33 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(
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
index 751abf6e79..d2f59bfe38 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -142,8 +142,8 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify {
void QueryWherePopup(void* pPrivateData,
float fPopupMin,
float fPopupMax,
- int32_t& nRet,
- float& fPopupRet) override;
+ bool* bBottom,
+ float* fPopupRet) override;
void OnBeforeKeyStroke(void* pPrivateData,
CFX_WideString& strChange,
const CFX_WideString& strChangeEx,