From b1a59597db4b8ce3ffc34dbfda2fb1ecb80c2397 Mon Sep 17 00:00:00 2001 From: thestig Date: Thu, 14 Apr 2016 18:29:56 -0700 Subject: Simplify XFA event handling. - Avoid casting to void* - Don't bother firing events that no one listens for Review URL: https://codereview.chromium.org/1890563003 --- xfa/fxfa/parser/cxfa_widgetdata.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_widgetdata.cpp') diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index e75eef8916..a702527347 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -927,9 +927,8 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, if (!bNotify) return; - m_pNode->GetDocument()->GetNotify()->OnWidgetDataEvent( - this, XFA_WIDGETEVENT_ListItemAdded, (void*)wsLabel.c_str(), - (void*)wsValue.c_str(), (void*)(uintptr_t)nIndex); + m_pNode->GetDocument()->GetNotify()->OnWidgetListItemAdded( + this, wsLabel.c_str(), wsValue.c_str(), nIndex); } void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue, @@ -1053,11 +1052,8 @@ FX_BOOL CXFA_WidgetData::DeleteItem(int32_t nIndex, } } } - if (!bNotify) - return TRUE; - - m_pNode->GetDocument()->GetNotify()->OnWidgetDataEvent( - this, XFA_WIDGETEVENT_ListItemRemoved, (void*)(uintptr_t)nIndex); + if (bNotify) + m_pNode->GetDocument()->GetNotify()->OnWidgetListItemRemoved(this, nIndex); return TRUE; } -- cgit v1.2.3