summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-07-03 14:13:53 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-03 14:13:53 +0000
commitd77e0ed72f73fb63305d04953ef03e2edab82d34 (patch)
tree0ed74aad3deaff8447733cae91b4d4ceaf075941 /xfa
parent7b10bb9c50d183caffc2f4481e249eb3cf763d5f (diff)
downloadpdfium-d77e0ed72f73fb63305d04953ef03e2edab82d34.tar.xz
Use more UnownedPtr<> in cfxa_ffpageview
Change-Id: Ifdb9fb23d61082b7c1b9b93c057e0881959cea2a Reviewed-on: https://pdfium-review.googlesource.com/36530 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/cxfa_ffpageview.cpp25
-rw-r--r--xfa/fxfa/cxfa_ffpageview.h8
2 files changed, 17 insertions, 16 deletions
diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp
index d85ff07c0f..cb9743972e 100644
--- a/xfa/fxfa/cxfa_ffpageview.cpp
+++ b/xfa/fxfa/cxfa_ffpageview.cpp
@@ -247,10 +247,10 @@ void CXFA_FFTabOrderPageWidgetIterator::Reset() {
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() {
for (int32_t i = 0;
i < pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
+ if (PageWidgetFilter(m_TabOrderWidgetArray[i].Get(), m_dwFilter, true,
m_bIgnorerelevant)) {
m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget];
+ return m_TabOrderWidgetArray[m_iCurWidget].Get();
}
}
return nullptr;
@@ -259,10 +259,10 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() {
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() {
for (int32_t i = pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray) - 1;
i >= 0; i--) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
+ if (PageWidgetFilter(m_TabOrderWidgetArray[i].Get(), m_dwFilter, true,
m_bIgnorerelevant)) {
m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget];
+ return m_TabOrderWidgetArray[m_iCurWidget].Get();
}
}
return nullptr;
@@ -271,10 +271,10 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() {
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() {
for (int32_t i = m_iCurWidget + 1;
i < pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
+ if (PageWidgetFilter(m_TabOrderWidgetArray[i].Get(), m_dwFilter, true,
m_bIgnorerelevant)) {
m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget];
+ return m_TabOrderWidgetArray[m_iCurWidget].Get();
}
}
m_iCurWidget = -1;
@@ -283,10 +283,10 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() {
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() {
for (int32_t i = m_iCurWidget - 1; i >= 0; i--) {
- if (PageWidgetFilter(m_TabOrderWidgetArray[i], m_dwFilter, true,
+ if (PageWidgetFilter(m_TabOrderWidgetArray[i].Get(), m_dwFilter, true,
m_bIgnorerelevant)) {
m_iCurWidget = i;
- return m_TabOrderWidgetArray[m_iCurWidget];
+ return m_TabOrderWidgetArray[m_iCurWidget].Get();
}
}
m_iCurWidget = -1;
@@ -294,7 +294,8 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToPrevious() {
}
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetCurrentWidget() {
- return m_iCurWidget >= 0 ? m_TabOrderWidgetArray[m_iCurWidget] : nullptr;
+ return m_iCurWidget >= 0 ? m_TabOrderWidgetArray[m_iCurWidget].Get()
+ : nullptr;
}
bool CXFA_FFTabOrderPageWidgetIterator::SetCurrentWidget(
@@ -343,7 +344,7 @@ void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() {
while (pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray) <
nWidgetCount) {
if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget)) {
- m_TabOrderWidgetArray.push_back(hWidget);
+ m_TabOrderWidgetArray.emplace_back(hWidget);
CXFA_Node* pNode = hWidget->GetNode();
if (pNode->GetFFWidgetType() == XFA_FFWidgetType::kExclGroup) {
auto it = std::find(SpaceOrderWidgetArray.begin(),
@@ -357,7 +358,7 @@ void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() {
if (radio->GetNode()->GetExclGroupIfExists() != pNode)
break;
if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget))
- m_TabOrderWidgetArray.push_back(radio);
+ m_TabOrderWidgetArray.emplace_back(radio);
iWidgetIndex++;
}
@@ -432,7 +433,7 @@ void CXFA_FFTabOrderPageWidgetIterator::OrderContainer(
void CXFA_FFTabOrderPageWidgetIterator::CreateSpaceOrderWidgetArray(
std::vector<CXFA_FFWidget*>* WidgetArray) {
- CXFA_LayoutItemIterator sIterator(m_pPageView);
+ CXFA_LayoutItemIterator sIterator(m_pPageView.Get());
auto pParam = pdfium::MakeUnique<CXFA_TabParam>(nullptr);
bool bCurrentItem = false;
bool bContentArea = false;
diff --git a/xfa/fxfa/cxfa_ffpageview.h b/xfa/fxfa/cxfa_ffpageview.h
index 10dac26b92..f3ae069638 100644
--- a/xfa/fxfa/cxfa_ffpageview.h
+++ b/xfa/fxfa/cxfa_ffpageview.h
@@ -54,8 +54,8 @@ class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator {
protected:
CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
- CXFA_FFPageView* m_pPageView;
- CXFA_FFWidget* m_hCurWidget;
+ UnownedPtr<CXFA_FFPageView> m_pPageView;
+ UnownedPtr<CXFA_FFWidget> m_hCurWidget;
uint32_t m_dwFilter;
bool m_bIgnorerelevant;
CXFA_LayoutItemIterator m_sIterator;
@@ -104,8 +104,8 @@ class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator {
bool& bContentArea,
bool bMarsterPage = false);
- std::vector<CXFA_FFWidget*> m_TabOrderWidgetArray;
- CXFA_FFPageView* m_pPageView;
+ std::vector<UnownedPtr<CXFA_FFWidget>> m_TabOrderWidgetArray;
+ UnownedPtr<CXFA_FFPageView> m_pPageView;
uint32_t m_dwFilter;
int32_t m_iCurWidget;
bool m_bIgnorerelevant;