Re-introduce FWL_STATE_PSB_Default definition. Once upon a time, there was a #define FWL_STATE_PSB_Default (1 << (FWL_WGTSTATE_MAX + 2)) that we removed because the definition was never used. However, it turns out there were places where the equivalent expression (1 << (FWL_WGTSTATE_MAX + 2)) was used in conditionals, so restore the value, and use it there. On the other hand, there doesn't appear to be a way to actually set this value, but since the style extension field is overloaded in all sorts of strange ways, we can't be 100% sure that this is dead code as a result. Change-Id: Iab2158cfdc672a11b50bcd9b0d7ae5d7f47d8af7 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/83191 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fwl/cfwl_pushbutton.h b/xfa/fwl/cfwl_pushbutton.h index 4b8998c..341a4b4 100644 --- a/xfa/fwl/cfwl_pushbutton.h +++ b/xfa/fwl/cfwl_pushbutton.h
@@ -11,6 +11,7 @@ #define FWL_STATE_PSB_Hovered (1 << FWL_STATE_WGT_MAX) #define FWL_STATE_PSB_Pressed (1 << (FWL_STATE_WGT_MAX + 1)) +#define FWL_STATE_PSB_Default (1 << (FWL_STATE_WGT_MAX + 2)) class CFWL_MessageKey; class CFWL_MessageMouse;
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index bed8e41..807dbc7 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -11,6 +11,7 @@ #include "xfa/fwl/cfwl_app.h" #include "xfa/fwl/cfwl_message.h" #include "xfa/fwl/cfwl_notedriver.h" +#include "xfa/fwl/cfwl_pushbutton.h" CFWL_WidgetMgr::CFWL_WidgetMgr(AdapterIface* pAdapter, CFWL_App* pApp) : m_pAdapter(pAdapter), m_pApp(pApp) { @@ -134,15 +135,15 @@ } CFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(CFWL_Widget* pParent) const { - if ((pParent->GetClassID() == FWL_Type::PushButton) && - (pParent->GetStates() & (1 << (FWL_STATE_WGT_MAX + 2)))) { + if (pParent->GetClassID() == FWL_Type::PushButton && + (pParent->GetStates() & FWL_STATE_PSB_Default)) { return pParent; } CFWL_Widget* child = GetFirstChildWidget(pParent); while (child) { - if ((child->GetClassID() == FWL_Type::PushButton) && - (child->GetStates() & (1 << (FWL_STATE_WGT_MAX + 2)))) { + if (child->GetClassID() == FWL_Type::PushButton && + (child->GetStates() & FWL_STATE_PSB_Default)) { return child; } if (CFWL_Widget* find = GetDefaultButton(child))