summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-09 09:17:20 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-09 15:04:51 +0000
commit1b08df18300bbc67dabd12fb35ab6ce1732a1024 (patch)
tree9773931c8d18709860c9fbc1177e290e7713044e /xfa/fxfa/app
parentac2e04797b258115b2dc768a56377d7e78038f42 (diff)
downloadpdfium-1b08df18300bbc67dabd12fb35ab6ce1732a1024.tar.xz
Convert Get methods to return instead of using out params.
This Cl changes several Get methods to return their values instead of using out parameters. Change-Id: Ie9a930a5c2d0e809f2d7181ca033d801945c1cf9 Reviewed-on: https://pdfium-review.googlesource.com/2556 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r--xfa/fxfa/app/xfa_ffbarcode.cpp11
-rw-r--r--xfa/fxfa/app/xfa_ffcheckbutton.cpp14
-rw-r--r--xfa/fxfa/app/xfa_ffchoicelist.cpp8
-rw-r--r--xfa/fxfa/app/xfa_ffchoicelist.h4
-rw-r--r--xfa/fxfa/app/xfa_ffexclgroup.cpp3
-rw-r--r--xfa/fxfa/app/xfa_fffield.cpp99
-rw-r--r--xfa/fxfa/app/xfa_fffield.h4
-rw-r--r--xfa/fxfa/app/xfa_ffimage.cpp54
-rw-r--r--xfa/fxfa/app/xfa_ffimageedit.cpp52
-rw-r--r--xfa/fxfa/app/xfa_ffnotify.cpp4
-rw-r--r--xfa/fxfa/app/xfa_ffpageview.cpp39
-rw-r--r--xfa/fxfa/app/xfa_ffpath.cpp78
-rw-r--r--xfa/fxfa/app/xfa_ffpushbutton.cpp68
-rw-r--r--xfa/fxfa/app/xfa_ffsignature.cpp19
-rw-r--r--xfa/fxfa/app/xfa_fftext.cpp117
-rw-r--r--xfa/fxfa/app/xfa_fftext.h1
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.cpp8
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.h4
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp134
-rw-r--r--xfa/fxfa/app/xfa_fwladapter.cpp4
-rw-r--r--xfa/fxfa/app/xfa_rendercontext.cpp9
21 files changed, 335 insertions, 399 deletions
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp
index 78452d5dd3..0207318e95 100644
--- a/xfa/fxfa/app/xfa_ffbarcode.cpp
+++ b/xfa/fxfa/app/xfa_ffbarcode.cpp
@@ -144,14 +144,13 @@ bool CXFA_FFBarcode::LoadWidget() {
void CXFA_FFBarcode::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
index c8ede3761a..8a20c1a879 100644
--- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
@@ -88,8 +88,7 @@ bool CXFA_FFCheckButton::PerformLayout() {
CXFA_FFWidget::PerformLayout();
FX_FLOAT fCheckSize = m_pDataAcc->GetCheckButtonSize();
CXFA_Margin mgWidget = m_pDataAcc->GetMargin();
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
+ CFX_RectF rtWidget = GetRectWithoutRotate();
if (mgWidget) {
XFA_RectWidthoutMargin(rtWidget, mgWidget);
}
@@ -212,14 +211,13 @@ void CXFA_FFCheckButton::AddUIMargin(int32_t iCapPlacement) {
void CXFA_FFCheckButton::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
DrawBorder(pGS, borderUI, m_rtUI, &mtRotate,
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp
index 847f080f3e..efe8b0c8c2 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp
@@ -220,12 +220,10 @@ CXFA_FFComboBox::CXFA_FFComboBox(CXFA_WidgetAcc* pDataAcc)
CXFA_FFComboBox::~CXFA_FFComboBox() {}
-bool CXFA_FFComboBox::GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus) {
+CFX_RectF CXFA_FFComboBox::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
if (bDrawFocus)
- return false;
- return CXFA_FFWidget::GetBBox(rtBox, dwStatus);
+ return CFX_RectF();
+ return CXFA_FFWidget::GetBBox(dwStatus);
}
bool CXFA_FFComboBox::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.h b/xfa/fxfa/app/xfa_ffchoicelist.h
index 18d58f983e..9eb42e593b 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.h
+++ b/xfa/fxfa/app/xfa_ffchoicelist.h
@@ -45,9 +45,7 @@ class CXFA_FFComboBox : public CXFA_FFField {
~CXFA_FFComboBox() override;
// CXFA_FFField
- bool GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus = false) override;
+ CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override;
bool LoadWidget() override;
void UpdateWidgetProperty() override;
bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override;
diff --git a/xfa/fxfa/app/xfa_ffexclgroup.cpp b/xfa/fxfa/app/xfa_ffexclgroup.cpp
index 938cdbcb23..7d63daddbc 100644
--- a/xfa/fxfa/app/xfa_ffexclgroup.cpp
+++ b/xfa/fxfa/app/xfa_ffexclgroup.cpp
@@ -22,8 +22,7 @@ void CXFA_FFExclGroup::RenderWidget(CFX_Graphics* pGS,
if (!IsMatchVisibleStatus(dwStatus))
return;
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
+ CFX_Matrix mtRotate = GetRotateMatrix();
if (pMatrix)
mtRotate.Concat(*pMatrix);
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index 7a2a4cd656..932754c09c 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -32,36 +32,32 @@ CXFA_FFField::~CXFA_FFField() {
CXFA_FFField::UnloadWidget();
}
-bool CXFA_FFField::GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus) {
+CFX_RectF CXFA_FFField::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
if (!bDrawFocus)
- return CXFA_FFWidget::GetBBox(rtBox, dwStatus);
+ return CXFA_FFWidget::GetBBox(dwStatus);
XFA_Element type = m_pDataAcc->GetUIType();
- if (type == XFA_Element::Button || type == XFA_Element::CheckButton ||
- type == XFA_Element::ImageEdit || type == XFA_Element::Signature ||
- type == XFA_Element::ChoiceList) {
- rtBox = m_rtUI;
- CFX_Matrix mt;
- GetRotateMatrix(mt);
- mt.TransformRect(rtBox);
- return true;
+ if (type != XFA_Element::Button && type != XFA_Element::CheckButton &&
+ type != XFA_Element::ImageEdit && type != XFA_Element::Signature &&
+ type != XFA_Element::ChoiceList) {
+ return CFX_RectF();
}
- return false;
+
+ CFX_RectF rtBox = m_rtUI;
+ GetRotateMatrix().TransformRect(rtBox);
+ return rtBox;
}
void CXFA_FFField::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
@@ -154,8 +150,7 @@ bool CXFA_FFField::PerformLayout() {
return true;
}
void CXFA_FFField::CapPlacement() {
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
+ CFX_RectF rtWidget = GetRectWithoutRotate();
CXFA_Margin mgWidget = m_pDataAcc->GetMargin();
if (mgWidget) {
CXFA_LayoutItem* pItem = this;
@@ -167,15 +162,15 @@ void CXFA_FFField::CapPlacement() {
if (!pItem->GetPrev() && !pItem->GetNext()) {
rtWidget.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
} else {
- if (!pItem->GetPrev()) {
+ if (!pItem->GetPrev())
rtWidget.Deflate(fLeftInset, fTopInset, fRightInset, 0);
- } else if (!pItem->GetNext()) {
+ else if (!pItem->GetNext())
rtWidget.Deflate(fLeftInset, 0, fRightInset, fBottomInset);
- } else {
+ else
rtWidget.Deflate(fLeftInset, 0, fRightInset, 0);
- }
}
}
+
XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
FX_FLOAT fCapReserve = 0;
CXFA_Caption caption = m_pDataAcc->GetCaption();
@@ -569,9 +564,8 @@ FWL_WidgetHit CXFA_FFField::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown)
return FWL_WidgetHit::Client;
}
- CFX_RectF rtBox;
- GetRectWithoutRotate(rtBox);
- if (!rtBox.Contains(fx, fy))
+
+ if (!GetRectWithoutRotate().Contains(fx, fy))
return FWL_WidgetHit::Unknown;
if (m_rtCaption.Contains(fx, fy))
return FWL_WidgetHit::Titlebar;
@@ -597,46 +591,45 @@ void CXFA_FFField::LayoutCaption() {
if (m_rtCaption.height < fHeight)
m_rtCaption.height = fHeight;
}
+
void CXFA_FFField::RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix) {
CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout();
- if (!pCapTextLayout) {
+ if (!pCapTextLayout)
return;
- }
+
CXFA_Caption caption = m_pDataAcc->GetCaption();
- if (caption && caption.GetPresence() == XFA_ATTRIBUTEENUM_Visible) {
- if (!pCapTextLayout->IsLoaded()) {
- pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height));
- }
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
- CFX_RectF rtClip = m_rtCaption;
- rtClip.Intersect(rtWidget);
- CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
- CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top);
- if (pMatrix) {
- pMatrix->TransformRect(rtClip);
- mt.Concat(*pMatrix);
- }
- pCapTextLayout->DrawString(pRenderDevice, mt, rtClip);
+ if (!caption || caption.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
+ return;
+
+ if (!pCapTextLayout->IsLoaded())
+ pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height));
+
+ CFX_RectF rtClip = m_rtCaption;
+ rtClip.Intersect(GetRectWithoutRotate());
+ CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
+ CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top);
+ if (pMatrix) {
+ pMatrix->TransformRect(rtClip);
+ mt.Concat(*pMatrix);
}
+ pCapTextLayout->DrawString(pRenderDevice, mt, rtClip);
}
+
bool CXFA_FFField::ProcessCommittedData() {
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) {
+ if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open)
return false;
- }
- if (!IsDataChanged()) {
+ if (!IsDataChanged())
return false;
- }
- if (CalculateOverride() != 1) {
+ if (CalculateOverride() != 1)
return false;
- }
- if (!CommitData()) {
+ if (!CommitData())
return false;
- }
+
m_pDocView->SetChangeMark();
m_pDocView->AddValidateWidget(m_pDataAcc);
return true;
}
+
int32_t CXFA_FFField::CalculateOverride() {
CXFA_WidgetAcc* pAcc = m_pDataAcc->GetExclGroup();
if (!pAcc) {
diff --git a/xfa/fxfa/app/xfa_fffield.h b/xfa/fxfa/app/xfa_fffield.h
index d7f5965fe9..1ccd57f30e 100644
--- a/xfa/fxfa/app/xfa_fffield.h
+++ b/xfa/fxfa/app/xfa_fffield.h
@@ -21,9 +21,7 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate {
~CXFA_FFField() override;
// CXFA_FFWidget
- bool GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus = false) override;
+ CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override;
void RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) override;
diff --git a/xfa/fxfa/app/xfa_ffimage.cpp b/xfa/fxfa/app/xfa_ffimage.cpp
index 996a3d6b3b..a613221ea6 100644
--- a/xfa/fxfa/app/xfa_ffimage.cpp
+++ b/xfa/fxfa/app/xfa_ffimage.cpp
@@ -34,34 +34,36 @@ void CXFA_FFImage::UnloadWidget() {
void CXFA_FFImage::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
- if (CFX_DIBitmap* pDIBitmap = GetDataAcc()->GetImageImage()) {
- CFX_RectF rtImage;
- GetRectWithoutRotate(rtImage);
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
- XFA_RectWidthoutMargin(rtImage, mgWidget);
- }
- int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left;
- int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top;
- if (CXFA_Para para = m_pDataAcc->GetPara()) {
- iHorzAlign = para.GetHorizontalAlign();
- iVertAlign = para.GetVerticalAlign();
- }
- CXFA_Value value = m_pDataAcc->GetFormValue();
- CXFA_Image imageObj = value.GetImage();
- int32_t iAspect = imageObj.GetAspect();
- int32_t iImageXDpi = 0;
- int32_t iImageYDpi = 0;
- m_pDataAcc->GetImageDpi(iImageXDpi, iImageYDpi);
- XFA_DrawImage(pGS, rtImage, &mtRotate, pDIBitmap, iAspect, iImageXDpi,
- iImageYDpi, iHorzAlign, iVertAlign);
+
+ CFX_DIBitmap* pDIBitmap = GetDataAcc()->GetImageImage();
+ if (!pDIBitmap)
+ return;
+
+ CFX_RectF rtImage = GetRectWithoutRotate();
+ if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
+ XFA_RectWidthoutMargin(rtImage, mgWidget);
+
+ int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left;
+ int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top;
+ if (CXFA_Para para = m_pDataAcc->GetPara()) {
+ iHorzAlign = para.GetHorizontalAlign();
+ iVertAlign = para.GetVerticalAlign();
}
+
+ CXFA_Value value = m_pDataAcc->GetFormValue();
+ CXFA_Image imageObj = value.GetImage();
+ int32_t iAspect = imageObj.GetAspect();
+ int32_t iImageXDpi = 0;
+ int32_t iImageYDpi = 0;
+ m_pDataAcc->GetImageDpi(iImageXDpi, iImageYDpi);
+ XFA_DrawImage(pGS, rtImage, &mtRotate, pDIBitmap, iAspect, iImageXDpi,
+ iImageYDpi, iHorzAlign, iVertAlign);
}
diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp
index 791b92b445..93e9481ddf 100644
--- a/xfa/fxfa/app/xfa_ffimageedit.cpp
+++ b/xfa/fxfa/app/xfa_ffimageedit.cpp
@@ -49,38 +49,40 @@ void CXFA_FFImageEdit::UnloadWidget() {
void CXFA_FFImageEdit::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
RenderCaption(pGS, &mtRotate);
- if (CFX_DIBitmap* pDIBitmap = m_pDataAcc->GetImageEditImage()) {
- 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()) {
- iHorzAlign = para.GetHorizontalAlign();
- iVertAlign = para.GetVerticalAlign();
- }
- int32_t iAspect = XFA_ATTRIBUTEENUM_Fit;
- if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
- if (CXFA_Image imageObj = value.GetImage()) {
- iAspect = imageObj.GetAspect();
- }
- }
- int32_t iImageXDpi = 0;
- int32_t iImageYDpi = 0;
- m_pDataAcc->GetImageEditDpi(iImageXDpi, iImageYDpi);
- XFA_DrawImage(pGS, rtImage, &mtRotate, pDIBitmap, iAspect, iImageXDpi,
- iImageYDpi, iHorzAlign, iVertAlign);
+ CFX_DIBitmap* pDIBitmap = m_pDataAcc->GetImageEditImage();
+ if (!pDIBitmap)
+ return;
+
+ 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()) {
+ iHorzAlign = para.GetHorizontalAlign();
+ iVertAlign = para.GetVerticalAlign();
+ }
+
+ int32_t iAspect = XFA_ATTRIBUTEENUM_Fit;
+ if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
+ if (CXFA_Image imageObj = value.GetImage())
+ iAspect = imageObj.GetAspect();
}
+
+ int32_t iImageXDpi = 0;
+ int32_t iImageYDpi = 0;
+ m_pDataAcc->GetImageEditDpi(iImageXDpi, iImageYDpi);
+ XFA_DrawImage(pGS, rtImage, &mtRotate, pDIBitmap, iAspect, iImageXDpi,
+ iImageYDpi, iHorzAlign, iVertAlign);
}
bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags,
diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp
index 0ea7a9c4e1..951b4fd3f1 100644
--- a/xfa/fxfa/app/xfa_ffnotify.cpp
+++ b/xfa/fxfa/app/xfa_ffnotify.cpp
@@ -487,9 +487,7 @@ void CXFA_FFNotify::OnLayoutItemAdded(CXFA_LayoutProcessor* pLayout,
return;
}
if (pWidget->IsLoaded()) {
- CFX_RectF rtOld;
- pWidget->GetWidgetRect(rtOld);
- if (rtOld != pWidget->RecacheWidgetRect())
+ if (pWidget->GetWidgetRect() != pWidget->RecacheWidgetRect())
pWidget->PerformLayout();
} else {
pWidget->LoadWidget();
diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp
index 7481fa61aa..7ae5493ba6 100644
--- a/xfa/fxfa/app/xfa_ffpageview.cpp
+++ b/xfa/fxfa/app/xfa_ffpageview.cpp
@@ -25,12 +25,12 @@
namespace {
-void GetPageMatrix(CFX_Matrix& pageMatrix,
- const CFX_RectF& docPageRect,
- const CFX_Rect& devicePageRect,
- int32_t iRotate,
- uint32_t dwCoordinatesType) {
+CFX_Matrix GetPageMatrix(const CFX_RectF& docPageRect,
+ const CFX_Rect& devicePageRect,
+ int32_t iRotate,
+ uint32_t dwCoordinatesType) {
ASSERT(iRotate >= 0 && iRotate <= 3);
+
bool bFlipX = (dwCoordinatesType & 0x01) != 0;
bool bFlipY = (dwCoordinatesType & 0x02) != 0;
CFX_Matrix m((bFlipX ? -1.0f : 1.0f), 0, 0, (bFlipY ? -1.0f : 1.0f), 0, 0);
@@ -70,7 +70,7 @@ void GetPageMatrix(CFX_Matrix& pageMatrix,
default:
break;
}
- pageMatrix = m;
+ return m;
}
bool PageWidgetFilter(CXFA_FFWidget* pWidget,
@@ -124,15 +124,13 @@ CXFA_FFDocView* CXFA_FFPageView::GetDocView() const {
return m_pDocView;
}
-void CXFA_FFPageView::GetPageViewRect(CFX_RectF& rtPage) const {
- rtPage = CFX_RectF(0, 0, GetPageSize());
+CFX_RectF CXFA_FFPageView::GetPageViewRect() const {
+ return CFX_RectF(0, 0, GetPageSize());
}
-void CXFA_FFPageView::GetDisplayMatrix(CFX_Matrix& mt,
- const CFX_Rect& rtDisp,
- int32_t iRotate) const {
- CFX_SizeF sz = GetPageSize();
- GetPageMatrix(mt, CFX_RectF(0, 0, sz), rtDisp, iRotate, 0);
+CFX_Matrix CXFA_FFPageView::GetDisplayMatrix(const CFX_Rect& rtDisp,
+ int32_t iRotate) const {
+ return GetPageMatrix(CFX_RectF(0, 0, GetPageSize()), rtDisp, iRotate, 0);
}
IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator(
@@ -365,19 +363,16 @@ void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() {
static int32_t XFA_TabOrderWidgetComparator(const void* phWidget1,
const void* phWidget2) {
- CXFA_FFWidget* pWidget1 = (*(CXFA_TabParam**)phWidget1)->m_pWidget;
- CXFA_FFWidget* pWidget2 = (*(CXFA_TabParam**)phWidget2)->m_pWidget;
- CFX_RectF rt1;
- pWidget1->GetWidgetRect(rt1);
-
- CFX_RectF rt2;
- pWidget2->GetWidgetRect(rt2);
+ auto param1 = *static_cast<CXFA_TabParam**>(const_cast<void*>(phWidget1));
+ auto param2 = *static_cast<CXFA_TabParam**>(const_cast<void*>(phWidget2));
+ CFX_RectF rt1 = param1->m_pWidget->GetWidgetRect();
+ CFX_RectF rt2 = param2->m_pWidget->GetWidgetRect();
FX_FLOAT x1 = rt1.left, y1 = rt1.top, x2 = rt2.left, y2 = rt2.top;
- if (y1 < y2 || (y1 - y2 < XFA_FLOAT_PERCISION && x1 < x2)) {
+ if (y1 < y2 || (y1 - y2 < XFA_FLOAT_PERCISION && x1 < x2))
return -1;
- }
return 1;
}
+
void CXFA_FFTabOrderPageWidgetIterator::OrderContainer(
CXFA_LayoutItemIterator* sIterator,
CXFA_LayoutItem* pContainerItem,
diff --git a/xfa/fxfa/app/xfa_ffpath.cpp b/xfa/fxfa/app/xfa_ffpath.cpp
index 0620982b1c..c4e6554c1a 100644
--- a/xfa/fxfa/app/xfa_ffpath.cpp
+++ b/xfa/fxfa/app/xfa_ffpath.cpp
@@ -54,47 +54,45 @@ void CXFA_FFLine::GetRectFromHand(CFX_RectF& rect,
void CXFA_FFLine::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
+
CXFA_Value value = m_pDataAcc->GetFormValue();
- if (!value) {
+ if (!value)
return;
- }
+
CXFA_Line lineObj = value.GetLine();
FX_ARGB lineColor = 0xFF000000;
int32_t iStrokeType = 0;
FX_FLOAT fLineWidth = 1.0f;
- bool bSlope = lineObj.GetSlop();
int32_t iCap = 0;
CXFA_Edge edge = lineObj.GetEdge();
if (edge) {
- if (edge.GetPresence() != XFA_ATTRIBUTEENUM_Visible) {
+ if (edge.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
return;
- }
+
lineColor = edge.GetColor();
iStrokeType = edge.GetStrokeType();
fLineWidth = edge.GetThickness();
iCap = edge.GetCapType();
}
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
- CFX_RectF rtLine;
- GetRectWithoutRotate(rtLine);
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
+
+ CFX_RectF rtLine = GetRectWithoutRotate();
+ if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
XFA_RectWidthoutMargin(rtLine, mgWidget);
- }
+
GetRectFromHand(rtLine, lineObj.GetHand(), fLineWidth);
CFX_Path linePath;
linePath.Create();
- if (bSlope && rtLine.right() > 0.0f && rtLine.bottom() > 0.0f) {
+ if (lineObj.GetSlope() && rtLine.right() > 0.0f && rtLine.bottom() > 0.0f)
linePath.AddLine(rtLine.right(), rtLine.top, rtLine.left, rtLine.bottom());
- } else {
+ else
linePath.AddLine(rtLine.left, rtLine.top, rtLine.right(), rtLine.bottom());
- }
+
CFX_Color color(lineColor);
pGS->SaveGraphState();
pGS->SetLineWidth(fLineWidth, true);
@@ -112,24 +110,22 @@ CXFA_FFArc::~CXFA_FFArc() {}
void CXFA_FFArc::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
+
CXFA_Value value = m_pDataAcc->GetFormValue();
- if (!value) {
+ if (!value)
return;
- }
+
CXFA_Arc arcObj = value.GetArc();
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
- CFX_RectF rtArc;
- GetRectWithoutRotate(rtArc);
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
+
+ CFX_RectF rtArc = GetRectWithoutRotate();
+ if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
XFA_RectWidthoutMargin(rtArc, mgWidget);
- }
+
DrawBorder(pGS, arcObj, rtArc, &mtRotate);
}
@@ -141,23 +137,21 @@ CXFA_FFRectangle::~CXFA_FFRectangle() {}
void CXFA_FFRectangle::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
+
CXFA_Value value = m_pDataAcc->GetFormValue();
- if (!value) {
+ if (!value)
return;
- }
+
CXFA_Rectangle rtObj = value.GetRectangle();
- CFX_RectF rect;
- GetRectWithoutRotate(rect);
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
+ CFX_RectF rect = GetRectWithoutRotate();
+ if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
XFA_RectWidthoutMargin(rect, mgWidget);
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
DrawBorder(pGS, rtObj, rect, &mtRotate);
}
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp
index fcb7d32761..9c05083bb0 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp
@@ -33,23 +33,22 @@ CXFA_FFPushButton::~CXFA_FFPushButton() {
void CXFA_FFPushButton::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
RenderHighlightCaption(pGS, &mtRotate);
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
+ CFX_RectF rtWidget = GetRectWithoutRotate();
CFX_Matrix mt(1, 0, 0, 1, rtWidget.left, rtWidget.top);
mt.Concat(mtRotate);
GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt);
}
+
bool CXFA_FFPushButton::LoadWidget() {
ASSERT(!m_pNormalWidget);
CFWL_PushButton* pPushButton = new CFWL_PushButton(GetFWLApp());
@@ -100,8 +99,7 @@ void CXFA_FFPushButton::UnloadWidget() {
bool CXFA_FFPushButton::PerformLayout() {
CXFA_FFWidget::PerformLayout();
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
+ CFX_RectF rtWidget = GetRectWithoutRotate();
m_rtUI = rtWidget;
if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin())
@@ -171,34 +169,30 @@ void CXFA_FFPushButton::RenderHighlightCaption(CFX_Graphics* pGS,
CFX_Matrix* pMatrix) {
CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout();
CXFA_Caption caption = m_pDataAcc->GetCaption();
- if (caption && caption.GetPresence() == XFA_ATTRIBUTEENUM_Visible) {
- CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
- CFX_RectF rtClip = m_rtCaption;
- rtClip.Intersect(rtWidget);
- CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top);
- if (pMatrix) {
- pMatrix->TransformRect(rtClip);
- mt.Concat(*pMatrix);
- }
- {
- uint32_t dwState = m_pNormalWidget->GetStates();
- if (m_pDownTextLayout && (dwState & FWL_STATE_PSB_Pressed) &&
- (dwState & FWL_STATE_PSB_Hovered)) {
- if (m_pDownTextLayout->DrawString(pRenderDevice, mt, rtClip)) {
- return;
- }
- } else if (m_pRolloverTextLayout && (dwState & FWL_STATE_PSB_Hovered)) {
- if (m_pRolloverTextLayout->DrawString(pRenderDevice, mt, rtClip)) {
- return;
- }
- }
- }
- if (pCapTextLayout) {
- pCapTextLayout->DrawString(pRenderDevice, mt, rtClip);
- }
+ if (!caption || caption.GetPresence() != XFA_ATTRIBUTEENUM_Visible)
+ return;
+
+ CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
+ CFX_RectF rtClip = m_rtCaption;
+ rtClip.Intersect(GetRectWithoutRotate());
+ CFX_Matrix mt(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top);
+ if (pMatrix) {
+ pMatrix->TransformRect(rtClip);
+ mt.Concat(*pMatrix);
+ }
+
+ uint32_t dwState = m_pNormalWidget->GetStates();
+ if (m_pDownTextLayout && (dwState & FWL_STATE_PSB_Pressed) &&
+ (dwState & FWL_STATE_PSB_Hovered)) {
+ if (m_pDownTextLayout->DrawString(pRenderDevice, mt, rtClip))
+ return;
+ } else if (m_pRolloverTextLayout && (dwState & FWL_STATE_PSB_Hovered)) {
+ if (m_pRolloverTextLayout->DrawString(pRenderDevice, mt, rtClip))
+ return;
}
+
+ if (pCapTextLayout)
+ pCapTextLayout->DrawString(pRenderDevice, mt, rtClip);
}
void CXFA_FFPushButton::OnProcessMessage(CFWL_Message* pMessage) {
diff --git a/xfa/fxfa/app/xfa_ffsignature.cpp b/xfa/fxfa/app/xfa_ffsignature.cpp
index 1e03e080cb..53f693d1ba 100644
--- a/xfa/fxfa/app/xfa_ffsignature.cpp
+++ b/xfa/fxfa/app/xfa_ffsignature.cpp
@@ -23,15 +23,15 @@ bool CXFA_FFSignature::LoadWidget() {
void CXFA_FFSignature::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
mtRotate.Concat(*pMatrix);
- }
+
CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
+
CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
RenderCaption(pGS, &mtRotate);
@@ -88,6 +88,7 @@ bool CXFA_FFSignature::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
bool CXFA_FFSignature::OnChar(uint32_t dwChar, uint32_t dwFlags) {
return false;
}
+
FWL_WidgetHit CXFA_FFSignature::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_pNormalWidget) {
FX_FLOAT ffx = fx, ffy = fy;
@@ -95,14 +96,14 @@ FWL_WidgetHit CXFA_FFSignature::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown)
return FWL_WidgetHit::Client;
}
- CFX_RectF rtBox;
- GetRectWithoutRotate(rtBox);
- if (!rtBox.Contains(fx, fy))
+
+ if (!GetRectWithoutRotate().Contains(fx, fy))
return FWL_WidgetHit::Unknown;
if (m_rtCaption.Contains(fx, fy))
return FWL_WidgetHit::Titlebar;
return FWL_WidgetHit::Client;
}
+
bool CXFA_FFSignature::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) {
return false;
}
diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp
index 9176276d85..d8231bfda8 100644
--- a/xfa/fxfa/app/xfa_fftext.cpp
+++ b/xfa/fxfa/app/xfa_fftext.cpp
@@ -26,46 +26,48 @@ CXFA_FFText::~CXFA_FFText() {}
void CXFA_FFText::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
+ return;
+
+ CFX_Matrix mtRotate = GetRotateMatrix();
+ if (pMatrix)
+ mtRotate.Concat(*pMatrix);
+
+ CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
+
+ CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
+ if (!pTextLayout)
return;
- }
- {
- CFX_Matrix mtRotate;
- GetRotateMatrix(mtRotate);
- if (pMatrix) {
- mtRotate.Concat(*pMatrix);
- }
- CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus);
- CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
- if (pTextLayout) {
- CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
- CFX_RectF rtText;
- GetRectWithoutRotate(rtText);
- if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
- CXFA_LayoutItem* pItem = this;
- if (!pItem->GetPrev() && !pItem->GetNext()) {
- XFA_RectWidthoutMargin(rtText, mgWidget);
- } else {
- FX_FLOAT fLeftInset, fRightInset, fTopInset = 0, fBottomInset = 0;
- mgWidget.GetLeftInset(fLeftInset);
- mgWidget.GetRightInset(fRightInset);
- if (!pItem->GetPrev()) {
- mgWidget.GetTopInset(fTopInset);
- } else if (!pItem->GetNext()) {
- mgWidget.GetBottomInset(fBottomInset);
- }
- rtText.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
- }
- }
- CFX_Matrix mt(1, 0, 0, 1, rtText.left, rtText.top);
- CFX_RectF rtClip = rtText;
- mtRotate.TransformRect(rtClip);
- mt.Concat(mtRotate);
- pTextLayout->DrawString(pRenderDevice, mt, rtClip, GetIndex());
+ CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
+ CFX_RectF rtText = GetRectWithoutRotate();
+ if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
+ CXFA_LayoutItem* pItem = this;
+ if (!pItem->GetPrev() && !pItem->GetNext()) {
+ XFA_RectWidthoutMargin(rtText, mgWidget);
+ } else {
+ FX_FLOAT fLeftInset;
+ FX_FLOAT fRightInset;
+ FX_FLOAT fTopInset = 0;
+ FX_FLOAT fBottomInset = 0;
+ mgWidget.GetLeftInset(fLeftInset);
+ mgWidget.GetRightInset(fRightInset);
+ if (!pItem->GetPrev())
+ mgWidget.GetTopInset(fTopInset);
+ else if (!pItem->GetNext())
+ mgWidget.GetBottomInset(fBottomInset);
+
+ rtText.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
}
}
+
+ CFX_Matrix mt(1, 0, 0, 1, rtText.left, rtText.top);
+ CFX_RectF rtClip = rtText;
+ mtRotate.TransformRect(rtClip);
+ mt.Concat(mtRotate);
+ pTextLayout->DrawString(pRenderDevice, mt, rtClip, GetIndex());
}
+
bool CXFA_FFText::IsLoaded() {
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
return pTextLayout && !pTextLayout->m_bHasBlock;
@@ -104,31 +106,23 @@ bool CXFA_FFText::PerformLayout() {
pTextLayout->m_bHasBlock = false;
return true;
}
+
bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- CFX_RectF rtBox;
- GetRectWithoutRotate(rtBox);
- if (!rtBox.Contains(fx, fy)) {
+ if (!GetRectWithoutRotate().Contains(fx, fy))
return false;
- }
+
const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
- if (!wsURLContent) {
+ if (!wsURLContent)
return false;
- }
+
SetButtonDown(true);
return true;
}
+
bool CXFA_FFText::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
- CFX_RectF rtBox;
- GetRectWithoutRotate(rtBox);
- if (!rtBox.Contains(fx, fy)) {
- return false;
- }
- const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
- if (!wsURLContent) {
- return false;
- }
- return true;
+ return GetRectWithoutRotate().Contains(fx, fy) && !!GetLinkURLAtPoint(fx, fy);
}
+
bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
if (!IsButtonDown()) {
return false;
@@ -142,35 +136,28 @@ bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
pDoc->GetDocEnvironment()->GotoURL(pDoc, wsURLContent);
return true;
}
+
FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
- CFX_RectF rtBox;
- GetRectWithoutRotate(rtBox);
- if (!rtBox.Contains(fx, fy))
+ if (!GetRectWithoutRotate().Contains(fx, fy))
return FWL_WidgetHit::Unknown;
if (!GetLinkURLAtPoint(fx, fy))
return FWL_WidgetHit::Unknown;
return FWL_WidgetHit::HyperLink;
}
+
const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
if (!pTextLayout)
return nullptr;
- FX_FLOAT x(fx);
- FX_FLOAT y(fy);
- FWLToClient(x, y);
-
+ CFX_RectF rect = GetRectWithoutRotate();
for (const auto& pPieceLine : *pTextLayout->GetPieceLines()) {
for (const auto& pPiece : pPieceLine->m_textPieces) {
- if (pPiece->pLinkData && pPiece->rtPiece.Contains(x, y))
+ if (pPiece->pLinkData &&
+ pPiece->rtPiece.Contains(fx - rect.left, fy - rect.top)) {
return pPiece->pLinkData->GetLinkURL();
+ }
}
}
return nullptr;
}
-void CXFA_FFText::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) {
- CFX_RectF rtWidget;
- GetRectWithoutRotate(rtWidget);
- fx -= rtWidget.left;
- fy -= rtWidget.top;
-}
diff --git a/xfa/fxfa/app/xfa_fftext.h b/xfa/fxfa/app/xfa_fftext.h
index 02716e532f..2c01a6f349 100644
--- a/xfa/fxfa/app/xfa_fftext.h
+++ b/xfa/fxfa/app/xfa_fftext.h
@@ -27,7 +27,6 @@ class CXFA_FFText : public CXFA_FFDraw {
private:
const FX_WCHAR* GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy);
- void FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy);
};
#endif // XFA_FXFA_APP_XFA_FFTEXT_H_
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
index 0cb43575b0..ad5ab434c6 100644
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -493,12 +493,10 @@ CXFA_FFDateTimeEdit::CXFA_FFDateTimeEdit(CXFA_WidgetAcc* pDataAcc)
CXFA_FFDateTimeEdit::~CXFA_FFDateTimeEdit() {}
-bool CXFA_FFDateTimeEdit::GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus) {
+CFX_RectF CXFA_FFDateTimeEdit::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
if (bDrawFocus)
- return false;
- return CXFA_FFWidget::GetBBox(rtBox, dwStatus);
+ return CFX_RectF();
+ return CXFA_FFWidget::GetBBox(dwStatus);
}
bool CXFA_FFDateTimeEdit::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
diff --git a/xfa/fxfa/app/xfa_fftextedit.h b/xfa/fxfa/app/xfa_fftextedit.h
index 0c22db7a2f..91c30ba8c9 100644
--- a/xfa/fxfa/app/xfa_fftextedit.h
+++ b/xfa/fxfa/app/xfa_fftextedit.h
@@ -84,9 +84,7 @@ class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit {
~CXFA_FFDateTimeEdit() override;
// CXFA_FFTextEdit
- bool GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus = false) override;
+ CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override;
bool LoadWidget() override;
void UpdateWidgetProperty() override;
void OnProcessEvent(CFWL_Event* pEvent) override;
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index 8bfee69578..3ee0a3cbe8 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -43,18 +43,20 @@ const CFWL_App* CXFA_FFWidget::GetFWLApp() {
return GetPageView()->GetDocView()->GetDoc()->GetApp()->GetFWLApp();
}
-void CXFA_FFWidget::GetWidgetRect(CFX_RectF& rtWidget) {
+CFX_RectF CXFA_FFWidget::GetWidgetRect() {
if ((m_dwStatus & XFA_WidgetStatus_RectCached) == 0)
RecacheWidgetRect();
- rtWidget = m_rtWidget;
+ return m_rtWidget;
}
+
CFX_RectF CXFA_FFWidget::RecacheWidgetRect() {
m_dwStatus |= XFA_WidgetStatus_RectCached;
m_rtWidget = GetRect(false);
return m_rtWidget;
}
-void CXFA_FFWidget::GetRectWithoutRotate(CFX_RectF& rtWidget) {
- GetWidgetRect(rtWidget);
+
+CFX_RectF CXFA_FFWidget::GetRectWithoutRotate() {
+ CFX_RectF rtWidget = GetWidgetRect();
FX_FLOAT fValue = 0;
switch (m_pDataAcc->GetRotate()) {
case 90:
@@ -74,7 +76,9 @@ void CXFA_FFWidget::GetRectWithoutRotate(CFX_RectF& rtWidget) {
rtWidget.height = fValue;
break;
}
+ return rtWidget;
}
+
uint32_t CXFA_FFWidget::GetStatus() {
return m_dwStatus;
}
@@ -83,14 +87,10 @@ void CXFA_FFWidget::ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved) {
m_dwStatus = (m_dwStatus & ~dwRemoved) | dwAdded;
}
-bool CXFA_FFWidget::GetBBox(CFX_RectF& rtBox,
- uint32_t dwStatus,
- bool bDrawFocus) {
- if (bDrawFocus)
- return false;
- if (m_pPageView)
- m_pPageView->GetPageViewRect(rtBox);
- return true;
+CFX_RectF CXFA_FFWidget::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
+ if (bDrawFocus || !m_pPageView)
+ return CFX_RectF();
+ return m_pPageView->GetPageViewRect();
}
CXFA_WidgetAcc* CXFA_FFWidget::GetDataAcc() {
@@ -105,24 +105,26 @@ bool CXFA_FFWidget::GetToolTip(CFX_WideString& wsToolTip) {
}
return GetCaptionText(wsToolTip);
}
+
void CXFA_FFWidget::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
- if (!IsMatchVisibleStatus(dwStatus)) {
+ if (!IsMatchVisibleStatus(dwStatus))
return;
- }
+
CXFA_Border border = m_pDataAcc->GetBorder();
- if (border) {
- CFX_RectF rtBorder;
- GetRectWithoutRotate(rtBorder);
- CXFA_Margin margin = border.GetMargin();
- if (margin) {
- XFA_RectWidthoutMargin(rtBorder, margin);
- }
- rtBorder.Normalize();
- DrawBorder(pGS, border, rtBorder, pMatrix);
- }
+ if (!border)
+ return;
+
+ CFX_RectF rtBorder = GetRectWithoutRotate();
+ CXFA_Margin margin = border.GetMargin();
+ if (margin)
+ XFA_RectWidthoutMargin(rtBorder, margin);
+
+ rtBorder.Normalize();
+ DrawBorder(pGS, border, rtBorder, pMatrix);
}
+
bool CXFA_FFWidget::IsLoaded() {
return !!m_pPageView;
}
@@ -146,28 +148,31 @@ void CXFA_FFWidget::DrawBorder(CFX_Graphics* pGS,
uint32_t dwFlags) {
XFA_DrawBox(box, pGS, rtBorder, pMatrix, dwFlags);
}
+
void CXFA_FFWidget::InvalidateWidget(const CFX_RectF* pRect) {
- if (!pRect) {
- CFX_RectF rtWidget;
- GetBBox(rtWidget, XFA_WidgetStatus_Focused);
- rtWidget.Inflate(2, 2);
- GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, rtWidget,
- XFA_INVALIDATE_CurrentPage);
- } else {
+ if (pRect) {
GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, *pRect,
XFA_INVALIDATE_CurrentPage);
+ return;
}
+
+ CFX_RectF rtWidget = GetBBox(XFA_WidgetStatus_Focused);
+ rtWidget.Inflate(2, 2);
+ GetDoc()->GetDocEnvironment()->InvalidateRect(m_pPageView, rtWidget,
+ XFA_INVALIDATE_CurrentPage);
}
+
void CXFA_FFWidget::AddInvalidateRect(const CFX_RectF* pRect) {
CFX_RectF rtWidget;
if (pRect) {
rtWidget = *pRect;
} else {
- GetBBox(rtWidget, XFA_WidgetStatus_Focused);
+ rtWidget = GetBBox(XFA_WidgetStatus_Focused);
rtWidget.Inflate(2, 2);
}
m_pDocView->AddInvalidateRect(m_pPageView, rtWidget);
}
+
bool CXFA_FFWidget::GetCaptionText(CFX_WideString& wsCap) {
CXFA_TextLayout* pCapTextlayout = m_pDataAcc->GetCaptionTextLayout();
if (!pCapTextlayout) {
@@ -312,8 +317,7 @@ bool CXFA_FFWidget::ReplaceSpellCheckWord(CFX_PointF pointf,
return false;
}
void CXFA_FFWidget::Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy) {
- CFX_Matrix mt;
- GetRotateMatrix(mt);
+ CFX_Matrix mt = GetRotateMatrix();
if (mt.IsIdentity()) {
return;
}
@@ -377,20 +381,22 @@ static void XFA_GetMatrix(CFX_Matrix& m,
break;
}
}
-void CXFA_FFWidget::GetRotateMatrix(CFX_Matrix& mt) {
- mt = CFX_Matrix();
+
+CFX_Matrix CXFA_FFWidget::GetRotateMatrix() {
+ CFX_Matrix mt;
int32_t iRotate = m_pDataAcc->GetRotate();
- if (!iRotate) {
- return;
- }
- CFX_RectF rcWidget;
- GetRectWithoutRotate(rcWidget);
+ if (!iRotate)
+ return mt;
+
+ CFX_RectF rcWidget = GetRectWithoutRotate();
XFA_ATTRIBUTEENUM at = XFA_ATTRIBUTEENUM_TopLeft;
XFA_GetMatrix(mt, iRotate, at, rcWidget);
+
+ return mt;
}
+
bool CXFA_FFWidget::IsLayoutRectEmpty() {
- CFX_RectF rtLayout;
- GetRectWithoutRotate(rtLayout);
+ CFX_RectF rtLayout = GetRectWithoutRotate();
return rtLayout.width < 0.1f && rtLayout.height < 0.1f;
}
CXFA_FFWidget* CXFA_FFWidget::GetParent() {
@@ -405,63 +411,45 @@ CXFA_FFWidget* CXFA_FFWidget::GetParent() {
}
return nullptr;
}
+
bool CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) {
- if (!pWidget) {
+ if (!pWidget)
return false;
- }
+
CXFA_Node* pNode = m_pDataAcc->GetNode();
CXFA_Node* pChildNode = pWidget->GetDataAcc()->GetNode();
while (pChildNode) {
- if (pChildNode == pNode) {
+ if (pChildNode == pNode)
return true;
- }
+
pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_Parent);
}
return false;
}
+
bool CXFA_FFWidget::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
- CFX_RectF rtWidget;
- GetWidgetRect(rtWidget);
- if (rtWidget.Contains(fx, fy)) {
- return true;
- }
- return false;
+ return GetWidgetRect().Contains(fx, fy);
}
+
CXFA_FFDocView* CXFA_FFWidget::GetDocView() {
return m_pDocView;
}
+
void CXFA_FFWidget::SetDocView(CXFA_FFDocView* pDocView) {
m_pDocView = pDocView;
}
+
CXFA_FFDoc* CXFA_FFWidget::GetDoc() {
return m_pDocView->GetDoc();
}
+
CXFA_FFApp* CXFA_FFWidget::GetApp() {
return GetDoc()->GetApp();
}
+
IXFA_AppProvider* CXFA_FFWidget::GetAppProvider() {
return GetApp()->GetAppProvider();
}
-void CXFA_FFWidget::GetMinMaxWidth(FX_FLOAT fMinWidth, FX_FLOAT fMaxWidth) {
- fMinWidth = fMaxWidth = 0;
- FX_FLOAT fWidth = 0;
- if (m_pDataAcc->GetWidth(fWidth)) {
- fMinWidth = fMaxWidth = fWidth;
- } else {
- m_pDataAcc->GetMinWidth(fMinWidth);
- m_pDataAcc->GetMaxWidth(fMaxWidth);
- }
-}
-void CXFA_FFWidget::GetMinMaxHeight(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight) {
- fMinHeight = fMaxHeight = 0;
- FX_FLOAT fHeight = 0;
- if (m_pDataAcc->GetHeight(fHeight)) {
- fMinHeight = fMaxHeight = fHeight;
- } else {
- m_pDataAcc->GetMinHeight(fMinHeight);
- m_pDataAcc->GetMaxHeight(fMaxHeight);
- }
-}
bool CXFA_FFWidget::IsMatchVisibleStatus(uint32_t dwStatus) {
return !!(m_dwStatus & XFA_WidgetStatus_Visible);
diff --git a/xfa/fxfa/app/xfa_fwladapter.cpp b/xfa/fxfa/app/xfa_fwladapter.cpp
index 3dfa679c4b..e1f3e202ed 100644
--- a/xfa/fxfa/app/xfa_fwladapter.cpp
+++ b/xfa/fxfa/app/xfa_fwladapter.cpp
@@ -30,10 +30,8 @@ bool CXFA_FWLAdapterWidgetMgr::GetPopupPos(CFWL_Widget* pWidget,
const CFX_RectF& rtAnchor,
CFX_RectF& rtPopup) {
CXFA_FFWidget* pFFWidget = pWidget->GetLayoutItem();
- CFX_Matrix mt;
- pFFWidget->GetRotateMatrix(mt);
CFX_RectF rtRotateAnchor(rtAnchor);
- mt.TransformRect(rtRotateAnchor);
+ pFFWidget->GetRotateMatrix().TransformRect(rtRotateAnchor);
pFFWidget->GetDoc()->GetDocEnvironment()->GetPopupPos(
pFFWidget, fMinHeight, fMaxHeight, rtRotateAnchor, rtPopup);
return true;
diff --git a/xfa/fxfa/app/xfa_rendercontext.cpp b/xfa/fxfa/app/xfa_rendercontext.cpp
index f103b23520..a855105e3d 100644
--- a/xfa/fxfa/app/xfa_rendercontext.cpp
+++ b/xfa/fxfa/app/xfa_rendercontext.cpp
@@ -32,11 +32,10 @@ int32_t CXFA_RenderContext::StartRender(CXFA_FFPageView* pPageView,
m_pGS = pGS;
m_matrix = matrix;
m_options = options;
- CFX_RectF rtPage;
- pGS->GetClipRect(rtPage);
+
CFX_Matrix mtRes;
mtRes.SetReverse(matrix);
- m_rtClipRect = rtPage;
+ m_rtClipRect = pGS->GetClipRect();
mtRes.TransformRect(m_rtClipRect);
m_dwStatus = m_options.m_bHighlight ? XFA_WidgetStatus_Highlight : 0;
uint32_t dwFilterType = XFA_WidgetStatus_Visible |
@@ -52,12 +51,12 @@ int32_t CXFA_RenderContext::DoRender(IFX_Pause* pPause) {
int32_t iCount = 0;
while (m_pWidget) {
CXFA_FFWidget* pWidget = m_pWidget;
- CFX_RectF rtWidgetBox;
- pWidget->GetBBox(rtWidgetBox, XFA_WidgetStatus_Visible);
+ CFX_RectF rtWidgetBox = pWidget->GetBBox(XFA_WidgetStatus_Visible);
rtWidgetBox.width += 1;
rtWidgetBox.height += 1;
if (rtWidgetBox.IntersectWith(m_rtClipRect))
pWidget->RenderWidget(m_pGS, &m_matrix, m_dwStatus);
+
m_pWidget = m_pWidgetIterator->MoveToNext();
iCount++;
if (iCount > kMaxCount && pPause && pPause->NeedToPauseNow())