diff options
Diffstat (limited to 'xfa/fwl')
-rw-r--r-- | xfa/fwl/cfwl_caret.cpp | 8 | ||||
-rw-r--r-- | xfa/fwl/cfwl_checkbox.cpp | 29 | ||||
-rw-r--r-- | xfa/fwl/cfwl_combobox.cpp | 44 | ||||
-rw-r--r-- | xfa/fwl/cfwl_comboboxproxy.cpp | 11 | ||||
-rw-r--r-- | xfa/fwl/cfwl_combolist.cpp | 5 | ||||
-rw-r--r-- | xfa/fwl/cfwl_datetimepicker.cpp | 54 | ||||
-rw-r--r-- | xfa/fwl/cfwl_edit.cpp | 59 | ||||
-rw-r--r-- | xfa/fwl/cfwl_form.cpp | 3 | ||||
-rw-r--r-- | xfa/fwl/cfwl_listbox.cpp | 28 | ||||
-rw-r--r-- | xfa/fwl/cfwl_monthcalendar.cpp | 65 | ||||
-rw-r--r-- | xfa/fwl/cfwl_pushbutton.cpp | 5 | ||||
-rw-r--r-- | xfa/fwl/cfwl_scrollbar.cpp | 50 | ||||
-rw-r--r-- | xfa/fwl/cfwl_spinbutton.cpp | 19 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widget.cpp | 54 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widgetmgr.cpp | 18 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widgetproperties.cpp | 4 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_checkboxtp.cpp | 3 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_monthcalendartp.cpp | 24 |
18 files changed, 201 insertions, 282 deletions
diff --git a/xfa/fwl/cfwl_caret.cpp b/xfa/fwl/cfwl_caret.cpp index 4a95b0924b..da57cb408c 100644 --- a/xfa/fwl/cfwl_caret.cpp +++ b/xfa/fwl/cfwl_caret.cpp @@ -76,13 +76,10 @@ void CFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics, if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) return; - CFX_RectF rect = GetWidgetRect(); - rect.Set(0, 0, rect.width, rect.height); - CFWL_ThemeBackground param; param.m_pWidget = this; param.m_pGraphics = pGraphics; - param.m_rtPart = rect; + param.m_rtPart = CFX_RectF(0, 0, GetWidgetRect().Size()); param.m_iPart = CFWL_Part::Background; param.m_dwStates = CFWL_PartState_HightLight; if (pMatrix) @@ -107,6 +104,5 @@ void CFWL_Caret::Timer::Run(CFWL_TimerInfo* pTimerInfo) { pCaret->RemoveStates(FWL_STATE_CAT_HightLight); CFX_RectF rt = pCaret->GetWidgetRect(); - rt.Set(0, 0, rt.width + 1, rt.height); - pCaret->RepaintRect(rt); + pCaret->RepaintRect(CFX_RectF(0, 0, rt.width + 1, rt.height)); } diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp index 4a2d2dbaee..2dc0808831 100644 --- a/xfa/fwl/cfwl_checkbox.cpp +++ b/xfa/fwl/cfwl_checkbox.cpp @@ -129,27 +129,21 @@ void CFWL_CheckBox::Layout() { FXSYS_round(m_pProperties->m_rtWidget.height); m_rtClient = GetClientRect(); - FX_FLOAT fBoxTop = m_rtClient.top; - FX_FLOAT fBoxLeft = m_rtClient.left; - FX_FLOAT fTextLeft = fBoxLeft + m_fBoxHeight; - FX_FLOAT fTextRight = m_rtClient.right(); - m_rtBox.Set(fBoxLeft, fBoxTop, m_fBoxHeight, m_fBoxHeight); - m_rtCaption.Set(fTextLeft, m_rtClient.top, fTextRight - fTextLeft, - m_rtClient.height); + FX_FLOAT fTextLeft = m_rtClient.left + m_fBoxHeight; + m_rtBox = CFX_RectF(m_rtClient.TopLeft(), m_fBoxHeight, m_fBoxHeight); + m_rtCaption = CFX_RectF(fTextLeft, m_rtClient.top, + m_rtClient.right() - fTextLeft, m_rtClient.height); m_rtCaption.Inflate(-kCaptionMargin, -kCaptionMargin); - CFX_RectF rtFocus; - rtFocus.Set(m_rtCaption.left, m_rtCaption.top, m_rtCaption.width, - m_rtCaption.height); + CFX_RectF rtFocus(m_rtCaption.left, m_rtCaption.top, m_rtCaption.width, + m_rtCaption.height); CalcTextRect(L"Check box", m_pProperties->m_pThemeProvider, m_dwTTOStyles, m_iTTOAlign, rtFocus); - FX_FLOAT fWidth = std::max(m_rtCaption.width, rtFocus.width); - FX_FLOAT fHeight = std::min(m_rtCaption.height, rtFocus.height); - FX_FLOAT fLeft = m_rtCaption.left; - FX_FLOAT fTop = m_rtCaption.top; - m_rtFocus.Set(fLeft, fTop, fWidth, fHeight); + m_rtFocus = CFX_RectF(m_rtCaption.TopLeft(), + std::max(m_rtCaption.width, rtFocus.width), + std::min(m_rtCaption.height, rtFocus.height)); m_rtFocus.Inflate(1, 1); } @@ -195,9 +189,8 @@ void CFWL_CheckBox::NextStates() { if (pCheckBox != this && pCheckBox->GetStates() & FWL_STATE_CKB_Checked) { pCheckBox->SetCheckState(0); - CFX_RectF rt = pCheckBox->GetWidgetRect(); - rt.left = rt.top = 0; - m_pWidgetMgr->RepaintWidget(pCheckBox, rt); + m_pWidgetMgr->RepaintWidget( + pCheckBox, CFX_RectF(0, 0, pCheckBox->GetWidgetRect().Size())); break; } } diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp index 03d2921e65..a0a4cc0a79 100644 --- a/xfa/fwl/cfwl_combobox.cpp +++ b/xfa/fwl/cfwl_combobox.cpp @@ -326,9 +326,8 @@ void CFWL_ComboBox::ShowDropList(bool bActivate) { m_pListBox->ModifyStylesEx(dwStyleAdd, 0); m_rtList = m_pListBox->GetAutosizedWidgetRect(); - CFX_RectF rtAnchor; - rtAnchor.Set(0, 0, m_pProperties->m_rtWidget.width, - m_pProperties->m_rtWidget.height); + CFX_RectF rtAnchor(0, 0, m_pProperties->m_rtWidget.width, + m_pProperties->m_rtWidget.height); m_rtList.width = std::max(m_rtList.width, m_rtClient.width); m_rtProxy = m_rtList; @@ -378,14 +377,13 @@ void CFWL_ComboBox::Layout() { return; FX_FLOAT fBtn = theme->GetScrollBarWidth(); - m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top, fBtn, - m_rtClient.height); + m_rtBtn = CFX_RectF(m_rtClient.right() - fBtn, m_rtClient.top, fBtn, + m_rtClient.height); if (!IsDropDownStyle() || !m_pEdit) return; - CFX_RectF rtEdit; - rtEdit.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn, - m_rtClient.height); + CFX_RectF rtEdit(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn, + m_rtClient.height); m_pEdit->SetWidgetRect(rtEdit); if (m_iCurSel >= 0) { @@ -552,11 +550,7 @@ void CFWL_ComboBox::DisForm_ShowDropList(bool bActivate) { fPopupMin = fItemHeight * 3 + fBorder * 2; FX_FLOAT fPopupMax = fItemHeight * iItems + fBorder * 2; - CFX_RectF rtList; - rtList.left = m_rtClient.left; - rtList.width = m_pProperties->m_rtWidget.width; - rtList.top = 0; - rtList.height = 0; + CFX_RectF rtList(m_rtClient.left, 0, m_pProperties->m_rtWidget.width, 0); GetPopupPos(fPopupMin, fPopupMax, m_pProperties->m_rtWidget, rtList); m_pListBox->SetWidgetRect(rtList); @@ -606,9 +600,8 @@ void CFWL_ComboBox::DisForm_Update() { } FWL_WidgetHit CFWL_ComboBox::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { - CFX_RectF rect; - rect.Set(0, 0, m_pProperties->m_rtWidget.width - m_rtBtn.width, - m_pProperties->m_rtWidget.height); + CFX_RectF rect(0, 0, m_pProperties->m_rtWidget.width - m_rtBtn.width, + m_pProperties->m_rtWidget.height); if (rect.Contains(fx, fy)) return FWL_WidgetHit::Edit; if (m_rtBtn.Contains(fx, fy)) @@ -624,8 +617,7 @@ FWL_WidgetHit CFWL_ComboBox::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { void CFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; - CFX_Matrix mtOrg; - mtOrg.Set(1, 0, 0, 1, 0, 0); + CFX_Matrix mtOrg(1, 0, 0, 1, 0, 0); if (pMatrix) mtOrg = *pMatrix; @@ -644,15 +636,13 @@ void CFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics, if (m_pEdit) { CFX_RectF rtEdit = m_pEdit->GetWidgetRect(); - CFX_Matrix mt; - mt.Set(1, 0, 0, 1, rtEdit.left, rtEdit.top); + CFX_Matrix mt(1, 0, 0, 1, rtEdit.left, rtEdit.top); mt.Concat(mtOrg); m_pEdit->DrawWidget(pGraphics, &mt); } if (m_pListBox && DisForm_IsDropListVisible()) { CFX_RectF rtList = m_pListBox->GetWidgetRect(); - CFX_Matrix mt; - mt.Set(1, 0, 0, 1, rtList.left, rtList.top); + CFX_Matrix mt(1, 0, 0, 1, rtList.left, rtList.top); mt.Concat(mtOrg); m_pListBox->DrawWidget(pGraphics, &mt); } @@ -679,8 +669,9 @@ void CFWL_ComboBox::DisForm_Layout() { FX_FLOAT borderWidth = 1; FX_FLOAT fBtn = theme->GetScrollBarWidth(); if (!(GetStylesEx() & FWL_STYLEEXT_CMB_ReadOnly)) { - m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top + borderWidth, - fBtn - borderWidth, m_rtClient.height - 2 * borderWidth); + m_rtBtn = + CFX_RectF(m_rtClient.right() - fBtn, m_rtClient.top + borderWidth, + fBtn - borderWidth, m_rtClient.height - 2 * borderWidth); } CFWL_ThemePart part; @@ -692,9 +683,8 @@ void CFWL_ComboBox::DisForm_Layout() { if (!IsDropDownStyle() || !m_pEdit) return; - CFX_RectF rtEdit; - rtEdit.Set(m_rtContent.left, m_rtContent.top, m_rtContent.width - fBtn, - m_rtContent.height); + CFX_RectF rtEdit(m_rtContent.left, m_rtContent.top, m_rtContent.width - fBtn, + m_rtContent.height); m_pEdit->SetWidgetRect(rtEdit); if (m_iCurSel >= 0) { diff --git a/xfa/fwl/cfwl_comboboxproxy.cpp b/xfa/fwl/cfwl_comboboxproxy.cpp index 7bf311d198..35ff3ef6e0 100644 --- a/xfa/fwl/cfwl_comboboxproxy.cpp +++ b/xfa/fwl/cfwl_comboboxproxy.cpp @@ -70,11 +70,9 @@ void CFWL_ComboBoxProxy::OnLButtonDown(CFWL_Message* pMessage) { CFWL_NoteDriver* pDriver = static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); - CFX_RectF rtWidget = GetWidgetRect(); - rtWidget.left = rtWidget.top = 0; - CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage); - if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) { + if (CFX_RectF(0, 0, GetWidgetRect().Size()) + .Contains(pMsg->m_fx, pMsg->m_fy)) { m_bLButtonDown = true; pDriver->SetGrab(this, true); } else { @@ -99,9 +97,8 @@ void CFWL_ComboBoxProxy::OnLButtonUp(CFWL_Message* pMessage) { } CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage); - CFX_RectF rect = GetWidgetRect(); - rect.left = rect.top = 0; - if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) && + if (!CFX_RectF(0, 0, GetWidgetRect().Size()) + .Contains(pMsg->m_fx, pMsg->m_fy) && m_pComboBox->IsDropListVisible()) { m_pComboBox->ShowDropList(false); } diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp index e78372cb26..d411f03ca3 100644 --- a/xfa/fwl/cfwl_combolist.cpp +++ b/xfa/fwl/cfwl_combolist.cpp @@ -231,9 +231,8 @@ void CFWL_ComboList::OnDropListKeyDown(CFWL_MessageKey* pKey) { SetSelection(hItem, hItem, true); ScrollToVisible(hItem); - CFX_RectF rtInvalidate; - rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, - m_pProperties->m_rtWidget.height); + CFX_RectF rtInvalidate(0, 0, m_pProperties->m_rtWidget.width, + m_pProperties->m_rtWidget.height); RepaintRect(rtInvalidate); break; } diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp index 861692f8e2..1a76727dac 100644 --- a/xfa/fwl/cfwl_datetimepicker.cpp +++ b/xfa/fwl/cfwl_datetimepicker.cpp @@ -33,8 +33,6 @@ CFWL_DateTimePicker::CFWL_DateTimePicker(const CFWL_App* app) m_iMonth(-1), m_iDay(-1), m_bLBtnDown(false) { - m_rtBtn.Set(0, 0, 0, 0); - m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; auto monthProp = pdfium::MakeUnique<CFWL_WidgetProperties>(); @@ -45,9 +43,8 @@ CFWL_DateTimePicker::CFWL_DateTimePicker(const CFWL_App* app) m_pMonthCal.reset( new CFWL_MonthCalendar(m_pOwnerApp, std::move(monthProp), this)); - CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect(); - rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height); - m_pMonthCal->SetWidgetRect(rtMonthCal); + m_pMonthCal->SetWidgetRect( + CFX_RectF(0, 0, m_pMonthCal->GetAutosizedWidgetRect().Size())); auto editProp = pdfium::MakeUnique<CFWL_WidgetProperties>(); editProp->m_pParent = this; @@ -85,12 +82,11 @@ void CFWL_DateTimePicker::Update() { return; FX_FLOAT fBtn = theme->GetScrollBarWidth(); - m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top, fBtn - 1, - m_rtClient.height - 1); + m_rtBtn = CFX_RectF(m_rtClient.right() - fBtn, m_rtClient.top, fBtn - 1, + m_rtClient.height - 1); - CFX_RectF rtEdit; - rtEdit.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn, - m_rtClient.height); + CFX_RectF rtEdit(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn, + m_rtClient.height); m_pEdit->SetWidgetRect(rtEdit); ResetEditAlignment(); m_pEdit->Update(); @@ -98,9 +94,8 @@ void CFWL_DateTimePicker::Update() { m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect(); - CFX_RectF rtPopUp; - rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, - rtMonthCal.width, rtMonthCal.height); + CFX_RectF rtPopUp(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, + rtMonthCal.width, rtMonthCal.height); m_pMonthCal->SetWidgetRect(rtPopUp); m_pMonthCal->Update(); return; @@ -242,9 +237,8 @@ void CFWL_DateTimePicker::ShowMonthCalendar(bool bActivate) { CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect(); - CFX_RectF rtAnchor; - rtAnchor.Set(0, 0, m_pProperties->m_rtWidget.width, - m_pProperties->m_rtWidget.height); + CFX_RectF rtAnchor(0, 0, m_pProperties->m_rtWidget.width, + m_pProperties->m_rtWidget.height); GetPopupPos(0, rtMonth.height, rtAnchor, rtMonth); m_pForm->SetWidgetRect(rtMonth); @@ -377,9 +371,8 @@ void CFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) { m_pEdit->GetDelegate()->OnProcessMessage(&msg); } - CFX_RectF rtInvalidate; - rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, - m_pProperties->m_rtWidget.height); + CFX_RectF rtInvalidate(0, 0, m_pProperties->m_rtWidget.width, + m_pProperties->m_rtWidget.height); CFX_RectF rtCal = m_pMonthCal->GetWidgetRect(); rtInvalidate.Union(rtCal); @@ -389,9 +382,8 @@ void CFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) { FWL_WidgetHit CFWL_DateTimePicker::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) const { - CFX_RectF rect; - rect.Set(0, 0, m_pProperties->m_rtWidget.width, - m_pProperties->m_rtWidget.height); + CFX_RectF rect(0, 0, m_pProperties->m_rtWidget.width, + m_pProperties->m_rtWidget.height); if (rect.Contains(fx, fy)) return FWL_WidgetHit::Edit; if (DisForm_IsNeedShowButton()) @@ -432,9 +424,8 @@ void CFWL_DateTimePicker::DisForm_Update() { m_fBtn = theme->GetScrollBarWidth(); CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect(); - CFX_RectF rtPopUp; - rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, - rtMonthCal.width, rtMonthCal.height); + CFX_RectF rtPopUp(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, + rtMonthCal.width, rtMonthCal.height); m_pMonthCal->SetWidgetRect(rtPopUp); m_pMonthCal->Update(); } @@ -459,8 +450,7 @@ void CFWL_DateTimePicker::DisForm_DrawWidget(CFX_Graphics* pGraphics, if (m_pEdit) { CFX_RectF rtEdit = m_pEdit->GetWidgetRect(); - CFX_Matrix mt; - mt.Set(1, 0, 0, 1, rtEdit.left, rtEdit.top); + CFX_Matrix mt(1, 0, 0, 1, rtEdit.left, rtEdit.top); if (pMatrix) mt.Concat(*pMatrix); m_pEdit->DrawWidget(pGraphics, &mt); @@ -469,8 +459,7 @@ void CFWL_DateTimePicker::DisForm_DrawWidget(CFX_Graphics* pGraphics, return; CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect(); - CFX_Matrix mt; - mt.Set(1, 0, 0, 1, rtMonth.left, rtMonth.top); + CFX_Matrix mt(1, 0, 0, 1, rtMonth.left, rtMonth.top); if (pMatrix) mt.Concat(*pMatrix); m_pMonthCal->DrawWidget(pGraphics, &mt); @@ -594,15 +583,16 @@ void CFWL_DateTimePicker::DisForm_OnFocusChanged(CFWL_Message* pMsg, if (bSet) { m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; if (m_pEdit && !(m_pEdit->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly)) { - m_rtBtn.Set(m_pProperties->m_rtWidget.width, 0, m_fBtn, - m_pProperties->m_rtWidget.height - 1); + m_rtBtn = CFX_RectF(m_pProperties->m_rtWidget.width, 0, m_fBtn, + m_pProperties->m_rtWidget.height - 1); } rtInvalidate = m_rtBtn; pMsg->m_pDstTarget = m_pEdit.get(); m_pEdit->GetDelegate()->OnProcessMessage(pMsg); } else { m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; - m_rtBtn.Set(0, 0, 0, 0); + m_rtBtn.Reset(); + if (DisForm_IsMonthCalendarVisible()) ShowMonthCalendar(false); if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index 87a49e0f45..5c024785f0 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -112,7 +112,7 @@ CFX_RectF CFWL_Edit::GetAutosizedWidgetRect() { CFX_SizeF sz = CalcTextSize( m_EdtEngine.GetText(0, -1), m_pProperties->m_pThemeProvider, !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine)); - rect.Set(0, 0, sz.x, sz.y); + rect = CFX_RectF(0, 0, sz); } InflateWidgetRect(rect); return rect; @@ -231,8 +231,7 @@ void CFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics, } if (!pathSpell.IsEmpty()) { CFX_RectF rtClip = m_rtEngine; - CFX_Matrix mt; - mt.Set(1, 0, 0, 1, fOffSetX, fOffSetY); + CFX_Matrix mt(1, 0, 0, 1, fOffSetX, fOffSetY); if (pMatrix) { pMatrix->TransformRect(rtClip); mt.Concat(*pMatrix); @@ -408,7 +407,6 @@ void CFWL_Edit::OnCaretChanged() { bool bRepaintContent = UpdateOffset(); UpdateCaret(); CFX_RectF rtInvalid; - rtInvalid.Set(0, 0, 0, 0); bool bRepaintScroll = false; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) { CFWL_ScrollBar* pScroll = UpdateScroll(); @@ -501,10 +499,9 @@ void CFWL_Edit::DrawTextBk(CFX_Graphics* pGraphics, CFX_RectF rtScroll = m_pHorzScrollBar->GetWidgetRect(); - CFX_RectF rtStatic; - rtStatic.Set(m_rtClient.right() - rtScroll.height, - m_rtClient.bottom() - rtScroll.height, rtScroll.height, - rtScroll.height); + CFX_RectF rtStatic(m_rtClient.right() - rtScroll.height, + m_rtClient.bottom() - rtScroll.height, rtScroll.height, + rtScroll.height); param.m_bStaticBackground = true; param.m_bMaximize = true; param.m_rtPart = rtStatic; @@ -525,8 +522,7 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics, CFX_RectF rtClip = m_rtEngine; FX_FLOAT fOffSetX = m_rtEngine.left - m_fScrollOffsetX; FX_FLOAT fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset; - CFX_Matrix mt; - mt.Set(1, 0, 0, 1, fOffSetX, fOffSetY); + CFX_Matrix mt(1, 0, 0, 1, fOffSetX, fOffSetY); if (pMatrix) { pMatrix->TransformRect(rtClip); mt.Concat(*pMatrix); @@ -812,8 +808,7 @@ void CFWL_Edit::UpdateCaret() { rtFDE.Offset(m_rtEngine.left - m_fScrollOffsetX, m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset); - CFX_RectF rtCaret; - rtCaret.Set(rtFDE.left, rtFDE.top, rtFDE.width, rtFDE.height); + CFX_RectF rtCaret(rtFDE.left, rtFDE.top, rtFDE.width, rtFDE.height); CFX_RectF rtClient = GetClientRect(); rtCaret.Intersect(rtClient); @@ -966,11 +961,11 @@ void CFWL_Edit::Layout() { CFX_RectF rtVertScr; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { - rtVertScr.Set(m_rtClient.right() + kEditMargin, m_rtClient.top, fWidth, - m_rtClient.height); + rtVertScr = CFX_RectF(m_rtClient.right() + kEditMargin, m_rtClient.top, + fWidth, m_rtClient.height); } else { - rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth, - m_rtClient.height); + rtVertScr = CFX_RectF(m_rtClient.right() - fWidth, m_rtClient.top, fWidth, + m_rtClient.height); if (bShowHorzScrollbar) rtVertScr.height -= fWidth; m_rtEngine.width -= fWidth; @@ -988,11 +983,11 @@ void CFWL_Edit::Layout() { CFX_RectF rtHoriScr; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { - rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin, - m_rtClient.width, fWidth); + rtHoriScr = CFX_RectF(m_rtClient.left, m_rtClient.bottom() + kEditMargin, + m_rtClient.width, fWidth); } else { - rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth, - m_rtClient.width, fWidth); + rtHoriScr = CFX_RectF(m_rtClient.left, m_rtClient.bottom() - fWidth, + m_rtClient.width, fWidth); if (bShowVertScrollbar) rtHoriScr.width -= fWidth; m_rtEngine.height -= fWidth; @@ -1021,11 +1016,11 @@ void CFWL_Edit::LayoutScrollBar() { InitVerticalScrollBar(); CFX_RectF rtVertScr; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { - rtVertScr.Set(m_rtClient.right() + kEditMargin, m_rtClient.top, fWidth, - m_rtClient.height); + rtVertScr = CFX_RectF(m_rtClient.right() + kEditMargin, m_rtClient.top, + fWidth, m_rtClient.height); } else { - rtVertScr.Set(m_rtClient.right() - fWidth, m_rtClient.top, fWidth, - m_rtClient.height); + rtVertScr = CFX_RectF(m_rtClient.right() - fWidth, m_rtClient.top, + fWidth, m_rtClient.height); if (bShowHorzScrollbar) rtVertScr.height -= fWidth; } @@ -1042,11 +1037,12 @@ void CFWL_Edit::LayoutScrollBar() { InitHorizontalScrollBar(); CFX_RectF rtHoriScr; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { - rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin, + rtHoriScr = + CFX_RectF(m_rtClient.left, m_rtClient.bottom() + kEditMargin, m_rtClient.width, fWidth); } else { - rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() - fWidth, - m_rtClient.width, fWidth); + rtHoriScr = CFX_RectF(m_rtClient.left, m_rtClient.bottom() - fWidth, + m_rtClient.width, fWidth); if (bShowVertScrollbar) rtHoriScr.width -= (fWidth); } @@ -1312,9 +1308,8 @@ void CFWL_Edit::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { if (!bRepaint) return; - CFX_RectF rtInvalidate; - rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, - m_pProperties->m_rtWidget.height); + CFX_RectF rtInvalidate(0, 0, m_pProperties->m_rtWidget.width, + m_pProperties->m_rtWidget.height); RepaintRect(rtInvalidate); } @@ -1561,8 +1556,6 @@ bool CFWL_Edit::OnScroll(CFWL_ScrollBar* pScrollBar, UpdateCaret(); CFX_RectF rect = GetWidgetRect(); - CFX_RectF rtInvalidate; - rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); - RepaintRect(rtInvalidate); + RepaintRect(CFX_RectF(0, 0, rect.width + 2, rect.height + 2)); return true; } diff --git a/xfa/fwl/cfwl_form.cpp b/xfa/fwl/cfwl_form.cpp index d0d6ef211c..54a77dc65f 100644 --- a/xfa/fwl/cfwl_form.cpp +++ b/xfa/fwl/cfwl_form.cpp @@ -70,8 +70,7 @@ void CFWL_Form::Update() { FWL_WidgetHit CFWL_Form::HitTest(FX_FLOAT fx, FX_FLOAT fy) { GetAvailableTheme(); - CFX_RectF rtCap; - rtCap.Set(m_fCYBorder, m_fCXBorder, -2 * m_fCYBorder, 0 - m_fCXBorder); + CFX_RectF rtCap(m_fCYBorder, m_fCXBorder, -2 * m_fCYBorder, 0 - m_fCXBorder); return rtCap.Contains(fx, fy) ? FWL_WidgetHit::Titlebar : FWL_WidgetHit::Client; } diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp index a7a568cd14..14d9886480 100644 --- a/xfa/fwl/cfwl_listbox.cpp +++ b/xfa/fwl/cfwl_listbox.cpp @@ -475,7 +475,6 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { m_rtClient = GetClientRect(); m_rtConent = m_rtClient; CFX_RectF rtUIMargin; - rtUIMargin.Set(0, 0, 0, 0); if (!m_pOuter) { CFWL_ThemePart part; part.m_pWidget = this; @@ -514,9 +513,9 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { if (!m_pVertScrollBar) InitVerticalScrollBar(); - CFX_RectF rtScrollBar; - rtScrollBar.Set(m_rtClient.right() - m_fScorllBarWidth, m_rtClient.top, - m_fScorllBarWidth, m_rtClient.height - 1); + CFX_RectF rtScrollBar(m_rtClient.right() - m_fScorllBarWidth, + m_rtClient.top, m_fScorllBarWidth, + m_rtClient.height - 1); if (bShowHorzScr) rtScrollBar.height -= m_fScorllBarWidth; @@ -547,9 +546,9 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { if (!m_pHorzScrollBar) InitHorizontalScrollBar(); - CFX_RectF rtScrollBar; - rtScrollBar.Set(m_rtClient.left, m_rtClient.bottom() - m_fScorllBarWidth, - m_rtClient.width, m_fScorllBarWidth); + CFX_RectF rtScrollBar(m_rtClient.left, + m_rtClient.bottom() - m_fScorllBarWidth, + m_rtClient.width, m_fScorllBarWidth); if (bShowVertScr) rtScrollBar.width -= m_fScorllBarWidth; @@ -575,9 +574,9 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible); } if (bShowVertScr && bShowHorzScr) { - m_rtStatic.Set(m_rtClient.right() - m_fScorllBarWidth, - m_rtClient.bottom() - m_fScorllBarWidth, m_fScorllBarWidth, - m_fScorllBarWidth); + m_rtStatic = CFX_RectF(m_rtClient.right() - m_fScorllBarWidth, + m_rtClient.bottom() - m_fScorllBarWidth, + m_fScorllBarWidth, m_fScorllBarWidth); } return fs; } @@ -588,8 +587,7 @@ void CFWL_ListBox::UpdateItemSize(CFWL_ListItem* pItem, FX_FLOAT fItemHeight, bool bAutoSize) const { if (!bAutoSize && pItem) { - CFX_RectF rtItem; - rtItem.Set(0, size.y, fWidth, fItemHeight); + CFX_RectF rtItem(0, size.y, fWidth, fItemHeight); pItem->SetRect(rtItem); } size.x = fWidth; @@ -833,10 +831,8 @@ void CFWL_ListBox::OnVK(CFWL_ListItem* pItem, bool bShift, bool bCtrl) { SetFocusItem(pItem); ScrollToVisible(pItem); - CFX_RectF rtInvalidate; - rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, - m_pProperties->m_rtWidget.height); - RepaintRect(rtInvalidate); + RepaintRect(CFX_RectF(0, 0, m_pProperties->m_rtWidget.width, + m_pProperties->m_rtWidget.height)); } bool CFWL_ListBox::OnScroll(CFWL_ScrollBar* pScrollBar, diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp index d72e4a0d9a..2158da2064 100644 --- a/xfa/fwl/cfwl_monthcalendar.cpp +++ b/xfa/fwl/cfwl_monthcalendar.cpp @@ -125,8 +125,7 @@ FWL_Type CFWL_MonthCalendar::GetClassID() const { CFX_RectF CFWL_MonthCalendar::GetAutosizedWidgetRect() { CFX_SizeF fs = CalcSize(); - CFX_RectF rect; - rect.Set(0, 0, fs.x, fs.y); + CFX_RectF rect(0, 0, fs.x, fs.y); InflateWidgetRect(rect); return rect; } @@ -314,8 +313,9 @@ void CFWL_MonthCalendar::DrawWeek(CFX_Graphics* pGraphics, params.m_matrix.Concat(*pMatrix); for (int32_t i = 0; i < 7; i++) { - rtDayOfWeek.Set(m_rtWeek.left + i * (m_szCell.x + MONTHCAL_HMARGIN * 2), - m_rtWeek.top, m_szCell.x, m_szCell.y); + rtDayOfWeek = + CFX_RectF(m_rtWeek.left + i * (m_szCell.x + MONTHCAL_HMARGIN * 2), + m_rtWeek.top, m_szCell.x, m_szCell.y); params.m_rtPart = rtDayOfWeek; params.m_wsText = GetCapacityForDay(pTheme, params, i); params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; @@ -469,18 +469,18 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { void CFWL_MonthCalendar::CalcHeadSize() { FX_FLOAT fHeadHMargin = (m_rtClient.width - m_szHead.x) / 2; FX_FLOAT fHeadVMargin = (m_szCell.x - m_szHead.y) / 2; - m_rtHeadText.Set(m_rtClient.left + fHeadHMargin, - m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN + - MONTHCAL_VMARGIN + fHeadVMargin, - m_szHead.x, m_szHead.y); + m_rtHeadText = CFX_RectF(m_rtClient.left + fHeadHMargin, + m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN + + MONTHCAL_VMARGIN + fHeadVMargin, + m_szHead.x, m_szHead.y); } void CFWL_MonthCalendar::CalcTodaySize() { - m_rtTodayFlag.Set( + m_rtTodayFlag = CFX_RectF( m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + MONTHCAL_HMARGIN, m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN, m_szCell.x, m_szToday.y); - m_rtToday.Set( + m_rtToday = CFX_RectF( m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + m_szCell.x + MONTHCAL_HMARGIN * 2, m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN, @@ -490,30 +490,31 @@ void CFWL_MonthCalendar::CalcTodaySize() { void CFWL_MonthCalendar::Layout() { m_rtClient = GetClientRect(); - m_rtHead.Set( + m_rtHead = CFX_RectF( m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, m_rtClient.top, m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, m_szCell.x + (MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN) * 2); - m_rtWeek.Set(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, m_rtHead.bottom(), - m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, - m_szCell.y + MONTHCAL_VMARGIN * 2); - m_rtLBtn.Set(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, - m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN, m_szCell.x, - m_szCell.x); - m_rtRBtn.Set(m_rtClient.left + m_rtClient.width - - MONTHCAL_HEADER_BTN_HMARGIN - m_szCell.x, - m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN, m_szCell.x, - m_szCell.x); - m_rtHSep.Set( + m_rtWeek = CFX_RectF(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, + m_rtHead.bottom(), + m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, + m_szCell.y + MONTHCAL_VMARGIN * 2); + m_rtLBtn = CFX_RectF(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, + m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN, m_szCell.x, + m_szCell.x); + m_rtRBtn = CFX_RectF(m_rtClient.left + m_rtClient.width - + MONTHCAL_HEADER_BTN_HMARGIN - m_szCell.x, + m_rtClient.top + MONTHCAL_HEADER_BTN_VMARGIN, m_szCell.x, + m_szCell.x); + m_rtHSep = CFX_RectF( m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + MONTHCAL_HMARGIN, m_rtWeek.bottom() - MONTHCAL_VMARGIN, m_rtClient.width - (MONTHCAL_HEADER_BTN_HMARGIN + MONTHCAL_HMARGIN) * 2, MONTHCAL_HSEP_HEIGHT); - m_rtDates.Set(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, - m_rtWeek.bottom(), - m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, - m_szCell.y * (MONTHCAL_ROWS - 3) + - MONTHCAL_VMARGIN * (MONTHCAL_ROWS - 3) * 2); + m_rtDates = CFX_RectF(m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN, + m_rtWeek.bottom(), + m_rtClient.width - MONTHCAL_HEADER_BTN_HMARGIN * 2, + m_szCell.y * (MONTHCAL_ROWS - 3) + + MONTHCAL_VMARGIN * (MONTHCAL_ROWS - 3) * 2); CalDateItem(); } @@ -528,7 +529,7 @@ void CFWL_MonthCalendar::CalDateItem() { iWeekOfMonth++; bNewWeek = false; } - pDateInfo->rect.Set( + pDateInfo->rect = CFX_RectF( fLeft + pDateInfo->iDayOfWeek * (m_szCell.x + (MONTHCAL_HMARGIN * 2)), fTop + iWeekOfMonth * (m_szCell.y + (MONTHCAL_VMARGIN * 2)), m_szCell.x + (MONTHCAL_HMARGIN * 2), @@ -579,7 +580,6 @@ void CFWL_MonthCalendar::ResetDateItem() { dwStates |= FWL_ITEMSTATE_MCD_Selected; CFX_RectF rtDate; - rtDate.Set(0, 0, 0, 0); m_arrDates.push_back(pdfium::MakeUnique<DATEINFO>(i + 1, iDayOfWeek, dwStates, rtDate, wsDay)); iDayOfWeek++; @@ -787,8 +787,6 @@ void CFWL_MonthCalendar::OnLButtonUp(CFWL_MessageMouse* pMsg) { int32_t iCurSel = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); CFWL_DateTimePicker* pIPicker = static_cast<CFWL_DateTimePicker*>(m_pOuter); - CFX_RectF rt = pIPicker->GetFormProxy()->GetWidgetRect(); - rt.Set(0, 0, rt.width, rt.height); if (iCurSel > 0) { DATEINFO* lpDatesInfo = m_arrDates[iCurSel - 1].get(); CFX_RectF rtInvalidate(lpDatesInfo->rect); @@ -802,7 +800,9 @@ void CFWL_MonthCalendar::OnLButtonUp(CFWL_MessageMouse* pMsg) { pIPicker->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); pIPicker->ShowMonthCalendar(false); - } else if (m_bFlag && (!rt.Contains(pMsg->m_fx, pMsg->m_fy))) { + } else if (m_bFlag && + (!CFX_RectF(0, 0, pIPicker->GetFormProxy()->GetWidgetRect().Size()) + .Contains(pMsg->m_fx, pMsg->m_fy))) { pIPicker->ShowMonthCalendar(false); } m_bFlag = false; @@ -845,7 +845,6 @@ void CFWL_MonthCalendar::DisForm_OnLButtonUp(CFWL_MessageMouse* pMsg) { void CFWL_MonthCalendar::OnMouseMove(CFWL_MessageMouse* pMsg) { bool bRepaint = false; CFX_RectF rtInvalidate; - rtInvalidate.Set(0, 0, 0, 0); if (m_rtDates.Contains(pMsg->m_fx, pMsg->m_fy)) { int32_t iHover = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); bRepaint = m_iHovered != iHover; diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp index 3f0be45d10..d36d1d8ca7 100644 --- a/xfa/fwl/cfwl_pushbutton.cpp +++ b/xfa/fwl/cfwl_pushbutton.cpp @@ -24,10 +24,7 @@ CFWL_PushButton::CFWL_PushButton(const CFWL_App* app) : CFWL_Widget(app, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr), m_bBtnDown(false), m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), - m_iTTOAlign(FDE_TTOALIGNMENT_Center) { - m_rtClient.Set(0, 0, 0, 0); - m_rtCaption.Set(0, 0, 0, 0); -} + m_iTTOAlign(FDE_TTOALIGNMENT_Center) {} CFWL_PushButton::~CFWL_PushButton() {} diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp index d4dd8885e3..b928d4c5b3 100644 --- a/xfa/fwl/cfwl_scrollbar.cpp +++ b/xfa/fwl/cfwl_scrollbar.cpp @@ -176,30 +176,22 @@ void CFWL_ScrollBar::CalcButtonLen() { } CFX_RectF CFWL_ScrollBar::CalcMinButtonRect() { - CFX_RectF rect; if (IsVertical()) - rect.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width, m_fButtonLen); - else - rect.Set(m_rtClient.left, m_rtClient.top, m_fButtonLen, m_rtClient.height); - return rect; + return CFX_RectF(m_rtClient.TopLeft(), m_rtClient.width, m_fButtonLen); + return CFX_RectF(m_rtClient.TopLeft(), m_fButtonLen, m_rtClient.height); } CFX_RectF CFWL_ScrollBar::CalcMaxButtonRect() { - CFX_RectF rect; if (IsVertical()) { - rect.Set(m_rtClient.left, m_rtClient.bottom() - m_fButtonLen, - m_rtClient.width, m_fButtonLen); - } else { - rect.Set(m_rtClient.right() - m_fButtonLen, m_rtClient.top, m_fButtonLen, - m_rtClient.height); + return CFX_RectF(m_rtClient.left, m_rtClient.bottom() - m_fButtonLen, + m_rtClient.width, m_fButtonLen); } - return rect; + return CFX_RectF(m_rtClient.right() - m_fButtonLen, m_rtClient.top, + m_fButtonLen, m_rtClient.height); } CFX_RectF CFWL_ScrollBar::CalcThumbButtonRect(const CFX_RectF& rtThumb) { CFX_RectF rect; - rect.Reset(); - if (!IsEnabled()) return rect; @@ -211,11 +203,11 @@ CFX_RectF CFWL_ScrollBar::CalcThumbButtonRect(const CFX_RectF& rtThumb) { FX_FLOAT fRange = m_fRangeMax - m_fRangeMin; if (fRange < 0) { - if (IsVertical()) - rect.Set(m_rtClient.left, m_rtMaxBtn.bottom(), m_rtClient.width, 0); - else - rect.Set(m_rtMaxBtn.right(), m_rtClient.top, 0, m_rtClient.height); - return rect; + if (IsVertical()) { + return CFX_RectF(m_rtClient.left, m_rtMaxBtn.bottom(), m_rtClient.width, + 0); + } + return CFX_RectF(m_rtMaxBtn.right(), m_rtClient.top, 0, m_rtClient.height); } CFX_RectF rtClient = m_rtClient; @@ -251,8 +243,6 @@ CFX_RectF CFWL_ScrollBar::CalcThumbButtonRect(const CFX_RectF& rtThumb) { CFX_RectF CFWL_ScrollBar::CalcMinTrackRect(const CFX_RectF& rtMinRect) { CFX_RectF rect; - rect.Reset(); - if (m_bMinSize) { rect.left = rtMinRect.left; rect.top = rtMinRect.top; @@ -272,20 +262,18 @@ CFX_RectF CFWL_ScrollBar::CalcMinTrackRect(const CFX_RectF& rtMinRect) { } CFX_RectF CFWL_ScrollBar::CalcMaxTrackRect(const CFX_RectF& rtMaxRect) { - CFX_RectF rect; - if (m_bMinSize) { - rect.Set(rtMaxRect.left, rtMaxRect.top, 0, 0); - return rect; - } + if (m_bMinSize) + return CFX_RectF(rtMaxRect.TopLeft(), 0, 0); if (IsVertical()) { FX_FLOAT iy = (m_rtThumb.top + m_rtThumb.bottom()) / 2; - rect.Set(m_rtClient.left, iy, m_rtClient.width, m_rtClient.bottom() - iy); - } else { - FX_FLOAT ix = (m_rtThumb.left + m_rtThumb.right()) / 2; - rect.Set(ix, m_rtClient.top, m_rtClient.height - ix, m_rtClient.height); + return CFX_RectF(m_rtClient.left, iy, m_rtClient.width, + m_rtClient.bottom() - iy); } - return rect; + + FX_FLOAT ix = (m_rtThumb.left + m_rtThumb.right()) / 2; + return CFX_RectF(ix, m_rtClient.top, m_rtClient.height - ix, + m_rtClient.height); } FX_FLOAT CFWL_ScrollBar::GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy) { diff --git a/xfa/fwl/cfwl_spinbutton.cpp b/xfa/fwl/cfwl_spinbutton.cpp index 3748d36a30..140cdd50be 100644 --- a/xfa/fwl/cfwl_spinbutton.cpp +++ b/xfa/fwl/cfwl_spinbutton.cpp @@ -52,15 +52,17 @@ void CFWL_SpinButton::Update() { 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); - m_rtDnButton.Set(m_rtClient.left, m_rtClient.top + m_rtClient.height / 2, - m_rtClient.width, m_rtClient.height / 2); + m_rtUpButton = CFX_RectF(m_rtClient.top, m_rtClient.left, m_rtClient.width, + m_rtClient.height / 2); + m_rtDnButton = + CFX_RectF(m_rtClient.left, m_rtClient.top + m_rtClient.height / 2, + m_rtClient.width, m_rtClient.height / 2); } else { - m_rtUpButton.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width / 2, - m_rtClient.height); - m_rtDnButton.Set(m_rtClient.left + m_rtClient.width / 2, m_rtClient.top, - m_rtClient.width / 2, m_rtClient.height); + m_rtUpButton = CFX_RectF(m_rtClient.TopLeft(), m_rtClient.width / 2, + m_rtClient.height); + m_rtDnButton = + CFX_RectF(m_rtClient.left + m_rtClient.width / 2, m_rtClient.top, + m_rtClient.width / 2, m_rtClient.height); } } @@ -253,7 +255,6 @@ void CFWL_SpinButton::OnMouseMove(CFWL_MessageMouse* pMsg) { bool bRepaint = false; CFX_RectF rtInvlidate; - rtInvlidate.Reset(); if (m_rtUpButton.Contains(pMsg->m_fx, pMsg->m_fy)) { if (IsUpButtonEnabled()) { if (m_dwUpState == CFWL_PartState_Hovered) { diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp index e7085ba405..72af87fc86 100644 --- a/xfa/fwl/cfwl_widget.cpp +++ b/xfa/fwl/cfwl_widget.cpp @@ -281,8 +281,8 @@ bool CFWL_Widget::IsChild() const { } CFX_RectF CFWL_Widget::GetEdgeRect() { - CFX_RectF rtEdge = m_pProperties->m_rtWidget; - rtEdge.left = rtEdge.top = 0; + CFX_RectF rtEdge(0, 0, m_pProperties->m_rtWidget.width, + m_pProperties->m_rtWidget.height); if (HasBorder()) { FX_FLOAT fCX = GetBorderSize(true); FX_FLOAT fCY = GetBorderSize(false); @@ -299,10 +299,8 @@ FX_FLOAT CFWL_Widget::GetBorderSize(bool bCX) { } CFX_RectF CFWL_Widget::GetRelativeRect() { - CFX_RectF rect = m_pProperties->m_rtWidget; - rect.left = 0; - rect.top = 0; - return rect; + return CFX_RectF(0, 0, m_pProperties->m_rtWidget.width, + m_pProperties->m_rtWidget.height); } IFWL_ThemeProvider* CFWL_Widget::GetAvailableTheme() { @@ -345,10 +343,9 @@ CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText, calPart.m_dwTTOStyles = bMultiLine ? FDE_TTOSTYLE_LineWrap : FDE_TTOSTYLE_SingleLine; calPart.m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft; - CFX_RectF rect; FX_FLOAT fWidth = bMultiLine ? FWL_WGT_CalcMultiLineDefWidth : FWL_WGT_CalcWidth; - rect.Set(0, 0, fWidth, FWL_WGT_CalcHeight); + CFX_RectF rect(0, 0, fWidth, FWL_WGT_CalcHeight); pTheme->CalcTextRect(&calPart, rect); return CFX_SizeF(rect.width, rect.height); } @@ -430,21 +427,21 @@ bool CFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight, FX_FLOAT fRight = rtAnchor.right() + rtPopup.width; TransformTo(nullptr, fx, fy); if (fRight + fx > 0.0f || bLeft) { - rtPopup.Set(rtAnchor.left - rtPopup.width, rtAnchor.top, rtPopup.width, - rtPopup.height); + rtPopup = CFX_RectF(rtAnchor.left - rtPopup.width, rtAnchor.top, + rtPopup.width, rtPopup.height); } else { - rtPopup.Set(rtAnchor.right(), rtAnchor.top, rtPopup.width, - rtPopup.height); + rtPopup = CFX_RectF(rtAnchor.right(), rtAnchor.top, rtPopup.width, + rtPopup.height); } } else { FX_FLOAT fBottom = rtAnchor.bottom() + rtPopup.height; TransformTo(nullptr, fx, fy); if (fBottom + fy > 0.0f) { - rtPopup.Set(rtAnchor.left, rtAnchor.top - rtPopup.height, rtPopup.width, - rtPopup.height); + rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.top - rtPopup.height, + rtPopup.width, rtPopup.height); } else { - rtPopup.Set(rtAnchor.left, rtAnchor.bottom(), rtPopup.width, - rtPopup.height); + rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.bottom(), rtPopup.width, + rtPopup.height); } } rtPopup.Offset(fx, fy); @@ -467,10 +464,12 @@ bool CFWL_Widget::GetPopupPosComboBox(FX_FLOAT fMinHeight, FX_FLOAT fWidth = std::max(rtAnchor.width, rtPopup.width); FX_FLOAT fBottom = rtAnchor.bottom() + fPopHeight; TransformTo(nullptr, fx, fy); - if (fBottom + fy > 0.0f) - rtPopup.Set(rtAnchor.left, rtAnchor.top - fPopHeight, fWidth, fPopHeight); - else - rtPopup.Set(rtAnchor.left, rtAnchor.bottom(), fWidth, fPopHeight); + if (fBottom + fy > 0.0f) { + rtPopup = + CFX_RectF(rtAnchor.left, rtAnchor.top - fPopHeight, fWidth, fPopHeight); + } else { + rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.bottom(), fWidth, fPopHeight); + } rtPopup.Offset(fx, fy); return true; @@ -485,11 +484,11 @@ bool CFWL_Widget::GetPopupPosGeneral(FX_FLOAT fMinHeight, TransformTo(nullptr, fx, fy); if (rtAnchor.bottom() + fy > 0.0f) { - rtPopup.Set(rtAnchor.left, rtAnchor.top - rtPopup.height, rtPopup.width, - rtPopup.height); + rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.top - rtPopup.height, + rtPopup.width, rtPopup.height); } else { - rtPopup.Set(rtAnchor.left, rtAnchor.bottom(), rtPopup.width, - rtPopup.height); + rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.bottom(), rtPopup.width, + rtPopup.height); } rtPopup.Offset(fx, fy); return true; @@ -535,11 +534,8 @@ void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) { } void CFWL_Widget::Repaint() { - CFX_RectF rect; - rect = m_pProperties->m_rtWidget; - rect.left = 0; - rect.top = 0; - RepaintRect(rect); + RepaintRect(CFX_RectF(0, 0, m_pProperties->m_rtWidget.width, + m_pProperties->m_rtWidget.height)); } void CFWL_Widget::RepaintRect(const CFX_RectF& pRect) { diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index cd9c3e609d..6e537a4ad9 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp @@ -267,9 +267,10 @@ CFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(CFWL_Widget* parent, if ((child->GetStates() & FWL_WGTSTATE_Invisible) == 0) { x1 = x; y1 = y; - CFX_Matrix matrixOnParent; CFX_Matrix m; m.SetIdentity(); + + CFX_Matrix matrixOnParent; m.SetReverse(matrixOnParent); m.TransformPoint(x1, y1); CFX_RectF bounds = child->GetWidgetRect(); @@ -428,9 +429,7 @@ void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget, if (!pWidget || !pGraphics) return; - CFX_RectF clipCopy = pWidget->GetWidgetRect(); - clipCopy.left = clipCopy.top = 0; - + CFX_RectF clipCopy(0, 0, pWidget->GetWidgetRect().Size()); CFX_RectF clipBounds; #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ || \ @@ -444,7 +443,7 @@ void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget, pGraphics->GetClipRect(clipBounds); clipCopy = clipBounds; } else { - clipBounds.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d); + clipBounds = CFX_RectF(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d); const_cast<CFX_Matrix*>(pMatrix)->SetIdentity(); // FIXME: const cast. pWidget->GetDelegate()->OnDrawWidget(pGraphics, pMatrix); } @@ -518,8 +517,7 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, return true; } - CFX_RectF rtWidget = pWidget->GetWidgetRect(); - rtWidget.left = rtWidget.top = 0; + CFX_RectF rtWidget(0, 0, pWidget->GetWidgetRect().Size()); pMatrix->TransformRect(rtWidget); if (!rtWidget.IntersectWith(rtDirty)) return false; @@ -530,7 +528,6 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, return true; CFX_RectF rtChilds; - rtChilds.Empty(); bool bChildIntersectWithDirty = false; bool bOrginPtIntersectWidthChild = false; bool bOrginPtIntersectWidthDirty = @@ -555,9 +552,8 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, rtWidget.height + rtWidget.top; do { CFX_RectF rect = pChild->GetWidgetRect(); - CFX_RectF r = rect; - r.left += rtWidget.left; - r.top += rtWidget.top; + CFX_RectF r(rect.left + rtWidget.left, rect.top + rtWidget.top, rect.width, + rect.height); if (r.IsEmpty()) continue; if (r.Contains(rtDirty)) diff --git a/xfa/fwl/cfwl_widgetproperties.cpp b/xfa/fwl/cfwl_widgetproperties.cpp index 1b41105ef3..fee957aecf 100644 --- a/xfa/fwl/cfwl_widgetproperties.cpp +++ b/xfa/fwl/cfwl_widgetproperties.cpp @@ -12,8 +12,6 @@ CFWL_WidgetProperties::CFWL_WidgetProperties() m_dwStates(0), m_pThemeProvider(nullptr), m_pParent(nullptr), - m_pOwner(nullptr) { - m_rtWidget.Set(0, 0, 0, 0); -} + m_pOwner(nullptr) {} CFWL_WidgetProperties::~CFWL_WidgetProperties() {} diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index 0bc75ec66b..052b9c1638 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -275,8 +275,7 @@ void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) { pt1.x + px2 * FX_BEZIER, pt1.y + py2 * FX_BEZIER, pt1.x, pt1.y); FX_FLOAT fScale = fCheckLen / kSignPath; - CFX_Matrix mt; - mt.Set(1, 0, 0, 1, 0, 0); + CFX_Matrix mt(1, 0, 0, 1, 0, 0); mt.Scale(fScale, fScale); CFX_PathData* pData = m_pCheckPath->GetPathData(); pData->Transform(&mt); diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp index d98cf24f85..476135fa44 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp +++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp @@ -132,8 +132,7 @@ void CFWL_MonthCalendarTP::DrawLButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); - CFX_RectF rtLBtn; - rtLBtn = pParams->m_rtPart; + CFX_RectF rtLBtn = pParams->m_rtPart; path.AddRectangle(rtLBtn.left, rtLBtn.top, rtLBtn.width, rtLBtn.height); pParams->m_pGraphics->SaveGraphState(); CFX_Color clrLBtnEdge(ArgbEncode(0xff, 205, 219, 243)); @@ -164,8 +163,7 @@ void CFWL_MonthCalendarTP::DrawRButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); - CFX_RectF rtRBtn; - rtRBtn = pParams->m_rtPart; + CFX_RectF rtRBtn = pParams->m_rtPart; path.AddRectangle(rtRBtn.left, rtRBtn.top, rtRBtn.width, rtRBtn.height); pParams->m_pGraphics->SaveGraphState(); CFX_Color clrRBtnEdge(ArgbEncode(0xff, 205, 219, 243)); @@ -196,8 +194,7 @@ void CFWL_MonthCalendarTP::DrawHSeperator(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); - CFX_RectF rtHSep; - rtHSep = pParams->m_rtPart; + CFX_RectF rtHSep = pParams->m_rtPart; path.MoveTo(rtHSep.left, rtHSep.top + rtHSep.height / 2); path.LineTo(rtHSep.right(), rtHSep.top + rtHSep.height / 2); pParams->m_pGraphics->SaveGraphState(); @@ -211,8 +208,7 @@ void CFWL_MonthCalendarTP::DrawWeekNumSep(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); - CFX_RectF rtWeekSep; - rtWeekSep = pParams->m_rtPart; + CFX_RectF rtWeekSep = pParams->m_rtPart; path.MoveTo(rtWeekSep.left, rtWeekSep.top); path.LineTo(rtWeekSep.left, rtWeekSep.bottom()); pParams->m_pGraphics->SaveGraphState(); @@ -228,8 +224,7 @@ void CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams, if (pParams->m_dwStates & CFWL_PartState_Selected) { CFX_Path path; path.Create(); - CFX_RectF rtSelDay; - rtSelDay = pParams->m_rtPart; + CFX_RectF rtSelDay = pParams->m_rtPart; path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, rtSelDay.height); CFX_Color clrSelDayBK(m_pThemeData->clrDatesSelectedBK); @@ -238,8 +233,7 @@ void CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams, } else if (pParams->m_dwStates & CFWL_PartState_Hovered) { CFX_Path path; path.Create(); - CFX_RectF rtSelDay; - rtSelDay = pParams->m_rtPart; + CFX_RectF rtSelDay = pParams->m_rtPart; path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, rtSelDay.height); CFX_Color clrSelDayBK(m_pThemeData->clrDatesHoverBK); @@ -253,8 +247,7 @@ void CFWL_MonthCalendarTP::DrawDatesInCircle(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); - CFX_RectF rtSelDay; - rtSelDay = pParams->m_rtPart; + CFX_RectF rtSelDay = pParams->m_rtPart; path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, rtSelDay.height); pParams->m_pGraphics->SaveGraphState(); @@ -268,8 +261,7 @@ void CFWL_MonthCalendarTP::DrawTodayCircle(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; path.Create(); - CFX_RectF rtTodayCircle; - rtTodayCircle = pParams->m_rtPart; + CFX_RectF rtTodayCircle = pParams->m_rtPart; path.AddRectangle(rtTodayCircle.left, rtTodayCircle.top, rtTodayCircle.width, rtTodayCircle.height); pParams->m_pGraphics->SaveGraphState(); |