Chromium Code Reviews| Index: xfa/fwl/core/fwl_widgetimp.cpp |
| diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp |
| index c9d91c41f2642bb6a8bb10ca6aa7014e2ac23acb..2fd046be8190fb97268851a76162a139fd16f992 100644 |
| --- a/xfa/fwl/core/fwl_widgetimp.cpp |
| +++ b/xfa/fwl/core/fwl_widgetimp.cpp |
| @@ -18,12 +18,10 @@ |
| #include "xfa/fwl/core/fwl_appimp.h" |
| #include "xfa/fwl/core/fwl_noteimp.h" |
| #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
| -#include "xfa/fwl/core/ifwl_adapternative.h" |
| -#include "xfa/fwl/core/ifwl_adapterthreadmgr.h" |
| -#include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" |
| #include "xfa/fwl/core/ifwl_app.h" |
| #include "xfa/fwl/core/ifwl_form.h" |
| #include "xfa/fwl/core/ifwl_themeprovider.h" |
| +#include "xfa/fxfa/include/xfa_ffapp.h" |
| #define FWL_CLASSHASH_Menu 3957949655 |
| #define FWL_STYLEEXT_MNU_Vert (1L << 0) |
| @@ -165,33 +163,22 @@ FWL_ERR CFWL_WidgetImp::Initialize() { |
| IFWL_App* pApp = FWL_GetApp(); |
| if (!pApp) |
| return FWL_ERR_Indefinite; |
| - IFWL_AdapterNative* pAdapter = pApp->GetAdapterNative(); |
| + CXFA_FFApp* pAdapter = pApp->GetAdapterNative(); |
| if (!pAdapter) |
| return FWL_ERR_Indefinite; |
| - IFWL_AdapterThreadMgr* pAdapterThread = pAdapter->GetThreadMgr(); |
| - if (!pAdapterThread) |
| - return FWL_ERR_Indefinite; |
| - SetOwnerApp( |
| - static_cast<CFWL_AppImp*>(pAdapterThread->GetCurrentThread()->GetImpl())); |
| + SetOwnerApp(static_cast<CFWL_AppImp*>(FWL_GetApp()->GetImpl())); |
| IFWL_Widget* pParent = m_pProperties->m_pParent; |
| m_pWidgetMgr->InsertWidget(pParent, m_pInterface); |
| if (!IsChild()) { |
| - { |
| - IFWL_Widget* pOwner = m_pProperties->m_pOwner; |
| - if (pOwner) { |
| - m_pWidgetMgr->SetOwner(pOwner, m_pInterface); |
| - } |
| - } |
| - m_pWidgetMgr->CreateWidget_Native(m_pInterface); |
| + IFWL_Widget* pOwner = m_pProperties->m_pOwner; |
| + if (pOwner) |
| + m_pWidgetMgr->SetOwner(pOwner, m_pInterface); |
| } |
| return FWL_ERR_Succeeded; |
| } |
| FWL_ERR CFWL_WidgetImp::Finalize() { |
| NotifyDriver(); |
| - if (!IsChild()) |
| - m_pWidgetMgr->DestroyWidget_Native(m_pInterface); |
| - |
| m_pWidgetMgr->RemoveWidget(m_pInterface); |
| return FWL_ERR_Succeeded; |
| } |
| @@ -317,26 +304,21 @@ static void NotifyHideChildWidget(IFWL_WidgetMgr* widgetMgr, |
| FWL_ERR CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { |
|
Tom Sepez
2016/04/28 16:42:12
nit: always success? can this be void?
dsinclair
2016/04/28 17:53:46
Done.
|
| bSet ? (m_pProperties->m_dwStates |= dwStates) |
| : (m_pProperties->m_dwStates &= ~dwStates); |
| - FWL_ERR ret = FWL_ERR_Succeeded; |
| - if (dwStates & FWL_WGTSTATE_Invisible) { |
| - if (bSet) { |
| - ret = m_pWidgetMgr->HideWidget_Native(m_pInterface); |
| - CFWL_NoteDriver* noteDriver = |
| - static_cast<CFWL_NoteDriver*>(GetOwnerApp()->GetNoteDriver()); |
| - IFWL_WidgetMgr* widgetMgr = FWL_GetWidgetMgr(); |
| - noteDriver->NotifyTargetHide(m_pInterface); |
| - IFWL_Widget* child = |
| - widgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_FirstChild); |
| - while (child) { |
| - noteDriver->NotifyTargetHide(child); |
| - NotifyHideChildWidget(widgetMgr, child, noteDriver); |
| - child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling); |
| - } |
| - } else { |
| - ret = m_pWidgetMgr->ShowWidget_Native(m_pInterface); |
| - } |
| + if (!(dwStates & FWL_WGTSTATE_Invisible) || !bSet) |
| + return FWL_ERR_Succeeded; |
| + |
| + CFWL_NoteDriver* noteDriver = |
| + static_cast<CFWL_NoteDriver*>(GetOwnerApp()->GetNoteDriver()); |
| + IFWL_WidgetMgr* widgetMgr = FWL_GetWidgetMgr(); |
| + noteDriver->NotifyTargetHide(m_pInterface); |
| + IFWL_Widget* child = |
| + widgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_FirstChild); |
| + while (child) { |
| + noteDriver->NotifyTargetHide(child); |
| + NotifyHideChildWidget(widgetMgr, child, noteDriver); |
| + child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling); |
| } |
| - return ret; |
| + return FWL_ERR_Succeeded; |
| } |
| FWL_ERR CFWL_WidgetImp::SetPrivateData(void* module_id, |
| void* pData, |