diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-10-26 23:56:27 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-26 23:56:27 +0000 |
commit | b7c4a0243e82f6c4ff91cd90b5bae336100c3c70 (patch) | |
tree | 782b8b225dbc01d78c0dff7b126f90f606d13fb1 /fpdfsdk/pwl | |
parent | 314380e271d0a1e3117c67cb5a417cbc5b5b81b3 (diff) | |
download | pdfium-b7c4a0243e82f6c4ff91cd90b5bae336100c3c70.tar.xz |
Pass CreateParams to CPWL_Wnd constructor.chromium/3595chromium/3594
The previous reshuffling means we always have the create params
earlier, so pass them in at create time.
Clean up two forward declarations that were not needed as
noticed in the process.
Change-Id: I5d3861f3c1e3508e0d25950e919859244fac5f8b
Reviewed-on: https://pdfium-review.googlesource.com/c/44710
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/pwl')
-rw-r--r-- | fpdfsdk/pwl/cpwl_appstream.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_button.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_button.h | 3 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_caret.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_caret.h | 3 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_combo_box.cpp | 27 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_combo_box.h | 9 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_edit.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_edit.h | 2 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_edit_ctrl.cpp | 9 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_edit_ctrl.h | 3 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_icon.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_icon.h | 2 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_list_box.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_list_box.h | 3 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_scroll_bar.cpp | 22 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_scroll_bar.h | 9 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_special_button.cpp | 15 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_special_button.h | 9 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_wnd.cpp | 15 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_wnd.h | 4 |
21 files changed, 94 insertions, 73 deletions
diff --git a/fpdfsdk/pwl/cpwl_appstream.cpp b/fpdfsdk/pwl/cpwl_appstream.cpp index 02541aa3b6..93bd3e7b26 100644 --- a/fpdfsdk/pwl/cpwl_appstream.cpp +++ b/fpdfsdk/pwl/cpwl_appstream.cpp @@ -683,10 +683,11 @@ ByteString GenerateIconAppStream(CPDF_IconFit& fit, if (rcIcon.IsEmpty() || !pIconStream) return ByteString(); - CPWL_Icon icon(nullptr); - CPWL_Wnd::CreateParams cp; // No parent. + CPWL_Wnd::CreateParams cp; cp.dwFlags = PWS_VISIBLE; - icon.Realize(cp); + + CPWL_Icon icon(cp, nullptr); + icon.Realize(); icon.SetIconFit(&fit); icon.SetPDFStream(pIconStream); if (!icon.Move(rcIcon, false, false)) diff --git a/fpdfsdk/pwl/cpwl_button.cpp b/fpdfsdk/pwl/cpwl_button.cpp index 766e8c49ad..9f746cf1c8 100644 --- a/fpdfsdk/pwl/cpwl_button.cpp +++ b/fpdfsdk/pwl/cpwl_button.cpp @@ -10,8 +10,9 @@ #include "fpdfsdk/pwl/cpwl_wnd.h" -CPWL_Button::CPWL_Button(std::unique_ptr<PrivateData> pAttachedData) - : CPWL_Wnd(std::move(pAttachedData)) {} +CPWL_Button::CPWL_Button(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData) + : CPWL_Wnd(cp, std::move(pAttachedData)) {} CPWL_Button::~CPWL_Button() = default; diff --git a/fpdfsdk/pwl/cpwl_button.h b/fpdfsdk/pwl/cpwl_button.h index cf53ff906c..5835b7a0db 100644 --- a/fpdfsdk/pwl/cpwl_button.h +++ b/fpdfsdk/pwl/cpwl_button.h @@ -13,7 +13,8 @@ class CPWL_Button : public CPWL_Wnd { public: - explicit CPWL_Button(std::unique_ptr<PrivateData> pAttachedData); + CPWL_Button(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData); ~CPWL_Button() override; // CPWL_Wnd diff --git a/fpdfsdk/pwl/cpwl_caret.cpp b/fpdfsdk/pwl/cpwl_caret.cpp index 63fb1ce2b5..4dfda8aecf 100644 --- a/fpdfsdk/pwl/cpwl_caret.cpp +++ b/fpdfsdk/pwl/cpwl_caret.cpp @@ -16,8 +16,9 @@ #define PWL_CARET_FLASHINTERVAL 500 -CPWL_Caret::CPWL_Caret(std::unique_ptr<PrivateData> pAttachedData) - : CPWL_Wnd(std::move(pAttachedData)) {} +CPWL_Caret::CPWL_Caret(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData) + : CPWL_Wnd(cp, std::move(pAttachedData)) {} CPWL_Caret::~CPWL_Caret() = default; diff --git a/fpdfsdk/pwl/cpwl_caret.h b/fpdfsdk/pwl/cpwl_caret.h index c85a8776f3..f576fe36e8 100644 --- a/fpdfsdk/pwl/cpwl_caret.h +++ b/fpdfsdk/pwl/cpwl_caret.h @@ -13,7 +13,8 @@ class CPWL_Caret final : public CPWL_Wnd { public: - explicit CPWL_Caret(std::unique_ptr<PrivateData> pAttachedData); + CPWL_Caret(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData); ~CPWL_Caret() override; // CPWL_Wnd diff --git a/fpdfsdk/pwl/cpwl_combo_box.cpp b/fpdfsdk/pwl/cpwl_combo_box.cpp index 887b0225e5..eef4496118 100644 --- a/fpdfsdk/pwl/cpwl_combo_box.cpp +++ b/fpdfsdk/pwl/cpwl_combo_box.cpp @@ -27,8 +27,9 @@ constexpr int kDefaultButtonWidth = 13; } // namespace -CPWL_CBListBox::CPWL_CBListBox(std::unique_ptr<PrivateData> pAttachedData) - : CPWL_ListBox(std::move(pAttachedData)) {} +CPWL_CBListBox::CPWL_CBListBox(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData) + : CPWL_ListBox(cp, std::move(pAttachedData)) {} CPWL_CBListBox::~CPWL_CBListBox() = default; @@ -100,8 +101,9 @@ bool CPWL_CBListBox::OnCharNotify(uint16_t nChar, uint32_t nFlag) { return OnNotifySelectionChanged(true, nFlag); } -CPWL_CBButton::CPWL_CBButton(std::unique_ptr<PrivateData> pAttachedData) - : CPWL_Wnd(std::move(pAttachedData)) {} +CPWL_CBButton::CPWL_CBButton(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData) + : CPWL_Wnd(cp, std::move(pAttachedData)) {} CPWL_CBButton::~CPWL_CBButton() = default; @@ -156,8 +158,9 @@ bool CPWL_CBButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { return true; } -CPWL_ComboBox::CPWL_ComboBox(std::unique_ptr<PrivateData> pAttachedData) - : CPWL_Wnd(std::move(pAttachedData)) {} +CPWL_ComboBox::CPWL_ComboBox(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData) + : CPWL_Wnd(cp, std::move(pAttachedData)) {} CPWL_ComboBox::~CPWL_ComboBox() = default; @@ -286,11 +289,11 @@ void CPWL_ComboBox::CreateEdit(const CreateParams& cp) { ecp.dwBorderWidth = 0; ecp.nBorderStyle = BorderStyle::SOLID; - auto pEdit = pdfium::MakeUnique<CPWL_Edit>(CloneAttachedData()); + auto pEdit = pdfium::MakeUnique<CPWL_Edit>(ecp, CloneAttachedData()); m_pEdit = pEdit.get(); m_pEdit->AttachFFLData(m_pFormFiller.Get()); AddChild(std::move(pEdit)); - m_pEdit->Realize(ecp); + m_pEdit->Realize(); } void CPWL_ComboBox::CreateButton(const CreateParams& cp) { @@ -306,10 +309,10 @@ void CPWL_ComboBox::CreateButton(const CreateParams& cp) { bcp.nBorderStyle = BorderStyle::BEVELED; bcp.eCursorType = FXCT_ARROW; - auto pButton = pdfium::MakeUnique<CPWL_CBButton>(CloneAttachedData()); + auto pButton = pdfium::MakeUnique<CPWL_CBButton>(bcp, CloneAttachedData()); m_pButton = pButton.get(); AddChild(std::move(pButton)); - m_pButton->Realize(bcp); + m_pButton->Realize(); } void CPWL_ComboBox::CreateListBox(const CreateParams& cp) { @@ -333,11 +336,11 @@ void CPWL_ComboBox::CreateListBox(const CreateParams& cp) { if (cp.sBackgroundColor.nColorType == CFX_Color::kTransparent) lcp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR; - auto pList = pdfium::MakeUnique<CPWL_CBListBox>(CloneAttachedData()); + auto pList = pdfium::MakeUnique<CPWL_CBListBox>(lcp, CloneAttachedData()); m_pList = pList.get(); m_pList->AttachFFLData(m_pFormFiller.Get()); AddChild(std::move(pList)); - m_pList->Realize(lcp); + m_pList->Realize(); } bool CPWL_ComboBox::RePosChildWnd() { diff --git a/fpdfsdk/pwl/cpwl_combo_box.h b/fpdfsdk/pwl/cpwl_combo_box.h index e3a3ff38ca..ee6ed90910 100644 --- a/fpdfsdk/pwl/cpwl_combo_box.h +++ b/fpdfsdk/pwl/cpwl_combo_box.h @@ -16,7 +16,8 @@ class CPWL_CBListBox final : public CPWL_ListBox { public: - explicit CPWL_CBListBox(std::unique_ptr<PrivateData> pAttachedData); + CPWL_CBListBox(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData); ~CPWL_CBListBox() override; // CPWL_ListBox @@ -30,7 +31,8 @@ class CPWL_CBListBox final : public CPWL_ListBox { class CPWL_CBButton final : public CPWL_Wnd { public: - explicit CPWL_CBButton(std::unique_ptr<PrivateData> pAttachedData); + CPWL_CBButton(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData); ~CPWL_CBButton() override; // CPWL_Wnd @@ -42,7 +44,8 @@ class CPWL_CBButton final : public CPWL_Wnd { class CPWL_ComboBox final : public CPWL_Wnd { public: - explicit CPWL_ComboBox(std::unique_ptr<PrivateData> pAttachedData); + CPWL_ComboBox(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData); ~CPWL_ComboBox() override; CPWL_Edit* GetEdit() const { return m_pEdit.Get(); } diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp index d0922cdf0d..abaac94752 100644 --- a/fpdfsdk/pwl/cpwl_edit.cpp +++ b/fpdfsdk/pwl/cpwl_edit.cpp @@ -27,8 +27,9 @@ #include "fpdfsdk/pwl/cpwl_wnd.h" #include "public/fpdf_fwlevent.h" -CPWL_Edit::CPWL_Edit(std::unique_ptr<PrivateData> pAttachedData) - : CPWL_EditCtrl(std::move(pAttachedData)) {} +CPWL_Edit::CPWL_Edit(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData) + : CPWL_EditCtrl(cp, std::move(pAttachedData)) {} CPWL_Edit::~CPWL_Edit() { ASSERT(!m_bFocus); diff --git a/fpdfsdk/pwl/cpwl_edit.h b/fpdfsdk/pwl/cpwl_edit.h index c996437dd1..419a240b67 100644 --- a/fpdfsdk/pwl/cpwl_edit.h +++ b/fpdfsdk/pwl/cpwl_edit.h @@ -43,7 +43,7 @@ class IPWL_Filler_Notify { class CPWL_Edit final : public CPWL_EditCtrl { public: - explicit CPWL_Edit(std::unique_ptr<PrivateData> pAttachedData); + CPWL_Edit(const CreateParams& cp, std::unique_ptr<PrivateData> pAttachedData); ~CPWL_Edit() override; // CPWL_EditCtrl diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp index 44918be30e..1b398a66c6 100644 --- a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp +++ b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp @@ -18,8 +18,9 @@ #include "public/fpdf_fwlevent.h" #include "third_party/base/ptr_util.h" -CPWL_EditCtrl::CPWL_EditCtrl(std::unique_ptr<PrivateData> pAttachedData) - : CPWL_Wnd(std::move(pAttachedData)), +CPWL_EditCtrl::CPWL_EditCtrl(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData) + : CPWL_Wnd(cp, std::move(pAttachedData)), m_pEdit(pdfium::MakeUnique<CPWL_EditImpl>()) {} CPWL_EditCtrl::~CPWL_EditCtrl() = default; @@ -94,11 +95,11 @@ void CPWL_EditCtrl::CreateEditCaret(const CreateParams& cp) { ecp.nBorderStyle = BorderStyle::SOLID; ecp.rcRectWnd = CFX_FloatRect(); - auto pCaret = pdfium::MakeUnique<CPWL_Caret>(CloneAttachedData()); + auto pCaret = pdfium::MakeUnique<CPWL_Caret>(ecp, CloneAttachedData()); m_pEditCaret = pCaret.get(); m_pEditCaret->SetInvalidRect(GetClientRect()); AddChild(std::move(pCaret)); - m_pEditCaret->Realize(ecp); + m_pEditCaret->Realize(); } void CPWL_EditCtrl::SetFontSize(float fFontSize) { diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.h b/fpdfsdk/pwl/cpwl_edit_ctrl.h index eb8ccb8029..cb89943f88 100644 --- a/fpdfsdk/pwl/cpwl_edit_ctrl.h +++ b/fpdfsdk/pwl/cpwl_edit_ctrl.h @@ -23,7 +23,8 @@ enum PWL_EDIT_ALIGNFORMAT_V { PEAV_TOP = 0, PEAV_CENTER, PEAV_BOTTOM }; class CPWL_EditCtrl : public CPWL_Wnd { public: - explicit CPWL_EditCtrl(std::unique_ptr<PrivateData> pAttachedData); + CPWL_EditCtrl(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData); ~CPWL_EditCtrl() override; void SetSelection(int32_t nStartChar, int32_t nEndChar); diff --git a/fpdfsdk/pwl/cpwl_icon.cpp b/fpdfsdk/pwl/cpwl_icon.cpp index 8d672f58da..946c76fd7b 100644 --- a/fpdfsdk/pwl/cpwl_icon.cpp +++ b/fpdfsdk/pwl/cpwl_icon.cpp @@ -15,8 +15,9 @@ #include "core/fpdfapi/parser/cpdf_stream.h" #include "fpdfsdk/pwl/cpwl_wnd.h" -CPWL_Icon::CPWL_Icon(std::unique_ptr<PrivateData> pAttachedData) - : CPWL_Wnd(std::move(pAttachedData)) {} +CPWL_Icon::CPWL_Icon(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData) + : CPWL_Wnd(cp, std::move(pAttachedData)) {} CPWL_Icon::~CPWL_Icon() = default; diff --git a/fpdfsdk/pwl/cpwl_icon.h b/fpdfsdk/pwl/cpwl_icon.h index 83709f7e18..b36c697e7d 100644 --- a/fpdfsdk/pwl/cpwl_icon.h +++ b/fpdfsdk/pwl/cpwl_icon.h @@ -16,7 +16,7 @@ class CPWL_Icon final : public CPWL_Wnd { public: - explicit CPWL_Icon(std::unique_ptr<PrivateData> pAttachedData); + CPWL_Icon(const CreateParams& cp, std::unique_ptr<PrivateData> pAttachedData); ~CPWL_Icon() override; void SetIconFit(CPDF_IconFit* pIconFit) { m_pIconFit = pIconFit; } diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp index 4cea17b661..003fe11956 100644 --- a/fpdfsdk/pwl/cpwl_list_box.cpp +++ b/fpdfsdk/pwl/cpwl_list_box.cpp @@ -65,8 +65,9 @@ void CPWL_List_Notify::IOnInvalidateRect(CFX_FloatRect* pRect) { m_pList->InvalidateRect(pRect); } -CPWL_ListBox::CPWL_ListBox(std::unique_ptr<PrivateData> pAttachedData) - : CPWL_Wnd(std::move(pAttachedData)), +CPWL_ListBox::CPWL_ListBox(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData) + : CPWL_Wnd(cp, std::move(pAttachedData)), m_pList(pdfium::MakeUnique<CPWL_ListCtrl>()) {} CPWL_ListBox::~CPWL_ListBox() = default; diff --git a/fpdfsdk/pwl/cpwl_list_box.h b/fpdfsdk/pwl/cpwl_list_box.h index cbfca4585f..2b4d69343e 100644 --- a/fpdfsdk/pwl/cpwl_list_box.h +++ b/fpdfsdk/pwl/cpwl_list_box.h @@ -38,7 +38,8 @@ class CPWL_List_Notify { class CPWL_ListBox : public CPWL_Wnd { public: - explicit CPWL_ListBox(std::unique_ptr<PrivateData> pAttachedData); + CPWL_ListBox(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData); ~CPWL_ListBox() override; // CPWL_Wnd diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.cpp b/fpdfsdk/pwl/cpwl_scroll_bar.cpp index fb2060a149..0209ba09c2 100644 --- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp +++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp @@ -105,10 +105,11 @@ void PWL_SCROLL_PRIVATEDATA::SubBig() { SetPos(ScrollRange.fMin); } -CPWL_SBButton::CPWL_SBButton(std::unique_ptr<PrivateData> pAttachedData, +CPWL_SBButton::CPWL_SBButton(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData, PWL_SCROLLBAR_TYPE eScrollBarType, PWL_SBBUTTON_TYPE eButtonType) - : CPWL_Wnd(std::move(pAttachedData)), + : CPWL_Wnd(cp, std::move(pAttachedData)), m_eScrollBarType(eScrollBarType), m_eSBButtonType(eButtonType) {} @@ -298,9 +299,10 @@ bool CPWL_SBButton::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) { return true; } -CPWL_ScrollBar::CPWL_ScrollBar(std::unique_ptr<PrivateData> pAttachedData, +CPWL_ScrollBar::CPWL_ScrollBar(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData, PWL_SCROLLBAR_TYPE sbType) - : CPWL_Wnd(std::move(pAttachedData)), m_sbType(sbType) {} + : CPWL_Wnd(cp, std::move(pAttachedData)), m_sbType(sbType) {} CPWL_ScrollBar::~CPWL_ScrollBar() = default; @@ -541,29 +543,29 @@ void CPWL_ScrollBar::CreateButtons(const CreateParams& cp) { PWS_VISIBLE | PWS_CHILD | PWS_BORDER | PWS_BACKGROUND | PWS_NOREFRESHCLIP; if (!m_pMinButton) { - auto pButton = pdfium::MakeUnique<CPWL_SBButton>(CloneAttachedData(), + auto pButton = pdfium::MakeUnique<CPWL_SBButton>(scp, CloneAttachedData(), m_sbType, PSBT_MIN); m_pMinButton = pButton.get(); AddChild(std::move(pButton)); - m_pMinButton->Realize(scp); + m_pMinButton->Realize(); } if (!m_pMaxButton) { - auto pButton = pdfium::MakeUnique<CPWL_SBButton>(CloneAttachedData(), + auto pButton = pdfium::MakeUnique<CPWL_SBButton>(scp, CloneAttachedData(), m_sbType, PSBT_MAX); m_pMaxButton = pButton.get(); AddChild(std::move(pButton)); - m_pMaxButton->Realize(scp); + m_pMaxButton->Realize(); } if (!m_pPosButton) { - auto pButton = pdfium::MakeUnique<CPWL_SBButton>(CloneAttachedData(), + auto pButton = pdfium::MakeUnique<CPWL_SBButton>(scp, CloneAttachedData(), m_sbType, PSBT_POS); m_pPosButton = pButton.get(); ObservedPtr thisObserved(this); if (m_pPosButton->SetVisible(false) && thisObserved) { AddChild(std::move(pButton)); - m_pPosButton->Realize(scp); + m_pPosButton->Realize(); } } } diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.h b/fpdfsdk/pwl/cpwl_scroll_bar.h index 40660db1f6..82c995b607 100644 --- a/fpdfsdk/pwl/cpwl_scroll_bar.h +++ b/fpdfsdk/pwl/cpwl_scroll_bar.h @@ -12,9 +12,6 @@ #include "core/fxcrt/unowned_ptr.h" #include "fpdfsdk/pwl/cpwl_wnd.h" -class CPWL_SBButton; -class CPWL_ScrollBar; - struct PWL_SCROLL_INFO { public: PWL_SCROLL_INFO() @@ -46,7 +43,8 @@ enum PWL_SBBUTTON_TYPE { PSBT_MIN, PSBT_MAX, PSBT_POS }; class CPWL_SBButton final : public CPWL_Wnd { public: - CPWL_SBButton(std::unique_ptr<PrivateData> pAttachedData, + CPWL_SBButton(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData, PWL_SCROLLBAR_TYPE eScrollBarType, PWL_SBBUTTON_TYPE eButtonType); ~CPWL_SBButton() override; @@ -117,7 +115,8 @@ struct PWL_SCROLL_PRIVATEDATA { class CPWL_ScrollBar final : public CPWL_Wnd { public: - CPWL_ScrollBar(std::unique_ptr<PrivateData> pAttachedData, + CPWL_ScrollBar(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData, PWL_SCROLLBAR_TYPE sbType); ~CPWL_ScrollBar() override; diff --git a/fpdfsdk/pwl/cpwl_special_button.cpp b/fpdfsdk/pwl/cpwl_special_button.cpp index 8e5f1b8d48..16f8c89738 100644 --- a/fpdfsdk/pwl/cpwl_special_button.cpp +++ b/fpdfsdk/pwl/cpwl_special_button.cpp @@ -11,8 +11,9 @@ #include "fpdfsdk/pwl/cpwl_button.h" #include "fpdfsdk/pwl/cpwl_wnd.h" -CPWL_PushButton::CPWL_PushButton(std::unique_ptr<PrivateData> pAttachedData) - : CPWL_Button(std::move(pAttachedData)) {} +CPWL_PushButton::CPWL_PushButton(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData) + : CPWL_Button(cp, std::move(pAttachedData)) {} CPWL_PushButton::~CPWL_PushButton() = default; @@ -21,8 +22,9 @@ CFX_FloatRect CPWL_PushButton::GetFocusRect() const { static_cast<float>(GetBorderWidth())); } -CPWL_CheckBox::CPWL_CheckBox(std::unique_ptr<PrivateData> pAttachedData) - : CPWL_Button(std::move(pAttachedData)) {} +CPWL_CheckBox::CPWL_CheckBox(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData) + : CPWL_Button(cp, std::move(pAttachedData)) {} CPWL_CheckBox::~CPWL_CheckBox() = default; @@ -39,8 +41,9 @@ bool CPWL_CheckBox::OnChar(uint16_t nChar, uint32_t nFlag) { return true; } -CPWL_RadioButton::CPWL_RadioButton(std::unique_ptr<PrivateData> pAttachedData) - : CPWL_Button(std::move(pAttachedData)) {} +CPWL_RadioButton::CPWL_RadioButton(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData) + : CPWL_Button(cp, std::move(pAttachedData)) {} CPWL_RadioButton::~CPWL_RadioButton() = default; diff --git a/fpdfsdk/pwl/cpwl_special_button.h b/fpdfsdk/pwl/cpwl_special_button.h index 28c2a6b14c..68bb965a49 100644 --- a/fpdfsdk/pwl/cpwl_special_button.h +++ b/fpdfsdk/pwl/cpwl_special_button.h @@ -13,7 +13,8 @@ class CPWL_PushButton final : public CPWL_Button { public: - explicit CPWL_PushButton(std::unique_ptr<PrivateData> pAttachedData); + CPWL_PushButton(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData); ~CPWL_PushButton() override; // CPWL_Button: @@ -22,7 +23,8 @@ class CPWL_PushButton final : public CPWL_Button { class CPWL_CheckBox final : public CPWL_Button { public: - explicit CPWL_CheckBox(std::unique_ptr<PrivateData> pAttachedData); + CPWL_CheckBox(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData); ~CPWL_CheckBox() override; // CPWL_Button: @@ -38,7 +40,8 @@ class CPWL_CheckBox final : public CPWL_Button { class CPWL_RadioButton final : public CPWL_Button { public: - explicit CPWL_RadioButton(std::unique_ptr<PrivateData> pAttachedData); + CPWL_RadioButton(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData); ~CPWL_RadioButton() override; // CPWL_Button diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp index 8ed57de646..90aa15cfee 100644 --- a/fpdfsdk/pwl/cpwl_wnd.cpp +++ b/fpdfsdk/pwl/cpwl_wnd.cpp @@ -111,17 +111,17 @@ class CPWL_MsgControl final : public Observable<CPWL_MsgControl> { UnownedPtr<CPWL_Wnd> m_pMainKeyboardWnd; }; -CPWL_Wnd::CPWL_Wnd(std::unique_ptr<PrivateData> pAttachedData) - : m_pAttachedData(std::move(pAttachedData)) {} +CPWL_Wnd::CPWL_Wnd(const CreateParams& cp, + std::unique_ptr<PrivateData> pAttachedData) + : m_CreationParams(cp), m_pAttachedData(std::move(pAttachedData)) {} CPWL_Wnd::~CPWL_Wnd() { ASSERT(!m_bCreated); } -void CPWL_Wnd::Realize(const CreateParams& cp) { +void CPWL_Wnd::Realize() { ASSERT(!m_bCreated); - m_CreationParams = cp; OnCreate(&m_CreationParams); m_CreationParams.rcRectWnd.Normalize(); m_rcWindow = m_CreationParams.rcRectWnd; @@ -484,20 +484,17 @@ void CPWL_Wnd::CreateVScrollBar(const CreateParams& cp) { return; CreateParams scp = cp; - - // flags scp.dwFlags = PWS_CHILD | PWS_BACKGROUND | PWS_AUTOTRANSPARENT | PWS_NOREFRESHCLIP; - scp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR; scp.eCursorType = FXCT_ARROW; scp.nTransparency = PWL_SCROLLBAR_TRANSPARENCY; auto pBar = - pdfium::MakeUnique<CPWL_ScrollBar>(CloneAttachedData(), SBT_VSCROLL); + pdfium::MakeUnique<CPWL_ScrollBar>(scp, CloneAttachedData(), SBT_VSCROLL); m_pVScrollBar = pBar.get(); AddChild(std::move(pBar)); - m_pVScrollBar->Realize(scp); + m_pVScrollBar->Realize(); } void CPWL_Wnd::SetCapture() { diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h index 51e34a769d..64fe1310e2 100644 --- a/fpdfsdk/pwl/cpwl_wnd.h +++ b/fpdfsdk/pwl/cpwl_wnd.h @@ -132,7 +132,7 @@ class CPWL_Wnd : public CPWL_TimerHandler, public Observable<CPWL_Wnd> { CFX_Matrix mtChild; // ignore }; - explicit CPWL_Wnd(std::unique_ptr<PrivateData> pAttachedData); + CPWL_Wnd(const CreateParams& cp, std::unique_ptr<PrivateData> pAttachedData); ~CPWL_Wnd() override; // Returns |true| iff this instance is still allocated. @@ -178,7 +178,7 @@ class CPWL_Wnd : public CPWL_TimerHandler, public Observable<CPWL_Wnd> { void AddChild(std::unique_ptr<CPWL_Wnd> pWnd); void RemoveChild(CPWL_Wnd* pWnd); - void Realize(const CreateParams& cp); + void Realize(); void Destroy(); bool Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh); |