summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-29 20:38:16 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-29 20:38:16 +0000
commit59cdc7dc88310bd8cdf2ace60e0f567561d38dbb (patch)
tree298be106e7d44cb418e8ee7592428fc3d94b7796
parent32d5de5948ff8a54b24d79e1f032857874b6053f (diff)
downloadpdfium-59cdc7dc88310bd8cdf2ace60e0f567561d38dbb.tar.xz
Move barcode code to CXFA_Barcode
This CL moves the barcode specific code out of CXFA_Node and into CXFA_Barcode. The CXFA_FFBarcode widget was modified to take the barcode as a parameter. Change-Id: I8ff91cb58402665f4ba63f2eeced45feeaa9ff50 Reviewed-on: https://pdfium-review.googlesource.com/24450 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--xfa/fxfa/cxfa_ffbarcode.cpp32
-rw-r--r--xfa/fxfa/cxfa_ffbarcode.h8
-rw-r--r--xfa/fxfa/cxfa_ffnotify.cpp5
-rw-r--r--xfa/fxfa/cxfa_fftextedit.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_barcode.cpp142
-rw-r--r--xfa/fxfa/parser/cxfa_barcode.h14
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp149
-rw-r--r--xfa/fxfa/parser/cxfa_node.h15
8 files changed, 189 insertions, 184 deletions
diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp
index ce3ca6b791..c458696ce8 100644
--- a/xfa/fxfa/cxfa_ffbarcode.cpp
+++ b/xfa/fxfa/cxfa_ffbarcode.cpp
@@ -17,6 +17,7 @@
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h"
+#include "xfa/fxfa/parser/cxfa_barcode.h"
#include "xfa/fxfa/parser/cxfa_border.h"
namespace {
@@ -111,7 +112,8 @@ const BarCodeInfo* CXFA_FFBarcode::GetBarcodeTypeByName(
return nullptr;
}
-CXFA_FFBarcode::CXFA_FFBarcode(CXFA_Node* pNode) : CXFA_FFTextEdit(pNode) {}
+CXFA_FFBarcode::CXFA_FFBarcode(CXFA_Node* pNode, CXFA_Barcode* barcode)
+ : CXFA_FFTextEdit(pNode), barcode_(barcode) {}
CXFA_FFBarcode::~CXFA_FFBarcode() {}
@@ -157,60 +159,58 @@ void CXFA_FFBarcode::RenderWidget(CXFA_Graphics* pGS,
void CXFA_FFBarcode::UpdateWidgetProperty() {
CXFA_FFTextEdit::UpdateWidgetProperty();
- auto* node = GetNode();
- const BarCodeInfo* info = GetBarcodeTypeByName(node->GetBarcodeType());
+ const BarCodeInfo* info = GetBarcodeTypeByName(barcode_->GetBarcodeType());
if (!info)
return;
auto* pBarCodeWidget = static_cast<CFWL_Barcode*>(m_pNormalWidget.get());
pBarCodeWidget->SetType(info->eBCType);
- Optional<BC_CHAR_ENCODING> encoding =
- node->GetBarcodeAttribute_CharEncoding();
+ Optional<BC_CHAR_ENCODING> encoding = barcode_->GetCharEncoding();
if (encoding)
pBarCodeWidget->SetCharEncoding(*encoding);
- Optional<bool> calcChecksum = node->GetBarcodeAttribute_Checksum();
+ Optional<bool> calcChecksum = barcode_->GetChecksum();
if (calcChecksum)
pBarCodeWidget->SetCalChecksum(*calcChecksum);
- Optional<int32_t> dataLen = node->GetBarcodeAttribute_DataLength();
+ Optional<int32_t> dataLen = barcode_->GetDataLength();
if (dataLen)
pBarCodeWidget->SetDataLength(*dataLen);
- Optional<char> startChar = node->GetBarcodeAttribute_StartChar();
+ Optional<char> startChar = barcode_->GetStartChar();
if (startChar)
pBarCodeWidget->SetStartChar(*startChar);
- Optional<char> endChar = node->GetBarcodeAttribute_EndChar();
+ Optional<char> endChar = barcode_->GetEndChar();
if (endChar)
pBarCodeWidget->SetEndChar(*endChar);
- Optional<int32_t> ecLevel = node->GetBarcodeAttribute_ECLevel();
+ Optional<int32_t> ecLevel = barcode_->GetECLevel();
if (ecLevel)
pBarCodeWidget->SetErrorCorrectionLevel(*ecLevel);
- Optional<int32_t> width = node->GetBarcodeAttribute_ModuleWidth();
+ Optional<int32_t> width = barcode_->GetModuleWidth();
if (width)
pBarCodeWidget->SetModuleWidth(*width);
- Optional<int32_t> height = node->GetBarcodeAttribute_ModuleHeight();
+ Optional<int32_t> height = barcode_->GetModuleHeight();
if (height)
pBarCodeWidget->SetModuleHeight(*height);
- Optional<bool> printCheck = node->GetBarcodeAttribute_PrintChecksum();
+ Optional<bool> printCheck = barcode_->GetPrintChecksum();
if (printCheck)
pBarCodeWidget->SetPrintChecksum(*printCheck);
- Optional<BC_TEXT_LOC> textLoc = node->GetBarcodeAttribute_TextLocation();
+ Optional<BC_TEXT_LOC> textLoc = barcode_->GetTextLocation();
if (textLoc)
pBarCodeWidget->SetTextLocation(*textLoc);
- Optional<bool> truncate = node->GetBarcodeAttribute_Truncate();
+ Optional<bool> truncate = barcode_->GetTruncate();
if (truncate)
pBarCodeWidget->SetTruncated(*truncate);
- Optional<int8_t> ratio = node->GetBarcodeAttribute_WideNarrowRatio();
+ Optional<int8_t> ratio = barcode_->GetWideNarrowRatio();
if (ratio)
pBarCodeWidget->SetWideNarrowRatio(*ratio);
diff --git a/xfa/fxfa/cxfa_ffbarcode.h b/xfa/fxfa/cxfa_ffbarcode.h
index 93984700da..df62b8ee7f 100644
--- a/xfa/fxfa/cxfa_ffbarcode.h
+++ b/xfa/fxfa/cxfa_ffbarcode.h
@@ -7,6 +7,7 @@
#ifndef XFA_FXFA_CXFA_FFBARCODE_H_
#define XFA_FXFA_CXFA_FFBARCODE_H_
+#include "core/fxcrt/unowned_ptr.h"
#include "fxbarcode/BC_Library.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/cxfa_fftextedit.h"
@@ -83,11 +84,13 @@ struct BarCodeInfo {
BC_TYPE eBCType;
};
+class CXFA_Barcode;
+
class CXFA_FFBarcode : public CXFA_FFTextEdit {
public:
static const BarCodeInfo* GetBarcodeTypeByName(const WideString& wsName);
- explicit CXFA_FFBarcode(CXFA_Node* pNode);
+ explicit CXFA_FFBarcode(CXFA_Node* pNode, CXFA_Barcode* barcode);
~CXFA_FFBarcode() override;
// CXFA_FFTextEdit
@@ -98,6 +101,9 @@ class CXFA_FFBarcode : public CXFA_FFTextEdit {
void UpdateWidgetProperty() override;
bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
+
+ private:
+ UnownedPtr<CXFA_Barcode> barcode_;
};
#endif // XFA_FXFA_CXFA_FFBARCODE_H_
diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp
index d4834f02f2..36f860199a 100644
--- a/xfa/fxfa/cxfa_ffnotify.cpp
+++ b/xfa/fxfa/cxfa_ffnotify.cpp
@@ -35,6 +35,7 @@
#include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h"
#include "xfa/fxfa/cxfa_textlayout.h"
#include "xfa/fxfa/cxfa_textprovider.h"
+#include "xfa/fxfa/parser/cxfa_barcode.h"
#include "xfa/fxfa/parser/cxfa_binditems.h"
#include "xfa/fxfa/parser/cxfa_node.h"
@@ -119,7 +120,9 @@ CXFA_ContentLayoutItem* CXFA_FFNotify::OnCreateContentLayoutItem(
CXFA_FFWidget* pWidget = nullptr;
switch (pNode->GetFFWidgetType()) {
case XFA_FFWidgetType::kBarcode:
- pWidget = new CXFA_FFBarcode(pNode);
+ ASSERT(pNode->GetUIChildNode()->GetElementType() == XFA_Element::Barcode);
+ pWidget = new CXFA_FFBarcode(
+ pNode, static_cast<CXFA_Barcode*>(pNode->GetUIChildNode()));
break;
case XFA_FFWidgetType::kButton:
pWidget = new CXFA_FFPushButton(pNode);
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index ad03b5273b..d91e7f7086 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -19,6 +19,7 @@
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
+#include "xfa/fxfa/parser/cxfa_barcode.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_para.h"
@@ -271,8 +272,11 @@ bool CXFA_FFTextEdit::UpdateFWLData() {
}
} else if (m_pNode->GetFFWidgetType() == XFA_FFWidgetType::kBarcode) {
int32_t nDataLen = 0;
- if (eType == XFA_VALUEPICTURE_Edit)
- nDataLen = m_pNode->GetBarcodeAttribute_DataLength().value_or(0);
+ if (eType == XFA_VALUEPICTURE_Edit) {
+ nDataLen = static_cast<CXFA_Barcode*>(m_pNode.Get())
+ ->GetDataLength()
+ .value_or(0);
+ }
pEdit->SetLimit(nDataLen);
bUpdate = true;
diff --git a/xfa/fxfa/parser/cxfa_barcode.cpp b/xfa/fxfa/parser/cxfa_barcode.cpp
index 8c77c571f0..9fb7082754 100644
--- a/xfa/fxfa/parser/cxfa_barcode.cpp
+++ b/xfa/fxfa/parser/cxfa_barcode.cpp
@@ -8,6 +8,7 @@
#include "fxjs/xfa/cjx_barcode.h"
#include "third_party/base/ptr_util.h"
+#include "xfa/fxfa/parser/cxfa_measurement.h"
namespace {
@@ -59,3 +60,144 @@ CXFA_Barcode::~CXFA_Barcode() {}
XFA_FFWidgetType CXFA_Barcode::GetDefaultFFWidgetType() const {
return XFA_FFWidgetType::kBarcode;
}
+
+WideString CXFA_Barcode::GetBarcodeType() {
+ return WideString(JSObject()->GetCData(XFA_Attribute::Type));
+}
+
+Optional<BC_CHAR_ENCODING> CXFA_Barcode::GetCharEncoding() {
+ Optional<WideString> wsCharEncoding =
+ JSObject()->TryCData(XFA_Attribute::CharEncoding, true);
+ if (!wsCharEncoding)
+ return {};
+ if (wsCharEncoding->CompareNoCase(L"UTF-16"))
+ return {CHAR_ENCODING_UNICODE};
+ if (wsCharEncoding->CompareNoCase(L"UTF-8"))
+ return {CHAR_ENCODING_UTF8};
+ return {};
+}
+
+Optional<bool> CXFA_Barcode::GetChecksum() {
+ Optional<XFA_AttributeEnum> checksum =
+ JSObject()->TryEnum(XFA_Attribute::Checksum, true);
+ if (!checksum)
+ return {};
+
+ switch (*checksum) {
+ case XFA_AttributeEnum::None:
+ return {false};
+ case XFA_AttributeEnum::Auto:
+ return {true};
+ case XFA_AttributeEnum::Checksum_1mod10:
+ case XFA_AttributeEnum::Checksum_1mod10_1mod11:
+ case XFA_AttributeEnum::Checksum_2mod10:
+ default:
+ break;
+ }
+ return {};
+}
+
+Optional<int32_t> CXFA_Barcode::GetDataLength() {
+ Optional<WideString> wsDataLength =
+ JSObject()->TryCData(XFA_Attribute::DataLength, true);
+ if (!wsDataLength)
+ return {};
+
+ return {FXSYS_wtoi(wsDataLength->c_str())};
+}
+
+Optional<char> CXFA_Barcode::GetStartChar() {
+ Optional<WideString> wsStartEndChar =
+ JSObject()->TryCData(XFA_Attribute::StartChar, true);
+ if (!wsStartEndChar || wsStartEndChar->IsEmpty())
+ return {};
+
+ return {static_cast<char>((*wsStartEndChar)[0])};
+}
+
+Optional<char> CXFA_Barcode::GetEndChar() {
+ Optional<WideString> wsStartEndChar =
+ JSObject()->TryCData(XFA_Attribute::EndChar, true);
+ if (!wsStartEndChar || wsStartEndChar->IsEmpty())
+ return {};
+
+ return {static_cast<char>((*wsStartEndChar)[0])};
+}
+
+Optional<int32_t> CXFA_Barcode::GetECLevel() {
+ Optional<WideString> wsECLevel =
+ JSObject()->TryCData(XFA_Attribute::ErrorCorrectionLevel, true);
+ if (!wsECLevel)
+ return {};
+ return {FXSYS_wtoi(wsECLevel->c_str())};
+}
+
+Optional<int32_t> CXFA_Barcode::GetModuleWidth() {
+ Optional<CXFA_Measurement> moduleWidthHeight =
+ JSObject()->TryMeasure(XFA_Attribute::ModuleWidth, true);
+ if (!moduleWidthHeight)
+ return {};
+
+ return {static_cast<int32_t>(moduleWidthHeight->ToUnit(XFA_Unit::Pt))};
+}
+
+Optional<int32_t> CXFA_Barcode::GetModuleHeight() {
+ Optional<CXFA_Measurement> moduleWidthHeight =
+ JSObject()->TryMeasure(XFA_Attribute::ModuleHeight, true);
+ if (!moduleWidthHeight)
+ return {};
+
+ return {static_cast<int32_t>(moduleWidthHeight->ToUnit(XFA_Unit::Pt))};
+}
+
+Optional<bool> CXFA_Barcode::GetPrintChecksum() {
+ return JSObject()->TryBoolean(XFA_Attribute::PrintCheckDigit, true);
+}
+
+Optional<BC_TEXT_LOC> CXFA_Barcode::GetTextLocation() {
+ Optional<XFA_AttributeEnum> textLocation =
+ JSObject()->TryEnum(XFA_Attribute::TextLocation, true);
+ if (!textLocation)
+ return {};
+
+ switch (*textLocation) {
+ case XFA_AttributeEnum::None:
+ return {BC_TEXT_LOC_NONE};
+ case XFA_AttributeEnum::Above:
+ return {BC_TEXT_LOC_ABOVE};
+ case XFA_AttributeEnum::Below:
+ return {BC_TEXT_LOC_BELOW};
+ case XFA_AttributeEnum::AboveEmbedded:
+ return {BC_TEXT_LOC_ABOVEEMBED};
+ case XFA_AttributeEnum::BelowEmbedded:
+ return {BC_TEXT_LOC_BELOWEMBED};
+ default:
+ break;
+ }
+ return {};
+}
+
+Optional<bool> CXFA_Barcode::GetTruncate() {
+ return JSObject()->TryBoolean(XFA_Attribute::Truncate, true);
+}
+
+Optional<int8_t> CXFA_Barcode::GetWideNarrowRatio() {
+ Optional<WideString> wsWideNarrowRatio =
+ JSObject()->TryCData(XFA_Attribute::WideNarrowRatio, true);
+ if (!wsWideNarrowRatio)
+ return {};
+
+ Optional<size_t> ptPos = wsWideNarrowRatio->Find(':');
+ if (!ptPos)
+ return {static_cast<int8_t>(FXSYS_wtoi(wsWideNarrowRatio->c_str()))};
+
+ int32_t fB = FXSYS_wtoi(
+ wsWideNarrowRatio->Right(wsWideNarrowRatio->GetLength() - (*ptPos + 1))
+ .c_str());
+ if (!fB)
+ return {0};
+
+ int32_t fA = FXSYS_wtoi(wsWideNarrowRatio->Left(*ptPos).c_str());
+ float result = static_cast<float>(fA) / static_cast<float>(fB);
+ return {static_cast<int8_t>(result)};
+}
diff --git a/xfa/fxfa/parser/cxfa_barcode.h b/xfa/fxfa/parser/cxfa_barcode.h
index 056196f3ac..0899740424 100644
--- a/xfa/fxfa/parser/cxfa_barcode.h
+++ b/xfa/fxfa/parser/cxfa_barcode.h
@@ -15,6 +15,20 @@ class CXFA_Barcode : public CXFA_Node {
~CXFA_Barcode() override;
XFA_FFWidgetType GetDefaultFFWidgetType() const override;
+
+ WideString GetBarcodeType();
+ Optional<BC_CHAR_ENCODING> GetCharEncoding();
+ Optional<bool> GetChecksum();
+ Optional<int32_t> GetDataLength();
+ Optional<char> GetStartChar();
+ Optional<char> GetEndChar();
+ Optional<int32_t> GetECLevel();
+ Optional<int32_t> GetModuleWidth();
+ Optional<int32_t> GetModuleHeight();
+ Optional<bool> GetPrintChecksum();
+ Optional<BC_TEXT_LOC> GetTextLocation();
+ Optional<bool> GetTruncate();
+ Optional<int8_t> GetWideNarrowRatio();
};
#endif // XFA_FXFA_PARSER_CXFA_BARCODE_H_
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 5b04700010..2ccdd1d919 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -2371,155 +2371,6 @@ std::pair<int32_t, bool> CXFA_Node::ExecuteBoolScript(
return {iRet, pTmpRetValue->IsBoolean() ? pTmpRetValue->ToBoolean() : false};
}
-WideString CXFA_Node::GetBarcodeType() {
- CXFA_Node* pUIChild = GetUIChildNode();
- return pUIChild
- ? WideString(pUIChild->JSObject()->GetCData(XFA_Attribute::Type))
- : WideString();
-}
-
-Optional<BC_CHAR_ENCODING> CXFA_Node::GetBarcodeAttribute_CharEncoding() {
- Optional<WideString> wsCharEncoding =
- GetUIChildNode()->JSObject()->TryCData(XFA_Attribute::CharEncoding, true);
- if (!wsCharEncoding)
- return {};
- if (wsCharEncoding->CompareNoCase(L"UTF-16"))
- return {CHAR_ENCODING_UNICODE};
- if (wsCharEncoding->CompareNoCase(L"UTF-8"))
- return {CHAR_ENCODING_UTF8};
- return {};
-}
-
-Optional<bool> CXFA_Node::GetBarcodeAttribute_Checksum() {
- Optional<XFA_AttributeEnum> checksum =
- GetUIChildNode()->JSObject()->TryEnum(XFA_Attribute::Checksum, true);
- if (!checksum)
- return {};
-
- switch (*checksum) {
- case XFA_AttributeEnum::None:
- return {false};
- case XFA_AttributeEnum::Auto:
- return {true};
- case XFA_AttributeEnum::Checksum_1mod10:
- case XFA_AttributeEnum::Checksum_1mod10_1mod11:
- case XFA_AttributeEnum::Checksum_2mod10:
- default:
- break;
- }
- return {};
-}
-
-Optional<int32_t> CXFA_Node::GetBarcodeAttribute_DataLength() {
- Optional<WideString> wsDataLength =
- GetUIChildNode()->JSObject()->TryCData(XFA_Attribute::DataLength, true);
- if (!wsDataLength)
- return {};
-
- return {FXSYS_wtoi(wsDataLength->c_str())};
-}
-
-Optional<char> CXFA_Node::GetBarcodeAttribute_StartChar() {
- Optional<WideString> wsStartEndChar =
- GetUIChildNode()->JSObject()->TryCData(XFA_Attribute::StartChar, true);
- if (!wsStartEndChar || wsStartEndChar->IsEmpty())
- return {};
-
- return {static_cast<char>((*wsStartEndChar)[0])};
-}
-
-Optional<char> CXFA_Node::GetBarcodeAttribute_EndChar() {
- Optional<WideString> wsStartEndChar =
- GetUIChildNode()->JSObject()->TryCData(XFA_Attribute::EndChar, true);
- if (!wsStartEndChar || wsStartEndChar->IsEmpty())
- return {};
-
- return {static_cast<char>((*wsStartEndChar)[0])};
-}
-
-Optional<int32_t> CXFA_Node::GetBarcodeAttribute_ECLevel() {
- Optional<WideString> wsECLevel = GetUIChildNode()->JSObject()->TryCData(
- XFA_Attribute::ErrorCorrectionLevel, true);
- if (!wsECLevel)
- return {};
- return {FXSYS_wtoi(wsECLevel->c_str())};
-}
-
-Optional<int32_t> CXFA_Node::GetBarcodeAttribute_ModuleWidth() {
- Optional<CXFA_Measurement> moduleWidthHeight =
- GetUIChildNode()->JSObject()->TryMeasure(XFA_Attribute::ModuleWidth,
- true);
- if (!moduleWidthHeight)
- return {};
-
- return {static_cast<int32_t>(moduleWidthHeight->ToUnit(XFA_Unit::Pt))};
-}
-
-Optional<int32_t> CXFA_Node::GetBarcodeAttribute_ModuleHeight() {
- Optional<CXFA_Measurement> moduleWidthHeight =
- GetUIChildNode()->JSObject()->TryMeasure(XFA_Attribute::ModuleHeight,
- true);
- if (!moduleWidthHeight)
- return {};
-
- return {static_cast<int32_t>(moduleWidthHeight->ToUnit(XFA_Unit::Pt))};
-}
-
-Optional<bool> CXFA_Node::GetBarcodeAttribute_PrintChecksum() {
- return GetUIChildNode()->JSObject()->TryBoolean(
- XFA_Attribute::PrintCheckDigit, true);
-}
-
-Optional<BC_TEXT_LOC> CXFA_Node::GetBarcodeAttribute_TextLocation() {
- Optional<XFA_AttributeEnum> textLocation =
- GetUIChildNode()->JSObject()->TryEnum(XFA_Attribute::TextLocation, true);
- if (!textLocation)
- return {};
-
- switch (*textLocation) {
- case XFA_AttributeEnum::None:
- return {BC_TEXT_LOC_NONE};
- case XFA_AttributeEnum::Above:
- return {BC_TEXT_LOC_ABOVE};
- case XFA_AttributeEnum::Below:
- return {BC_TEXT_LOC_BELOW};
- case XFA_AttributeEnum::AboveEmbedded:
- return {BC_TEXT_LOC_ABOVEEMBED};
- case XFA_AttributeEnum::BelowEmbedded:
- return {BC_TEXT_LOC_BELOWEMBED};
- default:
- break;
- }
- return {};
-}
-
-Optional<bool> CXFA_Node::GetBarcodeAttribute_Truncate() {
- return GetUIChildNode()->JSObject()->TryBoolean(XFA_Attribute::Truncate,
- true);
-}
-
-Optional<int8_t> CXFA_Node::GetBarcodeAttribute_WideNarrowRatio() {
- Optional<WideString> wsWideNarrowRatio =
- GetUIChildNode()->JSObject()->TryCData(XFA_Attribute::WideNarrowRatio,
- true);
- if (!wsWideNarrowRatio)
- return {};
-
- Optional<size_t> ptPos = wsWideNarrowRatio->Find(':');
- if (!ptPos)
- return {static_cast<int8_t>(FXSYS_wtoi(wsWideNarrowRatio->c_str()))};
-
- int32_t fB = FXSYS_wtoi(
- wsWideNarrowRatio->Right(wsWideNarrowRatio->GetLength() - (*ptPos + 1))
- .c_str());
- if (!fB)
- return {0};
-
- int32_t fA = FXSYS_wtoi(wsWideNarrowRatio->Left(*ptPos).c_str());
- float result = static_cast<float>(fA) / static_cast<float>(fB);
- return {static_cast<int8_t>(result)};
-}
-
std::pair<XFA_FFWidgetType, CXFA_Ui*>
CXFA_Node::CreateChildUIAndValueNodesIfNeeded() {
XFA_Element eType = GetElementType();
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index ae7f4bae99..99b035dfc7 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -299,21 +299,6 @@ class CXFA_Node : public CXFA_Object {
CXFA_Script* script,
CXFA_EventParam* pEventParam);
- // TODO(dsinclair): Figure out how to move this to cxfa_barcode.
- WideString GetBarcodeType();
- 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();
-
CXFA_Node* GetUIChildNode();
XFA_FFWidgetType GetFFWidgetType();