summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-05-01 21:00:44 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-01 21:00:44 +0000
commit0b0b0b32bc2b03f09b7156b855c626a44703f9c4 (patch)
tree411225574a545e49ae4d883082be6a013460b7c6 /xfa
parent9294ffdf371fbae8c166dd5e3c63955f1d3ab18e (diff)
downloadpdfium-0b0b0b32bc2b03f09b7156b855c626a44703f9c4.tar.xz
Transform rect out param from reference to pointer in XFA code.
Change-Id: Ib5f8b8754bca8198d9122700d7d876b45d1428da Reviewed-on: https://pdfium-review.googlesource.com/31852 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/cfde_texteditengine.cpp2
-rw-r--r--xfa/fde/cfde_textout.cpp34
-rw-r--r--xfa/fde/cfde_textout.h4
-rw-r--r--xfa/fwl/cfwl_checkbox.cpp2
-rw-r--r--xfa/fwl/cfwl_widget.cpp6
-rw-r--r--xfa/fwl/cfwl_widget.h2
-rw-r--r--xfa/fwl/ifwl_themeprovider.h2
-rw-r--r--xfa/fxfa/cxfa_fwltheme.cpp6
-rw-r--r--xfa/fxfa/cxfa_fwltheme.h2
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp2
10 files changed, 31 insertions, 31 deletions
diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp
index 0157b353cf..87dba53158 100644
--- a/xfa/fde/cfde_texteditengine.cpp
+++ b/xfa/fde/cfde_texteditengine.cpp
@@ -246,7 +246,7 @@ size_t CFDE_TextEditEngine::CountCharsExceedingSize(const WideString& text,
for (size_t i = 0; i < num_to_check; i++) {
// This does a lot of string copying ....
// TODO(dsinclair): make CalcLogicSize take a WideStringC instead.
- text_out->CalcLogicSize(WideString(temp), text_rect);
+ text_out->CalcLogicSize(WideString(temp), &text_rect);
if (limit_horizontal_area_ && text_rect.width <= available_width_)
break;
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index ab5f9c0f85..b8049fbe82 100644
--- a/xfa/fde/cfde_textout.cpp
+++ b/xfa/fde/cfde_textout.cpp
@@ -194,32 +194,32 @@ void CFDE_TextOut::SetLineBreakTolerance(float fTolerance) {
m_pTxtBreak->SetLineBreakTolerance(m_fTolerance);
}
-void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_SizeF& size) {
- CFX_RectF rtText(0.0f, 0.0f, size.width, size.height);
- CalcLogicSize(str, rtText);
- size = rtText.Size();
+void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_SizeF* pSize) {
+ CFX_RectF rtText(0.0f, 0.0f, pSize->width, pSize->height);
+ CalcLogicSize(str, &rtText);
+ *pSize = rtText.Size();
}
-void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_RectF& rect) {
+void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_RectF* pRect) {
if (str.IsEmpty()) {
- rect.width = 0.0f;
- rect.height = 0.0f;
+ pRect->width = 0.0f;
+ pRect->height = 0.0f;
return;
}
ASSERT(m_pFont && m_fFontSize >= 1.0f);
if (!m_Styles.single_line_) {
- if (rect.Width() < 1.0f)
- rect.width = m_fFontSize * 1000.0f;
+ if (pRect->Width() < 1.0f)
+ pRect->width = m_fFontSize * 1000.0f;
- m_pTxtBreak->SetLineWidth(rect.Width());
+ m_pTxtBreak->SetLineWidth(pRect->Width());
}
m_iTotalLines = 0;
float fWidth = 0.0f;
float fHeight = 0.0f;
- float fStartPos = rect.right();
+ float fStartPos = pRect->right();
CFX_BreakType dwBreakStatus = CFX_BreakType::None;
bool break_char_is_set = false;
for (const wchar_t& wch : str) {
@@ -237,18 +237,18 @@ void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_RectF& rect) {
RetrieveLineWidth(dwBreakStatus, fStartPos, fWidth, fHeight);
m_pTxtBreak->Reset();
- float fInc = rect.Height() - fHeight;
+ float fInc = pRect->Height() - fHeight;
if (TextAlignmentVerticallyCentered(m_iAlignment))
fInc /= 2.0f;
else if (IsTextAlignmentTop(m_iAlignment))
fInc = 0.0f;
- rect.left += fStartPos;
- rect.top += fInc;
- rect.width = std::min(fWidth, rect.Width());
- rect.height = fHeight;
+ pRect->left += fStartPos;
+ pRect->top += fInc;
+ pRect->width = std::min(fWidth, pRect->Width());
+ pRect->height = fHeight;
if (m_Styles.last_line_height_)
- rect.height -= m_fLineSpace - m_fFontSize;
+ pRect->height -= m_fLineSpace - m_fFontSize;
}
bool CFDE_TextOut::RetrieveLineWidth(CFX_BreakType dwBreakStatus,
diff --git a/xfa/fde/cfde_textout.h b/xfa/fde/cfde_textout.h
index 6e72f8c441..5014d9517c 100644
--- a/xfa/fde/cfde_textout.h
+++ b/xfa/fde/cfde_textout.h
@@ -55,8 +55,8 @@ class CFDE_TextOut {
void SetMatrix(const CFX_Matrix& matrix) { m_Matrix = matrix; }
void SetLineBreakTolerance(float fTolerance);
- void CalcLogicSize(const WideString& str, CFX_SizeF& size);
- void CalcLogicSize(const WideString& str, CFX_RectF& rect);
+ void CalcLogicSize(const WideString& str, CFX_SizeF* pSize);
+ void CalcLogicSize(const WideString& str, CFX_RectF* pRect);
void DrawLogicText(CFX_RenderDevice* device,
const WideStringView& str,
const CFX_RectF& rect);
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index 42b6cadc83..7e78efae63 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -137,7 +137,7 @@ void CFWL_CheckBox::Layout() {
m_rtCaption.height);
CalcTextRect(L"Check box", m_pProperties->m_pThemeProvider, m_dwTTOStyles,
- m_iTTOAlign, rtFocus);
+ m_iTTOAlign, &rtFocus);
m_rtFocus = CFX_RectF(m_rtCaption.TopLeft(),
std::max(m_rtCaption.width, rtFocus.width),
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index c8d0db682a..e891cd1cbb 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -332,7 +332,7 @@ CFX_SizeF CFWL_Widget::CalcTextSize(const WideString& wsText,
calPart.m_iTTOAlign = FDE_TextAlignment::kTopLeft;
float fWidth = bMultiLine ? FWL_WGT_CalcMultiLineDefWidth : FWL_WGT_CalcWidth;
CFX_RectF rect(0, 0, fWidth, FWL_WGT_CalcHeight);
- pTheme->CalcTextRect(&calPart, rect);
+ pTheme->CalcTextRect(&calPart, &rect);
return CFX_SizeF(rect.width, rect.height);
}
@@ -340,13 +340,13 @@ void CFWL_Widget::CalcTextRect(const WideString& wsText,
IFWL_ThemeProvider* pTheme,
const FDE_TextStyle& dwTTOStyles,
FDE_TextAlignment iTTOAlign,
- CFX_RectF& rect) {
+ CFX_RectF* pRect) {
CFWL_ThemeText calPart;
calPart.m_pWidget = this;
calPart.m_wsText = wsText;
calPart.m_dwTTOStyles = dwTTOStyles;
calPart.m_iTTOAlign = iTTOAlign;
- pTheme->CalcTextRect(&calPart, rect);
+ pTheme->CalcTextRect(&calPart, pRect);
}
void CFWL_Widget::SetFocus(bool bFocus) {
diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h
index 66ec0e170c..85f9b768d3 100644
--- a/xfa/fwl/cfwl_widget.h
+++ b/xfa/fwl/cfwl_widget.h
@@ -134,7 +134,7 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
IFWL_ThemeProvider* pTheme,
const FDE_TextStyle& dwTTOStyles,
FDE_TextAlignment iTTOAlign,
- CFX_RectF& rect);
+ CFX_RectF* pRect);
void SetGrab(bool bSet);
void RegisterEventTarget(CFWL_Widget* pEventSource);
void UnregisterEventTarget();
diff --git a/xfa/fwl/ifwl_themeprovider.h b/xfa/fwl/ifwl_themeprovider.h
index eba308597c..78c3e19fe2 100644
--- a/xfa/fwl/ifwl_themeprovider.h
+++ b/xfa/fwl/ifwl_themeprovider.h
@@ -23,7 +23,7 @@ class IFWL_ThemeProvider {
virtual void DrawBackground(CFWL_ThemeBackground* pParams) = 0;
virtual void DrawText(CFWL_ThemeText* pParams) = 0;
- virtual void CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) = 0;
+ virtual void CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF* pRect) = 0;
virtual float GetCXBorderSize() const = 0;
virtual float GetCYBorderSize() const = 0;
virtual CFX_RectF GetUIMargin(CFWL_ThemePart* pThemePart) const = 0;
diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp
index d1739f4e97..94d963d70e 100644
--- a/xfa/fxfa/cxfa_fwltheme.cpp
+++ b/xfa/fxfa/cxfa_fwltheme.cpp
@@ -227,7 +227,7 @@ CFX_SizeF CXFA_FWLTheme::GetSpaceAboveBelow(CFWL_ThemePart* pThemePart) const {
return sizeAboveBelow;
}
-void CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
+void CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF* pRect) {
if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) {
CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget);
if (!pWidget || !pParams || !m_pTextOut)
@@ -238,7 +238,7 @@ void CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);
m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
- m_pTextOut->CalcLogicSize(pParams->m_wsText, rect);
+ m_pTextOut->CalcLogicSize(pParams->m_wsText, pRect);
return;
}
@@ -255,7 +255,7 @@ void CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
- m_pTextOut->CalcLogicSize(pParams->m_wsText, rect);
+ m_pTextOut->CalcLogicSize(pParams->m_wsText, pRect);
}
CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(CFWL_Widget* pWidget) const {
diff --git a/xfa/fxfa/cxfa_fwltheme.h b/xfa/fxfa/cxfa_fwltheme.h
index b8f8ff68be..289bbd4fe5 100644
--- a/xfa/fxfa/cxfa_fwltheme.h
+++ b/xfa/fxfa/cxfa_fwltheme.h
@@ -34,7 +34,7 @@ class CXFA_FWLTheme final : public IFWL_ThemeProvider {
// IFWL_ThemeProvider:
void DrawBackground(CFWL_ThemeBackground* pParams) override;
void DrawText(CFWL_ThemeText* pParams) override;
- void CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) override;
+ void CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF* pRect) override;
float GetCXBorderSize() const override;
float GetCYBorderSize() const override;
CFX_RectF GetUIMargin(CFWL_ThemePart* pThemePart) const override;
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 3399023037..884a7d089c 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -2837,7 +2837,7 @@ void CXFA_Node::CalculateTextContentSize(CXFA_FFDoc* doc, CFX_SizeF& size) {
pTextOut->SetStyles(dwStyles);
}
- layoutData->m_pTextOut->CalcLogicSize(wsText, size);
+ layoutData->m_pTextOut->CalcLogicSize(wsText, &size);
}
bool CXFA_Node::CalculateTextEditAutoSize(CXFA_FFDoc* doc, CFX_SizeF& size) {