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

Side by Side Diff: xfa/fxfa/app/xfa_ffpageview.cpp

Issue 1976123003: Remove { delete this; } anti-pattern from IXFA_WidgetIterator (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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
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 "xfa/fxfa/include/xfa_ffpageview.h" 7 #include "xfa/fxfa/include/xfa_ffpageview.h"
8 8
9 #include "xfa/fde/fde_render.h" 9 #include "xfa/fde/fde_render.h"
10 #include "xfa/fxfa/app/xfa_ffcheckbutton.h" 10 #include "xfa/fxfa/app/xfa_ffcheckbutton.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 return NULL; 190 return NULL;
191 } 191 }
192 if (!pWidget->IsLoaded() && 192 if (!pWidget->IsLoaded() &&
193 (pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible) != 0) { 193 (pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible) != 0) {
194 pWidget->LoadWidget(); 194 pWidget->LoadWidget();
195 } 195 }
196 return pWidget; 196 return pWidget;
197 } 197 }
198 return NULL; 198 return NULL;
199 } 199 }
200
200 CXFA_FFTabOrderPageWidgetIterator::CXFA_FFTabOrderPageWidgetIterator( 201 CXFA_FFTabOrderPageWidgetIterator::CXFA_FFTabOrderPageWidgetIterator(
201 CXFA_FFPageView* pPageView, 202 CXFA_FFPageView* pPageView,
202 uint32_t dwFilter) 203 uint32_t dwFilter)
203 : m_pPageView(pPageView), m_dwFilter(dwFilter), m_iCurWidget(-1) { 204 : m_pPageView(pPageView), m_dwFilter(dwFilter), m_iCurWidget(-1) {
204 m_bIgnorerelevant = ((CXFA_FFDoc*)m_pPageView->GetDocView()->GetDoc()) 205 m_bIgnorerelevant = ((CXFA_FFDoc*)m_pPageView->GetDocView()->GetDoc())
205 ->GetXFADoc() 206 ->GetXFADoc()
206 ->GetCurVersionMode() < XFA_VERSION_205; 207 ->GetCurVersionMode() < XFA_VERSION_205;
207 Reset(); 208 Reset();
208 } 209 }
210
209 CXFA_FFTabOrderPageWidgetIterator::~CXFA_FFTabOrderPageWidgetIterator() {} 211 CXFA_FFTabOrderPageWidgetIterator::~CXFA_FFTabOrderPageWidgetIterator() {}
210 void CXFA_FFTabOrderPageWidgetIterator::Release() { 212
211 delete this;
212 }
213 void CXFA_FFTabOrderPageWidgetIterator::Reset() { 213 void CXFA_FFTabOrderPageWidgetIterator::Reset() {
214 CreateTabOrderWidgetArray(); 214 CreateTabOrderWidgetArray();
215 m_iCurWidget = -1; 215 m_iCurWidget = -1;
216 } 216 }
217 CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() { 217 CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() {
218 if (m_TabOrderWidgetArray.GetSize() > 0) { 218 if (m_TabOrderWidgetArray.GetSize() > 0) {
219 for (int32_t i = 0; i < m_TabOrderWidgetArray.GetSize(); i++) { 219 for (int32_t i = 0; i < m_TabOrderWidgetArray.GetSize(); i++) {
220 if (XFA_PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, TRUE, 220 if (XFA_PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, TRUE,
221 m_bIgnorerelevant)) { 221 m_bIgnorerelevant)) {
222 m_iCurWidget = i; 222 m_iCurWidget = i;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 CXFA_LayoutItem* pLayoutItem) { 427 CXFA_LayoutItem* pLayoutItem) {
428 if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) { 428 if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) {
429 if (!pWidget->IsLoaded() && 429 if (!pWidget->IsLoaded() &&
430 (pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) { 430 (pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) {
431 pWidget->LoadWidget(); 431 pWidget->LoadWidget();
432 } 432 }
433 return pWidget; 433 return pWidget;
434 } 434 }
435 return NULL; 435 return NULL;
436 } 436 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698