summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-02-14 15:44:21 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-14 15:44:21 +0000
commitd8d6f55140bd4f0a67de833346113cfa6e03c4bd (patch)
tree1031b18090215b45f2a1533dd0b17390bd6d96cc /xfa/fxfa/parser
parent2f68cb53f5938e2dd572db79fc5689c987cb350d (diff)
downloadpdfium-d8d6f55140bd4f0a67de833346113cfa6e03c4bd.tar.xz
Cleanup CXFA_Document const-ness
This CL marks methods const where possible and removes redundant methods from CXFA_Document. Change-Id: I34804425469dfd52469daba68f64a4b511e5d4d0 Reviewed-on: https://pdfium-review.googlesource.com/26730 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_document.h14
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_layoutitem.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_layoutitem.h4
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp4
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp2
7 files changed, 16 insertions, 22 deletions
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index 2a9d80e0cd..01ba3205ed 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -107,10 +107,6 @@ CXFA_LayoutProcessor* CXFA_Document::GetLayoutProcessor() {
return m_pLayoutProcessor.get();
}
-CXFA_LayoutProcessor* CXFA_Document::GetDocLayout() {
- return GetLayoutProcessor();
-}
-
void CXFA_Document::ClearLayoutData() {
m_pLayoutProcessor.reset();
m_pScriptContext.reset();
@@ -258,7 +254,7 @@ CFXJSE_Engine* CXFA_Document::InitScriptContext(CFXJS_Engine* fxjs_engine) {
// We have to call |InitScriptContext| before any calls to |GetScriptContext|
// or the context won't have an isolate set into it.
-CFXJSE_Engine* CXFA_Document::GetScriptContext() {
+CFXJSE_Engine* CXFA_Document::GetScriptContext() const {
ASSERT(m_pScriptContext);
return m_pScriptContext.get();
}
@@ -291,7 +287,7 @@ XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber(
}
CXFA_Node* CXFA_Document::GetNodeByID(CXFA_Node* pRoot,
- const WideStringView& wsID) {
+ const WideStringView& wsID) const {
if (!pRoot || wsID.IsEmpty())
return nullptr;
diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h
index 9dc8e52ab6..c04c31cfce 100644
--- a/xfa/fxfa/parser/cxfa_document.h
+++ b/xfa/fxfa/parser/cxfa_document.h
@@ -42,16 +42,13 @@ enum XFA_DocFlag {
class CFXJSE_Engine;
class CFXJS_Engine;
-class CFX_XMLDoc;
class CScript_DataWindow;
class CScript_EventPseudoModel;
class CScript_HostPseudoModel;
class CScript_LayoutPseudoModel;
class CScript_LogPseudoModel;
class CScript_SignaturePseudoModel;
-class CXFA_ContainerLayoutItem;
class CXFA_FFNotify;
-class CXFA_LayoutItem;
class CXFA_LayoutProcessor;
class CXFA_Node;
class CXFA_Object;
@@ -67,15 +64,16 @@ class CXFA_Document : public CXFA_NodeOwner {
CXFA_FFNotify* GetNotify() const { return notify_.Get(); }
CXFA_LocaleMgr* GetLocalMgr();
CXFA_Object* GetXFAObject(XFA_HashCode wsNodeNameHash);
- CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const WideStringView& wsID);
- CXFA_Node* GetNotBindNode(const std::vector<CXFA_Object*>& arrayNodes);
+ CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const WideStringView& wsID) const;
+ CXFA_Node* GetNotBindNode(const std::vector<CXFA_Object*>& arrayNodes) const;
CXFA_LayoutProcessor* GetLayoutProcessor();
- CXFA_LayoutProcessor* GetDocLayout();
- CFXJSE_Engine* GetScriptContext();
+ CFXJSE_Engine* GetScriptContext() const;
void SetRoot(CXFA_Node* pNewRoot) { m_pRootNode = pNewRoot; }
- bool HasFlag(uint32_t dwFlag) { return (m_dwDocFlags & dwFlag) == dwFlag; }
+ bool HasFlag(uint32_t dwFlag) const {
+ return (m_dwDocFlags & dwFlag) == dwFlag;
+ }
void SetFlag(uint32_t dwFlag, bool bOn);
bool IsInteractive();
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index e01f6ee037..88dcd1b4ae 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -432,7 +432,7 @@ bool FindBreakNode(CXFA_Node* pContainerNode,
void DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) {
CXFA_FFNotify* pNotify = pGenerateNode->GetDocument()->GetNotify();
CXFA_LayoutProcessor* pDocLayout =
- pGenerateNode->GetDocument()->GetDocLayout();
+ pGenerateNode->GetDocument()->GetLayoutProcessor();
CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator(
pGenerateNode);
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
@@ -819,7 +819,7 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() {
CXFA_FFNotify* pNotify =
m_pOldLayoutItem->m_pFormNode->GetDocument()->GetNotify();
CXFA_LayoutProcessor* pDocLayout =
- m_pOldLayoutItem->m_pFormNode->GetDocument()->GetDocLayout();
+ m_pOldLayoutItem->m_pFormNode->GetDocument()->GetLayoutProcessor();
CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem;
while (pOldLayoutItem) {
CXFA_ContentLayoutItem* pNextOldLayoutItem = pOldLayoutItem->m_pNext;
diff --git a/xfa/fxfa/parser/cxfa_layoutitem.cpp b/xfa/fxfa/parser/cxfa_layoutitem.cpp
index 7fb921ab84..bd8ca2a58a 100644
--- a/xfa/fxfa/parser/cxfa_layoutitem.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutitem.cpp
@@ -18,7 +18,7 @@ void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) {
CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild;
CXFA_FFNotify* pNotify = pLayoutItem->m_pFormNode->GetDocument()->GetNotify();
CXFA_LayoutProcessor* pDocLayout =
- pLayoutItem->m_pFormNode->GetDocument()->GetDocLayout();
+ pLayoutItem->m_pFormNode->GetDocument()->GetLayoutProcessor();
while (pNode) {
CXFA_LayoutItem* pNext = pNode->m_pNextSibling;
pNode->m_pParent = nullptr;
diff --git a/xfa/fxfa/parser/cxfa_layoutitem.h b/xfa/fxfa/parser/cxfa_layoutitem.h
index 9c088601ef..e03f455de5 100644
--- a/xfa/fxfa/parser/cxfa_layoutitem.h
+++ b/xfa/fxfa/parser/cxfa_layoutitem.h
@@ -13,8 +13,6 @@ class CXFA_ContainerLayoutItem;
class CXFA_ContentLayoutItem;
class CXFA_LayoutProcessor;
-void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem);
-
class CXFA_LayoutItem {
public:
virtual ~CXFA_LayoutItem();
@@ -53,4 +51,6 @@ class CXFA_LayoutItem {
bool m_bIsContentLayoutItem;
};
+void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem);
+
#endif // XFA_FXFA_PARSER_CXFA_LAYOUTITEM_H_
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index f921d8014f..d6178bfc5e 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -1626,7 +1626,7 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) {
CXFA_FFNotify* pNotify =
m_pTemplatePageSetRoot->GetDocument()->GetNotify();
CXFA_LayoutProcessor* pDocLayout =
- m_pTemplatePageSetRoot->GetDocument()->GetDocLayout();
+ m_pTemplatePageSetRoot->GetDocument()->GetLayoutProcessor();
if (pCurLayoutItem->m_pFirstChild)
SyncRemoveLayoutItem(pCurLayoutItem, pNotify, pDocLayout);
@@ -1687,7 +1687,7 @@ CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(CXFA_Node* pFormNode) {
void CXFA_LayoutPageMgr::MergePageSetContents() {
CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument();
CXFA_FFNotify* pNotify = pDocument->GetNotify();
- CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout();
+ CXFA_LayoutProcessor* pDocLayout = pDocument->GetLayoutProcessor();
CXFA_ContainerLayoutItem* pRootLayout = GetRootLayoutItem();
for (CXFA_Node* pPageNode : pDocument->m_pPendingPageSet) {
CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode>
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index fed59158aa..b06c9ce549 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -1356,7 +1356,7 @@ void CXFA_Document::DataMerge_UpdateBindingRelations(
}
CXFA_Node* CXFA_Document::GetNotBindNode(
- const std::vector<CXFA_Object*>& arrayObjects) {
+ const std::vector<CXFA_Object*>& arrayObjects) const {
for (CXFA_Object* pObject : arrayObjects) {
CXFA_Node* pNode = pObject->AsNode();
if (pNode && !pNode->HasBindItem())