summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/cfwl_eventtarget.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-21 17:57:21 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-21 17:57:21 -0800
commit4bd717ba4e40d4d3775c5e19334f4733fca8cb42 (patch)
tree473e54389cec12eebaade8189948e34705c52edc /xfa/fwl/core/cfwl_eventtarget.cpp
parent12ff1eba3eaa4a27089f1837a0826dfcac163db2 (diff)
downloadpdfium-4bd717ba4e40d4d3775c5e19334f4733fca8cb42.tar.xz
Remove FwlEventMask
The only value being set from the enum was the All Mask. This was always set through the default value in the methods. This Cl removes the mask code completely and updates surrounding code as needed. Review-Url: https://codereview.chromium.org/2515243003
Diffstat (limited to 'xfa/fwl/core/cfwl_eventtarget.cpp')
-rw-r--r--xfa/fwl/core/cfwl_eventtarget.cpp59
1 files changed, 8 insertions, 51 deletions
diff --git a/xfa/fwl/core/cfwl_eventtarget.cpp b/xfa/fwl/core/cfwl_eventtarget.cpp
index 77fb9d8354..836a7ed34d 100644
--- a/xfa/fwl/core/cfwl_eventtarget.cpp
+++ b/xfa/fwl/core/cfwl_eventtarget.cpp
@@ -12,63 +12,20 @@
CFWL_EventTarget::CFWL_EventTarget(IFWL_Widget* pListener)
: m_pListener(pListener), m_bInvalid(false) {}
-CFWL_EventTarget::~CFWL_EventTarget() {
- m_eventSources.RemoveAll();
-}
+CFWL_EventTarget::~CFWL_EventTarget() {}
-int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource,
- uint32_t dwFilter) {
- if (pSource) {
- m_eventSources.SetAt(pSource, dwFilter);
- return m_eventSources.GetCount();
- }
- return 1;
+void CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource) {
+ if (pSource)
+ m_widgets.insert(pSource);
}
bool CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) {
IFWL_WidgetDelegate* pDelegate = m_pListener->GetDelegate();
if (!pDelegate)
return false;
- if (m_eventSources.GetCount() == 0) {
- pDelegate->OnProcessEvent(pEvent);
- return true;
- }
-
- FX_POSITION pos = m_eventSources.GetStartPosition();
- while (pos) {
- IFWL_Widget* pSource = nullptr;
- uint32_t dwFilter = 0;
- m_eventSources.GetNextAssoc(pos, (void*&)pSource, dwFilter);
- if (pSource == pEvent->m_pSrcTarget) {
- if (IsFilterEvent(pEvent, dwFilter)) {
- pDelegate->OnProcessEvent(pEvent);
- return true;
- }
- }
- }
- return false;
-}
-
-bool CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent,
- uint32_t dwFilter) const {
- if (dwFilter == FWL_EVENT_ALL_MASK)
- return true;
+ if (!m_widgets.empty() && m_widgets.count(pEvent->m_pSrcTarget) == 0)
+ return false;
- switch (pEvent->GetClassID()) {
- case CFWL_EventType::Mouse:
- return !!(dwFilter & FWL_EVENT_MOUSE_MASK);
- case CFWL_EventType::MouseWheel:
- return !!(dwFilter & FWL_EVENT_MOUSEWHEEL_MASK);
- case CFWL_EventType::Key:
- return !!(dwFilter & FWL_EVENT_KEY_MASK);
- case CFWL_EventType::SetFocus:
- case CFWL_EventType::KillFocus:
- return !!(dwFilter & FWL_EVENT_FOCUSCHANGED_MASK);
- case CFWL_EventType::Close:
- return !!(dwFilter & FWL_EVENT_CLOSE_MASK);
- case CFWL_EventType::SizeChanged:
- return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK);
- default:
- return !!(dwFilter & FWL_EVENT_CONTROL_MASK);
- }
+ pDelegate->OnProcessEvent(pEvent);
+ return true;
}