Get rid of some #defines in XFA code.

Change-Id: If0b7e738e1d83fcf217d7dfedee6a807b0c1a260
Reviewed-on: https://pdfium-review.googlesource.com/c/47275
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp
index 6028059..727ee00 100644
--- a/xfa/fxfa/cxfa_ffpageview.cpp
+++ b/xfa/fxfa/cxfa_ffpageview.cpp
@@ -424,7 +424,7 @@
                const std::unique_ptr<CXFA_TabParam>& arg2) {
               const CFX_RectF& rt1 = arg1->GetWidget()->GetWidgetRect();
               const CFX_RectF& rt2 = arg2->GetWidget()->GetWidgetRect();
-              if (rt1.top - rt2.top >= XFA_FLOAT_PERCISION)
+              if (rt1.top - rt2.top >= kXFAWidgetPrecision)
                 return rt1.top < rt2.top;
               return rt1.left < rt2.left;
             });
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index 13942ad..ecb8acd 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -32,7 +32,7 @@
   return fPx * 72.0f / fDpi;
 }
 
-#define XFA_FLOAT_PERCISION 0.001f
+constexpr float kXFAWidgetPrecision = 0.001f;
 
 void XFA_DrawImage(CXFA_Graphics* pGS,
                    const CFX_RectF& rtImage,
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index f30f843..e622469 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -68,9 +68,9 @@
     case XFA_Element::Area:
     case XFA_Element::ExclGroup:
     case XFA_Element::SubformSet: {
-      if (*pWidth < -XFA_LAYOUT_FLOAT_PERCISION)
+      if (*pWidth < -kXFALayoutPrecision)
         *pWidth = pLayoutItem->m_sSize.width;
-      if (*pHeight < -XFA_LAYOUT_FLOAT_PERCISION)
+      if (*pHeight < -kXFALayoutPrecision)
         *pHeight = pLayoutItem->m_sSize.height;
       break;
     }
@@ -97,14 +97,14 @@
   if (eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) {
     Optional<CXFA_Measurement> wValue =
         pFormNode->JSObject()->TryMeasure(XFA_Attribute::W, false);
-    if (wValue && wValue->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
+    if (wValue && wValue->GetValue() > kXFALayoutPrecision) {
       containerSize.width = wValue->ToUnit(XFA_Unit::Pt);
       *bContainerWidthAutoSize = false;
     }
 
     Optional<CXFA_Measurement> hValue =
         pFormNode->JSObject()->TryMeasure(XFA_Attribute::H, false);
-    if (hValue && hValue->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
+    if (hValue && hValue->GetValue() > kXFALayoutPrecision) {
       containerSize.height = hValue->ToUnit(XFA_Unit::Pt);
       *bContainerHeightAutoSize = false;
     }
@@ -113,14 +113,14 @@
   if (*bContainerWidthAutoSize && eType == XFA_Element::Subform) {
     Optional<CXFA_Measurement> maxW =
         pFormNode->JSObject()->TryMeasure(XFA_Attribute::MaxW, false);
-    if (maxW && maxW->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
+    if (maxW && maxW->GetValue() > kXFALayoutPrecision) {
       containerSize.width = maxW->ToUnit(XFA_Unit::Pt);
       *bContainerWidthAutoSize = false;
     }
 
     Optional<CXFA_Measurement> maxH =
         pFormNode->JSObject()->TryMeasure(XFA_Attribute::MaxH, false);
-    if (maxH && maxH->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
+    if (maxH && maxH->GetValue() > kXFALayoutPrecision) {
       containerSize.height = maxH->ToUnit(XFA_Unit::Pt);
       *bContainerHeightAutoSize = false;
     }
@@ -471,9 +471,9 @@
                             bool* bAppChange,
                             bool bCalculateMargin) {
   CXFA_Node* pFormNode = pLayoutItem->GetFormNode();
-  if (*fProposedSplitPos <= fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION ||
+  if (*fProposedSplitPos <= fCurVerticalOffset + kXFALayoutPrecision ||
       *fProposedSplitPos > fCurVerticalOffset + pLayoutItem->m_sSize.height -
-                               XFA_LAYOUT_FLOAT_PERCISION) {
+                               kXFALayoutPrecision) {
     return false;
   }
 
@@ -505,7 +505,7 @@
             *fProposedSplitPos = fCurVerticalOffset + fRelSplitPos;
             *bAppChange = true;
             if (*fProposedSplitPos <=
-                fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) {
+                fCurVerticalOffset + kXFALayoutPrecision) {
               return true;
             }
           }
@@ -522,8 +522,7 @@
           bool bChange = false;
           if (FindLayoutItemSplitPos(pChildItem, fChildOffset, &fRelSplitPos,
                                      &bChange, bCalculateMargin)) {
-            if (fRelSplitPos - fChildOffset < XFA_LAYOUT_FLOAT_PERCISION &&
-                bChange) {
+            if (fRelSplitPos - fChildOffset < kXFALayoutPrecision && bChange) {
               *fProposedSplitPos = fRelSplitPos - fCurTopMargin;
             } else {
               *fProposedSplitPos = fRelSplitPos + fCurBottomMargin;
@@ -531,7 +530,7 @@
             bAnyChanged = true;
             bChanged = true;
             if (*fProposedSplitPos <=
-                fCurVerticalOffset + XFA_LAYOUT_FLOAT_PERCISION) {
+                fCurVerticalOffset + kXFALayoutPrecision) {
               return true;
             }
             if (bAnyChanged)
@@ -670,7 +669,7 @@
   auto value = GetFormNode()->JSObject()->TryEnum(XFA_Attribute::Layout, true);
   XFA_AttributeValue eLayout = value.value_or(XFA_AttributeValue::Position);
   bool bCalculateMargin = eLayout != XFA_AttributeValue::Position;
-  while (fProposedSplitPos > XFA_LAYOUT_FLOAT_PERCISION) {
+  while (fProposedSplitPos > kXFALayoutPrecision) {
     bool bAppChange = false;
     if (!FindLayoutItemSplitPos(m_pLayoutItem, 0, &fProposedSplitPos,
                                 &bAppChange, bCalculateMargin)) {
@@ -752,7 +751,7 @@
     pChildNext = ToContentLayoutItem(pChildItem->m_pNextSibling);
     pChildItem->m_pNextSibling = nullptr;
     if (fSplitPos <= fCurTopMargin + pChildItem->m_sPos.y + fCurBottomMargin +
-                         XFA_LAYOUT_FLOAT_PERCISION) {
+                         kXFALayoutPrecision) {
       if (!ExistContainerKeep(pChildItem->GetFormNode(), true)) {
         pChildItem->m_sPos.y -= fSplitPos - fCurBottomMargin;
         pChildItem->m_sPos.y += lHeightForKeep;
@@ -760,7 +759,7 @@
         pSecondLayoutItem->AddChild(pChildItem);
         continue;
       }
-      if (lHeightForKeep < XFA_LAYOUT_FLOAT_PERCISION) {
+      if (lHeightForKeep < kXFALayoutPrecision) {
         for (auto* pPreItem : keepLayoutItems) {
           pLayoutItem->RemoveChild(pPreItem);
           pPreItem->m_sPos.y -= fSplitPos;
@@ -782,9 +781,9 @@
       pSecondLayoutItem->AddChild(pChildItem);
       continue;
     }
-    if (fSplitPos + XFA_LAYOUT_FLOAT_PERCISION >=
-        fCurTopMargin + fCurBottomMargin + pChildItem->m_sPos.y +
-            pChildItem->m_sSize.height) {
+    if (fSplitPos + kXFALayoutPrecision >= fCurTopMargin + fCurBottomMargin +
+                                               pChildItem->m_sPos.y +
+                                               pChildItem->m_sSize.height) {
       pLayoutItem->AddChild(pChildItem);
       if (ExistContainerKeep(pChildItem->GetFormNode(), false))
         keepLayoutItems.push_back(pChildItem);
@@ -845,7 +844,7 @@
     XFA_ItemLayoutProcessorStages* nCurStage,
     CXFA_Node* pParentContainer,
     bool bUsePageBreak) {
-  CXFA_Node* pChildContainer = XFA_LAYOUT_INVALIDNODE;
+  CXFA_Node* pChildContainer = nullptr;
   switch (*nCurStage) {
     case XFA_ItemLayoutProcessorStages::BreakBefore:
     case XFA_ItemLayoutProcessorStages::BreakAfter: {
@@ -857,7 +856,7 @@
       pChildContainer = pCurActionNode;
       break;
     default:
-      pChildContainer = XFA_LAYOUT_INVALIDNODE;
+      pChildContainer = nullptr;
       break;
   }
 
@@ -871,12 +870,12 @@
       goto CheckNextChildContainer;
     }
     case XFA_ItemLayoutProcessorStages::None: {
-      pCurActionNode = XFA_LAYOUT_INVALIDNODE;
+      pCurActionNode = nullptr;
       FALLTHROUGH;
       case XFA_ItemLayoutProcessorStages::BookendLeader:
-        for (CXFA_Node* pBookendNode = pCurActionNode == XFA_LAYOUT_INVALIDNODE
-                                           ? pParentContainer->GetFirstChild()
-                                           : pCurActionNode->GetNextSibling();
+        for (CXFA_Node* pBookendNode = pCurActionNode
+                                           ? pCurActionNode->GetNextSibling()
+                                           : pParentContainer->GetFirstChild();
              pBookendNode; pBookendNode = pBookendNode->GetNextSibling()) {
           switch (pBookendNode->GetElementType()) {
             case XFA_Element::Bookend:
@@ -890,10 +889,10 @@
         }
     }
       {
-        pCurActionNode = XFA_LAYOUT_INVALIDNODE;
+        pCurActionNode = nullptr;
         FALLTHROUGH;
         case XFA_ItemLayoutProcessorStages::BreakBefore:
-          if (pCurActionNode != XFA_LAYOUT_INVALIDNODE) {
+          if (pCurActionNode) {
             CXFA_Node* pBreakBeforeNode = pCurActionNode->GetNextSibling();
             if (!m_bKeepBreakFinish &&
                 FindBreakNode(pBreakBeforeNode, true, &pCurActionNode,
@@ -914,19 +913,19 @@
           goto CheckNextChildContainer;
       }
     case XFA_ItemLayoutProcessorStages::Container: {
-      pCurActionNode = XFA_LAYOUT_INVALIDNODE;
+      pCurActionNode = nullptr;
       FALLTHROUGH;
       case XFA_ItemLayoutProcessorStages::BreakAfter: {
-        if (pCurActionNode == XFA_LAYOUT_INVALIDNODE) {
-          CXFA_Node* pBreakAfterNode = pChildContainer->GetFirstChild();
-          if (!m_bKeepBreakFinish &&
-              FindBreakNode(pBreakAfterNode, false, &pCurActionNode,
+        if (pCurActionNode) {
+          CXFA_Node* pBreakAfterNode = pCurActionNode->GetNextSibling();
+          if (FindBreakNode(pBreakAfterNode, false, &pCurActionNode,
                             nCurStage)) {
             return;
           }
         } else {
-          CXFA_Node* pBreakAfterNode = pCurActionNode->GetNextSibling();
-          if (FindBreakNode(pBreakAfterNode, false, &pCurActionNode,
+          CXFA_Node* pBreakAfterNode = pChildContainer->GetFirstChild();
+          if (!m_bKeepBreakFinish &&
+              FindBreakNode(pBreakAfterNode, false, &pCurActionNode,
                             nCurStage)) {
             return;
           }
@@ -937,9 +936,8 @@
 
     CheckNextChildContainer : {
       CXFA_Node* pNextChildContainer =
-          pChildContainer == XFA_LAYOUT_INVALIDNODE
-              ? pParentContainer->GetFirstContainerChild()
-              : pChildContainer->GetNextContainerSibling();
+          pChildContainer ? pChildContainer->GetNextContainerSibling()
+                          : pParentContainer->GetFirstContainerChild();
       while (pNextChildContainer &&
              pNextChildContainer->IsLayoutGeneratedNode()) {
         CXFA_Node* pSaveNode = pNextChildContainer;
@@ -969,12 +967,12 @@
     }
 
     NoMoreChildContainer : {
-      pCurActionNode = XFA_LAYOUT_INVALIDNODE;
+      pCurActionNode = nullptr;
       FALLTHROUGH;
       case XFA_ItemLayoutProcessorStages::BookendTrailer:
-        for (CXFA_Node* pBookendNode = pCurActionNode == XFA_LAYOUT_INVALIDNODE
-                                           ? pParentContainer->GetFirstChild()
-                                           : pCurActionNode->GetNextSibling();
+        for (CXFA_Node* pBookendNode = pCurActionNode
+                                           ? pCurActionNode->GetNextSibling()
+                                           : pParentContainer->GetFirstChild();
              pBookendNode; pBookendNode = pBookendNode->GetNextSibling()) {
           switch (pBookendNode->GetElementType()) {
             case XFA_Element::Bookend:
@@ -1053,7 +1051,7 @@
 void CXFA_ItemLayoutProcessor::DoLayoutPageArea(
     CXFA_ContainerLayoutItem* pPageAreaLayoutItem) {
   CXFA_Node* pFormNode = pPageAreaLayoutItem->GetFormNode();
-  CXFA_Node* pCurChildNode = XFA_LAYOUT_INVALIDNODE;
+  CXFA_Node* pCurChildNode = nullptr;
   XFA_ItemLayoutProcessorStages nCurChildNodeStage =
       XFA_ItemLayoutProcessorStages::None;
   CXFA_LayoutItem* pBeforeItem = nullptr;
@@ -1124,7 +1122,7 @@
   float fContentCalculatedHeight = 0;
   float fHiddenContentCalculatedWidth = 0;
   float fHiddenContentCalculatedHeight = 0;
-  if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) {
+  if (!m_pCurChildNode) {
     GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(),
                           false);
   }
@@ -1221,7 +1219,7 @@
   if (!pLayoutNode)
     pLayoutNode = GetFormNode();
 
-  ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE);
+  ASSERT(!m_pCurChildNode);
 
   m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
   bool bContainerWidthAutoSize = true;
@@ -1267,7 +1265,7 @@
   layoutContext.m_prgSpecifiedColumnWidths = &m_rgSpecifiedColumnWidths;
   CXFA_LayoutContext* pLayoutContext =
       iSpecifiedColumnCount > 0 ? &layoutContext : nullptr;
-  if (m_pCurChildNode == XFA_LAYOUT_INVALIDNODE) {
+  if (!m_pCurChildNode) {
     GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(),
                           false);
   }
@@ -1360,7 +1358,7 @@
           for (int32_t j = 0; j < c; j++)
             m_rgSpecifiedColumnWidths.push_back(0);
         }
-        if (m_rgSpecifiedColumnWidths[iColCount] < XFA_LAYOUT_FLOAT_PERCISION)
+        if (m_rgSpecifiedColumnWidths[iColCount] < kXFALayoutPrecision)
           bAutoCol = true;
         if (bAutoCol &&
             m_rgSpecifiedColumnWidths[iColCount] < rgRowItemsWidth[i]) {
@@ -1948,7 +1946,7 @@
           ASSERT(m_pCurChildNode->IsContainerNode());
           if (m_pCurChildNode->GetElementType() == XFA_Element::Variables)
             break;
-          if (fContentCurRowY >= fHeightLimit + XFA_LAYOUT_FLOAT_PERCISION &&
+          if (fContentCurRowY >= fHeightLimit + kXFALayoutPrecision &&
               m_pCurChildNode->PresenceRequiresSpace()) {
             bForceEndPage = true;
             goto SuspendAndCreateNewRow;
@@ -2028,7 +2026,7 @@
       GetFormNode(), bContainerWidthAutoSize, fContentCalculatedWidth,
       bContainerHeightAutoSize, fContentCalculatedHeight, containerSize);
 
-  if (containerSize.height >= XFA_LAYOUT_FLOAT_PERCISION || m_pLayoutItem ||
+  if (containerSize.height >= kXFALayoutPrecision || m_pLayoutItem ||
       bRetValue) {
     if (!m_pLayoutItem)
       m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
@@ -2198,7 +2196,7 @@
   if (m_pLayoutItem)
     return;
 
-  ASSERT(m_pCurChildNode == XFA_LAYOUT_INVALIDNODE);
+  ASSERT(!m_pCurChildNode);
   m_pLayoutItem = CreateContentLayoutItem(GetFormNode());
   if (!m_pLayoutItem)
     return;
@@ -2324,9 +2322,9 @@
   float fHeight = pTrailerLayoutItem->m_sSize.height;
   if (bUseInherited) {
     float fNewSplitPos = 0;
-    if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION)
+    if (fSplitPos - fHeight > kXFALayoutPrecision)
       fNewSplitPos = FindSplitPos(fSplitPos - fHeight);
-    if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION)
+    if (fNewSplitPos > kXFALayoutPrecision)
       SplitLayoutItem(fNewSplitPos);
     return;
   }
@@ -2362,10 +2360,10 @@
   }
 
   float fNewSplitPos = 0;
-  if (fSplitPos - fHeight > XFA_LAYOUT_FLOAT_PERCISION)
+  if (fSplitPos - fHeight > kXFALayoutPrecision)
     fNewSplitPos = FindSplitPos(fSplitPos - fHeight);
 
-  if (fNewSplitPos > XFA_LAYOUT_FLOAT_PERCISION) {
+  if (fNewSplitPos > kXFALayoutPrecision) {
     SplitLayoutItem(fNewSplitPos);
     pTrailerLayoutItem->m_sPos.y = fNewSplitPos - fTopInset - fBottomInset;
   } else {
@@ -2554,15 +2552,13 @@
     return eRetValue;
 
   CFX_SizeF childSize = pProcessor->GetCurrentComponentSize();
-  if (bUseRealHeight && fRealHeight < XFA_LAYOUT_FLOAT_PERCISION) {
+  if (bUseRealHeight && fRealHeight < kXFALayoutPrecision) {
     fRealHeight = FLT_MAX;
     fAvailHeight = FLT_MAX;
   }
   if (bTakeSpace &&
-      (childSize.width >
-       *fContentCurRowAvailWidth + XFA_LAYOUT_FLOAT_PERCISION) &&
-      (fContentWidthLimit - *fContentCurRowAvailWidth >
-       XFA_LAYOUT_FLOAT_PERCISION)) {
+      (childSize.width > *fContentCurRowAvailWidth + kXFALayoutPrecision) &&
+      (fContentWidthLimit - *fContentCurRowAvailWidth > kXFALayoutPrecision)) {
     return XFA_ItemLayoutProcessorResult::RowFullBreak;
   }
 
@@ -2606,10 +2602,9 @@
 
   if (!bTakeSpace ||
       *fContentCurRowY + childSize.height <=
-          fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION ||
+          fAvailHeight + kXFALayoutPrecision ||
       (!bContainerHeightAutoSize &&
-       m_fUsedSize + fAvailHeight + XFA_LAYOUT_FLOAT_PERCISION >=
-           fContainerHeight)) {
+       m_fUsedSize + fAvailHeight + kXFALayoutPrecision >= fContainerHeight)) {
     if (!bTakeSpace || eRetValue == XFA_ItemLayoutProcessorResult::Done) {
       if (pProcessor->m_bUseInheriated) {
         if (pTrailerLayoutItem)
@@ -2682,7 +2677,7 @@
 
   *bForceEndPage = true;
   float fSplitPos = pProcessor->FindSplitPos(fAvailHeight - *fContentCurRowY);
-  if (fSplitPos > XFA_LAYOUT_FLOAT_PERCISION) {
+  if (fSplitPos > kXFALayoutPrecision) {
     XFA_AttributeValue eLayout =
         pProcessor->GetFormNode()->JSObject()->GetEnum(XFA_Attribute::Layout);
     if (eLayout == XFA_AttributeValue::Tb &&
@@ -2745,7 +2740,7 @@
     return XFA_ItemLayoutProcessorResult::PageFullBreak;
   }
 
-  if (*fContentCurRowY <= XFA_LAYOUT_FLOAT_PERCISION) {
+  if (*fContentCurRowY <= kXFALayoutPrecision) {
     childSize = pProcessor->GetCurrentComponentSize();
     if (pProcessor->m_pPageMgr->GetNextAvailContentHeight(childSize.height)) {
       CXFA_Node* pTempLeaderNode = nullptr;
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h
index f545868..514bc56 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h
@@ -16,8 +16,7 @@
 #include "core/fxcrt/fx_coordinates.h"
 #include "xfa/fxfa/fxfa_basic.h"
 
-#define XFA_LAYOUT_INVALIDNODE nullptr
-#define XFA_LAYOUT_FLOAT_PERCISION (0.0005f)
+constexpr float kXFALayoutPrecision = 0.0005f;
 
 class CXFA_ContainerLayoutItem;
 class CXFA_ContentLayoutItem;
@@ -164,7 +163,7 @@
 
   CXFA_Node* m_pFormNode;
   CXFA_ContentLayoutItem* m_pLayoutItem = nullptr;
-  CXFA_Node* m_pCurChildNode = XFA_LAYOUT_INVALIDNODE;
+  CXFA_Node* m_pCurChildNode = nullptr;
   float m_fUsedSize = 0;
   CXFA_LayoutPageMgr* m_pPageMgr;
   std::list<CXFA_Node*> m_PendingNodes;
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index fee62fd..69f6991 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -499,7 +499,7 @@
                            ->JSObject()
                            ->GetMeasure(XFA_Attribute::H)
                            .ToUnit(XFA_Unit::Pt);
-  if (fAvailHeight >= XFA_LAYOUT_FLOAT_PERCISION)
+  if (fAvailHeight >= kXFALayoutPrecision)
     return fAvailHeight;
   if (m_CurrentContainerRecordIter == m_ProposedContainerRecords.begin())
     return 0.0f;
@@ -701,11 +701,11 @@
               continue;
             }
             iCurContentAreaIndex++;
-            if (rgUsedHeights[iCurContentAreaIndex] >
-                pContentAreaNode->JSObject()
-                        ->GetMeasure(XFA_Attribute::H)
-                        .ToUnit(XFA_Unit::Pt) +
-                    XFA_LAYOUT_FLOAT_PERCISION) {
+            const float fHeight = pContentAreaNode->JSObject()
+                                      ->GetMeasure(XFA_Attribute::H)
+                                      .ToUnit(XFA_Unit::Pt) +
+                                  kXFALayoutPrecision;
+            if (rgUsedHeights[iCurContentAreaIndex] > fHeight) {
               bUsable = false;
               break;
             }
@@ -1605,7 +1605,7 @@
   float fNextContentHeight = pContentArea->JSObject()
                                  ->GetMeasure(XFA_Attribute::H)
                                  .ToUnit(XFA_Unit::Pt);
-  if (fNextContentHeight < XFA_LAYOUT_FLOAT_PERCISION)
+  if (fNextContentHeight < kXFALayoutPrecision)
     return true;
   if (fNextContentHeight > fChildHeight)
     return true;
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index bbb6c42..c70d31b 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -3511,7 +3511,7 @@
     if (*pCalcHeight != 0) {
       if (iBlockIndex == 0)
         *pCalcHeight += fTopInset;
-      if (fabs(fHeight - *pCalcHeight) < XFA_FLOAT_PERCISION)
+      if (fabs(fHeight - *pCalcHeight) < kXFAWidgetPrecision)
         return false;
     }
     return true;
@@ -3632,7 +3632,7 @@
       *pCalcHeight = 0;
       return true;
     }
-    if (fStartOffset + XFA_FLOAT_PERCISION >= *pCalcHeight) {
+    if (fStartOffset + kXFAWidgetPrecision >= *pCalcHeight) {
       if (iFieldSplitCount / 3 == (iBlockIndex + 1)) {
         (*pFieldArray)[iBlockIndex * 3 + 1] = 0;
         (*pFieldArray)[iBlockIndex * 3 + 2] = *pCalcHeight;
@@ -3654,7 +3654,7 @@
       return true;
     }
     float fTextNum =
-        *pCalcHeight + XFA_FLOAT_PERCISION - fCapReserve - fStartOffset;
+        *pCalcHeight + kXFAWidgetPrecision - fCapReserve - fStartOffset;
     int32_t iLineNum =
         (int32_t)((fTextNum + (fLineHeight - fFontSize)) / fLineHeight);
     if (iLineNum >= iLinesCount) {
@@ -3687,7 +3687,7 @@
         pFieldArray->push_back(iLineNum);
         pFieldArray->push_back(fSplitHeight);
       }
-      if (fabs(fSplitHeight - *pCalcHeight) < XFA_FLOAT_PERCISION)
+      if (fabs(fSplitHeight - *pCalcHeight) < kXFAWidgetPrecision)
         return false;
 
       *pCalcHeight = fSplitHeight;