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

Side by Side Diff: fpdfsdk/cpdfsdk_annothandlermgr.cpp

Issue 2482143002: Fix regression in annotation key event handling. (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | 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_annothandlermgr.h" 7 #include "fpdfsdk/cpdfsdk_annothandlermgr.h"
8 8
9 #include "core/fpdfdoc/cpdf_annot.h" 9 #include "core/fpdfdoc/cpdf_annot.h"
10 #include "fpdfsdk/cba_annotiterator.h" 10 #include "fpdfsdk/cba_annotiterator.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 bool CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, 189 bool CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot,
190 uint32_t nChar, 190 uint32_t nChar,
191 uint32_t nFlags) { 191 uint32_t nFlags) {
192 return GetAnnotHandler(pAnnot)->OnChar(pAnnot, nChar, nFlags); 192 return GetAnnotHandler(pAnnot)->OnChar(pAnnot, nChar, nFlags);
193 } 193 }
194 194
195 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, 195 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot,
196 int nKeyCode, 196 int nKeyCode,
197 int nFlag) { 197 int nFlag) {
198 if (m_pFormFillEnv->IsCTRLKeyDown(nFlag) || 198 if (m_pFormFillEnv->IsCTRLKeyDown(nFlag) ||
199 m_pFormFillEnv->IsALTKeyDown(nFlag)) 199 m_pFormFillEnv->IsALTKeyDown(nFlag)) {
200 return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag); 200 return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag);
201 }
201 202
202 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); 203 CPDFSDK_PageView* pPage = pAnnot->GetPageView();
203 CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); 204 CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot();
204 if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) { 205 if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) {
205 CPDFSDK_Annot::ObservedPtr pNext( 206 CPDFSDK_Annot::ObservedPtr pNext(
206 GetNextAnnot(pFocusAnnot, !m_pFormFillEnv->IsSHIFTKeyDown(nFlag))); 207 GetNextAnnot(pFocusAnnot, !m_pFormFillEnv->IsSHIFTKeyDown(nFlag)));
207 if (pNext && pNext.Get() != pFocusAnnot) { 208 if (pNext && pNext.Get() != pFocusAnnot) {
208 pPage->GetFormFillEnv()->SetFocusAnnot(&pNext); 209 pPage->GetFormFillEnv()->SetFocusAnnot(&pNext);
209 return true; 210 return true;
210 } 211 }
211 } 212 }
212 213
213 return false; 214 return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag);
dsinclair 2016/11/09 03:36:21 Do you need to null check GetAnnotHandler as the o
Lei Zhang 2016/11/09 05:28:29 No, GetAnnotHandler() never returns nullptr.
214 } 215 }
215 216
216 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, 217 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot,
217 int nKeyCode, 218 int nKeyCode,
218 int nFlag) { 219 int nFlag) {
219 return false; 220 return false;
220 } 221 }
221 222
222 bool CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus( 223 bool CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(
223 CPDFSDK_Annot::ObservedPtr* pAnnot, 224 CPDFSDK_Annot::ObservedPtr* pAnnot,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); 297 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious();
297 if (!hNextFocus && pSDKAnnot) 298 if (!hNextFocus && pSDKAnnot)
298 hNextFocus = pWidgetIterator->MoveToFirst(); 299 hNextFocus = pWidgetIterator->MoveToFirst();
299 300
300 return pPageView->GetAnnotByXFAWidget(hNextFocus); 301 return pPageView->GetAnnotByXFAWidget(hNextFocus);
301 #else // PDF_ENABLE_XFA 302 #else // PDF_ENABLE_XFA
302 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET); 303 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET);
303 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); 304 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot);
304 #endif // PDF_ENABLE_XFA 305 #endif // PDF_ENABLE_XFA
305 } 306 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698