Remove CFWL_WidgetProperties::m_pParent.
It is always set to the same thing as CFWL_Widget:m_pOuter
Change-Id: I7e357b718ed89fb18fc4e3731264bd56ac36bad1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/72651
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fwl/cfwl_barcode.cpp b/xfa/fwl/cfwl_barcode.cpp
index e9a89b4..31a3051 100644
--- a/xfa/fwl/cfwl_barcode.cpp
+++ b/xfa/fwl/cfwl_barcode.cpp
@@ -16,9 +16,7 @@
#include "xfa/fwl/theme/cfwl_utils.h"
CFWL_Barcode::CFWL_Barcode(const CFWL_App* app)
- : CFWL_Edit(app,
- std::make_unique<CFWL_WidgetProperties>(nullptr),
- nullptr) {}
+ : CFWL_Edit(app, std::make_unique<CFWL_WidgetProperties>(), nullptr) {}
CFWL_Barcode::~CFWL_Barcode() = default;
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index 8ff0e13..baf7133 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -29,9 +29,7 @@
} // namespace
CFWL_CheckBox::CFWL_CheckBox(const CFWL_App* app)
- : CFWL_Widget(app,
- std::make_unique<CFWL_WidgetProperties>(nullptr),
- nullptr) {
+ : CFWL_Widget(app, std::make_unique<CFWL_WidgetProperties>(), nullptr) {
m_TTOStyles.single_line_ = true;
}
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index b14b7dd..6d50262 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -29,9 +29,7 @@
#include "xfa/fwl/ifwl_themeprovider.h"
CFWL_ComboBox::CFWL_ComboBox(const CFWL_App* app)
- : CFWL_Widget(app,
- std::make_unique<CFWL_WidgetProperties>(nullptr),
- nullptr) {
+ : CFWL_Widget(app, std::make_unique<CFWL_WidgetProperties>(), nullptr) {
InitComboList();
InitComboEdit();
}
@@ -407,7 +405,7 @@
if (m_pListBox)
return;
- auto prop = std::make_unique<CFWL_WidgetProperties>(this);
+ auto prop = std::make_unique<CFWL_WidgetProperties>();
prop->m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
prop->m_dwStates = FWL_WGTSTATE_Invisible;
prop->m_pThemeProvider = GetProperties()->m_pThemeProvider;
@@ -419,7 +417,7 @@
if (m_pEdit)
return;
- auto prop = std::make_unique<CFWL_WidgetProperties>(this);
+ auto prop = std::make_unique<CFWL_WidgetProperties>();
prop->m_pThemeProvider = GetProperties()->m_pThemeProvider;
m_pEdit =
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index 3f5a3b9..04efcdb 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -24,12 +24,10 @@
} // namespace
CFWL_DateTimePicker::CFWL_DateTimePicker(const CFWL_App* app)
- : CFWL_Widget(app,
- std::make_unique<CFWL_WidgetProperties>(nullptr),
- nullptr) {
+ : CFWL_Widget(app, std::make_unique<CFWL_WidgetProperties>(), nullptr) {
GetProperties()->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat;
- auto monthProp = std::make_unique<CFWL_WidgetProperties>(this);
+ auto monthProp = std::make_unique<CFWL_WidgetProperties>();
monthProp->m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border;
monthProp->m_dwStates = FWL_WGTSTATE_Invisible;
monthProp->m_pThemeProvider = GetProperties()->m_pThemeProvider;
@@ -39,7 +37,7 @@
m_pMonthCal->SetWidgetRect(
CFX_RectF(0, 0, m_pMonthCal->GetAutosizedWidgetRect().Size()));
- auto editProp = std::make_unique<CFWL_WidgetProperties>(this);
+ auto editProp = std::make_unique<CFWL_WidgetProperties>();
editProp->m_pThemeProvider = GetProperties()->m_pThemeProvider;
m_pEdit = std::make_unique<CFWL_DateTimeEdit>(GetOwnerApp(),
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 9806248..fc13fb5 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -870,7 +870,7 @@
if (m_pVertScrollBar)
return;
- auto prop = std::make_unique<CFWL_WidgetProperties>(this);
+ auto prop = std::make_unique<CFWL_WidgetProperties>();
prop->m_dwStyleExes = FWL_STYLEEXT_SCB_Vert;
prop->m_dwStates = FWL_WGTSTATE_Disabled | FWL_WGTSTATE_Invisible;
prop->m_pThemeProvider = GetProperties()->m_pThemeProvider;
@@ -882,7 +882,7 @@
if (m_pHorzScrollBar)
return;
- auto prop = std::make_unique<CFWL_WidgetProperties>(this);
+ auto prop = std::make_unique<CFWL_WidgetProperties>();
prop->m_dwStyleExes = FWL_STYLEEXT_SCB_Horz;
prop->m_dwStates = FWL_WGTSTATE_Disabled | FWL_WGTSTATE_Invisible;
prop->m_pThemeProvider = GetProperties()->m_pThemeProvider;
@@ -960,7 +960,7 @@
return;
m_pCaret = std::make_unique<CFWL_Caret>(
- GetOwnerApp(), std::make_unique<CFWL_WidgetProperties>(this), this);
+ GetOwnerApp(), std::make_unique<CFWL_WidgetProperties>(), this);
GetWidgetMgr()->SetParent(this, m_pCaret.get());
m_pCaret->SetStates(GetProperties()->m_dwStates);
UpdateCursorRect();
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index 9586cfa..bf38e5f 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -615,7 +615,7 @@
if (m_pVertScrollBar)
return;
- auto prop = std::make_unique<CFWL_WidgetProperties>(this);
+ auto prop = std::make_unique<CFWL_WidgetProperties>();
prop->m_dwStyleExes = FWL_STYLEEXT_SCB_Vert;
prop->m_dwStates = FWL_WGTSTATE_Invisible;
prop->m_pThemeProvider = m_pScrollBarTP;
@@ -627,7 +627,7 @@
if (m_pHorzScrollBar)
return;
- auto prop = std::make_unique<CFWL_WidgetProperties>(this);
+ auto prop = std::make_unique<CFWL_WidgetProperties>();
prop->m_dwStyleExes = FWL_STYLEEXT_SCB_Horz;
prop->m_dwStates = FWL_WGTSTATE_Invisible;
prop->m_pThemeProvider = m_pScrollBarTP;
diff --git a/xfa/fwl/cfwl_picturebox.cpp b/xfa/fwl/cfwl_picturebox.cpp
index 07062aa..6746042 100644
--- a/xfa/fwl/cfwl_picturebox.cpp
+++ b/xfa/fwl/cfwl_picturebox.cpp
@@ -9,9 +9,7 @@
#include <memory>
CFWL_PictureBox::CFWL_PictureBox(const CFWL_App* app)
- : CFWL_Widget(app,
- std::make_unique<CFWL_WidgetProperties>(nullptr),
- nullptr) {}
+ : CFWL_Widget(app, std::make_unique<CFWL_WidgetProperties>(), nullptr) {}
CFWL_PictureBox::~CFWL_PictureBox() = default;
diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp
index df68393..2e5c962 100644
--- a/xfa/fwl/cfwl_pushbutton.cpp
+++ b/xfa/fwl/cfwl_pushbutton.cpp
@@ -21,9 +21,7 @@
#include "xfa/fwl/ifwl_themeprovider.h"
CFWL_PushButton::CFWL_PushButton(const CFWL_App* app)
- : CFWL_Widget(app,
- std::make_unique<CFWL_WidgetProperties>(nullptr),
- nullptr) {}
+ : CFWL_Widget(app, std::make_unique<CFWL_WidgetProperties>(), nullptr) {}
CFWL_PushButton::~CFWL_PushButton() = default;
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index 89853c2..2cb94d5 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -41,7 +41,7 @@
m_pOuter(pOuter) {
ASSERT(m_pWidgetMgr);
ASSERT(m_pProperties);
- m_pWidgetMgr->InsertWidget(m_pProperties->m_pParent, this);
+ m_pWidgetMgr->InsertWidget(m_pOuter, this);
}
CFWL_Widget::~CFWL_Widget() {
diff --git a/xfa/fwl/cfwl_widgetproperties.cpp b/xfa/fwl/cfwl_widgetproperties.cpp
index 7437919..4dc3cd5 100644
--- a/xfa/fwl/cfwl_widgetproperties.cpp
+++ b/xfa/fwl/cfwl_widgetproperties.cpp
@@ -6,7 +6,6 @@
#include "xfa/fwl/cfwl_widgetproperties.h"
-CFWL_WidgetProperties::CFWL_WidgetProperties(CFWL_Widget* pParent)
- : m_pParent(pParent) {}
+CFWL_WidgetProperties::CFWL_WidgetProperties() = default;
CFWL_WidgetProperties::~CFWL_WidgetProperties() = default;
diff --git a/xfa/fwl/cfwl_widgetproperties.h b/xfa/fwl/cfwl_widgetproperties.h
index 59e9070..b9432cd 100644
--- a/xfa/fwl/cfwl_widgetproperties.h
+++ b/xfa/fwl/cfwl_widgetproperties.h
@@ -12,12 +12,11 @@
#include "core/fxcrt/unowned_ptr.h"
#include "xfa/fwl/fwl_widgetdef.h"
-class CFWL_Widget;
class IFWL_ThemeProvider;
class CFWL_WidgetProperties {
public:
- explicit CFWL_WidgetProperties(CFWL_Widget* pParent);
+ CFWL_WidgetProperties();
~CFWL_WidgetProperties();
uint32_t m_dwStyles = FWL_WGTSTYLE_Child;
@@ -25,7 +24,6 @@
uint32_t m_dwStates = 0;
CFX_RectF m_WidgetRect;
UnownedPtr<IFWL_ThemeProvider> m_pThemeProvider;
- CFWL_Widget* const m_pParent; // Raw, this class owned by node in tree.
};
#endif // XFA_FWL_CFWL_WIDGETPROPERTIES_H_
diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp
index 5a81efe..76a28c6 100644
--- a/xfa/fxfa/cxfa_fflistbox.cpp
+++ b/xfa/fxfa/cxfa_fflistbox.cpp
@@ -44,7 +44,7 @@
RetainPtr<CXFA_ContentLayoutItem> retain_layout(m_pLayoutItem.Get());
auto pNew = std::make_unique<CFWL_ListBox>(
- GetFWLApp(), std::make_unique<CFWL_WidgetProperties>(nullptr), nullptr);
+ GetFWLApp(), std::make_unique<CFWL_WidgetProperties>(), nullptr);
CFWL_ListBox* pListBox = pNew.get();
pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground,
0xFFFFFFFF);
diff --git a/xfa/fxfa/cxfa_ffnumericedit.cpp b/xfa/fxfa/cxfa_ffnumericedit.cpp
index 21248db..dae089c 100644
--- a/xfa/fxfa/cxfa_ffnumericedit.cpp
+++ b/xfa/fxfa/cxfa_ffnumericedit.cpp
@@ -29,7 +29,7 @@
RetainPtr<CXFA_ContentLayoutItem> retain_layout(m_pLayoutItem.Get());
auto pNewEdit = std::make_unique<CFWL_Edit>(
- GetFWLApp(), std::make_unique<CFWL_WidgetProperties>(nullptr), nullptr);
+ GetFWLApp(), std::make_unique<CFWL_WidgetProperties>(), nullptr);
CFWL_Edit* pWidget = pNewEdit.get();
SetNormalWidget(std::move(pNewEdit));
pWidget->SetAdapterIface(this);
diff --git a/xfa/fxfa/cxfa_ffpasswordedit.cpp b/xfa/fxfa/cxfa_ffpasswordedit.cpp
index 10ab7d5..b0ece33 100644
--- a/xfa/fxfa/cxfa_ffpasswordedit.cpp
+++ b/xfa/fxfa/cxfa_ffpasswordedit.cpp
@@ -28,7 +28,7 @@
RetainPtr<CXFA_ContentLayoutItem> retain_layout(m_pLayoutItem.Get());
auto pNewEdit = std::make_unique<CFWL_Edit>(
- GetFWLApp(), std::make_unique<CFWL_WidgetProperties>(nullptr), nullptr);
+ GetFWLApp(), std::make_unique<CFWL_WidgetProperties>(), nullptr);
CFWL_Edit* pWidget = pNewEdit.get();
SetNormalWidget(std::move(pNewEdit));
pWidget->SetAdapterIface(this);
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index 072c3fd..c2833b8 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -49,7 +49,7 @@
RetainPtr<CXFA_ContentLayoutItem> retain_layout(m_pLayoutItem.Get());
auto pNewWidget = std::make_unique<CFWL_Edit>(
- GetFWLApp(), std::make_unique<CFWL_WidgetProperties>(nullptr), nullptr);
+ GetFWLApp(), std::make_unique<CFWL_WidgetProperties>(), nullptr);
CFWL_Edit* pFWLEdit = pNewWidget.get();
SetNormalWidget(std::move(pNewWidget));
pFWLEdit->SetAdapterIface(this);