From bcdbeaea96d53800ee806f463108f54f79a19347 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 21 Aug 2018 23:07:21 +0000 Subject: Use UnownedPtr<> to theme provider in cfwl_widgetproperties.h Mark two other fields which must remain raw. Change-Id: Idcd9b074aad23f35dc6607feeaa4fa6701efffaa Reviewed-on: https://pdfium-review.googlesource.com/40916 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- xfa/fwl/cfwl_caret.cpp | 2 +- xfa/fwl/cfwl_checkbox.cpp | 15 +++++++-------- xfa/fwl/cfwl_combobox.cpp | 12 +++++------- xfa/fwl/cfwl_datetimepicker.cpp | 12 ++++++------ xfa/fwl/cfwl_edit.cpp | 11 ++++++----- xfa/fwl/cfwl_form.cpp | 10 +++++----- xfa/fwl/cfwl_listbox.cpp | 9 +++++---- xfa/fwl/cfwl_monthcalendar.cpp | 36 ++++++++++++++++++------------------ xfa/fwl/cfwl_pushbutton.cpp | 12 ++++++------ xfa/fwl/cfwl_scrollbar.cpp | 2 +- xfa/fwl/cfwl_widget.cpp | 8 ++------ xfa/fwl/cfwl_widget.h | 10 ++++++---- xfa/fwl/cfwl_widgetmgr.cpp | 4 ++-- xfa/fwl/cfwl_widgetmgr.h | 6 +++--- xfa/fwl/cfwl_widgetproperties.cpp | 10 ++-------- xfa/fwl/cfwl_widgetproperties.h | 16 ++++++++-------- 16 files changed, 83 insertions(+), 92 deletions(-) diff --git a/xfa/fwl/cfwl_caret.cpp b/xfa/fwl/cfwl_caret.cpp index 666ba8246f..b2efba4666 100644 --- a/xfa/fwl/cfwl_caret.cpp +++ b/xfa/fwl/cfwl_caret.cpp @@ -54,7 +54,7 @@ void CFWL_Caret::DrawWidget(CXFA_Graphics* pGraphics, if (!m_pProperties->m_pThemeProvider) return; - DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, &matrix); + DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider.Get(), &matrix); } void CFWL_Caret::ShowCaret() { diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp index d39cd534af..7e062289e0 100644 --- a/xfa/fwl/cfwl_checkbox.cpp +++ b/xfa/fwl/cfwl_checkbox.cpp @@ -65,14 +65,13 @@ void CFWL_CheckBox::DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) { if (!pGraphics) return; - if (!m_pProperties->m_pThemeProvider) + + IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider.Get(); + if (!pTheme) return; - IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; - if (HasBorder()) { - DrawBorder(pGraphics, CFWL_Part::Border, m_pProperties->m_pThemeProvider, - matrix); - } + if (HasBorder()) + DrawBorder(pGraphics, CFWL_Part::Border, pTheme, matrix); int32_t dwStates = GetPartStates(); @@ -136,8 +135,8 @@ void CFWL_CheckBox::Layout() { 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); + CalcTextRect(L"Check box", m_pProperties->m_pThemeProvider.Get(), + m_dwTTOStyles, m_iTTOAlign, &rtFocus); m_rtFocus = CFX_RectF(m_rtCaption.TopLeft(), std::max(m_rtCaption.width, rtFocus.width), diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp index 9cd2119aaf..41541c8774 100644 --- a/xfa/fwl/cfwl_combobox.cpp +++ b/xfa/fwl/cfwl_combobox.cpp @@ -98,8 +98,7 @@ FWL_WidgetHit CFWL_ComboBox::HitTest(const CFX_PointF& point) { void CFWL_ComboBox::DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) { - IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; - + IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider.Get(); pGraphics->SaveGraphState(); pGraphics->ConcatMatrix(&matrix); if (!m_rtBtn.IsEmpty(0.1f)) { @@ -327,11 +326,10 @@ void CFWL_ComboBox::Layout() { } void CFWL_ComboBox::ResetTheme() { - IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; - if (!pTheme) { - pTheme = GetAvailableTheme(); - m_pProperties->m_pThemeProvider = pTheme; - } + if (!m_pProperties->m_pThemeProvider) + m_pProperties->m_pThemeProvider = GetAvailableTheme(); + + IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider.Get(); if (m_pListBox && !m_pListBox->GetThemeProvider()) m_pListBox->SetThemeProvider(pTheme); if (m_pEdit && !m_pEdit->GetThemeProvider()) diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp index 0af01fb2a1..68dc171b7a 100644 --- a/xfa/fwl/cfwl_datetimepicker.cpp +++ b/xfa/fwl/cfwl_datetimepicker.cpp @@ -65,17 +65,16 @@ FWL_Type CFWL_DateTimePicker::GetClassID() const { void CFWL_DateTimePicker::Update() { if (m_iLock) return; + if (!m_pProperties->m_pThemeProvider) m_pProperties->m_pThemeProvider = GetAvailableTheme(); - - m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider); + m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider.Get()); m_rtClient = GetClientRect(); m_pEdit->SetWidgetRect(m_rtClient); ResetEditAlignment(); m_pEdit->Update(); - if (!m_pMonthCal->GetThemeProvider()) - m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); + m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider.Get()); IFWL_ThemeProvider* theme = GetAvailableTheme(); if (!theme) @@ -109,10 +108,11 @@ void CFWL_DateTimePicker::DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) { if (!pGraphics) return; - if (!m_pProperties->m_pThemeProvider) + + IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider.Get(); + if (!pTheme) return; - IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) DrawBorder(pGraphics, CFWL_Part::Border, pTheme, matrix); if (!m_rtBtn.IsEmpty()) diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index fc6ce094ea..07d3b0728a 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -95,7 +95,7 @@ CFX_RectF CFWL_Edit::GetAutosizedWidgetRect() { if (m_EdtEngine.GetLength() > 0) { CFX_SizeF size = CalcTextSize( - m_EdtEngine.GetText(), m_pProperties->m_pThemeProvider, + m_EdtEngine.GetText(), m_pProperties->m_pThemeProvider.Get(), !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine)); rect = CFX_RectF(0, 0, size); } @@ -147,14 +147,15 @@ FWL_WidgetHit CFWL_Edit::HitTest(const CFX_PointF& point) { void CFWL_Edit::DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) { if (!pGraphics) return; - if (!m_pProperties->m_pThemeProvider) - return; + if (m_rtClient.IsEmpty()) return; - IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; - DrawContent(pGraphics, pTheme, &matrix); + IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider.Get(); + if (!pTheme) + return; + DrawContent(pGraphics, pTheme, &matrix); if (HasBorder()) DrawBorder(pGraphics, CFWL_Part::Border, pTheme, matrix); } diff --git a/xfa/fwl/cfwl_form.cpp b/xfa/fwl/cfwl_form.cpp index f2ae46ddfd..f779c43468 100644 --- a/xfa/fwl/cfwl_form.cpp +++ b/xfa/fwl/cfwl_form.cpp @@ -76,15 +76,14 @@ FWL_WidgetHit CFWL_Form::HitTest(const CFX_PointF& point) { void CFWL_Form::DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) { if (!pGraphics) return; - if (!m_pProperties->m_pThemeProvider) + + IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider.Get(); + if (!pTheme) return; - IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; DrawBackground(pGraphics, pTheme); -#if _FX_OS_ == _FX_OS_MACOSX_ - return; -#endif +#if _FX_OS_ != _FX_OS_MACOSX_ CFWL_ThemeBackground param; param.m_pWidget = this; param.m_dwStates = CFWL_PartState_Normal; @@ -95,6 +94,7 @@ void CFWL_Form::DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) { param.m_iPart = CFWL_Part::Border; pTheme->DrawBackground(¶m); } +#endif } CFWL_Widget* CFWL_Form::DoModal() { diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp index 445d81ceb7..e50aa05782 100644 --- a/xfa/fwl/cfwl_listbox.cpp +++ b/xfa/fwl/cfwl_listbox.cpp @@ -94,10 +94,11 @@ void CFWL_ListBox::DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) { if (!pGraphics) return; - if (!m_pProperties->m_pThemeProvider) + + IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider.Get(); + if (!pTheme) return; - IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; pGraphics->SaveGraphState(); if (HasBorder()) DrawBorder(pGraphics, CFWL_Part::Border, pTheme, matrix); @@ -599,8 +600,8 @@ float CFWL_ListBox::GetMaxTextWidth() { if (!pItem) continue; - CFX_SizeF sz = - CalcTextSize(pItem->GetText(), m_pProperties->m_pThemeProvider, false); + CFX_SizeF sz = CalcTextSize(pItem->GetText(), + m_pProperties->m_pThemeProvider.Get(), false); fRet = std::max(fRet, sz.width); } return fRet; diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp index f3a34b0250..d55984f7d7 100644 --- a/xfa/fwl/cfwl_monthcalendar.cpp +++ b/xfa/fwl/cfwl_monthcalendar.cpp @@ -122,10 +122,11 @@ void CFWL_MonthCalendar::DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) { if (!pGraphics) return; + if (!m_pProperties->m_pThemeProvider) m_pProperties->m_pThemeProvider = GetAvailableTheme(); - IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; + IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider.Get(); if (HasBorder()) DrawBorder(pGraphics, CFWL_Part::Border, pTheme, matrix); @@ -215,8 +216,8 @@ void CFWL_MonthCalendar::DrawCaption(CXFA_Graphics* pGraphics, textParam.m_dwStates = CFWL_PartState_Normal; textParam.m_pGraphics = pGraphics; textParam.m_wsText = GetHeadText(m_iCurYear, m_iCurMonth); - m_szHead = - CalcTextSize(textParam.m_wsText, m_pProperties->m_pThemeProvider, false); + m_szHead = CalcTextSize(textParam.m_wsText, + m_pProperties->m_pThemeProvider.Get(), false); CalcHeadSize(); textParam.m_rtPart = m_rtHeadText; textParam.m_dwTTOStyles.single_line_ = true; @@ -307,8 +308,8 @@ void CFWL_MonthCalendar::DrawToday(CXFA_Graphics* pGraphics, params.m_iTTOAlign = FDE_TextAlignment::kCenterLeft; params.m_wsText = GetTodayText(m_iYear, m_iMonth, m_iDay); - m_szToday = - CalcTextSize(params.m_wsText, m_pProperties->m_pThemeProvider, false); + m_szToday = CalcTextSize(params.m_wsText, + m_pProperties->m_pThemeProvider.Get(), false); CalcTodaySize(); params.m_rtPart = m_rtToday; params.m_dwTTOStyles.single_line_ = true; @@ -383,18 +384,18 @@ void CFWL_MonthCalendar::DrawDatesInCircle(CXFA_Graphics* pGraphics, } CFX_SizeF CFWL_MonthCalendar::CalcSize() { - if (!m_pProperties->m_pThemeProvider) + IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider.Get(); + if (!pTheme) return CFX_SizeF(); CFWL_ThemePart params; params.m_pWidget = this; - IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; + float fMaxWeekW = 0.0f; float fMaxWeekH = 0.0f; - for (uint32_t i = 0; i < 7; ++i) { - CFX_SizeF sz = CalcTextSize(GetCapacityForDay(pTheme, params, i), - m_pProperties->m_pThemeProvider, false); + CFX_SizeF sz = + CalcTextSize(GetCapacityForDay(pTheme, params, i), pTheme, false); fMaxWeekW = (fMaxWeekW >= sz.width) ? fMaxWeekW : sz.width; fMaxWeekH = (fMaxWeekH >= sz.height) ? fMaxWeekH : sz.height; } @@ -402,8 +403,7 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { float fDayMaxW = 0.0f; float fDayMaxH = 0.0f; for (int day = 10; day <= 31; day++) { - CFX_SizeF sz = CalcTextSize(WideString::Format(L"%d", day), - m_pProperties->m_pThemeProvider, false); + CFX_SizeF sz = CalcTextSize(WideString::Format(L"%d", day), pTheme, false); fDayMaxW = (fDayMaxW >= sz.width) ? fDayMaxW : sz.width; fDayMaxH = (fDayMaxH >= sz.height) ? fDayMaxH : sz.height; } @@ -415,18 +415,18 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { fs.width = m_szCell.width * MONTHCAL_COLUMNS + MONTHCAL_HMARGIN * MONTHCAL_COLUMNS * 2 + MONTHCAL_HEADER_BTN_HMARGIN * 2; + float fMonthMaxW = 0.0f; float fMonthMaxH = 0.0f; - for (uint32_t i = 0; i < 12; ++i) { - CFX_SizeF sz = CalcTextSize(GetCapacityForMonth(pTheme, params, i), - m_pProperties->m_pThemeProvider, false); + CFX_SizeF sz = + CalcTextSize(GetCapacityForMonth(pTheme, params, i), pTheme, false); fMonthMaxW = (fMonthMaxW >= sz.width) ? fMonthMaxW : sz.width; fMonthMaxH = (fMonthMaxH >= sz.height) ? fMonthMaxH : sz.height; } - CFX_SizeF szYear = CalcTextSize(GetHeadText(m_iYear, m_iMonth), - m_pProperties->m_pThemeProvider, false); + CFX_SizeF szYear = + CalcTextSize(GetHeadText(m_iYear, m_iMonth), pTheme, false); fMonthMaxH = std::max(fMonthMaxH, szYear.height); m_szHead = CFX_SizeF(fMonthMaxW + szYear.width, fMonthMaxH); fMonthMaxW = @@ -434,7 +434,7 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { fs.width = std::max(fs.width, fMonthMaxW); m_wsToday = GetTodayText(m_iYear, m_iMonth, m_iDay); - m_szToday = CalcTextSize(m_wsToday, m_pProperties->m_pThemeProvider, false); + m_szToday = CalcTextSize(m_wsToday, pTheme, false); m_szToday.height = (m_szToday.height >= m_szCell.height) ? m_szToday.height : m_szCell.height; fs.height = m_szCell.width + m_szCell.height * (MONTHCAL_ROWS - 2) + diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp index 46d9876433..4856029f33 100644 --- a/xfa/fwl/cfwl_pushbutton.cpp +++ b/xfa/fwl/cfwl_pushbutton.cpp @@ -52,14 +52,14 @@ void CFWL_PushButton::DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) { if (!pGraphics) return; - if (!m_pProperties->m_pThemeProvider) + + IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider.Get(); + if (!pTheme) return; - if (HasBorder()) { - DrawBorder(pGraphics, CFWL_Part::Border, m_pProperties->m_pThemeProvider, - matrix); - } - DrawBkground(pGraphics, m_pProperties->m_pThemeProvider, &matrix); + if (HasBorder()) + DrawBorder(pGraphics, CFWL_Part::Border, pTheme, matrix); + DrawBkground(pGraphics, pTheme, &matrix); } void CFWL_PushButton::DrawBkground(CXFA_Graphics* pGraphics, diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp index 1d22386c83..4e52d8bbfd 100644 --- a/xfa/fwl/cfwl_scrollbar.cpp +++ b/xfa/fwl/cfwl_scrollbar.cpp @@ -81,7 +81,7 @@ void CFWL_ScrollBar::DrawWidget(CXFA_Graphics* pGraphics, if (!m_pProperties->m_pThemeProvider) return; - IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; + IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider.Get(); if (HasBorder()) DrawBorder(pGraphics, CFWL_Part::Border, pTheme, matrix); DrawTrack(pGraphics, pTheme, true, &matrix); diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp index 4a8f2c0caa..309793c690 100644 --- a/xfa/fwl/cfwl_widget.cpp +++ b/xfa/fwl/cfwl_widget.cpp @@ -171,7 +171,7 @@ CFX_PointF CFWL_Widget::TransformTo(CFWL_Widget* pWidget, return point + CFX_PointF(szOffset.width, szOffset.height); } -CFX_Matrix CFWL_Widget::GetMatrix() { +CFX_Matrix CFWL_Widget::GetMatrix() const { if (!m_pProperties) return CFX_Matrix(); @@ -201,10 +201,6 @@ CFX_Matrix CFWL_Widget::GetMatrix() { return matrix; } -IFWL_ThemeProvider* CFWL_Widget::GetThemeProvider() const { - return m_pProperties->m_pThemeProvider; -} - void CFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pProperties->m_pThemeProvider = pThemeProvider; } @@ -259,7 +255,7 @@ CFX_RectF CFWL_Widget::GetRelativeRect() { IFWL_ThemeProvider* CFWL_Widget::GetAvailableTheme() { if (m_pProperties->m_pThemeProvider) - return m_pProperties->m_pThemeProvider; + return m_pProperties->m_pThemeProvider.Get(); CFWL_Widget* pUp = this; do { diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h index 59cdb60826..13b06a9b49 100644 --- a/xfa/fwl/cfwl_widget.h +++ b/xfa/fwl/cfwl_widget.h @@ -16,6 +16,7 @@ #include "xfa/fwl/cfwl_event.h" #include "xfa/fwl/cfwl_themepart.h" #include "xfa/fwl/cfwl_widgetmgr.h" +#include "xfa/fwl/cfwl_widgetproperties.h" #include "xfa/fwl/fwl_widgethit.h" #include "xfa/fwl/ifwl_widgetdelegate.h" @@ -44,7 +45,6 @@ class CFWL_AppImp; class CFWL_MessageKey; class CFWL_Widget; class CFWL_WidgetMgr; -class CFWL_WidgetProperties; class CXFA_FFWidget; class IFWL_ThemeProvider; @@ -93,8 +93,10 @@ class CFWL_Widget : public IFWL_WidgetDelegate { } CFX_PointF TransformTo(CFWL_Widget* pWidget, const CFX_PointF& point); - CFX_Matrix GetMatrix(); - IFWL_ThemeProvider* GetThemeProvider() const; + CFX_Matrix GetMatrix() const; + IFWL_ThemeProvider* GetThemeProvider() const { + return m_pProperties->m_pThemeProvider.Get(); + } void SetDelegate(IFWL_WidgetDelegate* delegate) { m_pDelegate = delegate; } IFWL_WidgetDelegate* GetDelegate() { @@ -150,7 +152,7 @@ class CFWL_Widget : public IFWL_WidgetDelegate { int32_t m_iLock; private: - CFWL_Widget* GetParent() { return m_pWidgetMgr->GetParentWidget(this); } + CFWL_Widget* GetParent() const { return m_pWidgetMgr->GetParentWidget(this); } CFX_SizeF GetOffsetFromParent(CFWL_Widget* pParent); bool IsVisible() const; diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index 42c972df98..4f9170fadd 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp @@ -22,7 +22,7 @@ CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative) CFWL_WidgetMgr::~CFWL_WidgetMgr() {} -CFWL_Widget* CFWL_WidgetMgr::GetParentWidget(CFWL_Widget* pWidget) const { +CFWL_Widget* CFWL_WidgetMgr::GetParentWidget(const CFWL_Widget* pWidget) const { Item* pItem = GetWidgetMgrItem(pWidget); return pItem && pItem->pParent ? pItem->pParent->pWidget : nullptr; } @@ -328,7 +328,7 @@ void CFWL_WidgetMgr::ResetRedrawCounts(CFWL_Widget* pWidget) { } CFWL_WidgetMgr::Item* CFWL_WidgetMgr::GetWidgetMgrItem( - CFWL_Widget* pWidget) const { + const CFWL_Widget* pWidget) const { auto it = m_mapWidgetItem.find(pWidget); return it != m_mapWidgetItem.end() ? static_cast(it->second.get()) : nullptr; diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h index 856e7f4cc2..68c02bef7b 100644 --- a/xfa/fwl/cfwl_widgetmgr.h +++ b/xfa/fwl/cfwl_widgetmgr.h @@ -31,7 +31,7 @@ class CFWL_WidgetMgr { CXFA_Graphics* pGraphics, const CFX_Matrix& matrix); - CFWL_Widget* GetParentWidget(CFWL_Widget* pWidget) const; + CFWL_Widget* GetParentWidget(const CFWL_Widget* pWidget) const; CFWL_Widget* GetOwnerWidget(CFWL_Widget* pWidget) const; CFWL_Widget* GetNextSiblingWidget(CFWL_Widget* pWidget) const; CFWL_Widget* GetFirstChildWidget(CFWL_Widget* pWidget) const; @@ -80,7 +80,7 @@ class CFWL_WidgetMgr { CFWL_Widget* GetFirstSiblingWidget(CFWL_Widget* pWidget) const; CFWL_Widget* GetPriorSiblingWidget(CFWL_Widget* pWidget) const; CFWL_Widget* GetLastChildWidget(CFWL_Widget* pWidget) const; - Item* GetWidgetMgrItem(CFWL_Widget* pWidget) const; + Item* GetWidgetMgrItem(const CFWL_Widget* pWidget) const; void AppendWidget(CFWL_Widget* pWidget); @@ -96,7 +96,7 @@ class CFWL_WidgetMgr { bool IsAbleNative(CFWL_Widget* pWidget) const; - std::map> m_mapWidgetItem; + std::map> m_mapWidgetItem; UnownedPtr const m_pAdapter; }; diff --git a/xfa/fwl/cfwl_widgetproperties.cpp b/xfa/fwl/cfwl_widgetproperties.cpp index fee957aecf..4dc3cd5578 100644 --- a/xfa/fwl/cfwl_widgetproperties.cpp +++ b/xfa/fwl/cfwl_widgetproperties.cpp @@ -6,12 +6,6 @@ #include "xfa/fwl/cfwl_widgetproperties.h" -CFWL_WidgetProperties::CFWL_WidgetProperties() - : m_dwStyles(FWL_WGTSTYLE_Child), - m_dwStyleExes(0), - m_dwStates(0), - m_pThemeProvider(nullptr), - m_pParent(nullptr), - m_pOwner(nullptr) {} +CFWL_WidgetProperties::CFWL_WidgetProperties() = default; -CFWL_WidgetProperties::~CFWL_WidgetProperties() {} +CFWL_WidgetProperties::~CFWL_WidgetProperties() = default; diff --git a/xfa/fwl/cfwl_widgetproperties.h b/xfa/fwl/cfwl_widgetproperties.h index 065acad30f..797b8daeb6 100644 --- a/xfa/fwl/cfwl_widgetproperties.h +++ b/xfa/fwl/cfwl_widgetproperties.h @@ -9,11 +9,11 @@ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" -#include "xfa/fwl/cfwl_widget.h" +#include "core/fxcrt/unowned_ptr.h" #include "xfa/fwl/fwl_widgetdef.h" -class IFWL_ThemeProvider; class CFWL_Widget; +class IFWL_ThemeProvider; class CFWL_WidgetProperties { public: @@ -21,12 +21,12 @@ class CFWL_WidgetProperties { ~CFWL_WidgetProperties(); CFX_RectF m_rtWidget; - uint32_t m_dwStyles; - uint32_t m_dwStyleExes; - uint32_t m_dwStates; - IFWL_ThemeProvider* m_pThemeProvider; - CFWL_Widget* m_pParent; - CFWL_Widget* m_pOwner; + uint32_t m_dwStyles = FWL_WGTSTYLE_Child; + uint32_t m_dwStyleExes = 0; + uint32_t m_dwStates = 0; + UnownedPtr m_pThemeProvider; + CFWL_Widget* m_pParent = nullptr; // Raw, this class owned by node in tree. + CFWL_Widget* m_pOwner = nullptr; // Raw, this class owned by node in tree. }; #endif // XFA_FWL_CFWL_WIDGETPROPERTIES_H_ -- cgit v1.2.3