Remove redundant HasAttribute() calls before RemoveAttribute()
-- kill stray blank line in header grouping attribute methods.
Change-Id: Idfec3286ba5d899d4d56f2f0b140ef6a345c089f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/94030
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/xml/cfx_xmlelement.h b/core/fxcrt/xml/cfx_xmlelement.h
index 9ed03e8..ed40ac3 100644
--- a/core/fxcrt/xml/cfx_xmlelement.h
+++ b/core/fxcrt/xml/cfx_xmlelement.h
@@ -32,7 +32,6 @@
bool HasAttribute(const WideString& name) const;
void SetAttribute(const WideString& name, const WideString& value);
WideString GetAttribute(const WideString& name) const;
-
void RemoveAttribute(const WideString& name);
CFX_XMLElement* GetFirstChildNamed(WideStringView name) const;
diff --git a/fxjs/xfa/cjx_packet.cpp b/fxjs/xfa/cjx_packet.cpp
index e0b2c35..cd8f2e1 100644
--- a/fxjs/xfa/cjx_packet.cpp
+++ b/fxjs/xfa/cjx_packet.cpp
@@ -71,11 +71,9 @@
return CJS_Result::Failure(JSMessage::kParamError);
CFX_XMLElement* pElement = ToXMLElement(GetXFANode()->GetXMLMappingNode());
- if (pElement) {
- WideString name = runtime->ToWideString(params[0]);
- if (pElement->HasAttribute(name))
- pElement->RemoveAttribute(name);
- }
+ if (pElement)
+ pElement->RemoveAttribute(runtime->ToWideString(params[0]));
+
return CJS_Result::Success(runtime->NewNull());
}
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index 7a7e873..c29318c 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -436,8 +436,7 @@
CFX_XMLElement* pElement = ToXMLElement(pDataNode->GetXMLMappingNode());
if (iChildNum > 0) {
- if (pElement->HasAttribute(L"xfa:dataNode"))
- pElement->RemoveAttribute(L"xfa:dataNode");
+ pElement->RemoveAttribute(L"xfa:dataNode");
return;
}
pElement->SetAttribute(L"xfa:dataNode", L"dataGroup");