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

Side by Side Diff: fpdfsdk/cpdfsdk_widgethandler.cpp

Issue 2368403002: Watch destruction of widgets around OnAAction() method (Closed)
Patch Set: blown merge Created 4 years, 2 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_pageview.cpp ('k') | fpdfsdk/cpdfsdk_xfawidgethandler.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/include/cpdfsdk_widgethandler.h" 7 #include "fpdfsdk/include/cpdfsdk_widgethandler.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 if (m_pFormFiller) 103 if (m_pFormFiller)
104 m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device); 104 m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device);
105 } 105 }
106 } 106 }
107 107
108 void CPDFSDK_WidgetHandler::OnDelete(CPDFSDK_Annot* pAnnot) {} 108 void CPDFSDK_WidgetHandler::OnDelete(CPDFSDK_Annot* pAnnot) {}
109 109
110 void CPDFSDK_WidgetHandler::OnRelease(CPDFSDK_Annot* pAnnot) {} 110 void CPDFSDK_WidgetHandler::OnRelease(CPDFSDK_Annot* pAnnot) {}
111 111
112 void CPDFSDK_WidgetHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, 112 void CPDFSDK_WidgetHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
113 CPDFSDK_Annot* pAnnot, 113 CPDFSDK_Annot::ObservedPtr* pAnnot,
114 uint32_t nFlag) { 114 uint32_t nFlag) {
115 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) 115 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
116 m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag); 116 m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag);
117 } 117 }
118 118
119 void CPDFSDK_WidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView, 119 void CPDFSDK_WidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
120 CPDFSDK_Annot* pAnnot, 120 CPDFSDK_Annot::ObservedPtr* pAnnot,
121 uint32_t nFlag) { 121 uint32_t nFlag) {
122 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) 122 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
123 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); 123 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag);
124 } 124 }
125 125
126 FX_BOOL CPDFSDK_WidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, 126 FX_BOOL CPDFSDK_WidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView,
127 CPDFSDK_Annot* pAnnot, 127 CPDFSDK_Annot::ObservedPtr* pAnnot,
128 uint32_t nFlags, 128 uint32_t nFlags,
129 const CFX_FloatPoint& point) { 129 const CFX_FloatPoint& point) {
130 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) 130 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
131 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); 131 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point);
132 132
133 return FALSE; 133 return FALSE;
134 } 134 }
135 135
136 FX_BOOL CPDFSDK_WidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, 136 FX_BOOL CPDFSDK_WidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
137 CPDFSDK_Annot* pAnnot, 137 CPDFSDK_Annot::ObservedPtr* pAnnot,
138 uint32_t nFlags, 138 uint32_t nFlags,
139 const CFX_FloatPoint& point) { 139 const CFX_FloatPoint& point) {
140 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) 140 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
141 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); 141 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point);
142 142
143 return FALSE; 143 return FALSE;
144 } 144 }
145 145
146 FX_BOOL CPDFSDK_WidgetHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, 146 FX_BOOL CPDFSDK_WidgetHandler::OnLButtonDblClk(
147 CPDFSDK_Annot* pAnnot, 147 CPDFSDK_PageView* pPageView,
148 uint32_t nFlags, 148 CPDFSDK_Annot::ObservedPtr* pAnnot,
149 const CFX_FloatPoint& point) { 149 uint32_t nFlags,
150 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) 150 const CFX_FloatPoint& point) {
151 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
151 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); 152 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
152 153
153 return FALSE; 154 return FALSE;
154 } 155 }
155 156
156 FX_BOOL CPDFSDK_WidgetHandler::OnMouseMove(CPDFSDK_PageView* pPageView, 157 FX_BOOL CPDFSDK_WidgetHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
157 CPDFSDK_Annot* pAnnot, 158 CPDFSDK_Annot::ObservedPtr* pAnnot,
158 uint32_t nFlags, 159 uint32_t nFlags,
159 const CFX_FloatPoint& point) { 160 const CFX_FloatPoint& point) {
160 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) 161 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
161 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); 162 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point);
162 163
163 return FALSE; 164 return FALSE;
164 } 165 }
165 166
166 FX_BOOL CPDFSDK_WidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, 167 FX_BOOL CPDFSDK_WidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
167 CPDFSDK_Annot* pAnnot, 168 CPDFSDK_Annot::ObservedPtr* pAnnot,
168 uint32_t nFlags, 169 uint32_t nFlags,
169 short zDelta, 170 short zDelta,
170 const CFX_FloatPoint& point) { 171 const CFX_FloatPoint& point) {
171 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) 172 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
172 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, 173 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta,
173 point); 174 point);
174 175
175 return FALSE; 176 return FALSE;
176 } 177 }
177 178
178 FX_BOOL CPDFSDK_WidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, 179 FX_BOOL CPDFSDK_WidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
179 CPDFSDK_Annot* pAnnot, 180 CPDFSDK_Annot::ObservedPtr* pAnnot,
180 uint32_t nFlags, 181 uint32_t nFlags,
181 const CFX_FloatPoint& point) { 182 const CFX_FloatPoint& point) {
182 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) 183 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
183 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); 184 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point);
184 185
185 return FALSE; 186 return FALSE;
186 } 187 }
187 188
188 FX_BOOL CPDFSDK_WidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, 189 FX_BOOL CPDFSDK_WidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
189 CPDFSDK_Annot* pAnnot, 190 CPDFSDK_Annot::ObservedPtr* pAnnot,
190 uint32_t nFlags, 191 uint32_t nFlags,
191 const CFX_FloatPoint& point) { 192 const CFX_FloatPoint& point) {
192 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) 193 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
193 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); 194 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point);
194 195
195 return FALSE; 196 return FALSE;
196 } 197 }
197 198
198 FX_BOOL CPDFSDK_WidgetHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, 199 FX_BOOL CPDFSDK_WidgetHandler::OnRButtonDblClk(
199 CPDFSDK_Annot* pAnnot, 200 CPDFSDK_PageView* pPageView,
200 uint32_t nFlags, 201 CPDFSDK_Annot::ObservedPtr* pAnnot,
201 const CFX_FloatPoint& point) { 202 uint32_t nFlags,
203 const CFX_FloatPoint& point) {
202 return FALSE; 204 return FALSE;
203 } 205 }
204 206
205 FX_BOOL CPDFSDK_WidgetHandler::OnChar(CPDFSDK_Annot* pAnnot, 207 FX_BOOL CPDFSDK_WidgetHandler::OnChar(CPDFSDK_Annot* pAnnot,
206 uint32_t nChar, 208 uint32_t nChar,
207 uint32_t nFlags) { 209 uint32_t nFlags) {
208 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) 210 if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
209 return m_pFormFiller->OnChar(pAnnot, nChar, nFlags); 211 return m_pFormFiller->OnChar(pAnnot, nChar, nFlags);
210 212
211 return FALSE; 213 return FALSE;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 255 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
254 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { 256 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
255 if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty()) 257 if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty())
256 pWidget->ResetAppearance(FALSE); 258 pWidget->ResetAppearance(FALSE);
257 } 259 }
258 #endif // PDF_ENABLE_XFA 260 #endif // PDF_ENABLE_XFA
259 if (m_pFormFiller) 261 if (m_pFormFiller)
260 m_pFormFiller->OnLoad(pAnnot); 262 m_pFormFiller->OnLoad(pAnnot);
261 } 263 }
262 264
263 FX_BOOL CPDFSDK_WidgetHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, 265 FX_BOOL CPDFSDK_WidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
264 uint32_t nFlag) { 266 uint32_t nFlag) {
265 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) 267 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
266 return m_pFormFiller->OnSetFocus(pAnnot, nFlag); 268 return m_pFormFiller->OnSetFocus(pAnnot, nFlag);
267 269
268 return TRUE; 270 return TRUE;
269 } 271 }
270 272
271 FX_BOOL CPDFSDK_WidgetHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, 273 FX_BOOL CPDFSDK_WidgetHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
272 uint32_t nFlag) { 274 uint32_t nFlag) {
273 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) 275 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
274 return m_pFormFiller->OnKillFocus(pAnnot, nFlag); 276 return m_pFormFiller->OnKillFocus(pAnnot, nFlag);
275 277
276 return TRUE; 278 return TRUE;
277 } 279 }
278 280
279 #ifdef PDF_ENABLE_XFA 281 #ifdef PDF_ENABLE_XFA
280 FX_BOOL CPDFSDK_WidgetHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, 282 FX_BOOL CPDFSDK_WidgetHandler::OnXFAChangedFocus(
281 CPDFSDK_Annot* pNewAnnot) { 283 CPDFSDK_Annot::ObservedPtr* pOldAnnot,
284 CPDFSDK_Annot::ObservedPtr* pNewAnnot) {
282 return TRUE; 285 return TRUE;
283 } 286 }
284 #endif // PDF_ENABLE_XFA 287 #endif // PDF_ENABLE_XFA
285 288
286 CFX_FloatRect CPDFSDK_WidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView, 289 CFX_FloatRect CPDFSDK_WidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
287 CPDFSDK_Annot* pAnnot) { 290 CPDFSDK_Annot* pAnnot) {
288 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) 291 if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
289 return CFX_FloatRect(m_pFormFiller->GetViewBBox(pPageView, pAnnot)); 292 return CFX_FloatRect(m_pFormFiller->GetViewBBox(pPageView, pAnnot));
290 293
291 return CFX_FloatRect(0, 0, 0, 0); 294 return CFX_FloatRect(0, 0, 0, 0);
292 } 295 }
293 296
294 FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, 297 FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView,
295 CPDFSDK_Annot* pAnnot, 298 CPDFSDK_Annot* pAnnot,
296 const CFX_FloatPoint& point) { 299 const CFX_FloatPoint& point) {
297 ASSERT(pPageView); 300 ASSERT(pPageView);
298 ASSERT(pAnnot); 301 ASSERT(pAnnot);
299 302
300 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); 303 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot);
301 return rect.Contains(point.x, point.y); 304 return rect.Contains(point.x, point.y);
302 } 305 }
OLDNEW
« no previous file with comments | « fpdfsdk/cpdfsdk_pageview.cpp ('k') | fpdfsdk/cpdfsdk_xfawidgethandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698