summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fxjs/cjx_layoutpseudomodel.cpp8
-rw-r--r--xfa/fxfa/cxfa_ffwidgethandler.cpp8
-rw-r--r--xfa/fxfa/cxfa_textparser.cpp6
-rw-r--r--xfa/fxfa/fxfa_basic.h23
-rw-r--r--xfa/fxfa/parser/cxfa_captiondata.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_containerlayoutitem.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_data.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_fontdata.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp62
-rw-r--r--xfa/fxfa/parser/cxfa_layoutitem.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp22
-rw-r--r--xfa/fxfa/parser/cxfa_layoutprocessor.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_measurement.cpp74
-rw-r--r--xfa/fxfa/parser/cxfa_measurement.h14
-rw-r--r--xfa/fxfa/parser/cxfa_paradata.cpp12
-rw-r--r--xfa/fxfa/parser/cxfa_strokedata.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp8
-rw-r--r--xfa/fxfa/parser/xfa_basic_data_attributes.cpp18
18 files changed, 145 insertions, 144 deletions
diff --git a/fxjs/cjx_layoutpseudomodel.cpp b/fxjs/cjx_layoutpseudomodel.cpp
index 94c7dfb701..79e7fc8cf1 100644
--- a/fxjs/cjx_layoutpseudomodel.cpp
+++ b/fxjs/cjx_layoutpseudomodel.cpp
@@ -103,16 +103,16 @@ void CJX_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments,
CFX_RectF rtRect = pLayoutItem->GetRect(true);
switch (layoutModel) {
case XFA_LAYOUTMODEL_H:
- measure.Set(rtRect.height, XFA_UNIT_Pt);
+ measure.Set(rtRect.height, XFA_Unit::Pt);
break;
case XFA_LAYOUTMODEL_W:
- measure.Set(rtRect.width, XFA_UNIT_Pt);
+ measure.Set(rtRect.width, XFA_Unit::Pt);
break;
case XFA_LAYOUTMODEL_X:
- measure.Set(rtRect.left, XFA_UNIT_Pt);
+ measure.Set(rtRect.left, XFA_Unit::Pt);
break;
case XFA_LAYOUTMODEL_Y:
- measure.Set(rtRect.top, XFA_UNIT_Pt);
+ measure.Set(rtRect.top, XFA_Unit::Pt);
break;
}
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp
index 72c7f03c68..f1b8f76e87 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -521,19 +521,19 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateMarginNode(CXFA_Node* pParent,
CXFA_Node* pMargin = CreateCopyNode(XFA_Element::Margin, pParent);
if (dwFlags & 0x01)
pMargin->JSNode()->SetMeasure(XFA_Attribute::LeftInset,
- CXFA_Measurement(fInsets[0], XFA_UNIT_Pt),
+ CXFA_Measurement(fInsets[0], XFA_Unit::Pt),
false);
if (dwFlags & 0x02)
pMargin->JSNode()->SetMeasure(XFA_Attribute::TopInset,
- CXFA_Measurement(fInsets[1], XFA_UNIT_Pt),
+ CXFA_Measurement(fInsets[1], XFA_Unit::Pt),
false);
if (dwFlags & 0x04)
pMargin->JSNode()->SetMeasure(XFA_Attribute::RightInset,
- CXFA_Measurement(fInsets[2], XFA_UNIT_Pt),
+ CXFA_Measurement(fInsets[2], XFA_Unit::Pt),
false);
if (dwFlags & 0x08)
pMargin->JSNode()->SetMeasure(XFA_Attribute::BottomInset,
- CXFA_Measurement(fInsets[3], XFA_UNIT_Pt),
+ CXFA_Measurement(fInsets[3], XFA_Unit::Pt),
false);
return pMargin;
}
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp
index a95350da98..db03ec4367 100644
--- a/xfa/fxfa/cxfa_textparser.cpp
+++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -298,7 +298,7 @@ int32_t CXFA_TextParser::GetVAlign(CXFA_TextProvider* pTextProvider) const {
float CXFA_TextParser::GetTabInterval(CFX_CSSComputedStyle* pStyle) const {
WideString wsValue;
if (pStyle && pStyle->GetCustomStyle(L"tab-interval", wsValue))
- return CXFA_Measurement(wsValue.AsStringView()).ToUnit(XFA_UNIT_Pt);
+ return CXFA_Measurement(wsValue.AsStringView()).ToUnit(XFA_Unit::Pt);
return 36;
}
@@ -598,7 +598,7 @@ bool CXFA_TextParser::GetTabstops(CFX_CSSComputedStyle* pStyle,
if (ch == ' ') {
uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringView(), true);
CXFA_Measurement ms(WideStringView(pTabStops + iLast, iCur - iLast));
- float fPos = ms.ToUnit(XFA_UNIT_Pt);
+ float fPos = ms.ToUnit(XFA_Unit::Pt);
pTabstopContext->Append(dwHashCode, fPos);
wsAlign.clear();
eStatus = TabStopStatus::None;
@@ -613,7 +613,7 @@ bool CXFA_TextParser::GetTabstops(CFX_CSSComputedStyle* pStyle,
if (!wsAlign.IsEmpty()) {
uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringView(), true);
CXFA_Measurement ms(WideStringView(pTabStops + iLast, iCur - iLast));
- float fPos = ms.ToUnit(XFA_UNIT_Pt);
+ float fPos = ms.ToUnit(XFA_Unit::Pt);
pTabstopContext->Append(dwHashCode, fPos);
}
return true;
diff --git a/xfa/fxfa/fxfa_basic.h b/xfa/fxfa/fxfa_basic.h
index 37e85bb150..9a2fef5415 100644
--- a/xfa/fxfa/fxfa_basic.h
+++ b/xfa/fxfa/fxfa_basic.h
@@ -984,17 +984,18 @@ struct XFA_ATTRIBUTEENUMINFO {
XFA_ATTRIBUTEENUM eName;
};
-enum XFA_UNIT {
- XFA_UNIT_Unknown,
- XFA_UNIT_Percent,
- XFA_UNIT_Angle,
- XFA_UNIT_Em,
- XFA_UNIT_Pt,
- XFA_UNIT_In,
- XFA_UNIT_Pc,
- XFA_UNIT_Cm,
- XFA_UNIT_Mm,
- XFA_UNIT_Mp,
+enum class XFA_Unit : uint8_t {
+ Percent = 0,
+ Angle,
+ Em,
+ Pt,
+ In,
+ Pc,
+ Cm,
+ Mm,
+ Mp,
+
+ Unknown = 255,
};
struct XFA_NOTSUREATTRIBUTE {
diff --git a/xfa/fxfa/parser/cxfa_captiondata.cpp b/xfa/fxfa/parser/cxfa_captiondata.cpp
index 9f9af07b63..a91b45f436 100644
--- a/xfa/fxfa/parser/cxfa_captiondata.cpp
+++ b/xfa/fxfa/parser/cxfa_captiondata.cpp
@@ -26,7 +26,7 @@ int32_t CXFA_CaptionData::GetPlacementType() {
float CXFA_CaptionData::GetReserve() {
CXFA_Measurement ms;
m_pNode->JSNode()->TryMeasure(XFA_Attribute::Reserve, ms, true);
- return ms.ToUnit(XFA_UNIT_Pt);
+ return ms.ToUnit(XFA_Unit::Pt);
}
CXFA_MarginData CXFA_CaptionData::GetMarginData() {
diff --git a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp
index c981b6600e..fb54354eeb 100644
--- a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp
+++ b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp
@@ -32,8 +32,8 @@ CFX_SizeF CXFA_ContainerLayoutItem::GetPageSize() const {
return size;
size = CFX_SizeF(
- pMedium->JSNode()->GetMeasure(XFA_Attribute::Short).ToUnit(XFA_UNIT_Pt),
- pMedium->JSNode()->GetMeasure(XFA_Attribute::Long).ToUnit(XFA_UNIT_Pt));
+ pMedium->JSNode()->GetMeasure(XFA_Attribute::Short).ToUnit(XFA_Unit::Pt),
+ pMedium->JSNode()->GetMeasure(XFA_Attribute::Long).ToUnit(XFA_Unit::Pt));
if (pMedium->JSNode()->GetEnum(XFA_Attribute::Orientation) ==
XFA_ATTRIBUTEENUM_Landscape) {
size = CFX_SizeF(size.height, size.width);
diff --git a/xfa/fxfa/parser/cxfa_data.cpp b/xfa/fxfa/parser/cxfa_data.cpp
index 7ba1c12a46..d6b6700854 100644
--- a/xfa/fxfa/parser/cxfa_data.cpp
+++ b/xfa/fxfa/parser/cxfa_data.cpp
@@ -70,13 +70,13 @@ bool CXFA_Data::TryMeasure(XFA_Attribute eAttr,
bool bUseDefault) const {
CXFA_Measurement ms;
if (m_pNode->JSNode()->TryMeasure(eAttr, ms, bUseDefault)) {
- fValue = ms.ToUnit(XFA_UNIT_Pt);
+ fValue = ms.ToUnit(XFA_Unit::Pt);
return true;
}
return false;
}
bool CXFA_Data::SetMeasure(XFA_Attribute eAttr, float fValue) {
- CXFA_Measurement ms(fValue, XFA_UNIT_Pt);
+ CXFA_Measurement ms(fValue, XFA_Unit::Pt);
return m_pNode->JSNode()->SetMeasure(eAttr, ms, false);
}
diff --git a/xfa/fxfa/parser/cxfa_fontdata.cpp b/xfa/fxfa/parser/cxfa_fontdata.cpp
index 0a50a0e5e8..f207fdeda5 100644
--- a/xfa/fxfa/parser/cxfa_fontdata.cpp
+++ b/xfa/fxfa/parser/cxfa_fontdata.cpp
@@ -16,7 +16,7 @@ CXFA_FontData::CXFA_FontData(CXFA_Node* pNode) : CXFA_Data(pNode) {}
float CXFA_FontData::GetBaselineShift() {
return m_pNode->JSNode()
->GetMeasure(XFA_Attribute::BaselineShift)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
}
float CXFA_FontData::GetHorizontalScale() {
@@ -40,9 +40,9 @@ float CXFA_FontData::GetLetterSpacing() {
return 0;
CXFA_Measurement ms(wsValue);
- if (ms.GetUnit() == XFA_UNIT_Em)
+ if (ms.GetUnit() == XFA_Unit::Em)
return ms.GetValue() * GetFontSize();
- return ms.ToUnit(XFA_UNIT_Pt);
+ return ms.ToUnit(XFA_Unit::Pt);
}
int32_t CXFA_FontData::GetLineThrough() {
@@ -66,7 +66,7 @@ int32_t CXFA_FontData::GetUnderlinePeriod() {
float CXFA_FontData::GetFontSize() {
CXFA_Measurement ms;
m_pNode->JSNode()->TryMeasure(XFA_Attribute::Size, ms, true);
- return ms.ToUnit(XFA_UNIT_Pt);
+ return ms.ToUnit(XFA_Unit::Pt);
}
void CXFA_FontData::GetTypeface(WideStringView& wsTypeFace) {
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index 786fc2c32e..752d37473b 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -90,25 +90,25 @@ CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode,
if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) &&
pFormNode->JSNode()->TryMeasure(XFA_Attribute::W, mTmpValue, false) &&
mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
- containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt);
+ containerSize.width = mTmpValue.ToUnit(XFA_Unit::Pt);
*bContainerWidthAutoSize = false;
}
if ((eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) &&
pFormNode->JSNode()->TryMeasure(XFA_Attribute::H, mTmpValue, false) &&
mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
- containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt);
+ containerSize.height = mTmpValue.ToUnit(XFA_Unit::Pt);
*bContainerHeightAutoSize = false;
}
if (*bContainerWidthAutoSize && eType == XFA_Element::Subform &&
pFormNode->JSNode()->TryMeasure(XFA_Attribute::MaxW, mTmpValue, false) &&
mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
- containerSize.width = mTmpValue.ToUnit(XFA_UNIT_Pt);
+ containerSize.width = mTmpValue.ToUnit(XFA_Unit::Pt);
*bContainerWidthAutoSize = false;
}
if (*bContainerHeightAutoSize && eType == XFA_Element::Subform &&
pFormNode->JSNode()->TryMeasure(XFA_Attribute::MaxH, mTmpValue, false) &&
mTmpValue.GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
- containerSize.height = mTmpValue.ToUnit(XFA_UNIT_Pt);
+ containerSize.height = mTmpValue.ToUnit(XFA_Unit::Pt);
*bContainerHeightAutoSize = false;
}
return containerSize;
@@ -129,10 +129,10 @@ CFX_SizeF CalculateContainerComponentSizeFromContentSize(
if (pMarginNode) {
if (pMarginNode->JSNode()->TryMeasure(XFA_Attribute::LeftInset, mTmpValue,
false))
- componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt);
+ componentSize.width += mTmpValue.ToUnit(XFA_Unit::Pt);
if (pMarginNode->JSNode()->TryMeasure(XFA_Attribute::RightInset,
mTmpValue, false))
- componentSize.width += mTmpValue.ToUnit(XFA_UNIT_Pt);
+ componentSize.width += mTmpValue.ToUnit(XFA_Unit::Pt);
}
}
@@ -141,10 +141,10 @@ CFX_SizeF CalculateContainerComponentSizeFromContentSize(
if (pMarginNode) {
if (pMarginNode->JSNode()->TryMeasure(XFA_Attribute::TopInset, mTmpValue,
false))
- componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt);
+ componentSize.height += mTmpValue.ToUnit(XFA_Unit::Pt);
if (pMarginNode->JSNode()->TryMeasure(XFA_Attribute::BottomInset,
mTmpValue, false)) {
- componentSize.height += mTmpValue.ToUnit(XFA_UNIT_Pt);
+ componentSize.height += mTmpValue.ToUnit(XFA_Unit::Pt);
}
}
}
@@ -168,16 +168,16 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow,
if (pMarginNode) {
fLeftInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::LeftInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
fTopInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::TopInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
fRightInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::RightInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
fBottomInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::BottomInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
}
float fContentWidthLimit =
@@ -341,16 +341,16 @@ void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor,
if (pMarginNode) {
fLeftInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::LeftInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
fTopInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::TopInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
fRightInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::RightInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
fBottomInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::BottomInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
}
if (!pProcessor->IsAddNewRowForTrailer(pTrailerLayoutItem)) {
@@ -406,10 +406,10 @@ void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor,
if (pMarginNode) {
fLeftInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::LeftInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
fRightInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::RightInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
}
float fHeight = pLeaderLayoutItem->m_sSize.height;
@@ -984,10 +984,10 @@ bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem,
if (pMarginNode && bCalculateMargin) {
fCurTopMargin = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::TopInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
fCurBottomMargin = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::BottomInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
}
bool bChanged = true;
while (bChanged) {
@@ -1087,8 +1087,8 @@ CFX_PointF CalculatePositionedContainerPos(CXFA_Node* pNode,
{2, 5, 8, 1, 4, 7, 0, 3, 6}};
CFX_PointF pos(
- pNode->JSNode()->GetMeasure(XFA_Attribute::X).ToUnit(XFA_UNIT_Pt),
- pNode->JSNode()->GetMeasure(XFA_Attribute::Y).ToUnit(XFA_UNIT_Pt));
+ pNode->JSNode()->GetMeasure(XFA_Attribute::X).ToUnit(XFA_Unit::Pt),
+ pNode->JSNode()->GetMeasure(XFA_Attribute::Y).ToUnit(XFA_Unit::Pt));
int32_t nRotate = FXSYS_round(
pNode->JSNode()->GetMeasure(XFA_Attribute::Rotate).GetValue());
nRotate = XFA_MapRotation(nRotate) / 90;
@@ -1208,10 +1208,10 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem(
if (pMarginNode && bCalculateMargin) {
fCurTopMargin = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::TopInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
fCurBottomMargin = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::BottomInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
}
CXFA_ContentLayoutItem* pSecondLayoutItem = nullptr;
@@ -1770,10 +1770,10 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
if (pMarginNode) {
fLeftInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::LeftInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
fRightInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::RightInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
}
float fContentWidthLimit =
@@ -1790,7 +1790,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
continue;
m_rgSpecifiedColumnWidths.push_back(
- CXFA_Measurement(width.AsStringView()).ToUnit(XFA_UNIT_Pt));
+ CXFA_Measurement(width.AsStringView()).ToUnit(XFA_Unit::Pt));
}
}
@@ -2173,16 +2173,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
if (pMarginNode) {
fLeftInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::LeftInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
fTopInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::TopInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
fRightInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::RightInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
fBottomInset = pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::BottomInset)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
}
float fContentWidthLimit =
bContainerWidthAutoSize ? FLT_MAX
diff --git a/xfa/fxfa/parser/cxfa_layoutitem.cpp b/xfa/fxfa/parser/cxfa_layoutitem.cpp
index d2227c86aa..322884b2de 100644
--- a/xfa/fxfa/parser/cxfa_layoutitem.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutitem.cpp
@@ -78,10 +78,10 @@ CFX_RectF CXFA_LayoutItem::GetRect(bool bRelative) const {
if (pMarginNode) {
sPos += CFX_PointF(pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::LeftInset)
- .ToUnit(XFA_UNIT_Pt),
+ .ToUnit(XFA_Unit::Pt),
pMarginNode->JSNode()
->GetMeasure(XFA_Attribute::TopInset)
- .ToUnit(XFA_UNIT_Pt));
+ .ToUnit(XFA_Unit::Pt));
}
continue;
}
@@ -90,10 +90,10 @@ CFX_RectF CXFA_LayoutItem::GetRect(bool bRelative) const {
XFA_Element::ContentArea) {
sPos += CFX_PointF(pLayoutItem->m_pFormNode->JSNode()
->GetMeasure(XFA_Attribute::X)
- .ToUnit(XFA_UNIT_Pt),
+ .ToUnit(XFA_Unit::Pt),
pLayoutItem->m_pFormNode->JSNode()
->GetMeasure(XFA_Attribute::Y)
- .ToUnit(XFA_UNIT_Pt));
+ .ToUnit(XFA_Unit::Pt));
break;
}
if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::PageArea)
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index a982c5e17e..a24cce4979 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -330,13 +330,13 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) {
pPageArea->InsertChild(pContentArea, nullptr);
pContentArea->SetFlag(XFA_NodeFlag_Initialized, true);
pContentArea->JSNode()->SetMeasure(
- XFA_Attribute::X, CXFA_Measurement(0.25f, XFA_UNIT_In), false);
+ XFA_Attribute::X, CXFA_Measurement(0.25f, XFA_Unit::In), false);
pContentArea->JSNode()->SetMeasure(
- XFA_Attribute::Y, CXFA_Measurement(0.25f, XFA_UNIT_In), false);
+ XFA_Attribute::Y, CXFA_Measurement(0.25f, XFA_Unit::In), false);
pContentArea->JSNode()->SetMeasure(
- XFA_Attribute::W, CXFA_Measurement(8.0f, XFA_UNIT_In), false);
+ XFA_Attribute::W, CXFA_Measurement(8.0f, XFA_Unit::In), false);
pContentArea->JSNode()->SetMeasure(
- XFA_Attribute::H, CXFA_Measurement(10.5f, XFA_UNIT_In), false);
+ XFA_Attribute::H, CXFA_Measurement(10.5f, XFA_Unit::In), false);
}
CXFA_Node* pMedium = pPageArea->GetChild(0, XFA_Element::Medium, false);
if (!pMedium) {
@@ -348,9 +348,9 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) {
pPageArea->InsertChild(pMedium, nullptr);
pMedium->SetFlag(XFA_NodeFlag_Initialized, true);
pMedium->JSNode()->SetMeasure(XFA_Attribute::Short,
- CXFA_Measurement(8.5f, XFA_UNIT_In), false);
+ CXFA_Measurement(8.5f, XFA_Unit::In), false);
pMedium->JSNode()->SetMeasure(XFA_Attribute::Long,
- CXFA_Measurement(11.0f, XFA_UNIT_In), false);
+ CXFA_Measurement(11.0f, XFA_Unit::In), false);
}
return true;
}
@@ -472,7 +472,7 @@ float CXFA_LayoutPageMgr::GetAvailHeight() {
float fAvailHeight = pLayoutItem->m_pFormNode->JSNode()
->GetMeasure(XFA_Attribute::H)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
if (fAvailHeight >= XFA_LAYOUT_FLOAT_PERCISION)
return fAvailHeight;
if (m_CurrentContainerRecordIter == m_ProposedContainerRecords.begin())
@@ -698,7 +698,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
if (rgUsedHeights[iCurContentAreaIndex] >
pContentAreaNode->JSNode()
->GetMeasure(XFA_Attribute::H)
- .ToUnit(XFA_UNIT_Pt) +
+ .ToUnit(XFA_Unit::Pt) +
XFA_LAYOUT_FLOAT_PERCISION) {
bUsable = false;
break;
@@ -1550,7 +1550,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) {
if (pCurContentNode) {
float fNextContentHeight = pCurContentNode->JSNode()
->GetMeasure(XFA_Attribute::H)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
return fNextContentHeight > fChildHeight;
}
@@ -1581,7 +1581,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) {
if (pContentArea) {
float fNextContentHeight = pContentArea->JSNode()
->GetMeasure(XFA_Attribute::H)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
if (fNextContentHeight > fChildHeight)
return true;
}
@@ -1593,7 +1593,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) {
CXFA_Node* pContentArea =
pPageNode->GetFirstChildByClass(XFA_Element::ContentArea);
float fNextContentHeight =
- pContentArea->JSNode()->GetMeasure(XFA_Attribute::H).ToUnit(XFA_UNIT_Pt);
+ pContentArea->JSNode()->GetMeasure(XFA_Attribute::H).ToUnit(XFA_Unit::Pt);
if (fNextContentHeight < XFA_LAYOUT_FLOAT_PERCISION)
return true;
if (fNextContentHeight > fChildHeight)
diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp
index 6e921ed595..a2494e24b1 100644
--- a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp
@@ -64,9 +64,9 @@ int32_t CXFA_LayoutProcessor::DoLayout() {
XFA_ItemLayoutProcessorResult eStatus;
CXFA_Node* pFormNode = m_pRootItemLayoutProcessor->GetFormNode();
float fPosX =
- pFormNode->JSNode()->GetMeasure(XFA_Attribute::X).ToUnit(XFA_UNIT_Pt);
+ pFormNode->JSNode()->GetMeasure(XFA_Attribute::X).ToUnit(XFA_Unit::Pt);
float fPosY =
- pFormNode->JSNode()->GetMeasure(XFA_Attribute::Y).ToUnit(XFA_UNIT_Pt);
+ pFormNode->JSNode()->GetMeasure(XFA_Attribute::Y).ToUnit(XFA_Unit::Pt);
do {
float fAvailHeight = m_pLayoutPageMgr->GetAvailHeight();
eStatus = m_pRootItemLayoutProcessor->DoLayout(true, fAvailHeight,
diff --git a/xfa/fxfa/parser/cxfa_measurement.cpp b/xfa/fxfa/parser/cxfa_measurement.cpp
index 24b5ba2f59..053f9d1c47 100644
--- a/xfa/fxfa/parser/cxfa_measurement.cpp
+++ b/xfa/fxfa/parser/cxfa_measurement.cpp
@@ -23,52 +23,52 @@ CXFA_Measurement::CXFA_Measurement(const WideStringView& wsMeasure) {
}
CXFA_Measurement::CXFA_Measurement() {
- Set(-1, XFA_UNIT_Unknown);
+ Set(-1, XFA_Unit::Unknown);
}
-CXFA_Measurement::CXFA_Measurement(float fValue, XFA_UNIT eUnit) {
+CXFA_Measurement::CXFA_Measurement(float fValue, XFA_Unit eUnit) {
Set(fValue, eUnit);
}
void CXFA_Measurement::SetString(const WideStringView& wsMeasure) {
if (wsMeasure.IsEmpty()) {
m_fValue = 0;
- m_eUnit = XFA_UNIT_Unknown;
+ m_eUnit = XFA_Unit::Unknown;
return;
}
int32_t iUsedLen = 0;
int32_t iOffset = (wsMeasure[0] == L'=') ? 1 : 0;
float fValue = FXSYS_wcstof(wsMeasure.unterminated_c_str() + iOffset,
wsMeasure.GetLength() - iOffset, &iUsedLen);
- XFA_UNIT eUnit = GetUnitFromString(
+ XFA_Unit eUnit = GetUnitFromString(
wsMeasure.Right(wsMeasure.GetLength() - (iOffset + iUsedLen)));
Set(fValue, eUnit);
}
bool CXFA_Measurement::ToString(WideString* wsMeasure) const {
switch (GetUnit()) {
- case XFA_UNIT_Mm:
+ case XFA_Unit::Mm:
wsMeasure->Format(L"%.8gmm", GetValue());
return true;
- case XFA_UNIT_Pt:
+ case XFA_Unit::Pt:
wsMeasure->Format(L"%.8gpt", GetValue());
return true;
- case XFA_UNIT_In:
+ case XFA_Unit::In:
wsMeasure->Format(L"%.8gin", GetValue());
return true;
- case XFA_UNIT_Cm:
+ case XFA_Unit::Cm:
wsMeasure->Format(L"%.8gcm", GetValue());
return true;
- case XFA_UNIT_Mp:
+ case XFA_Unit::Mp:
wsMeasure->Format(L"%.8gmp", GetValue());
return true;
- case XFA_UNIT_Pc:
+ case XFA_Unit::Pc:
wsMeasure->Format(L"%.8gpc", GetValue());
return true;
- case XFA_UNIT_Em:
+ case XFA_Unit::Em:
wsMeasure->Format(L"%.8gem", GetValue());
return true;
- case XFA_UNIT_Percent:
+ case XFA_Unit::Percent:
wsMeasure->Format(L"%.8g%%", GetValue());
return true;
default:
@@ -77,33 +77,33 @@ bool CXFA_Measurement::ToString(WideString* wsMeasure) const {
}
}
-float CXFA_Measurement::ToUnit(XFA_UNIT eUnit) const {
+float CXFA_Measurement::ToUnit(XFA_Unit eUnit) const {
float f;
return ToUnitInternal(eUnit, &f) ? f : 0;
}
-bool CXFA_Measurement::ToUnitInternal(XFA_UNIT eUnit, float* fValue) const {
+bool CXFA_Measurement::ToUnitInternal(XFA_Unit eUnit, float* fValue) const {
*fValue = GetValue();
- XFA_UNIT eFrom = GetUnit();
+ XFA_Unit eFrom = GetUnit();
if (eFrom == eUnit)
return true;
switch (eFrom) {
- case XFA_UNIT_Pt:
+ case XFA_Unit::Pt:
break;
- case XFA_UNIT_Mm:
+ case XFA_Unit::Mm:
*fValue *= kPtToMm;
break;
- case XFA_UNIT_In:
+ case XFA_Unit::In:
*fValue *= kPtToInch;
break;
- case XFA_UNIT_Cm:
+ case XFA_Unit::Cm:
*fValue *= kPtToCm;
break;
- case XFA_UNIT_Mp:
+ case XFA_Unit::Mp:
*fValue *= kPtToMp;
break;
- case XFA_UNIT_Pc:
+ case XFA_Unit::Pc:
*fValue *= kPtToPc;
break;
default:
@@ -111,21 +111,21 @@ bool CXFA_Measurement::ToUnitInternal(XFA_UNIT eUnit, float* fValue) const {
return false;
}
switch (eUnit) {
- case XFA_UNIT_Pt:
+ case XFA_Unit::Pt:
return true;
- case XFA_UNIT_Mm:
+ case XFA_Unit::Mm:
*fValue /= kPtToMm;
return true;
- case XFA_UNIT_In:
+ case XFA_Unit::In:
*fValue /= kPtToInch;
return true;
- case XFA_UNIT_Cm:
+ case XFA_Unit::Cm:
*fValue /= kPtToCm;
return true;
- case XFA_UNIT_Mp:
+ case XFA_Unit::Mp:
*fValue /= kPtToMp;
return true;
- case XFA_UNIT_Pc:
+ case XFA_Unit::Pc:
*fValue /= kPtToPc;
return true;
default:
@@ -135,22 +135,22 @@ bool CXFA_Measurement::ToUnitInternal(XFA_UNIT eUnit, float* fValue) const {
}
// static
-XFA_UNIT CXFA_Measurement::GetUnitFromString(const WideStringView& wsUnit) {
+XFA_Unit CXFA_Measurement::GetUnitFromString(const WideStringView& wsUnit) {
if (wsUnit == L"mm")
- return XFA_UNIT_Mm;
+ return XFA_Unit::Mm;
if (wsUnit == L"pt")
- return XFA_UNIT_Pt;
+ return XFA_Unit::Pt;
if (wsUnit == L"in")
- return XFA_UNIT_In;
+ return XFA_Unit::In;
if (wsUnit == L"cm")
- return XFA_UNIT_Cm;
+ return XFA_Unit::Cm;
if (wsUnit == L"pc")
- return XFA_UNIT_Pc;
+ return XFA_Unit::Pc;
if (wsUnit == L"mp")
- return XFA_UNIT_Mp;
+ return XFA_Unit::Mp;
if (wsUnit == L"em")
- return XFA_UNIT_Em;
+ return XFA_Unit::Em;
if (wsUnit == L"%")
- return XFA_UNIT_Percent;
- return XFA_UNIT_Unknown;
+ return XFA_Unit::Percent;
+ return XFA_Unit::Unknown;
}
diff --git a/xfa/fxfa/parser/cxfa_measurement.h b/xfa/fxfa/parser/cxfa_measurement.h
index 0212ea1729..2f6af3d43c 100644
--- a/xfa/fxfa/parser/cxfa_measurement.h
+++ b/xfa/fxfa/parser/cxfa_measurement.h
@@ -15,27 +15,27 @@ class CXFA_Measurement {
public:
explicit CXFA_Measurement(const WideStringView& wsMeasure);
CXFA_Measurement();
- CXFA_Measurement(float fValue, XFA_UNIT eUnit);
+ CXFA_Measurement(float fValue, XFA_Unit eUnit);
- static XFA_UNIT GetUnitFromString(const WideStringView& wsUnit);
+ static XFA_Unit GetUnitFromString(const WideStringView& wsUnit);
- void Set(float fValue, XFA_UNIT eUnit) {
+ void Set(float fValue, XFA_Unit eUnit) {
m_fValue = fValue;
m_eUnit = eUnit;
}
- XFA_UNIT GetUnit() const { return m_eUnit; }
+ XFA_Unit GetUnit() const { return m_eUnit; }
float GetValue() const { return m_fValue; }
bool ToString(WideString* wsMeasure) const;
- float ToUnit(XFA_UNIT eUnit) const;
+ float ToUnit(XFA_Unit eUnit) const;
private:
void SetString(const WideStringView& wsMeasure);
- bool ToUnitInternal(XFA_UNIT eUnit, float* fValue) const;
+ bool ToUnitInternal(XFA_Unit eUnit, float* fValue) const;
float m_fValue;
- XFA_UNIT m_eUnit;
+ XFA_Unit m_eUnit;
};
#endif // XFA_FXFA_PARSER_CXFA_MEASUREMENT_H_
diff --git a/xfa/fxfa/parser/cxfa_paradata.cpp b/xfa/fxfa/parser/cxfa_paradata.cpp
index 6beb92d268..b0e8c69e36 100644
--- a/xfa/fxfa/parser/cxfa_paradata.cpp
+++ b/xfa/fxfa/parser/cxfa_paradata.cpp
@@ -26,35 +26,35 @@ int32_t CXFA_ParaData::GetVerticalAlign() {
float CXFA_ParaData::GetLineHeight() {
CXFA_Measurement ms;
m_pNode->JSNode()->TryMeasure(XFA_Attribute::LineHeight, ms, true);
- return ms.ToUnit(XFA_UNIT_Pt);
+ return ms.ToUnit(XFA_Unit::Pt);
}
float CXFA_ParaData::GetMarginLeft() {
CXFA_Measurement ms;
m_pNode->JSNode()->TryMeasure(XFA_Attribute::MarginLeft, ms, true);
- return ms.ToUnit(XFA_UNIT_Pt);
+ return ms.ToUnit(XFA_Unit::Pt);
}
float CXFA_ParaData::GetMarginRight() {
CXFA_Measurement ms;
m_pNode->JSNode()->TryMeasure(XFA_Attribute::MarginRight, ms, true);
- return ms.ToUnit(XFA_UNIT_Pt);
+ return ms.ToUnit(XFA_Unit::Pt);
}
float CXFA_ParaData::GetSpaceAbove() {
CXFA_Measurement ms;
m_pNode->JSNode()->TryMeasure(XFA_Attribute::SpaceAbove, ms, true);
- return ms.ToUnit(XFA_UNIT_Pt);
+ return ms.ToUnit(XFA_Unit::Pt);
}
float CXFA_ParaData::GetSpaceBelow() {
CXFA_Measurement ms;
m_pNode->JSNode()->TryMeasure(XFA_Attribute::SpaceBelow, ms, true);
- return ms.ToUnit(XFA_UNIT_Pt);
+ return ms.ToUnit(XFA_Unit::Pt);
}
float CXFA_ParaData::GetTextIndent() {
CXFA_Measurement ms;
m_pNode->JSNode()->TryMeasure(XFA_Attribute::TextIndent, ms, true);
- return ms.ToUnit(XFA_UNIT_Pt);
+ return ms.ToUnit(XFA_Unit::Pt);
}
diff --git a/xfa/fxfa/parser/cxfa_strokedata.cpp b/xfa/fxfa/parser/cxfa_strokedata.cpp
index 0579eef621..aa31d0a801 100644
--- a/xfa/fxfa/parser/cxfa_strokedata.cpp
+++ b/xfa/fxfa/parser/cxfa_strokedata.cpp
@@ -27,7 +27,7 @@ int32_t CXFA_StrokeData::GetStrokeType() const {
}
float CXFA_StrokeData::GetThickness() const {
- return GetMSThickness().ToUnit(XFA_UNIT_Pt);
+ return GetMSThickness().ToUnit(XFA_Unit::Pt);
}
CXFA_Measurement CXFA_StrokeData::GetMSThickness() const {
@@ -86,7 +86,7 @@ bool CXFA_StrokeData::IsInverted() const {
float CXFA_StrokeData::GetRadius() const {
return m_pNode ? m_pNode->JSNode()
->GetMeasure(XFA_Attribute::Radius)
- .ToUnit(XFA_UNIT_Pt)
+ .ToUnit(XFA_Unit::Pt)
: 0;
}
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 2abeea426d..d131b310cc 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -502,10 +502,10 @@ float CXFA_WidgetData::GetCheckButtonSize() {
if (pUIChild)
return pUIChild->JSNode()
->GetMeasure(XFA_Attribute::Size)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
return XFA_GetAttributeDefaultValue_Measure(
XFA_Element::CheckButton, XFA_Attribute::Size, XFA_XDPPACKET_Form)
- .ToUnit(XFA_UNIT_Pt);
+ .ToUnit(XFA_Unit::Pt);
}
bool CXFA_WidgetData::IsAllowNeutral() {
@@ -1276,7 +1276,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_ModuleWidth(int32_t* val) {
CXFA_Measurement mModuleWidthHeight;
if (pUIChild->JSNode()->TryMeasure(XFA_Attribute::ModuleWidth,
mModuleWidthHeight, true)) {
- *val = static_cast<int32_t>(mModuleWidthHeight.ToUnit(XFA_UNIT_Pt));
+ *val = static_cast<int32_t>(mModuleWidthHeight.ToUnit(XFA_Unit::Pt));
return true;
}
return false;
@@ -1287,7 +1287,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_ModuleHeight(int32_t* val) {
CXFA_Measurement mModuleWidthHeight;
if (pUIChild->JSNode()->TryMeasure(XFA_Attribute::ModuleHeight,
mModuleWidthHeight, true)) {
- *val = static_cast<int32_t>(mModuleWidthHeight.ToUnit(XFA_UNIT_Pt));
+ *val = static_cast<int32_t>(mModuleWidthHeight.ToUnit(XFA_Unit::Pt));
return true;
}
return false;
diff --git a/xfa/fxfa/parser/xfa_basic_data_attributes.cpp b/xfa/fxfa/parser/xfa_basic_data_attributes.cpp
index 6f4b2b5b1c..66f5c893ba 100644
--- a/xfa/fxfa/parser/xfa_basic_data_attributes.cpp
+++ b/xfa/fxfa/parser/xfa_basic_data_attributes.cpp
@@ -10,15 +10,15 @@
#include "xfa/fxfa/parser/cxfa_measurement.h"
static const CXFA_Measurement g_XFAMeasurementData[] = {
- CXFA_Measurement(0, XFA_UNIT_In),
- CXFA_Measurement(0, XFA_UNIT_Pt),
- CXFA_Measurement(5, XFA_UNIT_Mm),
- CXFA_Measurement(0.25, XFA_UNIT_Mm),
- CXFA_Measurement(-1, XFA_UNIT_Unknown),
- CXFA_Measurement(0, XFA_UNIT_Angle),
- CXFA_Measurement(10, XFA_UNIT_Pt),
- CXFA_Measurement(360, XFA_UNIT_Angle),
- CXFA_Measurement(0.5, XFA_UNIT_Pt),
+ CXFA_Measurement(0, XFA_Unit::In),
+ CXFA_Measurement(0, XFA_Unit::Pt),
+ CXFA_Measurement(5, XFA_Unit::Mm),
+ CXFA_Measurement(0.25, XFA_Unit::Mm),
+ CXFA_Measurement(-1, XFA_Unit::Unknown),
+ CXFA_Measurement(0, XFA_Unit::Angle),
+ CXFA_Measurement(10, XFA_Unit::Pt),
+ CXFA_Measurement(360, XFA_Unit::Angle),
+ CXFA_Measurement(0.5, XFA_Unit::Pt),
};
const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = {