summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-12-08 14:05:14 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-08 14:05:14 -0800
commit43ac44cbf52076fd2354d5276c95d5b4b4a06d64 (patch)
tree28670fc2d1ee83358c717fb43ca7bc9301b2480f /xfa/fwl
parent53ed03d9d865c312fdaa4434b83ed60619881226 (diff)
downloadpdfium-43ac44cbf52076fd2354d5276c95d5b4b4a06d64.tar.xz
Cleanup CFWL_Widget code to return CFX_RectFs where appropriate
This Cl changes the various Get*Rect methods in CFWL_Widget to return CFX_RectF classes instead of taking an out parameter. The Repaint method is split into Repaint() and RepaintRect() in order to change the param to a const CFX_RectF& from a CFX_RectF*. Review-Url: https://codereview.chromium.org/2560873005
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/cfwl_caret.cpp2
-rw-r--r--xfa/fwl/cfwl_checkbox.cpp16
-rw-r--r--xfa/fwl/cfwl_combobox.cpp24
-rw-r--r--xfa/fwl/cfwl_comboedit.cpp2
-rw-r--r--xfa/fwl/cfwl_combolist.cpp4
-rw-r--r--xfa/fwl/cfwl_datetimeedit.cpp2
-rw-r--r--xfa/fwl/cfwl_datetimepicker.cpp26
-rw-r--r--xfa/fwl/cfwl_edit.cpp29
-rw-r--r--xfa/fwl/cfwl_form.cpp17
-rw-r--r--xfa/fwl/cfwl_form.h2
-rw-r--r--xfa/fwl/cfwl_listbox.cpp12
-rw-r--r--xfa/fwl/cfwl_monthcalendar.cpp20
-rw-r--r--xfa/fwl/cfwl_picturebox.cpp2
-rw-r--r--xfa/fwl/cfwl_pushbutton.cpp12
-rw-r--r--xfa/fwl/cfwl_scrollbar.cpp12
-rw-r--r--xfa/fwl/cfwl_spinbutton.cpp22
-rw-r--r--xfa/fwl/cfwl_widget.cpp65
-rw-r--r--xfa/fwl/cfwl_widget.h9
-rw-r--r--xfa/fwl/cfwl_widgetmgr.cpp19
-rw-r--r--xfa/fwl/cfwl_widgetmgr.h2
20 files changed, 138 insertions, 161 deletions
diff --git a/xfa/fwl/cfwl_caret.cpp b/xfa/fwl/cfwl_caret.cpp
index fdac8ec040..4a95b0924b 100644
--- a/xfa/fwl/cfwl_caret.cpp
+++ b/xfa/fwl/cfwl_caret.cpp
@@ -108,5 +108,5 @@ void CFWL_Caret::Timer::Run(CFWL_TimerInfo* pTimerInfo) {
CFX_RectF rt = pCaret->GetWidgetRect();
rt.Set(0, 0, rt.width + 1, rt.height);
- pCaret->Repaint(&rt);
+ pCaret->RepaintRect(rt);
}
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index 2e37548954..3f8ca905c3 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -120,7 +120,7 @@ void CFWL_CheckBox::SetCheckState(int32_t iCheck) {
default:
break;
}
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_CheckBox::Layout() {
@@ -128,7 +128,7 @@ void CFWL_CheckBox::Layout() {
FXSYS_round(m_pProperties->m_rtWidget.width);
m_pProperties->m_rtWidget.height =
FXSYS_round(m_pProperties->m_rtWidget.height);
- GetClientRect(m_rtClient);
+ m_rtClient = GetClientRect();
FX_FLOAT fBoxTop = m_rtClient.top;
FX_FLOAT fClientBottom = m_rtClient.bottom();
@@ -287,7 +287,7 @@ void CFWL_CheckBox::NextStates() {
pCheckBox->SetCheckState(0);
CFX_RectF rt = pCheckBox->GetWidgetRect();
rt.left = rt.top = 0;
- m_pWidgetMgr->RepaintWidget(pCheckBox, &rt);
+ m_pWidgetMgr->RepaintWidget(pCheckBox, rt);
break;
}
}
@@ -311,7 +311,7 @@ void CFWL_CheckBox::NextStates() {
}
}
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
if (dwFirststate == m_pProperties->m_dwStates)
return;
@@ -374,7 +374,7 @@ void CFWL_CheckBox::OnFocusChanged(bool bSet) {
else
m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_CheckBox::OnLButtonDown() {
@@ -386,7 +386,7 @@ void CFWL_CheckBox::OnLButtonDown() {
m_bBtnDown = true;
m_pProperties->m_dwStates &= ~FWL_STATE_CKB_Hovered;
m_pProperties->m_dwStates |= FWL_STATE_CKB_Pressed;
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_CheckBox::OnLButtonUp(CFWL_MessageMouse* pMsg) {
@@ -436,7 +436,7 @@ void CFWL_CheckBox::OnMouseMove(CFWL_MessageMouse* pMsg) {
}
}
if (bRepaint)
- Repaint(&m_rtBox);
+ RepaintRect(m_rtBox);
}
void CFWL_CheckBox::OnMouseLeave() {
@@ -445,7 +445,7 @@ void CFWL_CheckBox::OnMouseLeave() {
else
m_pProperties->m_dwStates &= ~FWL_STATE_CKB_Hovered;
- Repaint(&m_rtBox);
+ RepaintRect(m_rtBox);
}
void CFWL_CheckBox::OnKeyDown(CFWL_MessageKey* pMsg) {
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index 83c3d4a1d9..eb6bb632cd 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -400,7 +400,7 @@ void CFWL_ComboBox::Layout() {
if (m_pWidgetMgr->IsFormDisabled())
return DisForm_Layout();
- GetClientRect(m_rtClient);
+ m_rtClient = GetClientRect();
FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>(
GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
if (!pFWidth)
@@ -504,7 +504,7 @@ void CFWL_ComboBox::ResetListItemAlignment() {
void CFWL_ComboBox::ProcessSelChanged(bool bLButtonUp) {
m_iCurSel = m_pListBox->GetItemIndex(this, m_pListBox->GetSelItem(0));
if (!IsDropDownStyle()) {
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
return;
}
@@ -614,7 +614,7 @@ void CFWL_ComboBox::DisForm_ShowDropList(bool bActivate) {
CFX_RectF rect = m_pListBox->GetWidgetRect();
rect.Inflate(2, 2);
- Repaint(&rect);
+ RepaintRect(rect);
}
void CFWL_ComboBox::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded,
@@ -709,7 +709,7 @@ CFX_RectF CFWL_ComboBox::DisForm_GetBBox() const {
}
void CFWL_ComboBox::DisForm_Layout() {
- GetClientRect(m_rtClient);
+ m_rtClient = GetClientRect();
m_rtContent = m_rtClient;
FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>(
GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
@@ -822,13 +822,13 @@ void CFWL_ComboBox::OnFocusChanged(CFWL_Message* pMsg, bool bSet) {
return;
}
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
return;
}
m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
if (!IsDropDownStyle() || pMsg->m_pDstTarget == m_pListBox.get()) {
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
return;
}
if (!m_pEdit)
@@ -851,11 +851,11 @@ void CFWL_ComboBox::OnLButtonDown(CFWL_MessageMouse* pMsg) {
m_bLButtonDown = true;
m_iBtnState = CFWL_PartState_Pressed;
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
ShowDropList(true);
m_iBtnState = CFWL_PartState_Normal;
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_ComboBox::OnLButtonUp(CFWL_MessageMouse* pMsg) {
@@ -865,7 +865,7 @@ void CFWL_ComboBox::OnLButtonUp(CFWL_MessageMouse* pMsg) {
else
m_iBtnState = CFWL_PartState_Normal;
- Repaint(&m_rtBtn);
+ RepaintRect(m_rtBtn);
}
void CFWL_ComboBox::OnMouseMove(CFWL_MessageMouse* pMsg) {
@@ -879,7 +879,7 @@ void CFWL_ComboBox::OnMouseMove(CFWL_MessageMouse* pMsg) {
if ((iOldState != m_iBtnState) &&
!((m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) ==
FWL_WGTSTATE_Disabled)) {
- Repaint(&m_rtBtn);
+ RepaintRect(m_rtBtn);
}
}
@@ -888,7 +888,7 @@ void CFWL_ComboBox::OnMouseLeave(CFWL_MessageMouse* pMsg) {
!((m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) ==
FWL_WGTSTATE_Disabled)) {
m_iBtnState = CFWL_PartState_Normal;
- Repaint(&m_rtBtn);
+ RepaintRect(m_rtBtn);
}
}
@@ -935,7 +935,7 @@ void CFWL_ComboBox::DoSubCtrlKey(CFWL_MessageKey* pMsg) {
if (bDropDown && m_pEdit)
SyncEditText(m_iCurSel);
else
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
return;
}
diff --git a/xfa/fwl/cfwl_comboedit.cpp b/xfa/fwl/cfwl_comboedit.cpp
index 5981fd79b4..22ad6bff32 100644
--- a/xfa/fwl/cfwl_comboedit.cpp
+++ b/xfa/fwl/cfwl_comboedit.cpp
@@ -23,7 +23,7 @@ CFWL_ComboEdit::CFWL_ComboEdit(
void CFWL_ComboEdit::ClearSelected() {
ClearSelections();
- Repaint(&GetRTClient());
+ RepaintRect(GetRTClient());
}
void CFWL_ComboEdit::SetSelected() {
diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp
index 4ec3abe072..1fa9acb68e 100644
--- a/xfa/fwl/cfwl_combolist.cpp
+++ b/xfa/fwl/cfwl_combolist.cpp
@@ -62,7 +62,7 @@ void CFWL_ComboList::ChangeSelected(int32_t iSel) {
SetSelItem(hSel, true);
}
if (!rtInvalidate.IsEmpty())
- Repaint(&rtInvalidate);
+ RepaintRect(rtInvalidate);
}
void CFWL_ComboList::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) {
@@ -236,7 +236,7 @@ void CFWL_ComboList::OnDropListKeyDown(CFWL_MessageKey* pKey) {
CFX_RectF rtInvalidate;
rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width,
m_pProperties->m_rtWidget.height);
- Repaint(&rtInvalidate);
+ RepaintRect(rtInvalidate);
break;
}
default:
diff --git a/xfa/fwl/cfwl_datetimeedit.cpp b/xfa/fwl/cfwl_datetimeedit.cpp
index 869f08ad33..f1ddbb1afb 100644
--- a/xfa/fwl/cfwl_datetimeedit.cpp
+++ b/xfa/fwl/cfwl_datetimeedit.cpp
@@ -53,7 +53,7 @@ void CFWL_DateTimeEdit::DisForm_OnProcessMessage(CFWL_Message* pMessage) {
CFX_RectF rtInvalidate = pDateTime->GetWidgetRect();
pDateTime->ShowMonthCalendar(false);
rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top);
- pDateTime->Repaint(&rtInvalidate);
+ pDateTime->RepaintRect(rtInvalidate);
}
}
CFWL_Edit::OnProcessMessage(pMessage);
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index 8bc17f3c57..fe7b90307b 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -77,7 +77,7 @@ void CFWL_DateTimePicker::Update() {
m_pProperties->m_pThemeProvider = GetAvailableTheme();
m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider);
- GetClientRect(m_rtClient);
+ m_rtClient = GetClientRect();
FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>(
GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
if (!pFWidth)
@@ -172,7 +172,7 @@ void CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) {
return;
m_pEdit->SetText(wsText);
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
CFWL_Event ev(CFWL_Event::Type::EditChanged);
DispatchEvent(&ev);
@@ -327,7 +327,7 @@ void CFWL_DateTimePicker::ProcessSelChanged(int32_t iYear,
FormatDateString(m_iYear, m_iMonth, m_iDay, wsText);
m_pEdit->SetText(wsText);
m_pEdit->Update();
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
CFWL_EventSelectChanged ev(this);
ev.iYear = m_iYear;
@@ -393,7 +393,7 @@ void CFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) {
CFX_RectF rtCal = m_pMonthCal->GetWidgetRect();
rtInvalidate.Union(rtCal);
rtInvalidate.Inflate(2, 2);
- Repaint(&rtInvalidate);
+ RepaintRect(rtInvalidate);
}
FWL_WidgetHit CFWL_DateTimePicker::DisForm_HitTest(FX_FLOAT fx,
@@ -427,7 +427,7 @@ void CFWL_DateTimePicker::DisForm_Update() {
m_pProperties->m_pThemeProvider = GetAvailableTheme();
m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider);
- GetClientRect(m_rtClient);
+ m_rtClient = GetClientRect();
m_pEdit->SetWidgetRect(m_rtClient);
ResetEditAlignment();
m_pEdit->Update();
@@ -543,15 +543,15 @@ void CFWL_DateTimePicker::OnFocusChanged(CFWL_Message* pMsg, bool bSet) {
if (bSet) {
m_pProperties->m_dwStates |= (FWL_WGTSTATE_Focused);
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
} else {
m_pProperties->m_dwStates &= ~(FWL_WGTSTATE_Focused);
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
if (pMsg->m_pSrcTarget == m_pMonthCal.get() && IsMonthCalendarVisible()) {
ShowMonthCalendar(false);
}
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_DateTimePicker::OnLButtonDown(CFWL_MessageMouse* pMsg) {
@@ -570,7 +570,7 @@ void CFWL_DateTimePicker::OnLButtonDown(CFWL_MessageMouse* pMsg) {
ShowMonthCalendar(true);
m_bLBtnDown = true;
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_DateTimePicker::OnLButtonUp(CFWL_MessageMouse* pMsg) {
@@ -582,20 +582,20 @@ void CFWL_DateTimePicker::OnLButtonUp(CFWL_MessageMouse* pMsg) {
m_iBtnState = CFWL_PartState_Hovered;
else
m_iBtnState = CFWL_PartState_Normal;
- Repaint(&m_rtBtn);
+ RepaintRect(m_rtBtn);
}
void CFWL_DateTimePicker::OnMouseMove(CFWL_MessageMouse* pMsg) {
if (!m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy))
m_iBtnState = CFWL_PartState_Normal;
- Repaint(&m_rtBtn);
+ RepaintRect(m_rtBtn);
}
void CFWL_DateTimePicker::OnMouseLeave(CFWL_MessageMouse* pMsg) {
if (!pMsg)
return;
m_iBtnState = CFWL_PartState_Normal;
- Repaint(&m_rtBtn);
+ RepaintRect(m_rtBtn);
}
void CFWL_DateTimePicker::DisForm_OnFocusChanged(CFWL_Message* pMsg,
@@ -621,5 +621,5 @@ void CFWL_DateTimePicker::DisForm_OnFocusChanged(CFWL_Message* pMsg,
}
}
rtInvalidate.Inflate(2, 2);
- Repaint(&rtInvalidate);
+ RepaintRect(rtInvalidate);
}
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 321303942e..913f08d7b9 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -429,7 +429,7 @@ void CFWL_Edit::OnCaretChanged() {
if (bRepaintContent || bRepaintScroll) {
if (bRepaintContent)
rtInvalid.Union(m_rtEngine);
- Repaint(&rtInvalid);
+ RepaintRect(rtInvalid);
}
}
@@ -437,21 +437,16 @@ void CFWL_Edit::OnTextChanged(const FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_VAlignMask)
UpdateVAlignment();
- CFX_RectF rtTemp;
- GetClientRect(rtTemp);
-
CFWL_EventTextChanged event(this);
event.wsPrevText = ChangeInfo.wsPrevText;
DispatchEvent(&event);
LayoutScrollBar();
- Repaint(&rtTemp);
+ RepaintRect(GetClientRect());
}
void CFWL_Edit::OnSelChanged() {
- CFX_RectF rtTemp;
- GetClientRect(rtTemp);
- Repaint(&rtTemp);
+ RepaintRect(GetClientRect());
}
bool CFWL_Edit::OnPageLoad(int32_t nPageIndex) {
@@ -863,10 +858,8 @@ void CFWL_Edit::UpdateCaret() {
CFX_RectF rtCaret;
rtCaret.Set(rtFDE.left, rtFDE.top, rtFDE.width, rtFDE.height);
- CFX_RectF rtClient;
- GetClientRect(rtClient);
+ CFX_RectF rtClient = GetClientRect();
rtCaret.Intersect(rtClient);
-
if (rtCaret.left > rtClient.right()) {
FX_FLOAT right = rtCaret.right();
rtCaret.left = rtClient.right() - 1;
@@ -990,7 +983,7 @@ int32_t CFWL_Edit::AddDoRecord(std::unique_ptr<IFDE_TxtEdtDoRecord> pRecord) {
}
void CFWL_Edit::Layout() {
- GetClientRect(m_rtClient);
+ m_rtClient = GetClientRect();
m_rtEngine = m_rtClient;
FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>(
GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
@@ -1162,7 +1155,7 @@ void CFWL_Edit::ShowCaret(CFX_RectF* pRect) {
m_pCaret->ShowCaret();
if (!pRect->IsEmpty())
m_pCaret->SetWidgetRect(*pRect);
- Repaint(&m_rtEngine);
+ RepaintRect(m_rtEngine);
return;
}
@@ -1196,7 +1189,7 @@ void CFWL_Edit::ShowCaret(CFX_RectF* pRect) {
void CFWL_Edit::HideCaret(CFX_RectF* pRect) {
if (m_pCaret) {
m_pCaret->HideCaret();
- Repaint(&m_rtEngine);
+ RepaintRect(m_rtEngine);
return;
}
@@ -1391,7 +1384,7 @@ void CFWL_Edit::OnFocusChanged(CFWL_Message* pMsg, bool bSet) {
CFX_RectF rtInvalidate;
rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width,
m_pProperties->m_rtWidget.height);
- Repaint(&rtInvalidate);
+ RepaintRect(rtInvalidate);
}
void CFWL_Edit::OnLButtonDown(CFWL_MessageMouse* pMsg) {
@@ -1417,7 +1410,7 @@ void CFWL_Edit::OnLButtonDown(CFWL_MessageMouse* pMsg) {
m_nSelStart = nIndex;
}
if (bRepaint)
- Repaint(&m_rtEngine);
+ RepaintRect(m_rtEngine);
}
void CFWL_Edit::OnLButtonUp(CFWL_MessageMouse* pMsg) {
@@ -1439,7 +1432,7 @@ void CFWL_Edit::OnButtonDblClk(CFWL_MessageMouse* pMsg) {
m_EdtEngine.AddSelRange(nIndex, nCount);
m_EdtEngine.SetCaretPos(nIndex + nCount - 1, false);
- Repaint(&m_rtEngine);
+ RepaintRect(m_rtEngine);
}
void CFWL_Edit::OnMouseMove(CFWL_MessageMouse* pMsg) {
@@ -1639,6 +1632,6 @@ bool CFWL_Edit::OnScroll(CFWL_ScrollBar* pScrollBar,
CFX_RectF rect = GetWidgetRect();
CFX_RectF rtInvalidate;
rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2);
- Repaint(&rtInvalidate);
+ RepaintRect(rtInvalidate);
return true;
}
diff --git a/xfa/fwl/cfwl_form.cpp b/xfa/fwl/cfwl_form.cpp
index 624957163f..4d978a503a 100644
--- a/xfa/fwl/cfwl_form.cpp
+++ b/xfa/fwl/cfwl_form.cpp
@@ -80,9 +80,10 @@ bool CFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const {
return CFWL_Widget::IsInstance(wsClass);
}
-void CFWL_Form::GetClientRect(CFX_RectF& rect) {
- rect = m_pProperties->m_rtWidget;
+CFX_RectF CFWL_Form::GetClientRect() {
+ CFX_RectF rect = m_pProperties->m_rtWidget;
rect.Offset(-rect.left, -rect.top);
+ return rect;
}
void CFWL_Form::Update() {
@@ -384,11 +385,11 @@ void CFWL_Form::SetWorkAreaRect() {
return;
m_bSetMaximize = true;
- Repaint(&m_rtRelative);
+ RepaintRect(m_rtRelative);
}
void CFWL_Form::Layout() {
- GetRelativeRect(m_rtRelative);
+ m_rtRelative = GetRelativeRect();
#ifndef FWL_UseMacSystemBorder
ResetSysBtn();
@@ -519,7 +520,7 @@ void CFWL_Form::OnLButtonDown(CFWL_MessageMouse* pMsg) {
return;
pPressBtn->SetPressed();
- Repaint(&pPressBtn->m_rtBtn);
+ RepaintRect(pPressBtn->m_rtBtn);
}
void CFWL_Form::OnLButtonUp(CFWL_MessageMouse* pMsg) {
@@ -535,7 +536,7 @@ void CFWL_Form::OnLButtonUp(CFWL_MessageMouse* pMsg) {
if (m_bMaximized) {
SetWidgetRect(m_rtRestore);
Update();
- Repaint(nullptr);
+ Repaint();
} else {
SetWorkAreaRect();
Update();
@@ -598,7 +599,7 @@ void CFWL_Form::OnMouseMove(CFWL_MessageMouse* pMsg) {
#endif
if (!rtInvalidate.IsEmpty())
- Repaint(&rtInvalidate);
+ RepaintRect(rtInvalidate);
}
void CFWL_Form::OnMouseLeave(CFWL_MessageMouse* pMsg) {
@@ -607,7 +608,7 @@ void CFWL_Form::OnMouseLeave(CFWL_MessageMouse* pMsg) {
return;
pHover->SetNormal();
- Repaint(&pHover->m_rtBtn);
+ RepaintRect(pHover->m_rtBtn);
}
void CFWL_Form::OnLButtonDblClk(CFWL_MessageMouse* pMsg) {
diff --git a/xfa/fwl/cfwl_form.h b/xfa/fwl/cfwl_form.h
index 725e82b46e..e894784b09 100644
--- a/xfa/fwl/cfwl_form.h
+++ b/xfa/fwl/cfwl_form.h
@@ -43,7 +43,7 @@ class CFWL_Form : public CFWL_Widget {
// CFWL_Widget
FWL_Type GetClassID() const override;
bool IsInstance(const CFX_WideStringC& wsClass) const override;
- void GetClientRect(CFX_RectF& rect) override;
+ CFX_RectF GetClientRect() override;
void Update() override;
FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index c126e5afb5..fafb61f4d2 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -385,7 +385,7 @@ bool CFWL_ListBox::ScrollToVisible(CFWL_ListItem* pItem) {
m_pVertScrollBar->SetPos(fPosY);
m_pVertScrollBar->SetTrackPos(fPosY);
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
return true;
}
@@ -554,7 +554,7 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) {
if (!m_pProperties->m_pThemeProvider)
return fs;
- GetClientRect(m_rtClient);
+ m_rtClient = GetClientRect();
m_rtConent = m_rtClient;
CFX_RectF rtUIMargin;
rtUIMargin.Set(0, 0, 0, 0);
@@ -841,7 +841,7 @@ void CFWL_ListBox::OnFocusChanged(CFWL_Message* pMsg, bool bSet) {
else
m_pProperties->m_dwStates &= ~(FWL_WGTSTATE_Focused);
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_ListBox::OnLButtonDown(CFWL_MessageMouse* pMsg) {
@@ -883,7 +883,7 @@ void CFWL_ListBox::OnLButtonDown(CFWL_MessageMouse* pMsg) {
SetFocusItem(pItem);
ScrollToVisible(pItem);
SetGrab(true);
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_ListBox::OnLButtonUp(CFWL_MessageMouse* pMsg) {
@@ -945,7 +945,7 @@ void CFWL_ListBox::OnVK(CFWL_ListItem* pItem, bool bShift, bool bCtrl) {
CFX_RectF rtInvalidate;
rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width,
m_pProperties->m_rtWidget.height);
- Repaint(&rtInvalidate);
+ RepaintRect(rtInvalidate);
}
bool CFWL_ListBox::OnScroll(CFWL_ScrollBar* pScrollBar,
@@ -998,7 +998,7 @@ bool CFWL_ListBox::OnScroll(CFWL_ScrollBar* pScrollBar,
if (iCurPos != fPos) {
pScrollBar->SetPos(fPos);
pScrollBar->SetTrackPos(fPos);
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
return true;
}
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp
index 94d198599d..c93ee04491 100644
--- a/xfa/fwl/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/cfwl_monthcalendar.cpp
@@ -601,7 +601,7 @@ void CFWL_MonthCalendar::CalcTodaySize() {
}
void CFWL_MonthCalendar::Layout() {
- GetClientRect(m_rtClient);
+ m_rtClient = GetClientRect();
m_rtHead.Set(
m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, m_rtClient.top,
@@ -934,15 +934,15 @@ void CFWL_MonthCalendar::OnLButtonDown(CFWL_MessageMouse* pMsg) {
if (m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
m_iLBtnPartStates = CFWL_PartState_Pressed;
PrevMonth();
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
} else if (m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
m_iRBtnPartStates |= CFWL_PartState_Pressed;
NextMonth();
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
} else if (m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) {
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) == 0) {
JumpToToday();
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
} else {
CFWL_DateTimePicker* pIPicker = static_cast<CFWL_DateTimePicker*>(m_pOuter);
@@ -957,12 +957,12 @@ void CFWL_MonthCalendar::OnLButtonUp(CFWL_MessageMouse* pMsg) {
if (m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
m_iLBtnPartStates = 0;
- Repaint(&m_rtLBtn);
+ RepaintRect(m_rtLBtn);
return;
}
if (m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
m_iRBtnPartStates = 0;
- Repaint(&m_rtRBtn);
+ RepaintRect(m_rtRBtn);
return;
}
if (m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy))
@@ -998,12 +998,12 @@ void CFWL_MonthCalendar::OnLButtonUp(CFWL_MessageMouse* pMsg) {
void CFWL_MonthCalendar::DisForm_OnLButtonUp(CFWL_MessageMouse* pMsg) {
if (m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
m_iLBtnPartStates = 0;
- Repaint(&(m_rtLBtn));
+ RepaintRect(m_rtLBtn);
return;
}
if (m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
m_iRBtnPartStates = 0;
- Repaint(&(m_rtRBtn));
+ RepaintRect(m_rtRBtn);
return;
}
if (m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy))
@@ -1060,7 +1060,7 @@ void CFWL_MonthCalendar::OnMouseMove(CFWL_MessageMouse* pMsg) {
m_iHovered = -1;
}
if (bRepaint && !rtInvalidate.IsEmpty())
- Repaint(&rtInvalidate);
+ RepaintRect(rtInvalidate);
}
void CFWL_MonthCalendar::OnMouseLeave(CFWL_MessageMouse* pMsg) {
@@ -1072,7 +1072,7 @@ void CFWL_MonthCalendar::OnMouseLeave(CFWL_MessageMouse* pMsg) {
GetDayRect(m_iHovered, rtInvalidate);
m_iHovered = -1;
if (!rtInvalidate.IsEmpty())
- Repaint(&rtInvalidate);
+ RepaintRect(rtInvalidate);
}
CFWL_MonthCalendar::DATEINFO::DATEINFO(int32_t day,
diff --git a/xfa/fwl/cfwl_picturebox.cpp b/xfa/fwl/cfwl_picturebox.cpp
index b62aac942e..9c1f033a77 100644
--- a/xfa/fwl/cfwl_picturebox.cpp
+++ b/xfa/fwl/cfwl_picturebox.cpp
@@ -29,7 +29,7 @@ void CFWL_PictureBox::Update() {
if (!m_pProperties->m_pThemeProvider)
m_pProperties->m_pThemeProvider = GetAvailableTheme();
- GetClientRect(m_rtClient);
+ m_rtClient = GetClientRect();
}
void CFWL_PictureBox::DrawWidget(CFX_Graphics* pGraphics,
diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp
index 4e5ab8baf6..a1566bdad2 100644
--- a/xfa/fwl/cfwl_pushbutton.cpp
+++ b/xfa/fwl/cfwl_pushbutton.cpp
@@ -50,7 +50,7 @@ void CFWL_PushButton::Update() {
m_pProperties->m_pThemeProvider = GetAvailableTheme();
UpdateTextOutStyles();
- GetClientRect(m_rtClient);
+ m_rtClient = GetClientRect();
m_rtCaption = m_rtClient;
FX_FLOAT* fcaption =
static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::Margin));
@@ -208,7 +208,7 @@ void CFWL_PushButton::OnFocusChanged(CFWL_Message* pMsg, bool bSet) {
else
m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_PushButton::OnLButtonDown(CFWL_MessageMouse* pMsg) {
@@ -218,7 +218,7 @@ void CFWL_PushButton::OnLButtonDown(CFWL_MessageMouse* pMsg) {
m_bBtnDown = true;
m_pProperties->m_dwStates |= FWL_STATE_PSB_Hovered;
m_pProperties->m_dwStates |= FWL_STATE_PSB_Pressed;
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_PushButton::OnLButtonUp(CFWL_MessageMouse* pMsg) {
@@ -234,7 +234,7 @@ void CFWL_PushButton::OnLButtonUp(CFWL_MessageMouse* pMsg) {
CFWL_Event wmClick(CFWL_Event::Type::Click, this);
DispatchEvent(&wmClick);
}
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_PushButton::OnMouseMove(CFWL_MessageMouse* pMsg) {
@@ -268,14 +268,14 @@ void CFWL_PushButton::OnMouseMove(CFWL_MessageMouse* pMsg) {
}
}
if (bRepaint)
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_PushButton::OnMouseLeave(CFWL_MessageMouse* pMsg) {
m_bBtnDown = false;
m_pProperties->m_dwStates &= ~FWL_STATE_PSB_Hovered;
m_pProperties->m_dwStates &= ~FWL_STATE_PSB_Pressed;
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_PushButton::OnKeyDown(CFWL_MessageKey* pMsg) {
diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp
index d6124c6515..a8e4447263 100644
--- a/xfa/fwl/cfwl_scrollbar.cpp
+++ b/xfa/fwl/cfwl_scrollbar.cpp
@@ -157,7 +157,7 @@ void CFWL_ScrollBar::Layout() {
part.m_pWidget = this;
m_fMinThumb = *static_cast<FX_FLOAT*>(
pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Size));
- GetClientRect(m_rtClient);
+ m_rtClient = GetClientRect();
CalcButtonLen();
CalcMinButtonRect(m_rtMinBtn);
CalcMaxButtonRect(m_rtMaxBtn);
@@ -433,7 +433,7 @@ void CFWL_ScrollBar::DoMouseDown(int32_t iItem,
return;
iState = CFWL_PartState_Pressed;
- Repaint(&rtItem);
+ RepaintRect(rtItem);
}
void CFWL_ScrollBar::DoMouseUp(int32_t iItem,
@@ -447,7 +447,7 @@ void CFWL_ScrollBar::DoMouseUp(int32_t iItem,
return;
iState = iNewState;
- Repaint(&rtItem);
+ RepaintRect(rtItem);
OnScroll(CFWL_EventScroll::Code::EndScroll, m_fTrackPos);
}
@@ -463,7 +463,7 @@ void CFWL_ScrollBar::DoMouseMove(int32_t iItem,
return;
iState = iNewState;
- Repaint(&rtItem);
+ RepaintRect(rtItem);
} else if ((2 == iItem) && (m_iThumbButtonState == CFWL_PartState_Pressed)) {
FX_FLOAT fPos = GetTrackPointPos(fx, fy);
m_fTrackPos = fPos;
@@ -478,7 +478,7 @@ void CFWL_ScrollBar::DoMouseLeave(int32_t iItem,
return;
iState = CFWL_PartState_Normal;
- Repaint(&rtItem);
+ RepaintRect(rtItem);
}
void CFWL_ScrollBar::DoMouseHover(int32_t iItem,
@@ -488,7 +488,7 @@ void CFWL_ScrollBar::DoMouseHover(int32_t iItem,
return;
iState = CFWL_PartState_Hovered;
- Repaint(&rtItem);
+ RepaintRect(rtItem);
}
CFWL_ScrollBar::Timer::Timer(CFWL_ScrollBar* pToolTip) : CFWL_Timer(pToolTip) {}
diff --git a/xfa/fwl/cfwl_spinbutton.cpp b/xfa/fwl/cfwl_spinbutton.cpp
index 1c6662e702..bda168f8d0 100644
--- a/xfa/fwl/cfwl_spinbutton.cpp
+++ b/xfa/fwl/cfwl_spinbutton.cpp
@@ -50,7 +50,7 @@ void CFWL_SpinButton::Update() {
if (IsLocked())
return;
- GetClientRect(m_rtClient);
+ m_rtClient = GetClientRect();
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXE_SPB_Vert) {
m_rtUpButton.Set(m_rtClient.top, m_rtClient.left, m_rtClient.width,
m_rtClient.height / 2);
@@ -69,12 +69,8 @@ FWL_WidgetHit CFWL_SpinButton::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
return FWL_WidgetHit::Client;
if (HasBorder() && (m_rtClient.Contains(fx, fy)))
return FWL_WidgetHit::Border;
- if (HasEdge()) {
- CFX_RectF rtEdge;
- GetEdgeRect(rtEdge);
- if (rtEdge.Contains(fx, fy))
- return FWL_WidgetHit::Left;
- }
+ if (HasEdge() && GetEdgeRect().Contains(fx, fy))
+ return FWL_WidgetHit::Left;
if (m_rtUpButton.Contains(fx, fy))
return FWL_WidgetHit::UpButton;
if (m_rtDnButton.Contains(fx, fy))
@@ -199,7 +195,7 @@ void CFWL_SpinButton::OnFocusChanged(CFWL_Message* pMsg, bool bSet) {
else
m_pProperties->m_dwStates &= ~(FWL_WGTSTATE_Focused);
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_SpinButton::OnLButtonDown(CFWL_MessageMouse* pMsg) {
@@ -225,7 +221,7 @@ void CFWL_SpinButton::OnLButtonDown(CFWL_MessageMouse* pMsg) {
CFWL_Event wmPosChanged(CFWL_Event::Type::Click, this);
DispatchEvent(&wmPosChanged);
- Repaint(bUpPress ? &m_rtUpButton : &m_rtDnButton);
+ RepaintRect(bUpPress ? m_rtUpButton : m_rtDnButton);
m_pTimerInfo = m_Timer.StartTimer(kElapseTime, true);
}
@@ -252,7 +248,7 @@ void CFWL_SpinButton::OnLButtonUp(CFWL_MessageMouse* pMsg) {
rtInvalidate = m_rtDnButton;
}
if (bRepaint)
- Repaint(&rtInvalidate);
+ RepaintRect(rtInvalidate);
}
void CFWL_SpinButton::OnMouseMove(CFWL_MessageMouse* pMsg) {
@@ -316,7 +312,7 @@ void CFWL_SpinButton::OnMouseMove(CFWL_MessageMouse* pMsg) {
}
}
if (bRepaint)
- Repaint(&rtInvlidate);
+ RepaintRect(rtInvlidate);
}
void CFWL_SpinButton::OnMouseLeave(CFWL_MessageMouse* pMsg) {
@@ -327,7 +323,7 @@ void CFWL_SpinButton::OnMouseLeave(CFWL_MessageMouse* pMsg) {
if (m_dwDnState != CFWL_PartState_Normal && IsDownButtonEnabled())
m_dwDnState = CFWL_PartState_Normal;
- Repaint(&m_rtClient);
+ RepaintRect(m_rtClient);
}
void CFWL_SpinButton::OnKeyDown(CFWL_MessageKey* pMsg) {
@@ -346,7 +342,7 @@ void CFWL_SpinButton::OnKeyDown(CFWL_MessageKey* pMsg) {
CFWL_Event wmPosChanged(CFWL_Event::Type::Click, this);
DispatchEvent(&wmPosChanged);
- Repaint(bUpEnable ? &m_rtUpButton : &m_rtDnButton);
+ RepaintRect(bUpEnable ? m_rtUpButton : m_rtDnButton);
}
CFWL_SpinButton::Timer::Timer(CFWL_SpinButton* pToolTip)
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index 4da576423a..071e0ded8d 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -92,12 +92,13 @@ void CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
m_pWidgetMgr->SetWidgetRect_Native(this, rect);
}
-void CFWL_Widget::GetClientRect(CFX_RectF& rect) {
- GetEdgeRect(rect);
+CFX_RectF CFWL_Widget::GetClientRect() {
+ CFX_RectF rect = GetEdgeRect();
if (HasEdge()) {
FX_FLOAT fEdge = GetEdgeWidth();
rect.Deflate(fEdge, fEdge);
}
+ return rect;
}
void CFWL_Widget::SetParent(CFWL_Widget* pParent) {
@@ -162,22 +163,12 @@ void CFWL_Widget::RemoveStates(uint32_t dwStates) {
}
FWL_WidgetHit CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
- CFX_RectF rtClient;
- GetClientRect(rtClient);
- if (rtClient.Contains(fx, fy))
+ if (GetClientRect().Contains(fx, fy))
return FWL_WidgetHit::Client;
- if (HasEdge()) {
- CFX_RectF rtEdge;
- GetEdgeRect(rtEdge);
- if (rtEdge.Contains(fx, fy))
- return FWL_WidgetHit::Edge;
- }
- if (HasBorder()) {
- CFX_RectF rtRelative;
- GetRelativeRect(rtRelative);
- if (rtRelative.Contains(fx, fy))
- return FWL_WidgetHit::Border;
- }
+ if (HasEdge() && GetEdgeRect().Contains(fx, fy))
+ return FWL_WidgetHit::Edge;
+ if (HasBorder() && GetRelativeRect().Contains(fx, fy))
+ return FWL_WidgetHit::Border;
return FWL_WidgetHit::Unknown;
}
@@ -317,14 +308,15 @@ bool CFWL_Widget::IsOffscreen() const {
return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen);
}
-void CFWL_Widget::GetEdgeRect(CFX_RectF& rtEdge) {
- rtEdge = m_pProperties->m_rtWidget;
+CFX_RectF CFWL_Widget::GetEdgeRect() {
+ CFX_RectF rtEdge = m_pProperties->m_rtWidget;
rtEdge.left = rtEdge.top = 0;
if (HasBorder()) {
FX_FLOAT fCX = GetBorderSize(true);
FX_FLOAT fCY = GetBorderSize(false);
rtEdge.Deflate(fCX, fCY);
}
+ return rtEdge;
}
FX_FLOAT CFWL_Widget::GetBorderSize(bool bCX) {
@@ -358,9 +350,11 @@ FX_FLOAT CFWL_Widget::GetEdgeWidth() {
return 0;
}
-void CFWL_Widget::GetRelativeRect(CFX_RectF& rect) {
- rect = m_pProperties->m_rtWidget;
- rect.left = rect.top = 0;
+CFX_RectF CFWL_Widget::GetRelativeRect() {
+ CFX_RectF rect = m_pProperties->m_rtWidget;
+ rect.left = 0;
+ rect.top = 0;
+ return rect;
}
void* CFWL_Widget::GetThemeCapacity(CFWL_WidgetCapacity dwCapacity) {
@@ -602,30 +596,29 @@ void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
pNoteDriver->SendEvent(pEvent);
}
-void CFWL_Widget::Repaint(const CFX_RectF* pRect) {
- if (pRect) {
- m_pWidgetMgr->RepaintWidget(this, pRect);
- return;
- }
+void CFWL_Widget::Repaint() {
CFX_RectF rect;
rect = m_pProperties->m_rtWidget;
- rect.left = rect.top = 0;
- m_pWidgetMgr->RepaintWidget(this, &rect);
+ rect.left = 0;
+ rect.top = 0;
+ RepaintRect(rect);
+}
+
+void CFWL_Widget::RepaintRect(const CFX_RectF& pRect) {
+ m_pWidgetMgr->RepaintWidget(this, pRect);
}
void CFWL_Widget::DrawBackground(CFX_Graphics* pGraphics,
CFWL_Part iPartBk,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- CFX_RectF rtRelative;
- GetRelativeRect(rtRelative);
CFWL_ThemeBackground param;
param.m_pWidget = this;
param.m_iPart = iPartBk;
param.m_pGraphics = pGraphics;
if (pMatrix)
param.m_matrix.Concat(*pMatrix, true);
- param.m_rtPart = rtRelative;
+ param.m_rtPart = GetRelativeRect();
pTheme->DrawBackground(&param);
}
@@ -633,15 +626,13 @@ void CFWL_Widget::DrawBorder(CFX_Graphics* pGraphics,
CFWL_Part iPartBorder,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- CFX_RectF rtRelative;
- GetRelativeRect(rtRelative);
CFWL_ThemeBackground param;
param.m_pWidget = this;
param.m_iPart = iPartBorder;
param.m_pGraphics = pGraphics;
if (pMatrix)
param.m_matrix.Concat(*pMatrix, true);
- param.m_rtPart = rtRelative;
+ param.m_rtPart = GetRelativeRect();
pTheme->DrawBackground(&param);
}
@@ -649,15 +640,13 @@ void CFWL_Widget::DrawEdge(CFX_Graphics* pGraphics,
CFWL_Part iPartEdge,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- CFX_RectF rtEdge;
- GetEdgeRect(rtEdge);
CFWL_ThemeBackground param;
param.m_pWidget = this;
param.m_iPart = iPartEdge;
param.m_pGraphics = pGraphics;
if (pMatrix)
param.m_matrix.Concat(*pMatrix, true);
- param.m_rtPart = rtEdge;
+ param.m_rtPart = GetEdgeRect();
pTheme->DrawBackground(&param);
}
diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h
index 53839a761b..64fc526ad6 100644
--- a/xfa/fwl/cfwl_widget.h
+++ b/xfa/fwl/cfwl_widget.h
@@ -53,7 +53,7 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
virtual bool IsInstance(const CFX_WideStringC& wsClass) const;
virtual CFX_RectF GetAutosizedWidgetRect();
virtual CFX_RectF GetWidgetRect();
- virtual void GetClientRect(CFX_RectF& rect);
+ virtual CFX_RectF GetClientRect();
virtual void ModifyStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved);
virtual void SetStates(uint32_t dwStates);
@@ -109,7 +109,8 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
void SetLayoutItem(void* pItem) { m_pLayoutItem = pItem; }
void SetFocus(bool bFocus);
- void Repaint(const CFX_RectF* pRect);
+ void RepaintRect(const CFX_RectF& pRect);
+ void Repaint();
protected:
CFWL_Widget(const CFWL_App* app,
@@ -121,10 +122,10 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
bool IsLocked() const { return m_iLock > 0; }
bool HasBorder() const;
bool HasEdge() const;
- void GetEdgeRect(CFX_RectF& rtEdge);
+ CFX_RectF GetEdgeRect();
FX_FLOAT GetBorderSize(bool bCX);
FX_FLOAT GetEdgeWidth();
- void GetRelativeRect(CFX_RectF& rect);
+ CFX_RectF GetRelativeRect();
void* GetThemeCapacity(CFWL_WidgetCapacity dwCapacity);
IFWL_ThemeProvider* GetAvailableTheme();
CFX_SizeF CalcTextSize(const CFX_WideString& wsText,
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index 825de0e14e..f01c02b6b8 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -148,18 +148,18 @@ void CFWL_WidgetMgr::AppendWidget(CFWL_Widget* pWidget) {
}
void CFWL_WidgetMgr::RepaintWidget(CFWL_Widget* pWidget,
- const CFX_RectF* pRect) {
+ const CFX_RectF& rect) {
if (!m_pAdapter)
return;
CFWL_Widget* pNative = pWidget;
- CFX_RectF rect(*pRect);
+ CFX_RectF transformedRect = rect;
if (IsFormDisabled()) {
CFWL_Widget* pOuter = pWidget->GetOuter();
while (pOuter) {
CFX_RectF rtTemp = pNative->GetWidgetRect();
- rect.left += rtTemp.left;
- rect.top += rtTemp.top;
+ transformedRect.left += rtTemp.left;
+ transformedRect.top += rtTemp.top;
pNative = pOuter;
pOuter = pOuter->GetOuter();
}
@@ -168,10 +168,10 @@ void CFWL_WidgetMgr::RepaintWidget(CFWL_Widget* pWidget,
if (!pNative)
return;
- pWidget->TransformTo(pNative, rect.left, rect.top);
+ pWidget->TransformTo(pNative, transformedRect.left, transformedRect.top);
}
AddRedrawCounts(pNative);
- m_pAdapter->RepaintWidget(pNative, &rect);
+ m_pAdapter->RepaintWidget(pNative);
}
void CFWL_WidgetMgr::InsertWidget(CFWL_Widget* pParent, CFWL_Widget* pChild) {
@@ -497,11 +497,8 @@ void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget,
}
#endif // _FX_OS_ == _FX_MACOSX_
- if (!IsFormDisabled()) {
- CFX_RectF rtClient;
- pWidget->GetClientRect(rtClient);
- clipBounds.Intersect(rtClient);
- }
+ if (!IsFormDisabled())
+ clipBounds.Intersect(pWidget->GetClientRect());
if (!clipBounds.IsEmpty())
DrawChild(pWidget, clipBounds, pTemp, pMatrix);
diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h
index 10825b941d..4d39d3651e 100644
--- a/xfa/fwl/cfwl_widgetmgr.h
+++ b/xfa/fwl/cfwl_widgetmgr.h
@@ -42,7 +42,7 @@ class CFWL_WidgetMgr : public CFWL_WidgetMgrDelegate {
CFWL_Widget* GetFirstChildWidget(CFWL_Widget* pWidget) const;
CFWL_Widget* GetSystemFormWidget(CFWL_Widget* pWidget) const;
- void RepaintWidget(CFWL_Widget* pWidget, const CFX_RectF* pRect);
+ void RepaintWidget(CFWL_Widget* pWidget, const CFX_RectF& pRect);
void InsertWidget(CFWL_Widget* pParent, CFWL_Widget* pChild);
void RemoveWidget(CFWL_Widget* pWidget);