summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-22 14:38:30 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-22 14:38:30 +0000
commitd4f4ce4b9c35db40d2dc3720ba07a83cff1b547d (patch)
treea9da9c73d0c59a492ef5ed48b6e3c4e85821b5fa /core/fxcrt
parent3caad939aeadce0d4278c130ce19dfd0692a8b98 (diff)
downloadpdfium-d4f4ce4b9c35db40d2dc3720ba07a83cff1b547d.tar.xz
Simplify GetEmbeddedObj() methods.
Change-Id: I976a8841f1519310cbf934103336dc050a7c293d Reviewed-on: https://pdfium-review.googlesource.com/40773 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/xml/cfx_xmlelement.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/fxcrt/xml/cfx_xmlelement.h b/core/fxcrt/xml/cfx_xmlelement.h
index 0d3468aba4..394866042c 100644
--- a/core/fxcrt/xml/cfx_xmlelement.h
+++ b/core/fxcrt/xml/cfx_xmlelement.h
@@ -60,4 +60,10 @@ inline CFX_XMLElement* ToXMLElement(CFX_XMLNode* pNode) {
: nullptr;
}
+inline const CFX_XMLElement* ToXMLElement(const CFX_XMLNode* pNode) {
+ return pNode && pNode->GetType() == FX_XMLNODE_Element
+ ? static_cast<const CFX_XMLElement*>(pNode)
+ : nullptr;
+}
+
#endif // CORE_FXCRT_XML_CFX_XMLELEMENT_H_