Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(822)

Side by Side Diff: core/src/fpdfdoc/doc_form.cpp

Issue 958423005: Handle overlapping links and widgets. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/include/fpdfdoc/fpdf_doc.h ('k') | core/src/fpdfdoc/doc_link.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../include/fpdfdoc/fpdf_doc.h" 7 #include "../../include/fpdfdoc/fpdf_doc.h"
8 #include "../../include/fxcrt/fx_xml.h" 8 #include "../../include/fxcrt/fx_xml.h"
9 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict); 9 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict);
10 void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Docu ment* pDocument); 10 void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Docu ment* pDocument);
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 if (pAnnotList == NULL) { 896 if (pAnnotList == NULL) {
897 return NULL; 897 return NULL;
898 } 898 }
899 for (FX_DWORD i = pAnnotList->GetCount(); i > 0; i --) { 899 for (FX_DWORD i = pAnnotList->GetCount(); i > 0; i --) {
900 CPDF_Dictionary* pAnnot = pAnnotList->GetDict(i - 1); 900 CPDF_Dictionary* pAnnot = pAnnotList->GetDict(i - 1);
901 if (pAnnot == NULL) { 901 if (pAnnot == NULL) {
902 continue; 902 continue;
903 } 903 }
904 CPDF_FormControl* pControl; 904 CPDF_FormControl* pControl;
905 if (!m_ControlMap.Lookup(pAnnot, (FX_LPVOID&)pControl)) { 905 if (!m_ControlMap.Lookup(pAnnot, (FX_LPVOID&)pControl)) {
906 // If there is a link that overlaps the widget, return NULL.
907 if (pAnnot->GetString("Subtype") == "Link") {
908 CPDF_Link link(pAnnot);
909 CPDF_Rect link_rect = link.GetRect();
910 if (link_rect.Contains(pdf_x, pdf_y)) {
911 return NULL;
912 }
913 }
906 continue; 914 continue;
907 } 915 }
908 CFX_FloatRect rect = pControl->GetRect(); 916 CFX_FloatRect rect = pControl->GetRect();
909 if (rect.Contains(pdf_x, pdf_y)) { 917 if (rect.Contains(pdf_x, pdf_y)) {
910 return pControl; 918 return pControl;
911 } 919 }
912 } 920 }
913 return NULL; 921 return NULL;
914 } 922 }
915 CPDF_FormControl* CPDF_InterForm::GetControlByDict(CPDF_Dictionary* pWidgetDict) const 923 CPDF_FormControl* CPDF_InterForm::GetControlByDict(CPDF_Dictionary* pWidgetDict) const
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 continue; 1663 continue;
1656 } 1664 }
1657 CPDF_FormControl* pControl = NULL; 1665 CPDF_FormControl* pControl = NULL;
1658 if (m_ControlMap.Lookup(pAnnotDict, (void*&)pControl)) { 1666 if (m_ControlMap.Lookup(pAnnotDict, (void*&)pControl)) {
1659 return iNewPage; 1667 return iNewPage;
1660 } 1668 }
1661 } 1669 }
1662 } while (TRUE); 1670 } while (TRUE);
1663 return -1; 1671 return -1;
1664 } 1672 }
OLDNEW
« no previous file with comments | « core/include/fpdfdoc/fpdf_doc.h ('k') | core/src/fpdfdoc/doc_link.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698