Convert some macros to constexprs in cfwl_widget.cpp
Also make these float constants, since the are only used in
float expressions.
Change-Id: I1ba2546b7447ac59672d3375cdb2a7f117753945
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/83557
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index dce10de..236a5eb 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -29,9 +29,13 @@
#include "xfa/fwl/cfwl_widgetmgr.h"
#include "xfa/fwl/ifwl_themeprovider.h"
-#define FWL_WGT_CalcHeight 2048
-#define FWL_WGT_CalcWidth 2048
-#define FWL_WGT_CalcMultiLineDefWidth 120.0f
+namespace {
+
+constexpr float kCalcHeight = 2048.0f;
+constexpr float kCalcWidth = 2048.0f;
+constexpr float kCalcMultiLineDefWidth = 120.0f;
+
+} // namespace
CFWL_Widget::CFWL_Widget(CFWL_App* app,
const Properties& properties,
@@ -232,8 +236,8 @@
calPart.m_dwTTOStyles.single_line_ = true;
calPart.m_iTTOAlign = FDE_TextAlignment::kTopLeft;
- float fWidth = bMultiLine ? FWL_WGT_CalcMultiLineDefWidth : FWL_WGT_CalcWidth;
- CFX_RectF rect(0, 0, fWidth, FWL_WGT_CalcHeight);
+ float fWidth = bMultiLine ? kCalcMultiLineDefWidth : kCalcWidth;
+ CFX_RectF rect(0, 0, fWidth, kCalcHeight);
GetThemeProvider()->CalcTextRect(calPart, &rect);
return CFX_SizeF(rect.width, rect.height);
}