Mark more CXFA_Node methods const.
Also remove Deprecated_GetPrevSibling(), which has no impl.
Change-Id: I5e00d77455caaa40b777981663eae3c9aa1844e3
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/52180
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index ac8b5ad..8ba7068 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -960,7 +960,7 @@
return data ? data->occurance_count : 0;
}
-Optional<XFA_Element> CXFA_Node::GetFirstPropertyWithFlag(uint8_t flag) {
+Optional<XFA_Element> CXFA_Node::GetFirstPropertyWithFlag(uint8_t flag) const {
for (const auto& prop : m_Properties) {
if (prop.flags & flag)
return prop.property;
@@ -1153,7 +1153,7 @@
return 0;
}
-bool CXFA_Node::HasBindItem() {
+bool CXFA_Node::HasBindItem() const {
return GetPacketType() == XFA_PacketType::Datasets && GetBindingNode();
}
@@ -1362,7 +1362,7 @@
CXFA_Node* CXFA_Node::GetChildInternal(size_t index,
XFA_Element eType,
- bool bOnlyChild) {
+ bool bOnlyChild) const {
size_t count = 0;
for (CXFA_Node* pNode = first_child_; pNode;
pNode = pNode->GetNextSibling()) {
@@ -1628,7 +1628,7 @@
XFA_AttributeValue::MetaData;
}
-void CXFA_Node::OnRemoved(bool bNotify) {
+void CXFA_Node::OnRemoved(bool bNotify) const {
if (!bNotify)
return;
@@ -1654,7 +1654,7 @@
return xml_node_.Get();
}
-bool CXFA_Node::IsNeedSavingXMLNode() {
+bool CXFA_Node::IsNeedSavingXMLNode() const {
return xml_node_ && (GetPacketType() == XFA_PacketType::Datasets ||
GetElementType() == XFA_Element::Xfa);
}
@@ -2062,7 +2062,7 @@
return JSObject()->GetContent(false);
}
-int32_t CXFA_Node::GetRotate() {
+int32_t CXFA_Node::GetRotate() const {
Optional<int32_t> degrees =
JSObject()->TryInteger(XFA_Attribute::Rotate, false);
return degrees ? XFA_MapRotation(*degrees) / 90 * 90 : 0;
@@ -2118,7 +2118,7 @@
return JSObject()->GetProperty<CXFA_Para>(0, XFA_Element::Para);
}
-bool CXFA_Node::IsOpenAccess() {
+bool CXFA_Node::IsOpenAccess() const {
for (auto* pNode = this; pNode; pNode = pNode->GetContainerParent()) {
XFA_AttributeValue iAcc = pNode->JSObject()->GetEnum(XFA_Attribute::Access);
if (iAcc != XFA_AttributeValue::Open)
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 941d5fc..d886d9f 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -147,7 +147,7 @@
void SetXMLMappingNode(CFX_XMLNode* node) { xml_node_ = node; }
CFX_XMLNode* GetXMLMappingNode() const { return xml_node_.Get(); }
CFX_XMLNode* CreateXMLMappingNode();
- bool IsNeedSavingXMLNode();
+ bool IsNeedSavingXMLNode() const;
void SetToXML(const WideString& value);
@@ -192,7 +192,7 @@
std::vector<CXFA_Node*>* GetBindItems() { return &binding_nodes_; }
int32_t AddBindItem(CXFA_Node* pFormNode);
int32_t RemoveBindItem(CXFA_Node* pFormNode);
- bool HasBindItem();
+ bool HasBindItem() const;
CXFA_Node* GetContainerNode();
LocaleIface* GetLocale();
Optional<WideString> GetLocaleName();
@@ -222,7 +222,7 @@
Optional<WideString> GetDefaultCData(XFA_Attribute attr) const;
Optional<XFA_AttributeValue> GetDefaultEnum(XFA_Attribute attr) const;
- bool IsOpenAccess();
+ bool IsOpenAccess() const;
CXFA_Occur* GetOccurIfExists();
CXFA_Border* GetBorderIfExists() const;
@@ -244,7 +244,7 @@
CXFA_Value* GetFormValueIfExists() const;
WideString GetRawValue();
- int32_t GetRotate();
+ int32_t GetRotate() const;
Optional<float> TryWidth();
CXFA_Node* GetExclGroupIfExists();
@@ -403,14 +403,15 @@
WideString GetValidateMessage(bool bError, bool bVersionFlag);
bool HasFlag(XFA_NodeFlag dwFlag) const;
- CXFA_Node* Deprecated_GetPrevSibling();
const PropertyData* GetPropertyData(XFA_Element property) const;
const AttributeData* GetAttributeData(XFA_Attribute attr) const;
- Optional<XFA_Element> GetFirstPropertyWithFlag(uint8_t flag);
- void OnRemoved(bool bNotify);
+ Optional<XFA_Element> GetFirstPropertyWithFlag(uint8_t flag) const;
+ void OnRemoved(bool bNotify) const;
Optional<void*> GetDefaultValue(XFA_Attribute attr,
XFA_AttributeType eType) const;
- CXFA_Node* GetChildInternal(size_t index, XFA_Element eType, bool bOnlyChild);
+ CXFA_Node* GetChildInternal(size_t index,
+ XFA_Element eType,
+ bool bOnlyChild) const;
CXFA_Node* GetFirstChildByClassInternal(XFA_Element eType) const;
CXFA_Node* GetNextSameNameSiblingInternal(WideStringView wsNodeName) const;
CXFA_Node* GetNextSameClassSiblingInternal(XFA_Element eType) const;