summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-01-05 15:46:40 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-05 21:06:28 +0000
commit5183e8679844eeff2c5dda2a2e02762487429a1f (patch)
tree4eb3182ea6e18f45583484d2748c6f20b94e423b /xfa/fxfa/parser
parent245f80c4ae2bde11de8fdff54e736ec4e4296e0a (diff)
downloadpdfium-5183e8679844eeff2c5dda2a2e02762487429a1f.tar.xz
Convert CXFA_Node::GetLocaleName out param to returnchromium/3315chromium/3314chromium/3313
Change-Id: Ia135db144c7037795fc1a1964b4f3eee57250caa Reviewed-on: https://pdfium-review.googlesource.com/22350 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp39
-rw-r--r--xfa/fxfa/parser/cxfa_node.h2
2 files changed, 19 insertions, 22 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 08af2004a1..141c9f1c6c 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -620,15 +620,15 @@ CXFA_WidgetAcc* CXFA_Node::GetContainerWidgetAcc() {
}
IFX_Locale* CXFA_Node::GetLocale() {
- WideString wsLocaleName;
- if (!GetLocaleName(wsLocaleName))
+ Optional<WideString> localeName = GetLocaleName();
+ if (!localeName)
return nullptr;
- if (wsLocaleName == L"ambient")
+ if (localeName.value() == L"ambient")
return GetDocument()->GetLocalMgr()->GetDefLocale();
- return GetDocument()->GetLocalMgr()->GetLocaleByName(wsLocaleName);
+ return GetDocument()->GetLocalMgr()->GetLocaleByName(localeName.value());
}
-bool CXFA_Node::GetLocaleName(WideString& wsLocaleName) {
+Optional<WideString> CXFA_Node::GetLocaleName() {
CXFA_Node* pForm = GetDocument()->GetXFAObject(XFA_HASHCODE_Form)->AsNode();
CXFA_Subform* pTopSubform =
pForm->GetFirstChildByClass<CXFA_Subform>(XFA_Element::Subform);
@@ -636,35 +636,32 @@ bool CXFA_Node::GetLocaleName(WideString& wsLocaleName) {
CXFA_Node* pLocaleNode = this;
do {
- Optional<WideString> ret =
+ Optional<WideString> localeName =
pLocaleNode->JSObject()->TryCData(XFA_Attribute::Locale, false);
- if (ret) {
- wsLocaleName = *ret;
- return true;
- }
+ if (localeName)
+ return localeName;
+
pLocaleNode = pLocaleNode->GetNodeItem(XFA_NODEITEM_Parent);
} while (pLocaleNode && pLocaleNode != pTopSubform);
CXFA_Node* pConfig = ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Config));
- wsLocaleName = GetDocument()->GetLocalMgr()->GetConfigLocaleName(pConfig);
- if (!wsLocaleName.IsEmpty())
- return true;
+ Optional<WideString> localeName = {
+ WideString(GetDocument()->GetLocalMgr()->GetConfigLocaleName(pConfig))};
+ if (localeName && !localeName->IsEmpty())
+ return localeName;
if (pTopSubform) {
- Optional<WideString> ret =
+ localeName =
pTopSubform->JSObject()->TryCData(XFA_Attribute::Locale, false);
- if (ret) {
- wsLocaleName = *ret;
- return true;
- }
+ if (localeName)
+ return localeName;
}
IFX_Locale* pLocale = GetDocument()->GetLocalMgr()->GetDefLocale();
if (!pLocale)
- return false;
+ return {};
- wsLocaleName = pLocale->GetName();
- return true;
+ return {pLocale->GetName()};
}
XFA_AttributeEnum CXFA_Node::GetIntact() {
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index dea53e4525..c8adbfe080 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -185,7 +185,7 @@ class CXFA_Node : public CXFA_Object {
CXFA_WidgetAcc* GetWidgetAcc();
CXFA_WidgetAcc* GetContainerWidgetAcc();
IFX_Locale* GetLocale();
- bool GetLocaleName(WideString& wsLocaleName);
+ Optional<WideString> GetLocaleName();
XFA_AttributeEnum GetIntact();
CXFA_Node* GetFirstChildByName(const WideStringView& wsNodeName) const;