Remove unreachable CPWL_Wnd::EnableWindow().
Its only caller is itself, so no way to reach it in the first place.
In turn, m_bEnabled is always true, so remove it. In turn, IsEnabled()
is always true so remove it and update callers.
Change-Id: Ib05b7545c8a5a9f9ac486fc374f3cee4c475f935
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79110
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.cpp b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
index 0fc0cf8..fcd0979 100644
--- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
@@ -26,8 +26,6 @@
} // namespace
-#define PWL_DEFAULT_HEAVYGRAYCOLOR CFX_Color(CFX_Color::kGray, 0.50)
-
void PWL_FLOATRANGE::Reset() {
fMin = 0.0f;
fMax = 0.0f;
@@ -180,15 +178,9 @@
if (m_eSBButtonType != PSBT_POS) {
// draw background
- if (IsEnabled()) {
- pDevice->DrawShadow(mtUser2Device, true, false,
- rectWnd.GetDeflated(1.0f, 1.0f), nTransparency, 80,
- 220);
- } else {
- pDevice->DrawFillRect(&mtUser2Device, rectWnd.GetDeflated(1.0f, 1.0f),
- ArgbEncode(255, 255, 255, 255));
- }
-
+ pDevice->DrawShadow(mtUser2Device, true, false,
+ rectWnd.GetDeflated(1.0f, 1.0f), nTransparency, 80,
+ 220);
// draw arrow
if (rectWnd.top - rectWnd.bottom > 6.0f) {
float fX = rectWnd.left + 1.5f;
@@ -209,40 +201,33 @@
for (size_t i = 0; i < pdfium::size(kOffsetsX); ++i)
pts.push_back(CFX_PointF(fX + kOffsetsX[i], fY + pOffsetsY[i]));
pDevice->DrawFillArea(mtUser2Device, pts,
- IsEnabled()
- ? ArgbEncode(nTransparency, 255, 255, 255)
- : PWL_DEFAULT_HEAVYGRAYCOLOR.ToFXColor(255));
+ ArgbEncode(nTransparency, 255, 255, 255));
}
return;
}
- if (IsEnabled()) {
- // draw shadow effect
- CFX_PointF ptTop = CFX_PointF(rectWnd.left, rectWnd.top - 1.0f);
- CFX_PointF ptBottom = CFX_PointF(rectWnd.left, rectWnd.bottom + 1.0f);
+ // draw shadow effect
+ CFX_PointF ptTop = CFX_PointF(rectWnd.left, rectWnd.top - 1.0f);
+ CFX_PointF ptBottom = CFX_PointF(rectWnd.left, rectWnd.bottom + 1.0f);
- ptTop.x += 1.5f;
- ptBottom.x += 1.5f;
+ ptTop.x += 1.5f;
+ ptBottom.x += 1.5f;
- const FX_COLORREF refs[] = {ArgbEncode(nTransparency, 210, 210, 210),
- ArgbEncode(nTransparency, 220, 220, 220),
- ArgbEncode(nTransparency, 240, 240, 240),
- ArgbEncode(nTransparency, 240, 240, 240),
- ArgbEncode(nTransparency, 210, 210, 210),
- ArgbEncode(nTransparency, 180, 180, 180),
- ArgbEncode(nTransparency, 150, 150, 150),
- ArgbEncode(nTransparency, 150, 150, 150),
- ArgbEncode(nTransparency, 180, 180, 180),
- ArgbEncode(nTransparency, 210, 210, 210)};
- for (FX_COLORREF ref : refs) {
- pDevice->DrawStrokeLine(&mtUser2Device, ptTop, ptBottom, ref, 1.0f);
+ const FX_COLORREF refs[] = {ArgbEncode(nTransparency, 210, 210, 210),
+ ArgbEncode(nTransparency, 220, 220, 220),
+ ArgbEncode(nTransparency, 240, 240, 240),
+ ArgbEncode(nTransparency, 240, 240, 240),
+ ArgbEncode(nTransparency, 210, 210, 210),
+ ArgbEncode(nTransparency, 180, 180, 180),
+ ArgbEncode(nTransparency, 150, 150, 150),
+ ArgbEncode(nTransparency, 150, 150, 150),
+ ArgbEncode(nTransparency, 180, 180, 180),
+ ArgbEncode(nTransparency, 210, 210, 210)};
+ for (FX_COLORREF ref : refs) {
+ pDevice->DrawStrokeLine(&mtUser2Device, ptTop, ptBottom, ref, 1.0f);
- ptTop.x += 1.0f;
- ptBottom.x += 1.0f;
- }
- } else {
- pDevice->DrawFillRect(&mtUser2Device, rectWnd.GetDeflated(0.5f, 0.5f),
- ArgbEncode(255, 255, 255, 255));
+ ptTop.x += 1.0f;
+ ptBottom.x += 1.0f;
}
// draw friction
@@ -250,12 +235,8 @@
return;
FX_COLORREF crStroke = ArgbEncode(nTransparency, 120, 120, 120);
- if (!IsEnabled())
- crStroke = PWL_DEFAULT_HEAVYGRAYCOLOR.ToFXColor(255);
-
float nFrictionWidth = 5.0f;
float nFrictionHeight = 5.5f;
-
CFX_PointF ptLeft = CFX_PointF(ptCenter.x - nFrictionWidth / 2.0f,
ptCenter.y - nFrictionHeight / 2.0f + 0.5f);
CFX_PointF ptRight = CFX_PointF(ptCenter.x + nFrictionWidth / 2.0f,
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index 0935e1b..58095a9 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -270,7 +270,7 @@
#define PWL_IMPLEMENT_KEY_METHOD(key_method_name) \
bool CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \
- if (!IsValid() || !IsVisible() || !IsEnabled()) \
+ if (!IsValid() || !IsVisible()) \
return false; \
if (!IsWndCaptureKeyboard(this)) \
return false; \
@@ -287,7 +287,7 @@
#define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \
bool CPWL_Wnd::mouse_method_name(uint32_t nFlag, const CFX_PointF& point) { \
- if (!IsValid() || !IsVisible() || !IsEnabled()) \
+ if (!IsValid() || !IsVisible()) \
return false; \
if (IsWndCaptureMouse(this)) { \
for (const auto& pChild : m_Children) { \
@@ -357,7 +357,7 @@
bool CPWL_Wnd::OnMouseWheel(uint32_t nFlag,
const CFX_PointF& point,
const CFX_Vector& delta) {
- if (!IsValid() || !IsVisible() || !IsEnabled())
+ if (!IsValid() || !IsVisible())
return false;
SetCursor();
@@ -751,13 +751,3 @@
CPWL_MsgControl* pMsgCtrl = GetMsgControl();
return pMsgCtrl ? pMsgCtrl->GetFocusedWindow() : nullptr;
}
-
-void CPWL_Wnd::EnableWindow(bool bEnable) {
- if (m_bEnabled == bEnable)
- return;
-
- for (const auto& pChild : m_Children)
- pChild->EnableWindow(bEnable);
-
- m_bEnabled = bEnable;
-}
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index 43b535e..72f98db 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -233,8 +233,6 @@
bool ClientHitTest(const CFX_PointF& point) const;
bool IsCaptureMouse() const;
- void EnableWindow(bool bEnable);
- bool IsEnabled() const { return m_bEnabled; }
const CPWL_Wnd* GetFocused() const;
bool IsFocused() const;
bool IsReadOnly() const;
@@ -326,7 +324,6 @@
bool m_bCreated = false;
bool m_bVisible = false;
bool m_bNotifying = false;
- bool m_bEnabled = true;
};
#endif // FPDFSDK_PWL_CPWL_WND_H_