From 60fa2fce1f6fc02b3039166d84ed8ec152312566 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 21 Jul 2017 17:42:19 -0700 Subject: Simplify code in CPDFSDK_FormFillEnvironment. This makes various IsFooKeyDown() methods static. Transitively apply that to callers too. Change-Id: Ia43b1fd62889c1943e0d8407e9696225b05125a8 Reviewed-on: https://pdfium-review.googlesource.com/7190 Commit-Queue: Lei Zhang Reviewed-by: dsinclair Reviewed-by: Tom Sepez --- fpdfsdk/pdfwindow/cpwl_wnd.cpp | 15 --------------- fpdfsdk/pdfwindow/cpwl_wnd.h | 13 ++++++++++--- 2 files changed, 10 insertions(+), 18 deletions(-) (limited to 'fpdfsdk/pdfwindow') diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.cpp b/fpdfsdk/pdfwindow/cpwl_wnd.cpp index ce5f4ee598..663a763e3c 100644 --- a/fpdfsdk/pdfwindow/cpwl_wnd.cpp +++ b/fpdfsdk/pdfwindow/cpwl_wnd.cpp @@ -802,18 +802,3 @@ void CPWL_Wnd::EnableWindow(bool bEnable) { } m_bEnabled = bEnable; } - -bool CPWL_Wnd::IsCTRLpressed(uint32_t nFlag) const { - CFX_SystemHandler* pSystemHandler = GetSystemHandler(); - return pSystemHandler && pSystemHandler->IsCTRLKeyDown(nFlag); -} - -bool CPWL_Wnd::IsSHIFTpressed(uint32_t nFlag) const { - CFX_SystemHandler* pSystemHandler = GetSystemHandler(); - return pSystemHandler && pSystemHandler->IsSHIFTKeyDown(nFlag); -} - -bool CPWL_Wnd::IsALTpressed(uint32_t nFlag) const { - CFX_SystemHandler* pSystemHandler = GetSystemHandler(); - return pSystemHandler && pSystemHandler->IsALTKeyDown(nFlag); -} diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.h b/fpdfsdk/pdfwindow/cpwl_wnd.h index 56fbb21baa..b22c5dba21 100644 --- a/fpdfsdk/pdfwindow/cpwl_wnd.h +++ b/fpdfsdk/pdfwindow/cpwl_wnd.h @@ -15,6 +15,7 @@ #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_basic.h" #include "core/fxge/cfx_color.h" +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_widget.h" #include "fpdfsdk/pdfwindow/cpwl_timer.h" #include "fpdfsdk/pdfwindow/cpwl_timer_handler.h" @@ -298,9 +299,15 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable { bool IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const; const CPWL_Wnd* GetRootWnd() const; - bool IsCTRLpressed(uint32_t nFlag) const; - bool IsSHIFTpressed(uint32_t nFlag) const; - bool IsALTpressed(uint32_t nFlag) const; + static bool IsCTRLpressed(uint32_t nFlag) { + return CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag); + } + static bool IsSHIFTpressed(uint32_t nFlag) { + return CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag); + } + static bool IsALTpressed(uint32_t nFlag) { + return CPDFSDK_FormFillEnvironment::IsALTKeyDown(nFlag); + } private: CFX_PointF ParentToChild(const CFX_PointF& point) const; -- cgit v1.2.3