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

Side by Side Diff: fpdfsdk/cpdfsdk_interform.cpp

Issue 2624933002: Annotation deleted while retriveing it in JS (Closed)
Patch Set: rebase, another case. Created 3 years, 11 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 | « fpdfsdk/cpdfsdk_interform.h ('k') | fpdfsdk/javascript/Document.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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "fpdfsdk/cpdfsdk_interform.h" 7 #include "fpdfsdk/cpdfsdk_interform.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 if (!pPage) 112 if (!pPage)
113 return nullptr; 113 return nullptr;
114 114
115 return static_cast<CPDFSDK_Widget*>(pPage->GetAnnotByDict(pControlDict)); 115 return static_cast<CPDFSDK_Widget*>(pPage->GetAnnotByDict(pControlDict));
116 } 116 }
117 117
118 void CPDFSDK_InterForm::GetWidgets( 118 void CPDFSDK_InterForm::GetWidgets(
119 const CFX_WideString& sFieldName, 119 const CFX_WideString& sFieldName,
120 std::vector<CPDFSDK_Widget*>* widgets) const { 120 std::vector<CPDFSDK_Annot::ObservedPtr>* widgets) const {
121 for (int i = 0, sz = m_pInterForm->CountFields(sFieldName); i < sz; ++i) { 121 for (int i = 0, sz = m_pInterForm->CountFields(sFieldName); i < sz; ++i) {
122 CPDF_FormField* pFormField = m_pInterForm->GetField(i, sFieldName); 122 CPDF_FormField* pFormField = m_pInterForm->GetField(i, sFieldName);
123 ASSERT(pFormField); 123 ASSERT(pFormField);
124 GetWidgets(pFormField, widgets); 124 GetWidgets(pFormField, widgets);
125 } 125 }
126 } 126 }
127 127
128 void CPDFSDK_InterForm::GetWidgets( 128 void CPDFSDK_InterForm::GetWidgets(
129 CPDF_FormField* pField, 129 CPDF_FormField* pField,
130 std::vector<CPDFSDK_Widget*>* widgets) const { 130 std::vector<CPDFSDK_Annot::ObservedPtr>* widgets) const {
131 for (int i = 0, sz = pField->CountControls(); i < sz; ++i) { 131 for (int i = 0, sz = pField->CountControls(); i < sz; ++i) {
132 CPDF_FormControl* pFormCtrl = pField->GetControl(i); 132 CPDF_FormControl* pFormCtrl = pField->GetControl(i);
133 ASSERT(pFormCtrl); 133 ASSERT(pFormCtrl);
134 CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl); 134 CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl);
135 if (pWidget) 135 if (pWidget)
136 widgets->push_back(pWidget); 136 widgets->emplace_back(pWidget);
137 } 137 }
138 } 138 }
139 139
140 int CPDFSDK_InterForm::GetPageIndexByAnnotDict( 140 int CPDFSDK_InterForm::GetPageIndexByAnnotDict(
141 CPDF_Document* pDocument, 141 CPDF_Document* pDocument,
142 CPDF_Dictionary* pAnnotDict) const { 142 CPDF_Dictionary* pAnnotDict) const {
143 ASSERT(pAnnotDict); 143 ASSERT(pAnnotDict);
144 144
145 for (int i = 0, sz = pDocument->GetPageCount(); i < sz; i++) { 145 for (int i = 0, sz = pDocument->GetPageCount(); i < sz; i++) {
146 if (CPDF_Dictionary* pPageDict = pDocument->GetPage(i)) { 146 if (CPDF_Dictionary* pPageDict = pDocument->GetPage(i)) {
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 } 693 }
694 } 694 }
695 695
696 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) { 696 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) {
697 if (nFieldType < 0 || nFieldType > kNumFieldTypes) 697 if (nFieldType < 0 || nFieldType > kNumFieldTypes)
698 return FXSYS_RGB(255, 255, 255); 698 return FXSYS_RGB(255, 255, 255);
699 if (nFieldType == 0) 699 if (nFieldType == 0)
700 return m_aHighlightColor[0]; 700 return m_aHighlightColor[0];
701 return m_aHighlightColor[nFieldType - 1]; 701 return m_aHighlightColor[nFieldType - 1];
702 } 702 }
OLDNEW
« no previous file with comments | « fpdfsdk/cpdfsdk_interform.h ('k') | fpdfsdk/javascript/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698