From d8ac668fad0211b5d8055866f835d38315d5dabb Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 4 Oct 2018 19:29:30 +0000 Subject: Remove CPWL_Wnd::GetClassName() and overrides. It's only used in two tests, and there it is not essential, so save some strings and vtable space. Change-Id: If8c68e5e2580dbe588bccb942f9008efb66fe490 Reviewed-on: https://pdfium-review.googlesource.com/c/43472 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- fpdfsdk/pwl/cpwl_button.cpp | 4 ---- fpdfsdk/pwl/cpwl_button.h | 1 - fpdfsdk/pwl/cpwl_caret.cpp | 4 ---- fpdfsdk/pwl/cpwl_caret.h | 1 - fpdfsdk/pwl/cpwl_combo_box.cpp | 4 ---- fpdfsdk/pwl/cpwl_combo_box.h | 1 - fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp | 1 - fpdfsdk/pwl/cpwl_edit.cpp | 4 ---- fpdfsdk/pwl/cpwl_edit.h | 3 --- fpdfsdk/pwl/cpwl_edit_embeddertest.cpp | 5 ++--- fpdfsdk/pwl/cpwl_list_box.cpp | 4 ---- fpdfsdk/pwl/cpwl_list_box.h | 1 - fpdfsdk/pwl/cpwl_scroll_bar.cpp | 8 -------- fpdfsdk/pwl/cpwl_scroll_bar.h | 2 -- fpdfsdk/pwl/cpwl_special_button.cpp | 12 ------------ fpdfsdk/pwl/cpwl_special_button.h | 3 --- fpdfsdk/pwl/cpwl_wnd.cpp | 4 ---- fpdfsdk/pwl/cpwl_wnd.h | 2 -- 18 files changed, 2 insertions(+), 62 deletions(-) diff --git a/fpdfsdk/pwl/cpwl_button.cpp b/fpdfsdk/pwl/cpwl_button.cpp index 364bcc6f2a..bdf56a21ae 100644 --- a/fpdfsdk/pwl/cpwl_button.cpp +++ b/fpdfsdk/pwl/cpwl_button.cpp @@ -12,10 +12,6 @@ CPWL_Button::CPWL_Button() : m_bMouseDown(false) {} CPWL_Button::~CPWL_Button() {} -ByteString CPWL_Button::GetClassName() const { - return "CPWL_Button"; -} - void CPWL_Button::OnCreate(CreateParams* pParamsToAdjust) { pParamsToAdjust->eCursorType = FXCT_HAND; } diff --git a/fpdfsdk/pwl/cpwl_button.h b/fpdfsdk/pwl/cpwl_button.h index 70f5ef1908..b327371c7f 100644 --- a/fpdfsdk/pwl/cpwl_button.h +++ b/fpdfsdk/pwl/cpwl_button.h @@ -15,7 +15,6 @@ class CPWL_Button : public CPWL_Wnd { ~CPWL_Button() override; // CPWL_Wnd - ByteString GetClassName() const override; void OnCreate(CreateParams* pParamsToAdjust) override; bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; diff --git a/fpdfsdk/pwl/cpwl_caret.cpp b/fpdfsdk/pwl/cpwl_caret.cpp index 77a768afe0..24ecb17533 100644 --- a/fpdfsdk/pwl/cpwl_caret.cpp +++ b/fpdfsdk/pwl/cpwl_caret.cpp @@ -19,10 +19,6 @@ CPWL_Caret::CPWL_Caret() : m_bFlash(false), m_fWidth(0.4f), m_nDelay(0) {} CPWL_Caret::~CPWL_Caret() {} -ByteString CPWL_Caret::GetClassName() const { - return "CPWL_Caret"; -} - void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, const CFX_Matrix& mtUser2Device) { if (!IsVisible() || !m_bFlash) diff --git a/fpdfsdk/pwl/cpwl_caret.h b/fpdfsdk/pwl/cpwl_caret.h index 1f7c2b84d4..27418ec868 100644 --- a/fpdfsdk/pwl/cpwl_caret.h +++ b/fpdfsdk/pwl/cpwl_caret.h @@ -15,7 +15,6 @@ class CPWL_Caret final : public CPWL_Wnd { ~CPWL_Caret() override; // CPWL_Wnd - ByteString GetClassName() const override; void DrawThisAppearance(CFX_RenderDevice* pDevice, const CFX_Matrix& mtUser2Device) override; bool InvalidateRect(CFX_FloatRect* pRect) override; diff --git a/fpdfsdk/pwl/cpwl_combo_box.cpp b/fpdfsdk/pwl/cpwl_combo_box.cpp index a69dd7418f..341bd93e41 100644 --- a/fpdfsdk/pwl/cpwl_combo_box.cpp +++ b/fpdfsdk/pwl/cpwl_combo_box.cpp @@ -151,10 +151,6 @@ CPWL_ComboBox::CPWL_ComboBox() {} CPWL_ComboBox::~CPWL_ComboBox() {} -ByteString CPWL_ComboBox::GetClassName() const { - return "CPWL_ComboBox"; -} - void CPWL_ComboBox::OnCreate(CreateParams* pParamsToAdjust) { pParamsToAdjust->dwFlags &= ~PWS_HSCROLL; pParamsToAdjust->dwFlags &= ~PWS_VSCROLL; diff --git a/fpdfsdk/pwl/cpwl_combo_box.h b/fpdfsdk/pwl/cpwl_combo_box.h index 0f54ae4f26..2e66b515b0 100644 --- a/fpdfsdk/pwl/cpwl_combo_box.h +++ b/fpdfsdk/pwl/cpwl_combo_box.h @@ -46,7 +46,6 @@ class CPWL_ComboBox final : public CPWL_Wnd { CPWL_Edit* GetEdit() const { return m_pEdit.Get(); } // CPWL_Wnd: - ByteString GetClassName() const override; void OnCreate(CreateParams* pParamsToAdjust) override; void OnDestroy() override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; diff --git a/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp b/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp index 62d42f9344..e839de0756 100644 --- a/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp +++ b/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp @@ -65,7 +65,6 @@ class CPWLComboBoxEditEmbeddertest : public EmbedderTest { CPWL_Wnd* pWindow = m_pFormFiller->GetPDFWindow(m_pFormFillEnv->GetPageView(0), false); ASSERT_TRUE(pWindow); - ASSERT_EQ("CPWL_ComboBox", pWindow->GetClassName()); m_pComboBox = static_cast(pWindow); } diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp index 4cd238b679..59fb921b89 100644 --- a/fpdfsdk/pwl/cpwl_edit.cpp +++ b/fpdfsdk/pwl/cpwl_edit.cpp @@ -33,10 +33,6 @@ CPWL_Edit::~CPWL_Edit() { ASSERT(!m_bFocus); } -ByteString CPWL_Edit::GetClassName() const { - return PWL_CLASSNAME_EDIT; -} - void CPWL_Edit::SetText(const WideString& csText) { m_pEdit->SetText(csText); } diff --git a/fpdfsdk/pwl/cpwl_edit.h b/fpdfsdk/pwl/cpwl_edit.h index f7429c9d2d..849436a3e3 100644 --- a/fpdfsdk/pwl/cpwl_edit.h +++ b/fpdfsdk/pwl/cpwl_edit.h @@ -13,8 +13,6 @@ #include "core/fxcrt/unowned_ptr.h" #include "fpdfsdk/pwl/cpwl_edit_ctrl.h" -#define PWL_CLASSNAME_EDIT "CPWL_Edit" - class IPWL_Filler_Notify { public: virtual ~IPWL_Filler_Notify() {} @@ -47,7 +45,6 @@ class CPWL_Edit final : public CPWL_EditCtrl { ~CPWL_Edit() override; // CPWL_EditCtrl - ByteString GetClassName() const override; void OnCreated() override; bool RePosChildWnd() override; CFX_FloatRect GetClientRect() const override; diff --git a/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp b/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp index 3edbf7580a..d7510231f7 100644 --- a/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp +++ b/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp @@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "fpdfsdk/pwl/cpwl_edit.h" + #include "fpdfsdk/cpdfsdk_annot.h" #include "fpdfsdk/cpdfsdk_annotiterator.h" #include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/formfiller/cffl_formfiller.h" #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" -#include "fpdfsdk/pwl/cpwl_wnd.h" #include "testing/embedder_test.h" #include "testing/gtest/include/gtest/gtest.h" @@ -64,8 +65,6 @@ class CPWLEditEmbeddertest : public EmbedderTest { CPWL_Wnd* pWindow = m_pFormFiller->GetPDFWindow(m_pFormFillEnv->GetPageView(0), false); ASSERT_TRUE(pWindow); - ASSERT_EQ(PWL_CLASSNAME_EDIT, pWindow->GetClassName()); - m_pEdit = static_cast(pWindow); } diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp index fdcd4bb635..11d451c920 100644 --- a/fpdfsdk/pwl/cpwl_list_box.cpp +++ b/fpdfsdk/pwl/cpwl_list_box.cpp @@ -72,10 +72,6 @@ CPWL_ListBox::CPWL_ListBox() CPWL_ListBox::~CPWL_ListBox() {} -ByteString CPWL_ListBox::GetClassName() const { - return "CPWL_ListBox"; -} - void CPWL_ListBox::OnCreated() { m_pList->SetFontMap(GetFontMap()); m_pListNotify = pdfium::MakeUnique(this); diff --git a/fpdfsdk/pwl/cpwl_list_box.h b/fpdfsdk/pwl/cpwl_list_box.h index 0371ba1b54..6a58982aee 100644 --- a/fpdfsdk/pwl/cpwl_list_box.h +++ b/fpdfsdk/pwl/cpwl_list_box.h @@ -42,7 +42,6 @@ class CPWL_ListBox : public CPWL_Wnd { ~CPWL_ListBox() override; // CPWL_Wnd - ByteString GetClassName() const override; void OnCreated() override; void OnDestroy() override; void DrawThisAppearance(CFX_RenderDevice* pDevice, diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.cpp b/fpdfsdk/pwl/cpwl_scroll_bar.cpp index a9cd4f67d0..472e6afc24 100644 --- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp +++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp @@ -127,10 +127,6 @@ CPWL_SBButton::CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType, CPWL_SBButton::~CPWL_SBButton() {} -ByteString CPWL_SBButton::GetClassName() const { - return "CPWL_SBButton"; -} - void CPWL_SBButton::OnCreate(CreateParams* pParamsToAdjust) { pParamsToAdjust->eCursorType = FXCT_ARROW; } @@ -326,10 +322,6 @@ CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType) CPWL_ScrollBar::~CPWL_ScrollBar() {} -ByteString CPWL_ScrollBar::GetClassName() const { - return "CPWL_ScrollBar"; -} - void CPWL_ScrollBar::OnCreate(CreateParams* pParamsToAdjust) { pParamsToAdjust->eCursorType = FXCT_ARROW; } diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.h b/fpdfsdk/pwl/cpwl_scroll_bar.h index a61c04d019..3c3c56e4bb 100644 --- a/fpdfsdk/pwl/cpwl_scroll_bar.h +++ b/fpdfsdk/pwl/cpwl_scroll_bar.h @@ -49,7 +49,6 @@ class CPWL_SBButton final : public CPWL_Wnd { ~CPWL_SBButton() override; // CPWL_Wnd - ByteString GetClassName() const override; void OnCreate(CreateParams* pParamsToAdjust) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, const CFX_Matrix& mtUser2Device) override; @@ -120,7 +119,6 @@ class CPWL_ScrollBar final : public CPWL_Wnd { ~CPWL_ScrollBar() override; // CPWL_Wnd: - ByteString GetClassName() const override; void OnCreate(CreateParams* pParamsToAdjust) override; void OnDestroy() override; bool RePosChildWnd() override; diff --git a/fpdfsdk/pwl/cpwl_special_button.cpp b/fpdfsdk/pwl/cpwl_special_button.cpp index f95918f60a..061d024382 100644 --- a/fpdfsdk/pwl/cpwl_special_button.cpp +++ b/fpdfsdk/pwl/cpwl_special_button.cpp @@ -13,10 +13,6 @@ CPWL_PushButton::CPWL_PushButton() {} CPWL_PushButton::~CPWL_PushButton() {} -ByteString CPWL_PushButton::GetClassName() const { - return "CPWL_PushButton"; -} - CFX_FloatRect CPWL_PushButton::GetFocusRect() const { return GetWindowRect().GetDeflated(static_cast(GetBorderWidth()), static_cast(GetBorderWidth())); @@ -26,10 +22,6 @@ CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(false) {} CPWL_CheckBox::~CPWL_CheckBox() {} -ByteString CPWL_CheckBox::GetClassName() const { - return "CPWL_CheckBox"; -} - void CPWL_CheckBox::SetCheck(bool bCheck) { m_bChecked = bCheck; } @@ -55,10 +47,6 @@ CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(false) {} CPWL_RadioButton::~CPWL_RadioButton() {} -ByteString CPWL_RadioButton::GetClassName() const { - return "CPWL_RadioButton"; -} - bool CPWL_RadioButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { if (IsReadOnly()) return false; diff --git a/fpdfsdk/pwl/cpwl_special_button.h b/fpdfsdk/pwl/cpwl_special_button.h index b980f84625..606be78f31 100644 --- a/fpdfsdk/pwl/cpwl_special_button.h +++ b/fpdfsdk/pwl/cpwl_special_button.h @@ -15,7 +15,6 @@ class CPWL_PushButton final : public CPWL_Button { ~CPWL_PushButton() override; // CPWL_Button - ByteString GetClassName() const override; CFX_FloatRect GetFocusRect() const override; }; @@ -25,7 +24,6 @@ class CPWL_CheckBox final : public CPWL_Button { ~CPWL_CheckBox() override; // CPWL_Button - ByteString GetClassName() const override; bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; @@ -42,7 +40,6 @@ class CPWL_RadioButton final : public CPWL_Button { ~CPWL_RadioButton() override; // CPWL_Button - ByteString GetClassName() const override; bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp index 1cd9461af4..095fae9b26 100644 --- a/fpdfsdk/pwl/cpwl_wnd.cpp +++ b/fpdfsdk/pwl/cpwl_wnd.cpp @@ -123,10 +123,6 @@ CPWL_Wnd::~CPWL_Wnd() { ASSERT(!m_bCreated); } -ByteString CPWL_Wnd::GetClassName() const { - return "CPWL_Wnd"; -} - void CPWL_Wnd::Create(const CreateParams& cp) { if (IsValid()) return; diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h index 8d962a7971..1ed239ed85 100644 --- a/fpdfsdk/pwl/cpwl_wnd.h +++ b/fpdfsdk/pwl/cpwl_wnd.h @@ -149,8 +149,6 @@ class CPWL_Wnd : public CPWL_TimerHandler, public Observable { CPWL_Wnd(); ~CPWL_Wnd() override; - virtual ByteString GetClassName() const; - // Returns |true| iff this instance is still allocated. virtual bool InvalidateRect(CFX_FloatRect* pRect); -- cgit v1.2.3