summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_edit.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-07 16:36:39 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-08 01:36:02 +0000
commitbba2a7cf30da9e84bcc14ef32dbb0bb944229219 (patch)
tree94a74de8d07b3e395bf6e08a62811a3a0d652d19 /xfa/fwl/cfwl_edit.cpp
parent55e026b7b6eec17b012c819c4a7d39e63094b5c4 (diff)
downloadpdfium-bba2a7cf30da9e84bcc14ef32dbb0bb944229219.tar.xz
Update to use CFX_Rect{F} and CFX_Matrix constructors.
This Cl updates the code to use the constructors instead of creating an empty object and calling Set(). It also removes the various memsets of the CFX_Rect{F} classes. Change-Id: I6e20cec00866a38372858dcba5a30d31103172e4 Reviewed-on: https://pdfium-review.googlesource.com/2550 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fwl/cfwl_edit.cpp')
-rw-r--r--xfa/fwl/cfwl_edit.cpp59
1 files changed, 26 insertions, 33 deletions
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 87a49e0f45..5c024785f0 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -112,7 +112,7 @@ CFX_RectF CFWL_Edit::GetAutosizedWidgetRect() {
CFX_SizeF sz = CalcTextSize(
m_EdtEngine.GetText(0, -1), m_pProperties->m_pThemeProvider,
!!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine));
- rect.Set(0, 0, sz.x, sz.y);
+ rect = CFX_RectF(0, 0, sz);
}
InflateWidgetRect(rect);
return rect;
@@ -231,8 +231,7 @@ void CFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics,
}
if (!pathSpell.IsEmpty()) {
CFX_RectF rtClip = m_rtEngine;
- CFX_Matrix mt;
- mt.Set(1, 0, 0, 1, fOffSetX, fOffSetY);
+ CFX_Matrix mt(1, 0, 0, 1, fOffSetX, fOffSetY);
if (pMatrix) {
pMatrix->TransformRect(rtClip);
mt.Concat(*pMatrix);
@@ -408,7 +407,6 @@ void CFWL_Edit::OnCaretChanged() {
bool bRepaintContent = UpdateOffset();
UpdateCaret();
CFX_RectF rtInvalid;
- rtInvalid.Set(0, 0, 0, 0);
bool bRepaintScroll = false;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) {
CFWL_ScrollBar* pScroll = UpdateScroll();
@@ -501,10 +499,9 @@ void CFWL_Edit::DrawTextBk(CFX_Graphics* pGraphics,
CFX_RectF rtScroll = m_pHorzScrollBar->GetWidgetRect();
- CFX_RectF rtStatic;
- rtStatic.Set(m_rtClient.right() - rtScroll.height,
- m_rtClient.bottom() - rtScroll.height, rtScroll.height,
- rtScroll.height);
+ CFX_RectF rtStatic(m_rtClient.right() - rtScroll.height,
+ m_rtClient.bottom() - rtScroll.height, rtScroll.height,
+ rtScroll.height);
param.m_bStaticBackground = true;
param.m_bMaximize = true;
param.m_rtPart = rtStatic;
@@ -525,8 +522,7 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics,
CFX_RectF rtClip = m_rtEngine;
FX_FLOAT fOffSetX = m_rtEngine.left - m_fScrollOffsetX;
FX_FLOAT fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset;
- CFX_Matrix mt;
- mt.Set(1, 0, 0, 1, fOffSetX, fOffSetY);
+ CFX_Matrix mt(1, 0, 0, 1, fOffSetX, fOffSetY);
if (pMatrix) {
pMatrix->TransformRect(rtClip);
mt.Concat(*pMatrix);
@@ -812,8 +808,7 @@ void CFWL_Edit::UpdateCaret() {
rtFDE.Offset(m_rtEngine.left - m_fScrollOffsetX,
m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset);
- CFX_RectF rtCaret;
- rtCaret.Set(rtFDE.left, rtFDE.top, rtFDE.width, rtFDE.height);
+ CFX_RectF rtCaret(rtFDE.left, rtFDE.top, rtFDE.width, rtFDE.height);
CFX_RectF rtClient = GetClientRect();
rtCaret.Intersect(rtClient);
@@ -966,11 +961,11 @@ void CFWL_Edit::Layout() {
CFX_RectF rtVertScr;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
- rtVertScr.Set(m_rtClient.right() + kEditMargin, m_rtClient.top, fWidth,
- m_rtClient.height);
+ rtVertScr = CFX_RectF(m_rtClient.right() + kEditMargin, m_rtClient.top,
+ fWidth, m_rtClient.height);
} else {
- rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth,
- m_rtClient.height);
+ rtVertScr = CFX_RectF(m_rtClient.right() - fWidth, m_rtClient.top, fWidth,
+ m_rtClient.height);
if (bShowHorzScrollbar)
rtVertScr.height -= fWidth;
m_rtEngine.width -= fWidth;
@@ -988,11 +983,11 @@ void CFWL_Edit::Layout() {
CFX_RectF rtHoriScr;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
- rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin,
- m_rtClient.width, fWidth);
+ rtHoriScr = CFX_RectF(m_rtClient.left, m_rtClient.bottom() + kEditMargin,
+ m_rtClient.width, fWidth);
} else {
- rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth,
- m_rtClient.width, fWidth);
+ rtHoriScr = CFX_RectF(m_rtClient.left, m_rtClient.bottom() - fWidth,
+ m_rtClient.width, fWidth);
if (bShowVertScrollbar)
rtHoriScr.width -= fWidth;
m_rtEngine.height -= fWidth;
@@ -1021,11 +1016,11 @@ void CFWL_Edit::LayoutScrollBar() {
InitVerticalScrollBar();
CFX_RectF rtVertScr;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
- rtVertScr.Set(m_rtClient.right() + kEditMargin, m_rtClient.top, fWidth,
- m_rtClient.height);
+ rtVertScr = CFX_RectF(m_rtClient.right() + kEditMargin, m_rtClient.top,
+ fWidth, m_rtClient.height);
} else {
- rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth,
- m_rtClient.height);
+ rtVertScr = CFX_RectF(m_rtClient.right() - fWidth, m_rtClient.top,
+ fWidth, m_rtClient.height);
if (bShowHorzScrollbar)
rtVertScr.height -= fWidth;
}
@@ -1042,11 +1037,12 @@ void CFWL_Edit::LayoutScrollBar() {
InitHorizontalScrollBar();
CFX_RectF rtHoriScr;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
- rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin,
+ rtHoriScr =
+ CFX_RectF(m_rtClient.left, m_rtClient.bottom() + kEditMargin,
m_rtClient.width, fWidth);
} else {
- rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth,
- m_rtClient.width, fWidth);
+ rtHoriScr = CFX_RectF(m_rtClient.left, m_rtClient.bottom() - fWidth,
+ m_rtClient.width, fWidth);
if (bShowVertScrollbar)
rtHoriScr.width -= (fWidth);
}
@@ -1312,9 +1308,8 @@ void CFWL_Edit::OnFocusChanged(CFWL_Message* pMsg, bool bSet) {
if (!bRepaint)
return;
- CFX_RectF rtInvalidate;
- rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width,
- m_pProperties->m_rtWidget.height);
+ CFX_RectF rtInvalidate(0, 0, m_pProperties->m_rtWidget.width,
+ m_pProperties->m_rtWidget.height);
RepaintRect(rtInvalidate);
}
@@ -1561,8 +1556,6 @@ bool CFWL_Edit::OnScroll(CFWL_ScrollBar* pScrollBar,
UpdateCaret();
CFX_RectF rect = GetWidgetRect();
- CFX_RectF rtInvalidate;
- rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2);
- RepaintRect(rtInvalidate);
+ RepaintRect(CFX_RectF(0, 0, rect.width + 2, rect.height + 2));
return true;
}