From da911bc12558667555266425d0b7e83296e8cc7d Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 7 Dec 2016 18:47:00 -0800 Subject: Convert GetWidgetRect to return rect. Current GetWidgetRect accepts the rect as an out-param. This CL converts the code to return the rect instead. Review-Url: https://codereview.chromium.org/2556873004 --- xfa/fxfa/app/xfa_ffbarcode.cpp | 3 +-- xfa/fxfa/app/xfa_fffield.cpp | 26 +++++++++++--------------- xfa/fxfa/app/xfa_ffimageedit.cpp | 3 +-- xfa/fxfa/app/xfa_ffpushbutton.cpp | 7 +++---- 4 files changed, 16 insertions(+), 23 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index 8c42bcf774..6f83173b71 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -157,8 +157,7 @@ void CXFA_FFBarcode::RenderWidget(CFX_Graphics* pGS, CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); DrawBorder(pGS, borderUI, m_rtUI, &mtRotate); RenderCaption(pGS, &mtRotate); - CFX_RectF rtWidget; - m_pNormalWidget->GetWidgetRect(rtWidget, false); + CFX_RectF rtWidget = m_pNormalWidget->GetWidgetRect(); CFX_Matrix mt; mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top); mt.Concat(mtRotate); diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 136a99cb6c..9b5504708f 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -69,8 +69,8 @@ void CXFA_FFField::RenderWidget(CFX_Graphics* pGS, DrawBorder(pGS, borderUI, m_rtUI, &mtRotate); RenderCaption(pGS, &mtRotate); DrawHighlight(pGS, &mtRotate, dwStatus, false); - CFX_RectF rtWidget; - m_pNormalWidget->GetWidgetRect(rtWidget, false); + + CFX_RectF rtWidget = m_pNormalWidget->GetWidgetRect(); CFX_Matrix mt; mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top); mt.Concat(mtRotate); @@ -363,15 +363,16 @@ bool CXFA_FFField::OnMouseExit() { TranslateFWLMessage(&ms); return true; } + void CXFA_FFField::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) { - if (!m_pNormalWidget) { + if (!m_pNormalWidget) return; - } - CFX_RectF rtWidget; - m_pNormalWidget->GetWidgetRect(rtWidget, false); + + CFX_RectF rtWidget = m_pNormalWidget->GetWidgetRect(); fx -= rtWidget.left; fy -= rtWidget.top; } + bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { if (!m_pNormalWidget) { return false; @@ -585,20 +586,15 @@ FWL_WidgetHit CXFA_FFField::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { return FWL_WidgetHit::Titlebar; return FWL_WidgetHit::Border; } + bool CXFA_FFField::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { return true; } + bool CXFA_FFField::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { - if (!m_pNormalWidget) { - return false; - } - CFX_RectF rtWidget; - m_pNormalWidget->GetWidgetRect(rtWidget, false); - if (rtWidget.Contains(fx, fy)) { - return true; - } - return false; + return m_pNormalWidget && m_pNormalWidget->GetWidgetRect().Contains(fx, fy); } + void CXFA_FFField::LayoutCaption() { CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); if (!pCapTextLayout) diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index e9156bace3..8ee6510b2d 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -61,8 +61,7 @@ void CXFA_FFImageEdit::RenderWidget(CFX_Graphics* pGS, DrawBorder(pGS, borderUI, m_rtUI, &mtRotate); RenderCaption(pGS, &mtRotate); if (CFX_DIBitmap* pDIBitmap = m_pDataAcc->GetImageEditImage()) { - CFX_RectF rtImage; - m_pNormalWidget->GetWidgetRect(rtImage, false); + CFX_RectF rtImage = m_pNormalWidget->GetWidgetRect(); int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left; int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top; if (CXFA_Para para = m_pDataAcc->GetPara()) { diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp index a26714aac3..a2b11e89ae 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.cpp +++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp @@ -214,8 +214,7 @@ void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics, if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HiliteInverted) { if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) && (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) { - CFX_RectF rtFill; - m_pNormalWidget->GetWidgetRect(rtFill, false); + CFX_RectF rtFill = m_pNormalWidget->GetWidgetRect(); rtFill.left = rtFill.top = 0; FX_FLOAT fLineWith = GetLineWidth(); rtFill.Deflate(fLineWith, fLineWith); @@ -236,8 +235,8 @@ void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics, pGraphics->SetLineWidth(fLineWidth); CFX_Path path; path.Create(); - CFX_RectF rect; - m_pNormalWidget->GetWidgetRect(rect, false); + + CFX_RectF rect = m_pNormalWidget->GetWidgetRect(); path.AddRectangle(0, 0, rect.width, rect.height); pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix); } -- cgit v1.2.3