summaryrefslogtreecommitdiff
path: root/core/fxcrt/xml/cxml_parser.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-09 15:03:33 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-09 22:24:52 +0000
commit8a6fdadccd2eedf332ae3a72f0149c1b40cb5bd9 (patch)
tree307288716efc81c5b3d5d0e05c380cdd10add95a /core/fxcrt/xml/cxml_parser.cpp
parent392cfd62f6fd6fc505b644b67938ea30131eb837 (diff)
downloadpdfium-8a6fdadccd2eedf332ae3a72f0149c1b40cb5bd9.tar.xz
Create common CXML_Object base class for CXML_Content and CXML_Element.
They should each know what they are rather than having an external ChildRecord struct to track the type. Change-Id: Ic647ba45569764073e944d30af1a96dccdc29eb3 Reviewed-on: https://pdfium-review.googlesource.com/5210 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/xml/cxml_parser.cpp')
-rw-r--r--core/fxcrt/xml/cxml_parser.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/core/fxcrt/xml/cxml_parser.cpp b/core/fxcrt/xml/cxml_parser.cpp
index 3c91d744ec..d43fbd6581 100644
--- a/core/fxcrt/xml/cxml_parser.cpp
+++ b/core/fxcrt/xml/cxml_parser.cpp
@@ -6,6 +6,7 @@
#include <algorithm>
#include <memory>
+#include <utility>
#include <vector>
#include "core/fxcrt/fx_extension.h"
@@ -493,8 +494,7 @@ std::unique_ptr<CXML_Element> CXML_Parser::ParseElementInternal(
if (!pSubElement)
break;
- pElement->m_Children.push_back(
- {CXML_Element::Element, pSubElement.release()});
+ pElement->m_Children.push_back(std::move(pSubElement));
SkipWhiteSpaces();
}
break;
@@ -537,7 +537,6 @@ void CXML_Parser::InsertContentSegment(bool bCDATA,
if (content.IsEmpty())
return;
- CXML_Content* pContent = new CXML_Content;
- pContent->Set(bCDATA, content);
- pElement->m_Children.push_back({CXML_Element::Content, pContent});
+ pElement->m_Children.push_back(
+ pdfium::MakeUnique<CXML_Content>(bCDATA, content));
}