diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-16 14:17:17 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-16 14:17:17 +0000 |
commit | 9d608ff14177cd665f6b2ead639415bda935fbe2 (patch) | |
tree | d538fbf435ed55cf07ff37c24bc835507c12466d /xfa/fxfa/cxfa_textprovider.cpp | |
parent | 9d47de6b27b167db46b6aba38352fc42a8b6adae (diff) | |
download | pdfium-9d608ff14177cd665f6b2ead639415bda935fbe2.tar.xz |
Cleanup CJX_Node::GetAttribute
This CL renames GetAttribute to TryAttribute and changes to return a
pdfium::Optional instead of a boolean with an out parameter.
GetAttribute is then added to call TryAttribute to mirror the other
methods in the file.
Change-Id: I875dac120776af7c53fe069e4dd36e5486838447
Reviewed-on: https://pdfium-review.googlesource.com/18514
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_textprovider.cpp')
-rw-r--r-- | xfa/fxfa/cxfa_textprovider.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp index e23fdec01a..544a5c26b9 100644 --- a/xfa/fxfa/cxfa_textprovider.cpp +++ b/xfa/fxfa/cxfa_textprovider.cpp @@ -45,10 +45,9 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild); if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) { - WideString wsContentType; - pChildNode->JSNode()->GetAttribute(XFA_Attribute::ContentType, - wsContentType, false); - if (wsContentType == L"text/html") + pdfium::Optional<WideString> contentType = + pChildNode->JSNode()->TryAttribute(XFA_Attribute::ContentType, false); + if (contentType && *contentType == L"text/html") bRichText = true; } return pChildNode; @@ -84,10 +83,9 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild); if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) { - WideString wsContentType; - pChildNode->JSNode()->GetAttribute(XFA_Attribute::ContentType, - wsContentType, false); - if (wsContentType == L"text/html") + pdfium::Optional<WideString> contentType = + pChildNode->JSNode()->TryAttribute(XFA_Attribute::ContentType, false); + if (contentType && *contentType == L"text/html") bRichText = true; } return pChildNode; |