diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-04-09 16:14:55 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-09 16:14:55 +0000 |
commit | 2b4ad9ff5bf1727d12ef2bcce7e3fa925bbe8978 (patch) | |
tree | ec7691e24cee40c81f4214a089efcc5fa146a744 /xfa/fxfa/parser | |
parent | a0706f0c904673ea9f679829ff87e730e5800765 (diff) | |
download | pdfium-2b4ad9ff5bf1727d12ef2bcce7e3fa925bbe8978.tar.xz |
Remove CXFA nodes instead of CFX_XML nodes
When we set data into the CJX nodes, we need to update the backing store
of the XFA nodes, which are the XML nodes. When we update the backing
store, there are cases where we need to remove the children (setting
CData on a node or setting the value of an Attribute which is backed by
a real node).
Currently we call DeleteChildren on the XML node. This causes issues
when we cleanup the tree as XFA nodes may point to these deleted XML
nodes.
Instead, this CL cleans up the XFA nodes which will in turn clean up the
XML nodes. This seems like the right thing to do as we no longer have
the backing nodes, so we should no longer have the XFA nodes on top of
them.
Bug: chromium:813155
Change-Id: I63d53fd56999ec9d3b3af2ab5952b374663f040c
Reviewed-on: https://pdfium-review.googlesource.com/29950
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 3823d2eae0..7122d95bff 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -4678,8 +4678,10 @@ void CXFA_Node::SetToXML(const WideString& value) { } } } - if (bDeleteChildren) - elem->DeleteChildren(); + if (bDeleteChildren) { + while (auto* child = GetLastChild()) + RemoveChild(child, false); + } elem->SetTextData(value); break; |