summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-01-04 14:43:27 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-04 20:19:41 +0000
commitc560a8c11a6f8ee239e570db8c022ae0fd2a4db5 (patch)
tree0c16389f7e5c5e29c57a9c7f77dd062fa07d8640
parentdf0a749452d933e4f434e2a33112667f1880db34 (diff)
downloadpdfium-c560a8c11a6f8ee239e570db8c022ae0fd2a4db5.tar.xz
Convert usages of pdfium::Optional to Optional
Change-Id: I29769f78eaad10c6a8b79e27524336c4f330377e Reviewed-on: https://pdfium-review.googlesource.com/22258 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--core/fpdftext/cpdf_textpagefind.cpp7
-rw-r--r--core/fpdftext/cpdf_textpagefind.h6
-rw-r--r--core/fxcrt/bytestring.cpp32
-rw-r--r--core/fxcrt/bytestring.h7
-rw-r--r--core/fxcrt/bytestring_unittest.cpp6
-rw-r--r--core/fxcrt/string_view_template.h5
-rw-r--r--core/fxcrt/widestring.cpp42
-rw-r--r--core/fxcrt/widestring.h5
-rw-r--r--core/fxcrt/widestring_unittest.cpp4
-rw-r--r--fpdfsdk/fpdfppo.cpp2
-rw-r--r--fpdfsdk/fpdftext.cpp7
-rw-r--r--fxjs/cfxjse_engine.cpp2
-rw-r--r--fxjs/cfxjse_formcalc_context.cpp2
-rw-r--r--fxjs/xfa/cjx_field.cpp6
-rw-r--r--fxjs/xfa/cjx_object.cpp56
-rw-r--r--fxjs/xfa/cjx_object.h26
-rw-r--r--third_party/base/optional.h3
-rw-r--r--xfa/fxfa/cxfa_ffbarcode.cpp25
-rw-r--r--xfa/fxfa/cxfa_ffdatetimeedit.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffnumericedit.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffpageview.cpp2
-rw-r--r--xfa/fxfa/cxfa_fftextedit.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp4
-rw-r--r--xfa/fxfa/cxfa_textprovider.cpp10
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp116
-rw-r--r--xfa/fxfa/cxfa_widgetacc.h41
-rw-r--r--xfa/fxfa/parser/cxfa_box.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_box.h4
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_fill.cpp10
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp22
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp14
-rw-r--r--xfa/fxfa/parser/cxfa_margin.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_margin.h8
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp51
-rw-r--r--xfa/fxfa/parser/cxfa_node.h19
-rw-r--r--xfa/fxfa/parser/cxfa_occur.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_script.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_validate.cpp2
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp12
-rw-r--r--xfa/fxfa/parser/xfa_utils.cpp15
41 files changed, 282 insertions, 323 deletions
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 97aa34fafe..4950a8fae2 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -81,7 +81,7 @@ int CPDF_TextPageFind::GetCharIndex(int index) const {
bool CPDF_TextPageFind::FindFirst(const WideString& findwhat,
int flags,
- pdfium::Optional<size_t> startPos) {
+ Optional<size_t> startPos) {
if (!m_pTextPage)
return false;
if (m_strText.IsEmpty() || m_bMatchCase != (flags & FPDFTEXT_MATCHCASE))
@@ -142,7 +142,7 @@ bool CPDF_TextPageFind::FindNext() {
return m_IsFind;
}
int nCount = pdfium::CollectionSize<int>(m_csFindWhatArray);
- pdfium::Optional<size_t> nResultPos = 0;
+ Optional<size_t> nResultPos = 0;
size_t nStartPos = m_findNextStart.value();
bool bSpaceStart = false;
for (int iWord = 0; iWord < nCount; iWord++) {
@@ -236,8 +236,7 @@ bool CPDF_TextPageFind::FindPrev() {
return m_IsFind;
}
CPDF_TextPageFind findEngine(m_pTextPage.Get());
- bool ret =
- findEngine.FindFirst(m_findWhat, m_flags, pdfium::Optional<size_t>(0));
+ bool ret = findEngine.FindFirst(m_findWhat, m_flags, Optional<size_t>(0));
if (!ret) {
m_IsFind = false;
return m_IsFind;
diff --git a/core/fpdftext/cpdf_textpagefind.h b/core/fpdftext/cpdf_textpagefind.h
index 574f05ed0d..dd7a31eba9 100644
--- a/core/fpdftext/cpdf_textpagefind.h
+++ b/core/fpdftext/cpdf_textpagefind.h
@@ -24,7 +24,7 @@ class CPDF_TextPageFind {
bool FindFirst(const WideString& findwhat,
int flags,
- pdfium::Optional<size_t> startPos);
+ Optional<size_t> startPos);
bool FindNext();
bool FindPrev();
int GetCurOrder() const;
@@ -48,8 +48,8 @@ class CPDF_TextPageFind {
WideString m_findWhat;
int m_flags;
std::vector<WideString> m_csFindWhatArray;
- pdfium::Optional<size_t> m_findNextStart;
- pdfium::Optional<size_t> m_findPreStart;
+ Optional<size_t> m_findNextStart;
+ Optional<size_t> m_findPreStart;
bool m_bMatchCase;
bool m_bMatchWholeWord;
int m_resStart;
diff --git a/core/fxcrt/bytestring.cpp b/core/fxcrt/bytestring.cpp
index 4c4bd57393..3e4861ae60 100644
--- a/core/fxcrt/bytestring.cpp
+++ b/core/fxcrt/bytestring.cpp
@@ -549,46 +549,44 @@ size_t ByteString::Insert(size_t location, char ch) {
return new_length;
}
-pdfium::Optional<size_t> ByteString::Find(char ch, size_t start) const {
+Optional<size_t> ByteString::Find(char ch, size_t start) const {
if (!m_pData)
- return pdfium::Optional<size_t>();
+ return Optional<size_t>();
if (!IsValidIndex(start))
- return pdfium::Optional<size_t>();
+ return Optional<size_t>();
const char* pStr = static_cast<const char*>(
memchr(m_pData->m_String + start, ch, m_pData->m_nDataLength - start));
- return pStr ? pdfium::Optional<size_t>(
- static_cast<size_t>(pStr - m_pData->m_String))
- : pdfium::Optional<size_t>();
+ return pStr ? Optional<size_t>(static_cast<size_t>(pStr - m_pData->m_String))
+ : Optional<size_t>();
}
-pdfium::Optional<size_t> ByteString::Find(const ByteStringView& subStr,
- size_t start) const {
+Optional<size_t> ByteString::Find(const ByteStringView& subStr,
+ size_t start) const {
if (!m_pData)
- return pdfium::Optional<size_t>();
+ return Optional<size_t>();
if (!IsValidIndex(start))
- return pdfium::Optional<size_t>();
+ return Optional<size_t>();
const char* pStr =
FX_strstr(m_pData->m_String + start, m_pData->m_nDataLength - start,
subStr.unterminated_c_str(), subStr.GetLength());
- return pStr ? pdfium::Optional<size_t>(
- static_cast<size_t>(pStr - m_pData->m_String))
- : pdfium::Optional<size_t>();
+ return pStr ? Optional<size_t>(static_cast<size_t>(pStr - m_pData->m_String))
+ : Optional<size_t>();
}
-pdfium::Optional<size_t> ByteString::ReverseFind(char ch) const {
+Optional<size_t> ByteString::ReverseFind(char ch) const {
if (!m_pData)
- return pdfium::Optional<size_t>();
+ return Optional<size_t>();
size_t nLength = m_pData->m_nDataLength;
while (nLength--) {
if (m_pData->m_String[nLength] == ch)
- return pdfium::Optional<size_t>(nLength);
+ return Optional<size_t>(nLength);
}
- return pdfium::Optional<size_t>();
+ return Optional<size_t>();
}
void ByteString::MakeLower() {
diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h
index 916820656d..70f10dcaba 100644
--- a/core/fxcrt/bytestring.h
+++ b/core/fxcrt/bytestring.h
@@ -152,10 +152,9 @@ class ByteString {
ByteString Left(size_t count) const;
ByteString Right(size_t count) const;
- pdfium::Optional<size_t> Find(const ByteStringView& lpszSub,
- size_t start = 0) const;
- pdfium::Optional<size_t> Find(char ch, size_t start = 0) const;
- pdfium::Optional<size_t> ReverseFind(char ch) const;
+ Optional<size_t> Find(const ByteStringView& lpszSub, size_t start = 0) const;
+ Optional<size_t> Find(char ch, size_t start = 0) const;
+ Optional<size_t> ReverseFind(char ch) const;
bool Contains(const ByteStringView& lpszSub, size_t start = 0) const {
return Find(lpszSub, start).has_value();
diff --git a/core/fxcrt/bytestring_unittest.cpp b/core/fxcrt/bytestring_unittest.cpp
index b45ee0fd5e..ce1512b4cf 100644
--- a/core/fxcrt/bytestring_unittest.cpp
+++ b/core/fxcrt/bytestring_unittest.cpp
@@ -615,7 +615,7 @@ TEST(ByteString, Find) {
EXPECT_FALSE(empty_string.Find('a').has_value());
EXPECT_FALSE(empty_string.Find('\0').has_value());
- pdfium::Optional<size_t> result;
+ Optional<size_t> result;
ByteString single_string("a");
result = single_string.Find('a');
ASSERT_TRUE(result.has_value());
@@ -664,7 +664,7 @@ TEST(ByteString, ReverseFind) {
EXPECT_FALSE(empty_string.ReverseFind('a').has_value());
EXPECT_FALSE(empty_string.ReverseFind('\0').has_value());
- pdfium::Optional<size_t> result;
+ Optional<size_t> result;
ByteString single_string("a");
result = single_string.ReverseFind('a');
ASSERT_TRUE(result.has_value());
@@ -1111,7 +1111,7 @@ TEST(ByteStringView, Find) {
EXPECT_FALSE(empty_string.Find('a').has_value());
EXPECT_FALSE(empty_string.Find('\0').has_value());
- pdfium::Optional<size_t> result;
+ Optional<size_t> result;
ByteStringView single_string("a");
result = single_string.Find('a');
ASSERT_TRUE(result.has_value());
diff --git a/core/fxcrt/string_view_template.h b/core/fxcrt/string_view_template.h
index fa33858a68..cd3614b34f 100644
--- a/core/fxcrt/string_view_template.h
+++ b/core/fxcrt/string_view_template.h
@@ -149,12 +149,11 @@ class StringViewTemplate {
return static_cast<CharType>(m_Ptr.Get()[index]);
}
- pdfium::Optional<size_t> Find(CharType ch) const {
+ Optional<size_t> Find(CharType ch) const {
const auto* found = reinterpret_cast<const UnsignedType*>(FXSYS_chr(
reinterpret_cast<const CharType*>(m_Ptr.Get()), ch, m_Length));
- return found ? pdfium::Optional<size_t>(found - m_Ptr.Get())
- : pdfium::Optional<size_t>();
+ return found ? Optional<size_t>(found - m_Ptr.Get()) : Optional<size_t>();
}
bool Contains(CharType ch) const { return Find(ch).has_value(); }
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index 3b72c8fa94..158c67409b 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -57,8 +57,8 @@ const wchar_t* FX_wcsstr(const wchar_t* haystack,
return nullptr;
}
-pdfium::Optional<size_t> GuessSizeForVSWPrintf(const wchar_t* pFormat,
- va_list argList) {
+Optional<size_t> GuessSizeForVSWPrintf(const wchar_t* pFormat,
+ va_list argList) {
size_t nMaxLen = 0;
for (const wchar_t* pStr = pFormat; *pStr != 0; pStr++) {
if (*pStr != '%' || *(pStr = pStr + 1) == '%') {
@@ -82,7 +82,7 @@ pdfium::Optional<size_t> GuessSizeForVSWPrintf(const wchar_t* pFormat,
++pStr;
}
if (nWidth < 0 || nWidth > 128 * 1024)
- return pdfium::Optional<size_t>();
+ return Optional<size_t>();
int nPrecision = 0;
if (*pStr == '.') {
pStr++;
@@ -96,7 +96,7 @@ pdfium::Optional<size_t> GuessSizeForVSWPrintf(const wchar_t* pFormat,
}
}
if (nPrecision < 0 || nPrecision > 128 * 1024)
- return pdfium::Optional<size_t>();
+ return Optional<size_t>();
int nModifier = 0;
if (*pStr == L'I' && *(pStr + 1) == L'6' && *(pStr + 2) == L'4') {
pStr += 3;
@@ -245,13 +245,13 @@ pdfium::Optional<size_t> GuessSizeForVSWPrintf(const wchar_t* pFormat,
nMaxLen += nItemLen;
}
nMaxLen += 32; // Fudge factor.
- return pdfium::Optional<size_t>(nMaxLen);
+ return Optional<size_t>(nMaxLen);
}
// Returns string unless we ran out of space.
-pdfium::Optional<WideString> TryVSWPrintf(size_t size,
- const wchar_t* pFormat,
- va_list argList) {
+Optional<WideString> TryVSWPrintf(size_t size,
+ const wchar_t* pFormat,
+ va_list argList) {
WideString str;
wchar_t* buffer = str.GetBuffer(size);
@@ -330,7 +330,7 @@ WideString WideString::FormatV(const wchar_t* format, va_list argList) {
while (maxLen < 32 * 1024) {
va_copy(argListCopy, argList);
- pdfium::Optional<WideString> ret =
+ Optional<WideString> ret =
TryVSWPrintf(static_cast<size_t>(maxLen), format, argListCopy);
va_end(argListCopy);
@@ -731,34 +731,32 @@ size_t WideString::Insert(size_t location, wchar_t ch) {
return new_length;
}
-pdfium::Optional<size_t> WideString::Find(wchar_t ch, size_t start) const {
+Optional<size_t> WideString::Find(wchar_t ch, size_t start) const {
if (!m_pData)
- return pdfium::Optional<size_t>();
+ return Optional<size_t>();
if (!IsValidIndex(start))
- return pdfium::Optional<size_t>();
+ return Optional<size_t>();
const wchar_t* pStr =
wmemchr(m_pData->m_String + start, ch, m_pData->m_nDataLength - start);
- return pStr ? pdfium::Optional<size_t>(
- static_cast<size_t>(pStr - m_pData->m_String))
- : pdfium::Optional<size_t>();
+ return pStr ? Optional<size_t>(static_cast<size_t>(pStr - m_pData->m_String))
+ : Optional<size_t>();
}
-pdfium::Optional<size_t> WideString::Find(const WideStringView& subStr,
- size_t start) const {
+Optional<size_t> WideString::Find(const WideStringView& subStr,
+ size_t start) const {
if (!m_pData)
- return pdfium::Optional<size_t>();
+ return Optional<size_t>();
if (!IsValidIndex(start))
- return pdfium::Optional<size_t>();
+ return Optional<size_t>();
const wchar_t* pStr =
FX_wcsstr(m_pData->m_String + start, m_pData->m_nDataLength - start,
subStr.unterminated_c_str(), subStr.GetLength());
- return pStr ? pdfium::Optional<size_t>(
- static_cast<size_t>(pStr - m_pData->m_String))
- : pdfium::Optional<size_t>();
+ return pStr ? Optional<size_t>(static_cast<size_t>(pStr - m_pData->m_String))
+ : Optional<size_t>();
}
void WideString::MakeLower() {
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h
index 728ab35090..30a423d9aa 100644
--- a/core/fxcrt/widestring.h
+++ b/core/fxcrt/widestring.h
@@ -169,9 +169,8 @@ class WideString {
int GetInteger() const;
float GetFloat() const;
- pdfium::Optional<size_t> Find(const WideStringView& pSub,
- size_t start = 0) const;
- pdfium::Optional<size_t> Find(wchar_t ch, size_t start = 0) const;
+ Optional<size_t> Find(const WideStringView& pSub, size_t start = 0) const;
+ Optional<size_t> Find(wchar_t ch, size_t start = 0) const;
bool Contains(const WideStringView& lpszSub, size_t start = 0) const {
return Find(lpszSub, start).has_value();
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index 1673c8f069..2fb9e8c8b4 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -575,7 +575,7 @@ TEST(WideString, Find) {
EXPECT_FALSE(empty_string.Find(L'a').has_value());
EXPECT_FALSE(empty_string.Find(L'\0').has_value());
- pdfium::Optional<size_t> result;
+ Optional<size_t> result;
WideString single_string(L"a");
result = single_string.Find(L'a');
ASSERT_TRUE(result.has_value());
@@ -1146,7 +1146,7 @@ TEST(WideStringView, Find) {
EXPECT_FALSE(empty_string.Find(L'a').has_value());
EXPECT_FALSE(empty_string.Find(L'\0').has_value());
- pdfium::Optional<size_t> result;
+ Optional<size_t> result;
WideStringView single_string(L"a");
result = single_string.Find(L'a');
ASSERT_TRUE(result.has_value());
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp
index 4df758a591..d88f9102b9 100644
--- a/fpdfsdk/fpdfppo.cpp
+++ b/fpdfsdk/fpdfppo.cpp
@@ -85,7 +85,7 @@ bool ParserPageRangeString(ByteString rangstring,
ByteString cbMidRange;
size_t nStringFrom = 0;
- pdfium::Optional<size_t> nStringTo = 0;
+ Optional<size_t> nStringTo = 0;
while (nStringTo < nLength) {
nStringTo = rangstring.Find(',', nStringFrom);
if (!nStringTo.has_value())
diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp
index d9f7d572e9..9392981df1 100644
--- a/fpdfsdk/fpdftext.cpp
+++ b/fpdfsdk/fpdftext.cpp
@@ -263,10 +263,9 @@ FPDFText_FindStart(FPDF_TEXTPAGE text_page,
CPDF_TextPageFind* textpageFind =
new CPDF_TextPageFind(CPDFTextPageFromFPDFTextPage(text_page));
size_t len = WideString::WStringLength(findwhat);
- textpageFind->FindFirst(WideString::FromUTF16LE(findwhat, len), flags,
- start_index >= 0
- ? pdfium::Optional<size_t>(start_index)
- : pdfium::Optional<size_t>());
+ textpageFind->FindFirst(
+ WideString::FromUTF16LE(findwhat, len), flags,
+ start_index >= 0 ? Optional<size_t>(start_index) : Optional<size_t>());
return textpageFind;
}
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index 3def7f250f..224cb25fd7 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -464,7 +464,7 @@ bool CFXJSE_Engine::RunVariablesScript(CXFA_Node* pScriptNode) {
if (!pTextNode)
return false;
- pdfium::Optional<WideString> wsScript =
+ Optional<WideString> wsScript =
pTextNode->JSObject()->TryCData(XFA_Attribute::Value, true);
if (!wsScript)
return false;
diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp
index 47d6ce6e4f..1c7d998807 100644
--- a/fxjs/cfxjse_formcalc_context.cpp
+++ b/fxjs/cfxjse_formcalc_context.cpp
@@ -5947,7 +5947,7 @@ bool CFXJSE_FormCalcContext::ResolveObjects(CFXJSE_Value* pThis,
if (bHasNoResolveName) {
WideString wsName;
if (CXFA_Node* pXFANode = pNode->AsNode()) {
- pdfium::Optional<WideString> ret =
+ Optional<WideString> ret =
pXFANode->JSObject()->TryAttribute(XFA_Attribute::Name, false);
if (ret)
wsName = *ret;
diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp
index cb0722eeee..b652aeedab 100644
--- a/fxjs/xfa/cjx_field.cpp
+++ b/fxjs/xfa/cjx_field.cpp
@@ -104,8 +104,7 @@ CJS_Return CJX_Field::getSaveItem(
if (!pWidgetAcc)
return CJS_Return(runtime->NewNull());
- pdfium::Optional<WideString> value =
- pWidgetAcc->GetChoiceListItem(iIndex, true);
+ Optional<WideString> value = pWidgetAcc->GetChoiceListItem(iIndex, true);
if (!value)
return CJS_Return(runtime->NewNull());
@@ -169,8 +168,7 @@ CJS_Return CJX_Field::getDisplayItem(
if (!pWidgetAcc)
return CJS_Return(runtime->NewNull());
- pdfium::Optional<WideString> value =
- pWidgetAcc->GetChoiceListItem(iIndex, false);
+ Optional<WideString> value = pWidgetAcc->GetChoiceListItem(iIndex, false);
if (!value)
return CJS_Return(runtime->NewNull());
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index e574454673..1512a32545 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -222,7 +222,7 @@ bool CJX_Object::SetAttribute(XFA_Attribute eAttr,
bool bNotify) {
switch (ToNode(GetXFAObject())->GetAttributeType(eAttr)) {
case XFA_AttributeType::Enum: {
- pdfium::Optional<XFA_AttributeEnum> item =
+ Optional<XFA_AttributeEnum> item =
CXFA_Node::NameToAttributeEnum(wsValue);
return SetEnum(
eAttr,
@@ -271,11 +271,11 @@ WideString CJX_Object::GetAttribute(XFA_Attribute attr) {
return TryAttribute(attr, true).value_or(WideString());
}
-pdfium::Optional<WideString> CJX_Object::TryAttribute(XFA_Attribute eAttr,
- bool bUseDefault) {
+Optional<WideString> CJX_Object::TryAttribute(XFA_Attribute eAttr,
+ bool bUseDefault) {
switch (ToNode(GetXFAObject())->GetAttributeType(eAttr)) {
case XFA_AttributeType::Enum: {
- pdfium::Optional<XFA_AttributeEnum> value = TryEnum(eAttr, bUseDefault);
+ Optional<XFA_AttributeEnum> value = TryEnum(eAttr, bUseDefault);
if (!value)
return {};
@@ -285,19 +285,19 @@ pdfium::Optional<WideString> CJX_Object::TryAttribute(XFA_Attribute eAttr,
return TryCData(eAttr, bUseDefault);
case XFA_AttributeType::Boolean: {
- pdfium::Optional<bool> value = TryBoolean(eAttr, bUseDefault);
+ Optional<bool> value = TryBoolean(eAttr, bUseDefault);
if (!value)
return {};
return {*value ? L"1" : L"0"};
}
case XFA_AttributeType::Integer: {
- pdfium::Optional<int32_t> iValue = TryInteger(eAttr, bUseDefault);
+ Optional<int32_t> iValue = TryInteger(eAttr, bUseDefault);
if (!iValue)
return {};
return {WideString::Format(L"%d", *iValue)};
}
case XFA_AttributeType::Measure: {
- pdfium::Optional<CXFA_Measurement> value = TryMeasure(eAttr, bUseDefault);
+ Optional<CXFA_Measurement> value = TryMeasure(eAttr, bUseDefault);
if (!value)
return {};
@@ -309,9 +309,8 @@ pdfium::Optional<WideString> CJX_Object::TryAttribute(XFA_Attribute eAttr,
return {};
}
-pdfium::Optional<WideString> CJX_Object::TryAttribute(
- const WideStringView& wsAttr,
- bool bUseDefault) {
+Optional<WideString> CJX_Object::TryAttribute(const WideStringView& wsAttr,
+ bool bUseDefault) {
XFA_Attribute attr = CXFA_Node::NameToAttribute(wsAttr);
if (attr != XFA_Attribute::Unknown)
return TryAttribute(attr, bUseDefault);
@@ -330,8 +329,7 @@ void CJX_Object::RemoveAttribute(const WideStringView& wsAttr) {
RemoveMapModuleKey(pKey);
}
-pdfium::Optional<bool> CJX_Object::TryBoolean(XFA_Attribute eAttr,
- bool bUseDefault) {
+Optional<bool> CJX_Object::TryBoolean(XFA_Attribute eAttr, bool bUseDefault) {
void* pValue = nullptr;
void* pKey = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
if (GetMapModuleValue(pKey, pValue))
@@ -368,8 +366,8 @@ int32_t CJX_Object::GetInteger(XFA_Attribute eAttr) {
return TryInteger(eAttr, true).value_or(0);
}
-pdfium::Optional<int32_t> CJX_Object::TryInteger(XFA_Attribute eAttr,
- bool bUseDefault) {
+Optional<int32_t> CJX_Object::TryInteger(XFA_Attribute eAttr,
+ bool bUseDefault) {
void* pKey = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
void* pValue = nullptr;
if (GetMapModuleValue(pKey, pValue))
@@ -380,8 +378,8 @@ pdfium::Optional<int32_t> CJX_Object::TryInteger(XFA_Attribute eAttr,
return ToNode(GetXFAObject())->GetDefaultInteger(eAttr);
}
-pdfium::Optional<XFA_AttributeEnum> CJX_Object::TryEnum(XFA_Attribute eAttr,
- bool bUseDefault) {
+Optional<XFA_AttributeEnum> CJX_Object::TryEnum(XFA_Attribute eAttr,
+ bool bUseDefault) {
void* pKey = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
void* pValue = nullptr;
if (GetMapModuleValue(pKey, pValue)) {
@@ -420,9 +418,8 @@ bool CJX_Object::SetMeasure(XFA_Attribute eAttr,
return true;
}
-pdfium::Optional<CXFA_Measurement> CJX_Object::TryMeasure(
- XFA_Attribute eAttr,
- bool bUseDefault) const {
+Optional<CXFA_Measurement> CJX_Object::TryMeasure(XFA_Attribute eAttr,
+ bool bUseDefault) const {
void* pKey = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
void* pValue;
int32_t iBytes;
@@ -436,9 +433,8 @@ pdfium::Optional<CXFA_Measurement> CJX_Object::TryMeasure(
return ToNode(GetXFAObject())->GetDefaultMeasurement(eAttr);
}
-pdfium::Optional<float> CJX_Object::TryMeasureAsFloat(
- XFA_Attribute attr) const {
- pdfium::Optional<CXFA_Measurement> measure = TryMeasure(attr, false);
+Optional<float> CJX_Object::TryMeasureAsFloat(XFA_Attribute attr) const {
+ Optional<CXFA_Measurement> measure = TryMeasure(attr, false);
if (measure)
return {measure->ToUnit(XFA_Unit::Pt)};
return {};
@@ -579,8 +575,8 @@ void CJX_Object::SetAttributeValue(const WideString& wsValue,
}
}
-pdfium::Optional<WideString> CJX_Object::TryCData(XFA_Attribute eAttr,
- bool bUseDefault) {
+Optional<WideString> CJX_Object::TryCData(XFA_Attribute eAttr,
+ bool bUseDefault) {
void* pKey = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
if (eAttr == XFA_Attribute::Value) {
void* pData;
@@ -744,7 +740,7 @@ bool CJX_Object::SetContent(const WideString& wsContent,
case XFA_ObjectType::ContentNode: {
WideString wsContentType;
if (ToNode(GetXFAObject())->GetElementType() == XFA_Element::ExData) {
- pdfium::Optional<WideString> ret =
+ Optional<WideString> ret =
TryAttribute(XFA_Attribute::ContentType, false);
if (ret)
wsContentType = *ret;
@@ -817,8 +813,7 @@ WideString CJX_Object::GetContent(bool bScriptModify) {
return TryContent(bScriptModify, true).value_or(WideString());
}
-pdfium::Optional<WideString> CJX_Object::TryContent(bool bScriptModify,
- bool bProto) {
+Optional<WideString> CJX_Object::TryContent(bool bScriptModify, bool bProto) {
CXFA_Node* pNode = nullptr;
switch (ToNode(GetXFAObject())->GetObjectType()) {
case XFA_ObjectType::ContainerNode:
@@ -847,7 +842,7 @@ pdfium::Optional<WideString> CJX_Object::TryContent(bool bScriptModify,
if (!pContentRawDataNode) {
XFA_Element element = XFA_Element::Sharptext;
if (ToNode(GetXFAObject())->GetElementType() == XFA_Element::ExData) {
- pdfium::Optional<WideString> contentType =
+ Optional<WideString> contentType =
TryAttribute(XFA_Attribute::ContentType, false);
if (contentType) {
if (*contentType == L"text/html")
@@ -883,7 +878,7 @@ pdfium::Optional<WideString> CJX_Object::TryContent(bool bScriptModify,
return {};
}
-pdfium::Optional<WideString> CJX_Object::TryNamespace() {
+Optional<WideString> CJX_Object::TryNamespace() {
if (ToNode(GetXFAObject())->IsModelNode() ||
ToNode(GetXFAObject())->GetElementType() == XFA_Element::Packet) {
CFX_XMLNode* pXMLNode = ToNode(GetXFAObject())->GetXMLMappingNode();
@@ -1706,8 +1701,7 @@ void CJX_Object::Script_Form_Checksum(CFXJSE_Value* pValue,
return;
}
- pdfium::Optional<WideString> checksum =
- TryAttribute(XFA_Attribute::Checksum, false);
+ Optional<WideString> checksum = TryAttribute(XFA_Attribute::Checksum, false);
pValue->SetString(checksum ? checksum->UTF8Encode().AsStringView() : "");
}
diff --git a/fxjs/xfa/cjx_object.h b/fxjs/xfa/cjx_object.h
index d7979a381f..2718f1738c 100644
--- a/fxjs/xfa/cjx_object.h
+++ b/fxjs/xfa/cjx_object.h
@@ -89,12 +89,11 @@ class CJX_Object {
void RemoveAttribute(const WideStringView& wsAttr);
WideString GetAttribute(const WideStringView& attr);
WideString GetAttribute(XFA_Attribute attr);
- pdfium::Optional<WideString> TryAttribute(const WideStringView& wsAttr,
- bool bUseDefault);
- pdfium::Optional<WideString> TryAttribute(XFA_Attribute eAttr,
- bool bUseDefault);
+ Optional<WideString> TryAttribute(const WideStringView& wsAttr,
+ bool bUseDefault);
+ Optional<WideString> TryAttribute(XFA_Attribute eAttr, bool bUseDefault);
- pdfium::Optional<WideString> TryContent(bool bScriptModify, bool bProto);
+ Optional<WideString> TryContent(bool bScriptModify, bool bProto);
bool SetContent(const WideString& wsContent,
const WideString& wsXMLValue,
bool bNotify,
@@ -174,31 +173,30 @@ class CJX_Object {
bool bSetting,
XFA_Attribute eAttribute);
- pdfium::Optional<WideString> TryNamespace();
+ Optional<WideString> TryNamespace();
- pdfium::Optional<int32_t> TryInteger(XFA_Attribute eAttr, bool bUseDefault);
+ Optional<int32_t> TryInteger(XFA_Attribute eAttr, bool bUseDefault);
bool SetInteger(XFA_Attribute eAttr, int32_t iValue, bool bNotify);
int32_t GetInteger(XFA_Attribute eAttr);
- pdfium::Optional<WideString> TryCData(XFA_Attribute eAttr, bool bUseDefault);
+ Optional<WideString> TryCData(XFA_Attribute eAttr, bool bUseDefault);
bool SetCData(XFA_Attribute eAttr,
const WideString& wsValue,
bool bNotify,
bool bScriptModify);
WideString GetCData(XFA_Attribute eAttr);
- pdfium::Optional<XFA_AttributeEnum> TryEnum(XFA_Attribute eAttr,
- bool bUseDefault);
+ Optional<XFA_AttributeEnum> TryEnum(XFA_Attribute eAttr, bool bUseDefault);
bool SetEnum(XFA_Attribute eAttr, XFA_AttributeEnum eValue, bool bNotify);
XFA_AttributeEnum GetEnum(XFA_Attribute eAttr);
- pdfium::Optional<bool> TryBoolean(XFA_Attribute eAttr, bool bUseDefault);
+ Optional<bool> TryBoolean(XFA_Attribute eAttr, bool bUseDefault);
bool SetBoolean(XFA_Attribute eAttr, bool bValue, bool bNotify);
bool GetBoolean(XFA_Attribute eAttr);
- pdfium::Optional<CXFA_Measurement> TryMeasure(XFA_Attribute eAttr,
- bool bUseDefault) const;
- pdfium::Optional<float> TryMeasureAsFloat(XFA_Attribute attr) const;
+ Optional<CXFA_Measurement> TryMeasure(XFA_Attribute eAttr,
+ bool bUseDefault) const;
+ Optional<float> TryMeasureAsFloat(XFA_Attribute attr) const;
bool SetMeasure(XFA_Attribute eAttr, CXFA_Measurement mValue, bool bNotify);
CXFA_Measurement GetMeasure(XFA_Attribute eAttr) const;
diff --git a/third_party/base/optional.h b/third_party/base/optional.h
index ae25724e73..f92101c19b 100644
--- a/third_party/base/optional.h
+++ b/third_party/base/optional.h
@@ -503,4 +503,7 @@ struct hash<pdfium::Optional<T>> {
} // namespace std
+template <class T>
+using Optional = pdfium::Optional<T>;
+
#endif // PDFIUM_THIRD_PARTY_BASE_OPTIONAL_H_
diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp
index a7a66afa49..6aac5dd7f2 100644
--- a/xfa/fxfa/cxfa_ffbarcode.cpp
+++ b/xfa/fxfa/cxfa_ffbarcode.cpp
@@ -167,53 +167,52 @@ void CXFA_FFBarcode::UpdateWidgetProperty() {
pBarCodeWidget->SetType(pBarcodeInfo->eBCType);
CXFA_WidgetAcc* pAcc = GetDataAcc();
- pdfium::Optional<BC_CHAR_ENCODING> encoding =
+ Optional<BC_CHAR_ENCODING> encoding =
pAcc->GetBarcodeAttribute_CharEncoding();
if (encoding)
pBarCodeWidget->SetCharEncoding(*encoding);
- pdfium::Optional<bool> calcChecksum = pAcc->GetBarcodeAttribute_Checksum();
+ Optional<bool> calcChecksum = pAcc->GetBarcodeAttribute_Checksum();
if (calcChecksum)
pBarCodeWidget->SetCalChecksum(*calcChecksum);
- pdfium::Optional<int32_t> dataLen = pAcc->GetBarcodeAttribute_DataLength();
+ Optional<int32_t> dataLen = pAcc->GetBarcodeAttribute_DataLength();
if (dataLen)
pBarCodeWidget->SetDataLength(*dataLen);
- pdfium::Optional<char> startChar = pAcc->GetBarcodeAttribute_StartChar();
+ Optional<char> startChar = pAcc->GetBarcodeAttribute_StartChar();
if (startChar)
pBarCodeWidget->SetStartChar(*startChar);
- pdfium::Optional<char> endChar = pAcc->GetBarcodeAttribute_EndChar();
+ Optional<char> endChar = pAcc->GetBarcodeAttribute_EndChar();
if (endChar)
pBarCodeWidget->SetEndChar(*endChar);
- pdfium::Optional<int32_t> ecLevel = pAcc->GetBarcodeAttribute_ECLevel();
+ Optional<int32_t> ecLevel = pAcc->GetBarcodeAttribute_ECLevel();
if (ecLevel)
pBarCodeWidget->SetErrorCorrectionLevel(*ecLevel);
- pdfium::Optional<int32_t> width = pAcc->GetBarcodeAttribute_ModuleWidth();
+ Optional<int32_t> width = pAcc->GetBarcodeAttribute_ModuleWidth();
if (width)
pBarCodeWidget->SetModuleWidth(*width);
- pdfium::Optional<int32_t> height = pAcc->GetBarcodeAttribute_ModuleHeight();
+ Optional<int32_t> height = pAcc->GetBarcodeAttribute_ModuleHeight();
if (height)
pBarCodeWidget->SetModuleHeight(*height);
- pdfium::Optional<bool> printCheck = pAcc->GetBarcodeAttribute_PrintChecksum();
+ Optional<bool> printCheck = pAcc->GetBarcodeAttribute_PrintChecksum();
if (printCheck)
pBarCodeWidget->SetPrintChecksum(*printCheck);
- pdfium::Optional<BC_TEXT_LOC> textLoc =
- pAcc->GetBarcodeAttribute_TextLocation();
+ Optional<BC_TEXT_LOC> textLoc = pAcc->GetBarcodeAttribute_TextLocation();
if (textLoc)
pBarCodeWidget->SetTextLocation(*textLoc);
- pdfium::Optional<bool> truncate = pAcc->GetBarcodeAttribute_Truncate();
+ Optional<bool> truncate = pAcc->GetBarcodeAttribute_Truncate();
if (truncate)
pBarCodeWidget->SetTruncated(*truncate);
- pdfium::Optional<int8_t> ratio = pAcc->GetBarcodeAttribute_WideNarrowRatio();
+ Optional<int8_t> ratio = pAcc->GetBarcodeAttribute_WideNarrowRatio();
if (ratio)
pBarCodeWidget->SetWideNarrowRatio(*ratio);
diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
index d6b892360c..728ad0e11f 100644
--- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp
+++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
@@ -84,7 +84,7 @@ void CXFA_FFDateTimeEdit::UpdateWidgetProperty() {
m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
uint32_t dwEditStyles = 0;
- pdfium::Optional<int32_t> numCells = m_pDataAcc->GetNumberOfCells();
+ Optional<int32_t> numCells = m_pDataAcc->GetNumberOfCells();
if (numCells && *numCells > 0) {
dwEditStyles |= FWL_STYLEEXT_EDT_CombText;
pWidget->SetEditLimit(*numCells);
diff --git a/xfa/fxfa/cxfa_ffnumericedit.cpp b/xfa/fxfa/cxfa_ffnumericedit.cpp
index 197905c56b..6229fdcd2c 100644
--- a/xfa/fxfa/cxfa_ffnumericedit.cpp
+++ b/xfa/fxfa/cxfa_ffnumericedit.cpp
@@ -53,7 +53,7 @@ void CXFA_FFNumericEdit::UpdateWidgetProperty() {
if (!m_pDataAcc->IsHorizontalScrollPolicyOff())
dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
- pdfium::Optional<int32_t> numCells = m_pDataAcc->GetNumberOfCells();
+ Optional<int32_t> numCells = m_pDataAcc->GetNumberOfCells();
if (numCells && *numCells > 0) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
pWidget->SetLimit(*numCells);
diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp
index 1305938db3..40eeea5d9e 100644
--- a/xfa/fxfa/cxfa_ffpageview.cpp
+++ b/xfa/fxfa/cxfa_ffpageview.cpp
@@ -316,7 +316,7 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget(
CXFA_Traverse* pTraverse =
pTraversal->GetChild<CXFA_Traverse>(0, XFA_Element::Traverse, false);
if (pTraverse) {
- pdfium::Optional<WideString> traverseWidgetName =
+ Optional<WideString> traverseWidgetName =
pTraverse->JSObject()->TryAttribute(XFA_Attribute::Ref, true);
if (traverseWidgetName)
return FindWidgetByName(*traverseWidgetName, pWidget);
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index d6fd5be4ca..f1ca3cc565 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -92,7 +92,7 @@ void CXFA_FFTextEdit::UpdateWidgetProperty() {
if (eType == XFA_Element::ExData)
iMaxChars = 0;
- pdfium::Optional<int32_t> numCells = m_pDataAcc->GetNumberOfCells();
+ Optional<int32_t> numCells = m_pDataAcc->GetNumberOfCells();
if (!numCells) {
pWidget->SetLimit(iMaxChars);
} else if (*numCells == 0) {
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index 2f4dcb4755..467cc7568b 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -62,8 +62,8 @@ void XFA_BOX_GetPath_Arc(CXFA_Box* box,
rtDraw.top = center.y - b;
rtDraw.width = a + a;
rtDraw.height = b + b;
- pdfium::Optional<int32_t> startAngle = box->GetStartAngle();
- pdfium::Optional<int32_t> sweepAngle = box->GetSweepAngle();
+ Optional<int32_t> startAngle = box->GetStartAngle();
+ Optional<int32_t> sweepAngle = box->GetSweepAngle();
if (!startAngle && !sweepAngle) {
fillPath.AddEllipse(rtDraw);
return;
diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp
index b0c1433135..a091baa24f 100644
--- a/xfa/fxfa/cxfa_textprovider.cpp
+++ b/xfa/fxfa/cxfa_textprovider.cpp
@@ -50,9 +50,8 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild);
if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) {
- pdfium::Optional<WideString> contentType =
- pChildNode->JSObject()->TryAttribute(XFA_Attribute::ContentType,
- false);
+ Optional<WideString> contentType = pChildNode->JSObject()->TryAttribute(
+ XFA_Attribute::ContentType, false);
if (contentType && *contentType == L"text/html")
bRichText = true;
}
@@ -90,9 +89,8 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild);
if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) {
- pdfium::Optional<WideString> contentType =
- pChildNode->JSObject()->TryAttribute(XFA_Attribute::ContentType,
- false);
+ Optional<WideString> contentType = pChildNode->JSObject()->TryAttribute(
+ XFA_Attribute::ContentType, false);
if (contentType && *contentType == L"text/html")
bRichText = true;
}
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index 8313e6074d..96701512f9 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -975,28 +975,28 @@ bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) {
if (para)
size.width += para->GetMarginLeft() + para->GetTextIndent();
- pdfium::Optional<float> width = TryWidth();
+ Optional<float> width = TryWidth();
if (width) {
size.width = *width;
} else {
- pdfium::Optional<float> min = TryMinWidth();
+ Optional<float> min = TryMinWidth();
if (min)
size.width = std::max(size.width, *min);
- pdfium::Optional<float> max = TryMaxWidth();
+ Optional<float> max = TryMaxWidth();
if (max && *max > 0)
size.width = std::min(size.width, *max);
}
- pdfium::Optional<float> height = TryHeight();
+ Optional<float> height = TryHeight();
if (height) {
size.height = *height;
} else {
- pdfium::Optional<float> min = TryMinHeight();
+ Optional<float> min = TryMinHeight();
if (min)
size.height = std::max(size.height, *min);
- pdfium::Optional<float> max = TryMaxHeight();
+ Optional<float> max = TryMaxHeight();
if (max && *max > 0)
size.height = std::min(size.height, *max);
}
@@ -1104,7 +1104,7 @@ CFX_SizeF CXFA_WidgetAcc::CalculateImageSize(float img_width,
XFA_UnitPx2Pt(img_height, dpi_y));
CFX_RectF rtFit;
- pdfium::Optional<float> width = TryWidth();
+ Optional<float> width = TryWidth();
if (width) {
rtFit.width = *width;
GetWidthWithoutMargin(rtFit.width);
@@ -1112,7 +1112,7 @@ CFX_SizeF CXFA_WidgetAcc::CalculateImageSize(float img_width,
rtFit.width = rtImage.width;
}
- pdfium::Optional<float> height = TryHeight();
+ Optional<float> height = TryHeight();
if (height) {
rtFit.height = *height;
GetHeightWithoutMargin(rtFit.height);
@@ -1206,11 +1206,11 @@ float CXFA_WidgetAcc::CalculateWidgetAutoWidth(float fWidthCalc) {
if (margin)
fWidthCalc += margin->GetLeftInset() + margin->GetRightInset();
- pdfium::Optional<float> min = TryMinWidth();
+ Optional<float> min = TryMinWidth();
if (min)
fWidthCalc = std::max(fWidthCalc, *min);
- pdfium::Optional<float> max = TryMaxWidth();
+ Optional<float> max = TryMaxWidth();
if (max && *max > 0)
fWidthCalc = std::min(fWidthCalc, *max);
@@ -1229,11 +1229,11 @@ float CXFA_WidgetAcc::CalculateWidgetAutoHeight(float fHeightCalc) {
if (margin)
fHeightCalc += margin->GetTopInset() + margin->GetBottomInset();
- pdfium::Optional<float> min = TryMinHeight();
+ Optional<float> min = TryMinHeight();
if (min)
fHeightCalc = std::max(fHeightCalc, *min);
- pdfium::Optional<float> max = TryMaxHeight();
+ Optional<float> max = TryMaxHeight();
if (max && *max > 0)
fHeightCalc = std::min(fHeightCalc, *max);
@@ -1261,7 +1261,7 @@ void CXFA_WidgetAcc::StartWidgetLayout(float& fCalcWidth, float& fCalcHeight) {
m_pLayoutData->m_fWidgetHeight = -1;
float fWidth = 0;
if (fCalcWidth > 0 && fCalcHeight < 0) {
- pdfium::Optional<float> height = TryHeight();
+ Optional<float> height = TryHeight();
if (height)
fCalcHeight = *height;
else
@@ -1271,8 +1271,8 @@ void CXFA_WidgetAcc::StartWidgetLayout(float& fCalcWidth, float& fCalcHeight) {
return;
}
if (fCalcWidth < 0 && fCalcHeight < 0) {
- pdfium::Optional<float> height;
- pdfium::Optional<float> width = TryWidth();
+ Optional<float> height;
+ Optional<float> width = TryWidth();
if (width) {
fWidth = *width;
@@ -1605,7 +1605,7 @@ void CXFA_WidgetAcc::StartTextLayout(float& fCalcWidth, float& fCalcHeight) {
}
if (fCalcWidth < 0 && fCalcHeight < 0) {
- pdfium::Optional<float> width = TryWidth();
+ Optional<float> width = TryWidth();
if (width) {
pTextLayout->StartLayout(GetWidthWithoutMargin(*width));
fCalcWidth = *width;
@@ -1743,7 +1743,7 @@ bool CXFA_WidgetAcc::IsOpenAccess() const {
}
int32_t CXFA_WidgetAcc::GetRotate() const {
- pdfium::Optional<int32_t> degrees =
+ Optional<int32_t> degrees =
m_pNode->JSObject()->TryInteger(XFA_Attribute::Rotate, false);
return degrees ? XFA_MapRotation(*degrees) / 90 * 90 : 0;
}
@@ -1823,27 +1823,27 @@ CXFA_Bind* CXFA_WidgetAcc::GetBind() {
false);
}
-pdfium::Optional<float> CXFA_WidgetAcc::TryWidth() {
+Optional<float> CXFA_WidgetAcc::TryWidth() {
return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::W);
}
-pdfium::Optional<float> CXFA_WidgetAcc::TryHeight() {
+Optional<float> CXFA_WidgetAcc::TryHeight() {
return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::H);
}
-pdfium::Optional<float> CXFA_WidgetAcc::TryMinWidth() {
+Optional<float> CXFA_WidgetAcc::TryMinWidth() {
return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::MinW);
}
-pdfium::Optional<float> CXFA_WidgetAcc::TryMinHeight() {
+Optional<float> CXFA_WidgetAcc::TryMinHeight() {
return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::MinH);
}
-pdfium::Optional<float> CXFA_WidgetAcc::TryMaxWidth() {
+Optional<float> CXFA_WidgetAcc::TryMaxWidth() {
return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::MaxW);
}
-pdfium::Optional<float> CXFA_WidgetAcc::TryMaxHeight() {
+Optional<float> CXFA_WidgetAcc::TryMaxHeight() {
return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::MaxH);
}
@@ -1869,10 +1869,10 @@ CFX_RectF CXFA_WidgetAcc::GetUIMargin() {
if (border && border->GetPresence() != XFA_AttributeEnum::Visible)
return CFX_RectF();
- pdfium::Optional<float> left = mgUI->TryLeftInset();
- pdfium::Optional<float> top = mgUI->TryTopInset();
- pdfium::Optional<float> right = mgUI->TryRightInset();
- pdfium::Optional<float> bottom = mgUI->TryBottomInset();
+ Optional<float> left = mgUI->TryLeftInset();
+ Optional<float> top = mgUI->TryTopInset();
+ Optional<float> right = mgUI->TryRightInset();
+ Optional<float> bottom = mgUI->TryBottomInset();
if (border) {
bool bVisible = false;
float fThickness = 0;
@@ -1977,8 +1977,7 @@ XFA_CHECKSTATE CXFA_WidgetAcc::GetCheckState() {
CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
int32_t i = 0;
while (pText) {
- pdfium::Optional<WideString> wsContent =
- pText->JSObject()->TryContent(false, true);
+ Optional<WideString> wsContent = pText->JSObject()->TryContent(false, true);
if (wsContent && *wsContent == wsValue)
return static_cast<XFA_CHECKSTATE>(i);
@@ -2213,9 +2212,8 @@ int32_t CXFA_WidgetAcc::CountChoiceListItems(bool bSaveValue) {
return pItem->CountChildren(XFA_Element::Unknown, false);
}
-pdfium::Optional<WideString> CXFA_WidgetAcc::GetChoiceListItem(
- int32_t nIndex,
- bool bSaveValue) {
+Optional<WideString> CXFA_WidgetAcc::GetChoiceListItem(int32_t nIndex,
+ bool bSaveValue) {
std::vector<CXFA_Node*> pItemsArray;
int32_t iCount = 0;
for (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); pNode;
@@ -2634,7 +2632,7 @@ bool CXFA_WidgetAcc::IsVerticalScrollPolicyOff() {
return false;
}
-pdfium::Optional<int32_t> CXFA_WidgetAcc::GetNumberOfCells() {
+Optional<int32_t> CXFA_WidgetAcc::GetNumberOfCells() {
CXFA_Node* pUIChild = GetUIChild();
if (!pUIChild)
return {};
@@ -2651,9 +2649,8 @@ WideString CXFA_WidgetAcc::GetBarcodeType() {
: WideString();
}
-pdfium::Optional<BC_CHAR_ENCODING>
-CXFA_WidgetAcc::GetBarcodeAttribute_CharEncoding() {
- pdfium::Optional<WideString> wsCharEncoding =
+Optional<BC_CHAR_ENCODING> CXFA_WidgetAcc::GetBarcodeAttribute_CharEncoding() {
+ Optional<WideString> wsCharEncoding =
GetUIChild()->JSObject()->TryCData(XFA_Attribute::CharEncoding, true);
if (!wsCharEncoding)
return {};
@@ -2664,8 +2661,8 @@ CXFA_WidgetAcc::GetBarcodeAttribute_CharEncoding() {
return {};
}
-pdfium::Optional<bool> CXFA_WidgetAcc::GetBarcodeAttribute_Checksum() {
- pdfium::Optional<XFA_AttributeEnum> checksum =
+Optional<bool> CXFA_WidgetAcc::GetBarcodeAttribute_Checksum() {
+ Optional<XFA_AttributeEnum> checksum =
GetUIChild()->JSObject()->TryEnum(XFA_Attribute::Checksum, true);
if (!checksum)
return {};
@@ -2684,8 +2681,8 @@ pdfium::Optional<bool> CXFA_WidgetAcc::GetBarcodeAttribute_Checksum() {
return {};
}
-pdfium::Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_DataLength() {
- pdfium::Optional<WideString> wsDataLength =
+Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_DataLength() {
+ Optional<WideString> wsDataLength =
GetUIChild()->JSObject()->TryCData(XFA_Attribute::DataLength, true);
if (!wsDataLength)
return {};
@@ -2693,8 +2690,8 @@ pdfium::Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_DataLength() {
return {FXSYS_wtoi(wsDataLength->c_str())};
}
-pdfium::Optional<char> CXFA_WidgetAcc::GetBarcodeAttribute_StartChar() {
- pdfium::Optional<WideString> wsStartEndChar =
+Optional<char> CXFA_WidgetAcc::GetBarcodeAttribute_StartChar() {
+ Optional<WideString> wsStartEndChar =
GetUIChild()->JSObject()->TryCData(XFA_Attribute::StartChar, true);
if (!wsStartEndChar || wsStartEndChar->IsEmpty())
return {};
@@ -2702,8 +2699,8 @@ pdfium::Optional<char> CXFA_WidgetAcc::GetBarcodeAttribute_StartChar() {
return {static_cast<char>((*wsStartEndChar)[0])};
}
-pdfium::Optional<char> CXFA_WidgetAcc::GetBarcodeAttribute_EndChar() {
- pdfium::Optional<WideString> wsStartEndChar =
+Optional<char> CXFA_WidgetAcc::GetBarcodeAttribute_EndChar() {
+ Optional<WideString> wsStartEndChar =
GetUIChild()->JSObject()->TryCData(XFA_Attribute::EndChar, true);
if (!wsStartEndChar || wsStartEndChar->IsEmpty())
return {};
@@ -2711,16 +2708,16 @@ pdfium::Optional<char> CXFA_WidgetAcc::GetBarcodeAttribute_EndChar() {
return {static_cast<char>((*wsStartEndChar)[0])};
}
-pdfium::Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_ECLevel() {
- pdfium::Optional<WideString> wsECLevel = GetUIChild()->JSObject()->TryCData(
+Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_ECLevel() {
+ Optional<WideString> wsECLevel = GetUIChild()->JSObject()->TryCData(
XFA_Attribute::ErrorCorrectionLevel, true);
if (!wsECLevel)
return {};
return {FXSYS_wtoi(wsECLevel->c_str())};
}
-pdfium::Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_ModuleWidth() {
- pdfium::Optional<CXFA_Measurement> moduleWidthHeight =
+Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_ModuleWidth() {
+ Optional<CXFA_Measurement> moduleWidthHeight =
GetUIChild()->JSObject()->TryMeasure(XFA_Attribute::ModuleWidth, true);
if (!moduleWidthHeight)
return {};
@@ -2728,8 +2725,8 @@ pdfium::Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_ModuleWidth() {
return {static_cast<int32_t>(moduleWidthHeight->ToUnit(XFA_Unit::Pt))};
}
-pdfium::Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_ModuleHeight() {
- pdfium::Optional<CXFA_Measurement> moduleWidthHeight =
+Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_ModuleHeight() {
+ Optional<CXFA_Measurement> moduleWidthHeight =
GetUIChild()->JSObject()->TryMeasure(XFA_Attribute::ModuleHeight, true);
if (!moduleWidthHeight)
return {};
@@ -2737,14 +2734,13 @@ pdfium::Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_ModuleHeight() {
return {static_cast<int32_t>(moduleWidthHeight->ToUnit(XFA_Unit::Pt))};
}
-pdfium::Optional<bool> CXFA_WidgetAcc::GetBarcodeAttribute_PrintChecksum() {
+Optional<bool> CXFA_WidgetAcc::GetBarcodeAttribute_PrintChecksum() {
return GetUIChild()->JSObject()->TryBoolean(XFA_Attribute::PrintCheckDigit,
true);
}
-pdfium::Optional<BC_TEXT_LOC>
-CXFA_WidgetAcc::GetBarcodeAttribute_TextLocation() {
- pdfium::Optional<XFA_AttributeEnum> textLocation =
+Optional<BC_TEXT_LOC> CXFA_WidgetAcc::GetBarcodeAttribute_TextLocation() {
+ Optional<XFA_AttributeEnum> textLocation =
GetUIChild()->JSObject()->TryEnum(XFA_Attribute::TextLocation, true);
if (!textLocation)
return {};
@@ -2766,17 +2762,17 @@ CXFA_WidgetAcc::GetBarcodeAttribute_TextLocation() {
return {};
}
-pdfium::Optional<bool> CXFA_WidgetAcc::GetBarcodeAttribute_Truncate() {
+Optional<bool> CXFA_WidgetAcc::GetBarcodeAttribute_Truncate() {
return GetUIChild()->JSObject()->TryBoolean(XFA_Attribute::Truncate, true);
}
-pdfium::Optional<int8_t> CXFA_WidgetAcc::GetBarcodeAttribute_WideNarrowRatio() {
- pdfium::Optional<WideString> wsWideNarrowRatio =
+Optional<int8_t> CXFA_WidgetAcc::GetBarcodeAttribute_WideNarrowRatio() {
+ Optional<WideString> wsWideNarrowRatio =
GetUIChild()->JSObject()->TryCData(XFA_Attribute::WideNarrowRatio, true);
if (!wsWideNarrowRatio)
return {};
- pdfium::Optional<size_t> ptPos = wsWideNarrowRatio->Find(':');
+ Optional<size_t> ptPos = wsWideNarrowRatio->Find(':');
if (!ptPos)
return {static_cast<int8_t>(FXSYS_wtoi(wsWideNarrowRatio->c_str()))};
@@ -2916,7 +2912,7 @@ WideString CXFA_WidgetAcc::GetPictureContent(XFA_VALUEPICTURE ePicture) {
m_pNode->GetChild<CXFA_Format>(0, XFA_Element::Format, false)) {
if (CXFA_Picture* pPicture = pFormat->GetChild<CXFA_Picture>(
0, XFA_Element::Picture, false)) {
- pdfium::Optional<WideString> picture =
+ Optional<WideString> picture =
pPicture->JSObject()->TryContent(false, true);
if (picture)
return *picture;
@@ -2948,7 +2944,7 @@ WideString CXFA_WidgetAcc::GetPictureContent(XFA_VALUEPICTURE ePicture) {
if (pUI) {
if (CXFA_Picture* pPicture =
pUI->GetChild<CXFA_Picture>(0, XFA_Element::Picture, false)) {
- pdfium::Optional<WideString> picture =
+ Optional<WideString> picture =
pPicture->JSObject()->TryContent(false, true);
if (picture)
return *picture;
diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h
index e2810571bc..976540df4d 100644
--- a/xfa/fxfa/cxfa_widgetacc.h
+++ b/xfa/fxfa/cxfa_widgetacc.h
@@ -137,12 +137,12 @@ class CXFA_WidgetAcc {
std::vector<CXFA_Event*> GetEventByActivity(XFA_AttributeEnum iActivity,
bool bIsFormReady);
- pdfium::Optional<float> TryWidth();
- pdfium::Optional<float> TryHeight();
- pdfium::Optional<float> TryMinWidth();
- pdfium::Optional<float> TryMinHeight();
- pdfium::Optional<float> TryMaxWidth();
- pdfium::Optional<float> TryMaxHeight();
+ Optional<float> TryWidth();
+ Optional<float> TryHeight();
+ Optional<float> TryMinWidth();
+ Optional<float> TryMinHeight();
+ Optional<float> TryMaxWidth();
+ Optional<float> TryMaxHeight();
XFA_AttributeEnum GetButtonHighlight();
bool HasButtonRollover() const;
@@ -166,8 +166,7 @@ class CXFA_WidgetAcc {
CXFA_Node* GetExclGroupNextMember(CXFA_Node* pNode);
int32_t CountChoiceListItems(bool bSaveValue);
- pdfium::Optional<WideString> GetChoiceListItem(int32_t nIndex,
- bool bSaveValue);
+ Optional<WideString> GetChoiceListItem(int32_t nIndex, bool bSaveValue);
bool IsChoiceListMultiSelect();
bool IsChoiceListCommitOnSelect();
std::vector<WideString> GetChoiceListItems(bool bSaveValue);
@@ -197,7 +196,7 @@ class CXFA_WidgetAcc {
bool IsHorizontalScrollPolicyOff();
bool IsVerticalScrollPolicyOff();
- pdfium::Optional<int32_t> GetNumberOfCells();
+ Optional<int32_t> GetNumberOfCells();
bool SetValue(XFA_VALUEPICTURE eValueType, const WideString& wsValue);
WideString GetValue(XFA_VALUEPICTURE eValueType);
@@ -210,18 +209,18 @@ class CXFA_WidgetAcc {
WideString NormalizeNumStr(const WideString& wsValue);
WideString GetBarcodeType();
- pdfium::Optional<BC_CHAR_ENCODING> GetBarcodeAttribute_CharEncoding();
- pdfium::Optional<bool> GetBarcodeAttribute_Checksum();
- pdfium::Optional<int32_t> GetBarcodeAttribute_DataLength();
- pdfium::Optional<char> GetBarcodeAttribute_StartChar();
- pdfium::Optional<char> GetBarcodeAttribute_EndChar();
- pdfium::Optional<int32_t> GetBarcodeAttribute_ECLevel();
- pdfium::Optional<int32_t> GetBarcodeAttribute_ModuleWidth();
- pdfium::Optional<int32_t> GetBarcodeAttribute_ModuleHeight();
- pdfium::Optional<bool> GetBarcodeAttribute_PrintChecksum();
- pdfium::Optional<BC_TEXT_LOC> GetBarcodeAttribute_TextLocation();
- pdfium::Optional<bool> GetBarcodeAttribute_Truncate();
- pdfium::Optional<int8_t> GetBarcodeAttribute_WideNarrowRatio();
+ Optional<BC_CHAR_ENCODING> GetBarcodeAttribute_CharEncoding();
+ Optional<bool> GetBarcodeAttribute_Checksum();
+ Optional<int32_t> GetBarcodeAttribute_DataLength();
+ Optional<char> GetBarcodeAttribute_StartChar();
+ Optional<char> GetBarcodeAttribute_EndChar();
+ Optional<int32_t> GetBarcodeAttribute_ECLevel();
+ Optional<int32_t> GetBarcodeAttribute_ModuleWidth();
+ Optional<int32_t> GetBarcodeAttribute_ModuleHeight();
+ Optional<bool> GetBarcodeAttribute_PrintChecksum();
+ Optional<BC_TEXT_LOC> GetBarcodeAttribute_TextLocation();
+ Optional<bool> GetBarcodeAttribute_Truncate();
+ Optional<int8_t> GetBarcodeAttribute_WideNarrowRatio();
WideString GetPasswordChar();
std::pair<XFA_Element, int32_t> GetMaxChars();
diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp
index ccb4e713ff..3bc641bbcd 100644
--- a/xfa/fxfa/parser/cxfa_box.cpp
+++ b/xfa/fxfa/parser/cxfa_box.cpp
@@ -94,11 +94,11 @@ bool CXFA_Box::IsCircular() {
return JSObject()->GetBoolean(XFA_Attribute::Circular);
}
-pdfium::Optional<int32_t> CXFA_Box::GetStartAngle() {
+Optional<int32_t> CXFA_Box::GetStartAngle() {
return JSObject()->TryInteger(XFA_Attribute::StartAngle, false);
}
-pdfium::Optional<int32_t> CXFA_Box::GetSweepAngle() {
+Optional<int32_t> CXFA_Box::GetSweepAngle() {
return JSObject()->TryInteger(XFA_Attribute::SweepAngle, false);
}
diff --git a/xfa/fxfa/parser/cxfa_box.h b/xfa/fxfa/parser/cxfa_box.h
index 5c2c8d20af..f995f5bb09 100644
--- a/xfa/fxfa/parser/cxfa_box.h
+++ b/xfa/fxfa/parser/cxfa_box.h
@@ -36,8 +36,8 @@ class CXFA_Box : public CXFA_Node {
std::vector<CXFA_Stroke*> GetStrokes();
- pdfium::Optional<int32_t> GetStartAngle();
- pdfium::Optional<int32_t> GetSweepAngle();
+ Optional<int32_t> GetStartAngle();
+ Optional<int32_t> GetSweepAngle();
protected:
CXFA_Box(CXFA_Document* pDoc,
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index de057aa933..b7c9be517f 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -167,12 +167,12 @@ CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) {
if (pDatasetsChild->GetNameHash() != XFA_HASHCODE_Data)
continue;
- pdfium::Optional<WideString> namespaceURI =
+ Optional<WideString> namespaceURI =
pDatasetsChild->JSObject()->TryNamespace();
if (!namespaceURI)
continue;
- pdfium::Optional<WideString> datasetsURI =
+ Optional<WideString> datasetsURI =
pDatasetsNode->JSObject()->TryNamespace();
if (!datasetsURI)
continue;
diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp
index f5138d5e2e..5b6c69eb24 100644
--- a/xfa/fxfa/parser/cxfa_fill.cpp
+++ b/xfa/fxfa/parser/cxfa_fill.cpp
@@ -74,7 +74,7 @@ void CXFA_Fill::SetColor(FX_ARGB color) {
FX_ARGB CXFA_Fill::GetColor(bool bText) {
if (CXFA_Color* pNode = GetChild<CXFA_Color>(0, XFA_Element::Color, false)) {
- pdfium::Optional<WideString> wsColor =
+ Optional<WideString> wsColor =
pNode->JSObject()->TryCData(XFA_Attribute::Value, false);
if (wsColor)
return StringToFXARGB(wsColor->AsStringView());
@@ -103,7 +103,7 @@ XFA_AttributeEnum CXFA_Fill::GetPatternType() {
FX_ARGB CXFA_Fill::GetPatternColor() {
if (CXFA_Color* pColor =
GetPattern()->GetChild<CXFA_Color>(0, XFA_Element::Color, false)) {
- pdfium::Optional<WideString> wsColor =
+ Optional<WideString> wsColor =
pColor->JSObject()->TryCData(XFA_Attribute::Value, false);
if (wsColor)
return StringToFXARGB(wsColor->AsStringView());
@@ -121,7 +121,7 @@ int32_t CXFA_Fill::GetStippleRate() {
FX_ARGB CXFA_Fill::GetStippleColor() {
if (CXFA_Color* pColor =
GetStipple()->GetChild<CXFA_Color>(0, XFA_Element::Color, false)) {
- pdfium::Optional<WideString> wsColor =
+ Optional<WideString> wsColor =
pColor->JSObject()->TryCData(XFA_Attribute::Value, false);
if (wsColor)
return StringToFXARGB(wsColor->AsStringView());
@@ -139,7 +139,7 @@ XFA_AttributeEnum CXFA_Fill::GetLinearType() {
FX_ARGB CXFA_Fill::GetLinearColor() {
if (CXFA_Color* pColor =
GetLinear()->GetChild<CXFA_Color>(0, XFA_Element::Color, false)) {
- pdfium::Optional<WideString> wsColor =
+ Optional<WideString> wsColor =
pColor->JSObject()->TryCData(XFA_Attribute::Value, false);
if (wsColor)
return StringToFXARGB(wsColor->AsStringView());
@@ -157,7 +157,7 @@ bool CXFA_Fill::IsRadialToEdge() {
FX_ARGB CXFA_Fill::GetRadialColor() {
if (CXFA_Color* pColor =
GetRadial()->GetChild<CXFA_Color>(0, XFA_Element::Color, false)) {
- pdfium::Optional<WideString> wsColor =
+ Optional<WideString> wsColor =
pColor->JSObject()->TryCData(XFA_Attribute::Value, false);
if (wsColor)
return StringToFXARGB(wsColor->AsStringView());
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index 61863d13b4..bd21cdcf11 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -92,14 +92,14 @@ CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode,
CFX_SizeF containerSize;
if (eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) {
- pdfium::Optional<CXFA_Measurement> wValue =
+ Optional<CXFA_Measurement> wValue =
pFormNode->JSObject()->TryMeasure(XFA_Attribute::W, false);
if (wValue && wValue->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
containerSize.width = wValue->ToUnit(XFA_Unit::Pt);
*bContainerWidthAutoSize = false;
}
- pdfium::Optional<CXFA_Measurement> hValue =
+ Optional<CXFA_Measurement> hValue =
pFormNode->JSObject()->TryMeasure(XFA_Attribute::H, false);
if (hValue && hValue->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
containerSize.height = hValue->ToUnit(XFA_Unit::Pt);
@@ -108,14 +108,14 @@ CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode,
}
if (*bContainerWidthAutoSize && eType == XFA_Element::Subform) {
- pdfium::Optional<CXFA_Measurement> maxW =
+ Optional<CXFA_Measurement> maxW =
pFormNode->JSObject()->TryMeasure(XFA_Attribute::MaxW, false);
if (maxW && maxW->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
containerSize.width = maxW->ToUnit(XFA_Unit::Pt);
*bContainerWidthAutoSize = false;
}
- pdfium::Optional<CXFA_Measurement> maxH =
+ Optional<CXFA_Measurement> maxH =
pFormNode->JSObject()->TryMeasure(XFA_Attribute::MaxH, false);
if (maxH && maxH->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
containerSize.height = maxH->ToUnit(XFA_Unit::Pt);
@@ -138,12 +138,12 @@ CFX_SizeF CalculateContainerComponentSizeFromContentSize(
if (bContainerWidthAutoSize) {
componentSize.width = fContentCalculatedWidth;
if (pMarginNode) {
- pdfium::Optional<CXFA_Measurement> leftInset =
+ Optional<CXFA_Measurement> leftInset =
pMarginNode->JSObject()->TryMeasure(XFA_Attribute::LeftInset, false);
if (leftInset)
componentSize.width += leftInset->ToUnit(XFA_Unit::Pt);
- pdfium::Optional<CXFA_Measurement> rightInset =
+ Optional<CXFA_Measurement> rightInset =
pMarginNode->JSObject()->TryMeasure(XFA_Attribute::RightInset, false);
if (rightInset)
componentSize.width += rightInset->ToUnit(XFA_Unit::Pt);
@@ -153,12 +153,12 @@ CFX_SizeF CalculateContainerComponentSizeFromContentSize(
if (bContainerHeightAutoSize) {
componentSize.height = fContentCalculatedHeight;
if (pMarginNode) {
- pdfium::Optional<CXFA_Measurement> topInset =
+ Optional<CXFA_Measurement> topInset =
pMarginNode->JSObject()->TryMeasure(XFA_Attribute::TopInset, false);
if (topInset)
componentSize.height += topInset->ToUnit(XFA_Unit::Pt);
- pdfium::Optional<CXFA_Measurement> bottomInset =
+ Optional<CXFA_Measurement> bottomInset =
pMarginNode->JSObject()->TryMeasure(XFA_Attribute::BottomInset,
false);
if (bottomInset)
@@ -504,7 +504,7 @@ float InsertPendingItems(CXFA_ItemLayoutProcessor* pProcessor,
XFA_AttributeEnum GetLayout(CXFA_Node* pFormNode, bool* bRootForceTb) {
*bRootForceTb = false;
- pdfium::Optional<XFA_AttributeEnum> layoutMode =
+ Optional<XFA_AttributeEnum> layoutMode =
pFormNode->JSObject()->TryEnum(XFA_Attribute::Layout, false);
if (layoutMode)
return *layoutMode;
@@ -537,7 +537,7 @@ bool ExistContainerKeep(CXFA_Node* pCurNode, bool bPreFind) {
if (!bPreFind)
eKeepType = XFA_Attribute::Next;
- pdfium::Optional<XFA_AttributeEnum> previous =
+ Optional<XFA_AttributeEnum> previous =
pKeep->JSObject()->TryEnum(eKeepType, false);
if (previous) {
if (*previous == XFA_AttributeEnum::ContentArea ||
@@ -555,7 +555,7 @@ bool ExistContainerKeep(CXFA_Node* pCurNode, bool bPreFind) {
if (!bPreFind)
eKeepType = XFA_Attribute::Previous;
- pdfium::Optional<XFA_AttributeEnum> next =
+ Optional<XFA_AttributeEnum> next =
pKeep->JSObject()->TryEnum(eKeepType, false);
if (!next)
return false;
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index b511cf8d3d..61caae762f 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -153,7 +153,7 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot,
bool bTargetAllFind = true;
while (iSplitIndex != -1) {
WideString wsExpr;
- pdfium::Optional<size_t> iSplitNextIndex = 0;
+ Optional<size_t> iSplitNextIndex = 0;
if (!bTargetAllFind) {
iSplitNextIndex = wsTargetAll.Find(' ', iSplitIndex);
if (!iSplitNextIndex.has_value())
@@ -1151,7 +1151,7 @@ bool CXFA_LayoutPageMgr::FindPageAreaFromPageSet_Ordered(
CXFA_Node* pOccurNode =
pPageSet->GetFirstChildByClass<CXFA_Occur>(XFA_Element::Occur);
if (pOccurNode) {
- pdfium::Optional<int32_t> ret =
+ Optional<int32_t> ret =
pOccurNode->JSObject()->TryInteger(XFA_Attribute::Max, false);
if (ret)
iMax = *ret;
@@ -1324,7 +1324,7 @@ bool CXFA_LayoutPageMgr::MatchPageAreaOddOrEven(CXFA_Node* pPageArea) {
if (m_ePageSetMode != XFA_AttributeEnum::DuplexPaginated)
return true;
- pdfium::Optional<XFA_AttributeEnum> ret =
+ Optional<XFA_AttributeEnum> ret =
pPageArea->JSObject()->TryEnum(XFA_Attribute::OddOrEven, true);
if (!ret || *ret == XFA_AttributeEnum::Any)
return true;
@@ -1354,7 +1354,7 @@ CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea(
CXFA_Node* pOccurNode =
m_pCurPageArea->GetFirstChildByClass<CXFA_Occur>(XFA_Element::Occur);
if (pOccurNode) {
- pdfium::Optional<int32_t> ret =
+ Optional<int32_t> ret =
pOccurNode->JSObject()->TryInteger(XFA_Attribute::Max, false);
if (ret)
iMax = *ret;
@@ -1460,7 +1460,7 @@ int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea,
return 0;
int32_t iMin = 0;
- pdfium::Optional<int32_t> ret;
+ Optional<int32_t> ret;
CXFA_Node* pOccurNode =
pPageArea->GetFirstChildByClass<CXFA_Occur>(XFA_Element::Occur);
if (pOccurNode) {
@@ -1507,7 +1507,7 @@ void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet,
if (!pOccurNode)
return;
- pdfium::Optional<int32_t> iMin =
+ Optional<int32_t> iMin =
pOccurNode->JSObject()->TryInteger(XFA_Attribute::Min, false);
if (!iMin || iCurSetCount >= *iMin)
return;
@@ -1572,7 +1572,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) {
CXFA_Node* pOccurNode =
pPageNode->GetFirstChildByClass<CXFA_Occur>(XFA_Element::Occur);
int32_t iMax = 0;
- pdfium::Optional<int32_t> ret;
+ Optional<int32_t> ret;
if (pOccurNode) {
ret = pOccurNode->JSObject()->TryInteger(XFA_Attribute::Max, false);
if (ret)
diff --git a/xfa/fxfa/parser/cxfa_margin.cpp b/xfa/fxfa/parser/cxfa_margin.cpp
index 6dd4d39ee4..265d7e92c8 100644
--- a/xfa/fxfa/parser/cxfa_margin.cpp
+++ b/xfa/fxfa/parser/cxfa_margin.cpp
@@ -56,18 +56,18 @@ float CXFA_Margin::GetBottomInset() const {
return TryBottomInset().value_or(0);
}
-pdfium::Optional<float> CXFA_Margin::TryLeftInset() const {
+Optional<float> CXFA_Margin::TryLeftInset() const {
return JSObject()->TryMeasureAsFloat(XFA_Attribute::LeftInset);
}
-pdfium::Optional<float> CXFA_Margin::TryTopInset() const {
+Optional<float> CXFA_Margin::TryTopInset() const {
return JSObject()->TryMeasureAsFloat(XFA_Attribute::TopInset);
}
-pdfium::Optional<float> CXFA_Margin::TryRightInset() const {
+Optional<float> CXFA_Margin::TryRightInset() const {
return JSObject()->TryMeasureAsFloat(XFA_Attribute::RightInset);
}
-pdfium::Optional<float> CXFA_Margin::TryBottomInset() const {
+Optional<float> CXFA_Margin::TryBottomInset() const {
return JSObject()->TryMeasureAsFloat(XFA_Attribute::BottomInset);
}
diff --git a/xfa/fxfa/parser/cxfa_margin.h b/xfa/fxfa/parser/cxfa_margin.h
index 621704ab7a..e7f95b6c9c 100644
--- a/xfa/fxfa/parser/cxfa_margin.h
+++ b/xfa/fxfa/parser/cxfa_margin.h
@@ -19,10 +19,10 @@ class CXFA_Margin : public CXFA_Node {
float GetRightInset() const;
float GetBottomInset() const;
- pdfium::Optional<float> TryLeftInset() const;
- pdfium::Optional<float> TryTopInset() const;
- pdfium::Optional<float> TryRightInset() const;
- pdfium::Optional<float> TryBottomInset() const;
+ Optional<float> TryLeftInset() const;
+ Optional<float> TryTopInset() const;
+ Optional<float> TryRightInset() const;
+ Optional<float> TryBottomInset() const;
};
#endif // XFA_FXFA_PARSER_CXFA_MARGIN_H_
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index f6f2675c29..3d132fedbc 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -142,7 +142,7 @@ WideString CXFA_Node::AttributeEnumToName(XFA_AttributeEnum item) {
}
// static
-pdfium::Optional<XFA_AttributeEnum> CXFA_Node::NameToAttributeEnum(
+Optional<XFA_AttributeEnum> CXFA_Node::NameToAttributeEnum(
const WideStringView& name) {
if (name.IsEmpty())
return {};
@@ -309,8 +309,7 @@ uint8_t CXFA_Node::PropertyOccuranceCount(XFA_Element property) const {
return data ? data->occurance_count : 0;
}
-pdfium::Optional<XFA_Element> CXFA_Node::GetFirstPropertyWithFlag(
- uint8_t flag) {
+Optional<XFA_Element> CXFA_Node::GetFirstPropertyWithFlag(uint8_t flag) {
if (m_Properties == nullptr)
return {};
@@ -439,7 +438,7 @@ std::vector<CXFA_Node*> CXFA_Node::GetNodeList(uint32_t dwTypeFilter,
if (m_Properties == nullptr)
return nodes;
- pdfium::Optional<XFA_Element> property =
+ Optional<XFA_Element> property =
GetFirstPropertyWithFlag(XFA_PROPERTYFLAG_DefaultOneOf);
if (!property)
return nodes;
@@ -637,7 +636,7 @@ bool CXFA_Node::GetLocaleName(WideString& wsLocaleName) {
CXFA_Node* pLocaleNode = this;
do {
- pdfium::Optional<WideString> ret =
+ Optional<WideString> ret =
pLocaleNode->JSObject()->TryCData(XFA_Attribute::Locale, false);
if (ret) {
wsLocaleName = *ret;
@@ -652,7 +651,7 @@ bool CXFA_Node::GetLocaleName(WideString& wsLocaleName) {
return true;
if (pTopSubform) {
- pdfium::Optional<WideString> ret =
+ Optional<WideString> ret =
pTopSubform->JSObject()->TryCData(XFA_Attribute::Locale, false);
if (ret) {
wsLocaleName = *ret;
@@ -674,7 +673,7 @@ XFA_AttributeEnum CXFA_Node::GetIntact() {
->TryEnum(XFA_Attribute::Layout, true)
.value_or(XFA_AttributeEnum::Position);
if (pKeep) {
- pdfium::Optional<XFA_AttributeEnum> intact =
+ Optional<XFA_AttributeEnum> intact =
pKeep->JSObject()->TryEnum(XFA_Attribute::Intact, false);
if (intact) {
if (*intact == XFA_AttributeEnum::None &&
@@ -685,7 +684,7 @@ XFA_AttributeEnum CXFA_Node::GetIntact() {
if (pPreviewRow &&
pPreviewRow->JSObject()->GetEnum(XFA_Attribute::Layout) ==
XFA_AttributeEnum::Row) {
- pdfium::Optional<XFA_AttributeEnum> value =
+ Optional<XFA_AttributeEnum> value =
pKeep->JSObject()->TryEnum(XFA_Attribute::Previous, false);
if (value && (*value == XFA_AttributeEnum::ContentArea ||
*value == XFA_AttributeEnum::PageArea)) {
@@ -694,7 +693,7 @@ XFA_AttributeEnum CXFA_Node::GetIntact() {
CXFA_Keep* pNode =
pPreviewRow->GetFirstChildByClass<CXFA_Keep>(XFA_Element::Keep);
- pdfium::Optional<XFA_AttributeEnum> ret;
+ Optional<XFA_AttributeEnum> ret;
if (pNode)
ret = pNode->JSObject()->TryEnum(XFA_Attribute::Next, false);
if (ret && (*ret == XFA_AttributeEnum::ContentArea ||
@@ -734,7 +733,7 @@ XFA_AttributeEnum CXFA_Node::GetIntact() {
XFA_VERSION version = m_pDocument->GetCurVersionMode();
if (eParLayout == XFA_AttributeEnum::Tb && version < XFA_VERSION_208) {
- pdfium::Optional<CXFA_Measurement> measureH =
+ Optional<CXFA_Measurement> measureH =
JSObject()->TryMeasure(XFA_Attribute::H, false);
if (measureH)
return XFA_AttributeEnum::ContentArea;
@@ -1326,27 +1325,23 @@ CXFA_Node* CXFA_Node::CreateInstance(bool bDataMerge) {
return pInstance;
}
-pdfium::Optional<bool> CXFA_Node::GetDefaultBoolean(XFA_Attribute attr) const {
- pdfium::Optional<void*> value =
- GetDefaultValue(attr, XFA_AttributeType::Boolean);
+Optional<bool> CXFA_Node::GetDefaultBoolean(XFA_Attribute attr) const {
+ Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::Boolean);
if (!value)
return {};
return {!!*value};
}
-pdfium::Optional<int32_t> CXFA_Node::GetDefaultInteger(
- XFA_Attribute attr) const {
- pdfium::Optional<void*> value =
- GetDefaultValue(attr, XFA_AttributeType::Integer);
+Optional<int32_t> CXFA_Node::GetDefaultInteger(XFA_Attribute attr) const {
+ Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::Integer);
if (!value)
return {};
return {static_cast<int32_t>(reinterpret_cast<uintptr_t>(*value))};
}
-pdfium::Optional<CXFA_Measurement> CXFA_Node::GetDefaultMeasurement(
+Optional<CXFA_Measurement> CXFA_Node::GetDefaultMeasurement(
XFA_Attribute attr) const {
- pdfium::Optional<void*> value =
- GetDefaultValue(attr, XFA_AttributeType::Measure);
+ Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::Measure);
if (!value)
return {};
@@ -1354,28 +1349,24 @@ pdfium::Optional<CXFA_Measurement> CXFA_Node::GetDefaultMeasurement(
return {CXFA_Measurement(str.AsStringView())};
}
-pdfium::Optional<WideString> CXFA_Node::GetDefaultCData(
- XFA_Attribute attr) const {
- pdfium::Optional<void*> value =
- GetDefaultValue(attr, XFA_AttributeType::CData);
+Optional<WideString> CXFA_Node::GetDefaultCData(XFA_Attribute attr) const {
+ Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::CData);
if (!value)
return {};
return {WideString(static_cast<const wchar_t*>(*value))};
}
-pdfium::Optional<XFA_AttributeEnum> CXFA_Node::GetDefaultEnum(
+Optional<XFA_AttributeEnum> CXFA_Node::GetDefaultEnum(
XFA_Attribute attr) const {
- pdfium::Optional<void*> value =
- GetDefaultValue(attr, XFA_AttributeType::Enum);
+ Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::Enum);
if (!value)
return {};
return {static_cast<XFA_AttributeEnum>(reinterpret_cast<uintptr_t>(*value))};
}
-pdfium::Optional<void*> CXFA_Node::GetDefaultValue(
- XFA_Attribute attr,
- XFA_AttributeType eType) const {
+Optional<void*> CXFA_Node::GetDefaultValue(XFA_Attribute attr,
+ XFA_AttributeType eType) const {
const AttributeData* data = GetAttributeData(attr);
if (!data)
return {};
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index e6683b24dc..cc8d5e8f8d 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -65,7 +65,7 @@ class CXFA_Node : public CXFA_Object {
#endif // NDEBUG
static WideString AttributeEnumToName(XFA_AttributeEnum item);
- static pdfium::Optional<XFA_AttributeEnum> NameToAttributeEnum(
+ static Optional<XFA_AttributeEnum> NameToAttributeEnum(
const WideStringView& name);
static XFA_Attribute NameToAttribute(const WideStringView& name);
static WideString AttributeToName(XFA_Attribute attr);
@@ -210,12 +210,11 @@ class CXFA_Node : public CXFA_Object {
CXFA_Occur* GetOccur();
- pdfium::Optional<bool> GetDefaultBoolean(XFA_Attribute attr) const;
- pdfium::Optional<int32_t> GetDefaultInteger(XFA_Attribute attr) const;
- pdfium::Optional<CXFA_Measurement> GetDefaultMeasurement(
- XFA_Attribute attr) const;
- pdfium::Optional<WideString> GetDefaultCData(XFA_Attribute attr) const;
- pdfium::Optional<XFA_AttributeEnum> GetDefaultEnum(XFA_Attribute attr) const;
+ Optional<bool> GetDefaultBoolean(XFA_Attribute attr) const;
+ Optional<int32_t> GetDefaultInteger(XFA_Attribute attr) const;
+ Optional<CXFA_Measurement> GetDefaultMeasurement(XFA_Attribute attr) const;
+ Optional<WideString> GetDefaultCData(XFA_Attribute attr) const;
+ Optional<XFA_AttributeEnum> GetDefaultEnum(XFA_Attribute attr) const;
void SyncValue(const WideString& wsValue, bool bNotify);
@@ -243,10 +242,10 @@ class CXFA_Node : public CXFA_Object {
CXFA_Node* Deprecated_GetPrevSibling();
const PropertyData* GetPropertyData(XFA_Element property) const;
const AttributeData* GetAttributeData(XFA_Attribute attr) const;
- pdfium::Optional<XFA_Element> GetFirstPropertyWithFlag(uint8_t flag);
+ Optional<XFA_Element> GetFirstPropertyWithFlag(uint8_t flag);
void OnRemoved(bool bNotify);
- pdfium::Optional<void*> GetDefaultValue(XFA_Attribute attr,
- XFA_AttributeType eType) const;
+ Optional<void*> GetDefaultValue(XFA_Attribute attr,
+ XFA_AttributeType eType) const;
CXFA_Node* GetChildInternal(int32_t index,
XFA_Element eType,
bool bOnlyChild);
diff --git a/xfa/fxfa/parser/cxfa_occur.cpp b/xfa/fxfa/parser/cxfa_occur.cpp
index 441394c567..7be3f7066d 100644
--- a/xfa/fxfa/parser/cxfa_occur.cpp
+++ b/xfa/fxfa/parser/cxfa_occur.cpp
@@ -40,14 +40,12 @@ CXFA_Occur::CXFA_Occur(CXFA_Document* doc, XFA_PacketType packet)
CXFA_Occur::~CXFA_Occur() {}
int32_t CXFA_Occur::GetMax() {
- pdfium::Optional<int32_t> max =
- JSObject()->TryInteger(XFA_Attribute::Max, true);
+ Optional<int32_t> max = JSObject()->TryInteger(XFA_Attribute::Max, true);
return max ? *max : GetMin();
}
int32_t CXFA_Occur::GetMin() {
- pdfium::Optional<int32_t> min =
- JSObject()->TryInteger(XFA_Attribute::Min, true);
+ Optional<int32_t> min = JSObject()->TryInteger(XFA_Attribute::Min, true);
return min && *min >= 0 ? *min : 1;
}
@@ -55,7 +53,7 @@ std::tuple<int32_t, int32_t, int32_t> CXFA_Occur::GetOccurInfo() {
int32_t iMin = GetMin();
int32_t iMax = GetMax();
- pdfium::Optional<int32_t> init =
+ Optional<int32_t> init =
JSObject()->TryInteger(XFA_Attribute::Initial, false);
return {iMin, iMax, init && *init >= iMin ? *init : iMin};
}
diff --git a/xfa/fxfa/parser/cxfa_script.cpp b/xfa/fxfa/parser/cxfa_script.cpp
index 1b784b331b..1e4eb7e0aa 100644
--- a/xfa/fxfa/parser/cxfa_script.cpp
+++ b/xfa/fxfa/parser/cxfa_script.cpp
@@ -48,7 +48,7 @@ CXFA_Script::CXFA_Script(CXFA_Document* doc, XFA_PacketType packet)
CXFA_Script::~CXFA_Script() {}
CXFA_Script::Type CXFA_Script::GetContentType() {
- pdfium::Optional<WideString> cData =
+ Optional<WideString> cData =
JSObject()->TryCData(XFA_Attribute::ContentType, false);
if (!cData || *cData == L"application/x-formcalc")
return Type::Formcalc;
diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp
index 665c606632..35479ca1f5 100644
--- a/xfa/fxfa/parser/cxfa_validate.cpp
+++ b/xfa/fxfa/parser/cxfa_validate.cpp
@@ -59,7 +59,7 @@ XFA_AttributeEnum CXFA_Validate::GetFormatTest() {
}
void CXFA_Validate::SetNullTest(const WideString& wsValue) {
- pdfium::Optional<XFA_AttributeEnum> item =
+ Optional<XFA_AttributeEnum> item =
CXFA_Node::NameToAttributeEnum(wsValue.AsStringView());
JSObject()->SetEnum(XFA_Attribute::NullTest,
item ? *item : XFA_AttributeEnum::Disabled, false);
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 5a42f21159..192a7f2fe5 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -90,7 +90,7 @@ bool FormValueNode_SetChildContent(CXFA_Node* pValueNode,
if (!pContentRawDataNode) {
XFA_Element element = XFA_Element::Sharptext;
if (pChildNode->GetElementType() == XFA_Element::ExData) {
- pdfium::Optional<WideString> contentType =
+ Optional<WideString> contentType =
pChildNode->JSObject()->TryAttribute(XFA_Attribute::ContentType,
false);
if (contentType) {
@@ -1058,8 +1058,7 @@ CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument,
if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup)
continue;
- pdfium::Optional<WideString> ns =
- pDDGroupNode->JSObject()->TryNamespace();
+ Optional<WideString> ns = pDDGroupNode->JSObject()->TryNamespace();
if (!ns || *ns != L"http://ns.adobe.com/data-description/")
continue;
}
@@ -1238,8 +1237,7 @@ void UpdateDataRelation(CXFA_Node* pDataNode, CXFA_Node* pDataDescriptionNode) {
if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup)
continue;
- pdfium::Optional<WideString> ns =
- pDDGroupNode->JSObject()->TryNamespace();
+ Optional<WideString> ns = pDDGroupNode->JSObject()->TryNamespace();
if (!ns || *ns != L"http://ns.adobe.com/data-description/")
continue;
}
@@ -1416,14 +1414,14 @@ void CXFA_Document::DoDataMerge() {
continue;
if (!pDDRoot && pChildNode->GetNameHash() == XFA_HASHCODE_DataDescription) {
- pdfium::Optional<WideString> namespaceURI =
+ Optional<WideString> namespaceURI =
pChildNode->JSObject()->TryNamespace();
if (!namespaceURI)
continue;
if (*namespaceURI == L"http://ns.adobe.com/data-description/")
pDDRoot = pChildNode;
} else if (!pDataRoot && pChildNode->GetNameHash() == XFA_HASHCODE_Data) {
- pdfium::Optional<WideString> namespaceURI =
+ Optional<WideString> namespaceURI =
pChildNode->JSObject()->TryNamespace();
if (!namespaceURI)
continue;
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index f891d47f23..0105752937 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -128,7 +128,7 @@ bool AttributeSaveInDataModel(CXFA_Node* pNode, XFA_Attribute eAttribute) {
}
bool ContentNodeNeedtoExport(CXFA_Node* pContentNode) {
- pdfium::Optional<WideString> wsContent =
+ Optional<WideString> wsContent =
pContentNode->JSObject()->TryContent(false, false);
if (!wsContent)
return false;
@@ -159,8 +159,7 @@ void SaveAttribute(CXFA_Node* pNode,
if (!bProto && !pNode->JSObject()->HasAttribute(eName))
return;
- pdfium::Optional<WideString> value =
- pNode->JSObject()->TryAttribute(eName, false);
+ Optional<WideString> value = pNode->JSObject()->TryAttribute(eName, false);
if (!value)
return;
@@ -206,7 +205,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
if (!pRawValueNode)
break;
- pdfium::Optional<WideString> contentType =
+ Optional<WideString> contentType =
pNode->JSObject()->TryAttribute(XFA_Attribute::ContentType, false);
if (pRawValueNode->GetElementType() == XFA_Element::SharpxHTML &&
(contentType && *contentType == L"text/html")) {
@@ -229,9 +228,8 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
ByteStringView(pMemStream->GetBuffer(), pMemStream->GetSize()));
} else if (pRawValueNode->GetElementType() == XFA_Element::Sharpxml &&
(contentType && *contentType == L"text/xml")) {
- pdfium::Optional<WideString> rawValue =
- pRawValueNode->JSObject()->TryAttribute(XFA_Attribute::Value,
- false);
+ Optional<WideString> rawValue = pRawValueNode->JSObject()->TryAttribute(
+ XFA_Attribute::Value, false);
if (!rawValue || rawValue->IsEmpty())
break;
@@ -399,8 +397,7 @@ void RecognizeXFAVersionNumber(CXFA_Node* pTemplateRoot,
if (!pTemplateRoot)
return;
- pdfium::Optional<WideString> templateNS =
- pTemplateRoot->JSObject()->TryNamespace();
+ Optional<WideString> templateNS = pTemplateRoot->JSObject()->TryNamespace();
if (!templateNS)
return;