Make CXFA_TraverseStrategy_ViewLayoutItem private to cxfa_layoutpagemgr.cpp.
Add a shorter equivalent typename for it.
Change-Id: Icbf8d1c1e7635e5769360a68e05e1893ec8e0641
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/52950
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fxfa/layout/BUILD.gn b/xfa/fxfa/layout/BUILD.gn
index a0b61e6..4ca00b9 100644
--- a/xfa/fxfa/layout/BUILD.gn
+++ b/xfa/fxfa/layout/BUILD.gn
@@ -23,7 +23,6 @@
"cxfa_layoutprocessor.cpp",
"cxfa_layoutprocessor.h",
"cxfa_traversestrategy_layoutitem.h",
- "cxfa_traversestrategy_viewlayoutitem.h",
"cxfa_viewlayoutitem.cpp",
"cxfa_viewlayoutitem.h",
]
diff --git a/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp b/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp
index e4d5eba..572c0bd 100644
--- a/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp
@@ -16,7 +16,6 @@
#include "xfa/fxfa/layout/cxfa_itemlayoutprocessor.h"
#include "xfa/fxfa/layout/cxfa_layoutprocessor.h"
#include "xfa/fxfa/layout/cxfa_traversestrategy_layoutitem.h"
-#include "xfa/fxfa/layout/cxfa_traversestrategy_viewlayoutitem.h"
#include "xfa/fxfa/layout/cxfa_viewlayoutitem.h"
#include "xfa/fxfa/parser/cxfa_contentarea.h"
#include "xfa/fxfa/parser/cxfa_document.h"
@@ -36,6 +35,37 @@
namespace {
+class TraverseStrategy_ViewLayoutItem {
+ public:
+ static CXFA_ViewLayoutItem* GetFirstChild(CXFA_ViewLayoutItem* pLayoutItem) {
+ for (CXFA_LayoutItem* pChildItem = pLayoutItem->GetFirstChild(); pChildItem;
+ pChildItem = pChildItem->GetNextSibling()) {
+ if (CXFA_ViewLayoutItem* pContainer = pChildItem->AsViewLayoutItem()) {
+ return pContainer;
+ }
+ }
+ return nullptr;
+ }
+
+ static CXFA_ViewLayoutItem* GetNextSibling(CXFA_ViewLayoutItem* pLayoutItem) {
+ for (CXFA_LayoutItem* pChildItem = pLayoutItem->GetNextSibling();
+ pChildItem; pChildItem = pChildItem->GetNextSibling()) {
+ if (CXFA_ViewLayoutItem* pContainer = pChildItem->AsViewLayoutItem()) {
+ return pContainer;
+ }
+ }
+ return nullptr;
+ }
+
+ static CXFA_ViewLayoutItem* GetParent(CXFA_ViewLayoutItem* pLayoutItem) {
+ return ToViewLayoutItem(pLayoutItem->GetParent());
+ }
+};
+
+using ViewLayoutItemIterator =
+ CXFA_NodeIteratorTemplate<CXFA_ViewLayoutItem,
+ TraverseStrategy_ViewLayoutItem>;
+
class TraverseStrategy_PageSet {
public:
static CXFA_ViewLayoutItem* GetFirstChild(CXFA_ViewLayoutItem* pLayoutItem) {
@@ -1662,9 +1692,7 @@
for (; pRootLayout;
pRootLayout = ToViewLayoutItem(pRootLayout->GetNextSibling())) {
CXFA_Node* pPendingPageSet = nullptr;
- CXFA_NodeIteratorTemplate<CXFA_ViewLayoutItem,
- CXFA_TraverseStrategy_ViewLayoutItem>
- iterator(pRootLayout);
+ ViewLayoutItemIterator iterator(pRootLayout);
CXFA_ViewLayoutItem* pRootPageSetViewItem = iterator.GetCurrent();
ASSERT(pRootPageSetViewItem->GetFormNode()->GetElementType() ==
XFA_Element::PageSet);
@@ -1829,9 +1857,7 @@
for (CXFA_ViewLayoutItem* pRootLayoutItem = GetRootLayoutItem();
pRootLayoutItem;
pRootLayoutItem = ToViewLayoutItem(pRootLayoutItem->GetNextSibling())) {
- CXFA_NodeIteratorTemplate<CXFA_ViewLayoutItem,
- CXFA_TraverseStrategy_ViewLayoutItem>
- iterator(pRootLayoutItem);
+ ViewLayoutItemIterator iterator(pRootLayoutItem);
for (CXFA_ViewLayoutItem* pViewItem = iterator.GetCurrent(); pViewItem;
pViewItem = iterator.MoveToNext()) {
XFA_Element type = pViewItem->GetFormNode()->GetElementType();
@@ -1852,9 +1878,7 @@
for (CXFA_ViewLayoutItem* pRootLayoutItem = GetRootLayoutItem();
pRootLayoutItem;
pRootLayoutItem = ToViewLayoutItem(pRootLayoutItem->GetNextSibling())) {
- CXFA_NodeIteratorTemplate<CXFA_ViewLayoutItem,
- CXFA_TraverseStrategy_ViewLayoutItem>
- iteratorParent(pRootLayoutItem);
+ ViewLayoutItemIterator iteratorParent(pRootLayoutItem);
for (CXFA_ViewLayoutItem* pViewItem = iteratorParent.GetCurrent();
pViewItem; pViewItem = iteratorParent.MoveToNext()) {
XFA_Element type = pViewItem->GetFormNode()->GetElementType();
diff --git a/xfa/fxfa/layout/cxfa_traversestrategy_viewlayoutitem.h b/xfa/fxfa/layout/cxfa_traversestrategy_viewlayoutitem.h
deleted file mode 100644
index 5224f3a..0000000
--- a/xfa/fxfa/layout/cxfa_traversestrategy_viewlayoutitem.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXFA_LAYOUT_CXFA_TRAVERSESTRATEGY_VIEWLAYOUTITEM_H_
-#define XFA_FXFA_LAYOUT_CXFA_TRAVERSESTRATEGY_VIEWLAYOUTITEM_H_
-
-#include "xfa/fxfa/layout/cxfa_viewlayoutitem.h"
-
-class CXFA_TraverseStrategy_ViewLayoutItem {
- public:
- static CXFA_ViewLayoutItem* GetFirstChild(CXFA_ViewLayoutItem* pLayoutItem) {
- for (CXFA_LayoutItem* pChildItem = pLayoutItem->GetFirstChild(); pChildItem;
- pChildItem = pChildItem->GetNextSibling()) {
- if (CXFA_ViewLayoutItem* pContainer = pChildItem->AsViewLayoutItem()) {
- return pContainer;
- }
- }
- return nullptr;
- }
-
- static CXFA_ViewLayoutItem* GetNextSibling(CXFA_ViewLayoutItem* pLayoutItem) {
- for (CXFA_LayoutItem* pChildItem = pLayoutItem->GetNextSibling();
- pChildItem; pChildItem = pChildItem->GetNextSibling()) {
- if (CXFA_ViewLayoutItem* pContainer = pChildItem->AsViewLayoutItem()) {
- return pContainer;
- }
- }
- return nullptr;
- }
-
- static CXFA_ViewLayoutItem* GetParent(CXFA_ViewLayoutItem* pLayoutItem) {
- return ToViewLayoutItem(pLayoutItem->GetParent());
- }
-};
-
-#endif // XFA_FXFA_LAYOUT_CXFA_TRAVERSESTRATEGY_VIEWLAYOUTITEM_H_