| Index: core/src/fpdfdoc/doc_form.cpp
|
| diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
|
| index a59f35eeac5139429d05897221f7078254981801..64e9b039f90e2cf03a68094ab929580626df9fa9 100644
|
| --- a/core/src/fpdfdoc/doc_form.cpp
|
| +++ b/core/src/fpdfdoc/doc_form.cpp
|
| @@ -866,29 +866,36 @@ CPDF_FormControl* CPDF_InterForm::GetPageControl(CPDF_Page* pPage,
|
| }
|
| return NULL;
|
| }
|
| +
|
| CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage,
|
| FX_FLOAT pdf_x,
|
| - FX_FLOAT pdf_y) const {
|
| + FX_FLOAT pdf_y,
|
| + int* z_order) const {
|
| CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArray("Annots");
|
| - if (pAnnotList == NULL) {
|
| - return NULL;
|
| - }
|
| - for (FX_DWORD i = pAnnotList->GetCount(); i > 0; i--) {
|
| - CPDF_Dictionary* pAnnot = pAnnotList->GetDict(i - 1);
|
| - if (pAnnot == NULL) {
|
| + if (!pAnnotList)
|
| + return nullptr;
|
| +
|
| + for (FX_DWORD i = pAnnotList->GetCount(); i > 0; --i) {
|
| + FX_DWORD annot_index = i - 1;
|
| + CPDF_Dictionary* pAnnot = pAnnotList->GetDict(annot_index);
|
| + if (!pAnnot)
|
| continue;
|
| - }
|
| +
|
| CPDF_FormControl* pControl;
|
| - if (!m_ControlMap.Lookup(pAnnot, (void*&)pControl)) {
|
| + if (!m_ControlMap.Lookup(pAnnot, (void*&)pControl))
|
| continue;
|
| - }
|
| +
|
| CFX_FloatRect rect = pControl->GetRect();
|
| - if (rect.Contains(pdf_x, pdf_y)) {
|
| - return pControl;
|
| - }
|
| + if (!rect.Contains(pdf_x, pdf_y))
|
| + continue;
|
| +
|
| + if (z_order)
|
| + *z_order = annot_index;
|
| + return pControl;
|
| }
|
| - return NULL;
|
| + return nullptr;
|
| }
|
| +
|
| CPDF_FormControl* CPDF_InterForm::GetControlByDict(
|
| CPDF_Dictionary* pWidgetDict) const {
|
| CPDF_FormControl* pControl = NULL;
|
|
|