summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-22 14:38:30 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-22 14:38:30 +0000
commitd4f4ce4b9c35db40d2dc3720ba07a83cff1b547d (patch)
treea9da9c73d0c59a492ef5ed48b6e3c4e85821b5fa /xfa
parent3caad939aeadce0d4278c130ce19dfd0692a8b98 (diff)
downloadpdfium-d4f4ce4b9c35db40d2dc3720ba07a83cff1b547d.tar.xz
Simplify GetEmbeddedObj() methods.
Change-Id: I976a8841f1519310cbf934103336dc050a7c293d Reviewed-on: https://pdfium-review.googlesource.com/40773 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/cxfa_textparser.cpp16
-rw-r--r--xfa/fxfa/cxfa_textparser.h4
-rw-r--r--xfa/fxfa/cxfa_textprovider.cpp6
-rw-r--r--xfa/fxfa/cxfa_textprovider.h4
4 files changed, 11 insertions, 19 deletions
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp
index 0d1c52fab7..b2b47474bf 100644
--- a/xfa/fxfa/cxfa_textparser.cpp
+++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -496,12 +496,12 @@ float CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider,
}
Optional<WideString> CXFA_TextParser::GetEmbeddedObj(
- CXFA_TextProvider* pTextProvider,
- CFX_XMLNode* pXMLNode) {
+ const CXFA_TextProvider* pTextProvider,
+ const CFX_XMLNode* pXMLNode) {
if (!pXMLNode)
return {};
- CFX_XMLElement* pElement = ToXMLElement(pXMLNode);
+ const CFX_XMLElement* pElement = ToXMLElement(pXMLNode);
if (!pElement)
return {};
@@ -517,9 +517,7 @@ Optional<WideString> CXFA_TextParser::GetEmbeddedObj(
ws = L"som";
else
ws.MakeLower();
-
- bool bURI = (ws == L"uri");
- if (!bURI && ws != L"som")
+ if (ws != L"uri")
return {};
ws = pElement->GetAttribute(L"xfa:embedMode");
@@ -527,12 +525,10 @@ Optional<WideString> CXFA_TextParser::GetEmbeddedObj(
ws = L"formatted";
else
ws.MakeLower();
-
- bool bRaw = (ws == L"raw");
- if (!bRaw && ws != L"formatted")
+ if (ws != L"raw" && ws != L"formatted")
return {};
- return pTextProvider->GetEmbeddedObj(bURI, bRaw, wsAttr);
+ return pTextProvider->GetEmbeddedObj(wsAttr);
}
CXFA_TextParseContext* CXFA_TextParser::GetParseContextFromMap(
diff --git a/xfa/fxfa/cxfa_textparser.h b/xfa/fxfa/cxfa_textparser.h
index 591606074e..70c153bfab 100644
--- a/xfa/fxfa/cxfa_textparser.h
+++ b/xfa/fxfa/cxfa_textparser.h
@@ -80,8 +80,8 @@ class CXFA_TextParser {
bool bFirst,
float fVerScale) const;
- Optional<WideString> GetEmbeddedObj(CXFA_TextProvider* pTextProvider,
- CFX_XMLNode* pXMLNode);
+ Optional<WideString> GetEmbeddedObj(const CXFA_TextProvider* pTextProvider,
+ const CFX_XMLNode* pXMLNode);
CXFA_TextParseContext* GetParseContextFromMap(CFX_XMLNode* pXMLNode);
protected:
diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp
index b46bf345f9..53a70a2f65 100644
--- a/xfa/fxfa/cxfa_textprovider.cpp
+++ b/xfa/fxfa/cxfa_textprovider.cpp
@@ -137,10 +137,8 @@ bool CXFA_TextProvider::IsCheckButtonAndAutoWidth() const {
}
Optional<WideString> CXFA_TextProvider::GetEmbeddedObj(
- bool bURI,
- bool bRaw,
- const WideString& wsAttr) {
- if (m_eType != XFA_TEXTPROVIDERTYPE_Text || !bURI)
+ const WideString& wsAttr) const {
+ if (m_eType != XFA_TEXTPROVIDERTYPE_Text)
return {};
CXFA_Node* pParent = m_pNode->GetParent();
diff --git a/xfa/fxfa/cxfa_textprovider.h b/xfa/fxfa/cxfa_textprovider.h
index d6f00056f0..eb16fe227b 100644
--- a/xfa/fxfa/cxfa_textprovider.h
+++ b/xfa/fxfa/cxfa_textprovider.h
@@ -35,9 +35,7 @@ class CXFA_TextProvider {
CXFA_Para* GetParaIfExists();
CXFA_Font* GetFontIfExists();
bool IsCheckButtonAndAutoWidth() const;
- Optional<WideString> GetEmbeddedObj(bool bURI,
- bool bRaw,
- const WideString& wsAttr);
+ Optional<WideString> GetEmbeddedObj(const WideString& wsAttr) const;
private:
CXFA_Node* m_pNode; // Raw, this class owned by tree node.