summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/cfwl_widgetmgr.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-01 08:33:02 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-01 08:33:02 -0700
commit9ec22175f945d227e71c459e7e0b7c464159c18b (patch)
tree1c4836aa35a9e8a1da1761562088b1f9df6aa94f /xfa/fwl/core/cfwl_widgetmgr.cpp
parent5a22582ca1dbe1d66b18d5253bfa1d202fcc3b4a (diff)
downloadpdfium-9ec22175f945d227e71c459e7e0b7c464159c18b.tar.xz
Rename IFWL_Widget::SetDelegate
The ::SetDelegate method was misleading. The primary use was SetDelegate(nullptr) which returned the current delegate and didn't actually set anything. When a value was passed it would set the |m_pCurDelegate| not the |m_pDelegate|. This Cl breaks ::SetDelegate into ::GetCurrentDelegate and ::SetCurrentDelegate to make it clear what is happening and that this does not effect the |m_pDelegate| variable. Review-Url: https://codereview.chromium.org/2459423003
Diffstat (limited to 'xfa/fwl/core/cfwl_widgetmgr.cpp')
-rw-r--r--xfa/fwl/core/cfwl_widgetmgr.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp
index bcbc394884..1008defcab 100644
--- a/xfa/fwl/core/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/core/cfwl_widgetmgr.cpp
@@ -613,21 +613,18 @@ void CFWL_WidgetMgrDelegate::OnDrawWidget(IFWL_Widget* pWidget,
#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ || \
_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_
- IFWL_WidgetDelegate* pDelegate = pWidget->SetDelegate(nullptr);
- pDelegate->OnDrawWidget(pTemp, pMatrix);
+ pWidget->GetCurrentDelegate()->OnDrawWidget(pTemp, pMatrix);
pGraphics->GetClipRect(clipBounds);
clipCopy = clipBounds;
#elif _FX_OS_ == _FX_MACOSX_
if (m_pWidgetMgr->IsFormDisabled()) {
- IFWL_WidgetDelegate* pDelegate = pWidget->SetDelegate(nullptr);
- pDelegate->OnDrawWidget(pTemp, pMatrix);
+ pWidget->GetCurrentDelegate()->OnDrawWidget(pTemp, pMatrix);
pGraphics->GetClipRect(clipBounds);
clipCopy = clipBounds;
} else {
clipBounds.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d);
const_cast<CFX_Matrix*>(pMatrix)->SetIdentity(); // FIXME: const cast.
- IFWL_WidgetDelegate* pDelegate = pWidget->SetDelegate(nullptr);
- pDelegate->OnDrawWidget(pTemp, pMatrix);
+ pWidget->GetCurrentDelegate()->OnDrawWidget(pTemp, pMatrix);
}
#endif // _FX_OS_ == _FX_MACOSX_
@@ -680,8 +677,8 @@ void CFWL_WidgetMgrDelegate::DrawChild(IFWL_Widget* parent,
pGraphics->SetClipRect(clipBounds);
}
widgetMatrix.Translate(rtWidget.left, rtWidget.top, TRUE);
- IFWL_WidgetDelegate* pDelegate = child->SetDelegate(nullptr);
- if (pDelegate) {
+
+ if (IFWL_WidgetDelegate* pDelegate = child->GetCurrentDelegate()) {
if (m_pWidgetMgr->IsFormDisabled() ||
IsNeedRepaint(child, &widgetMatrix, rtClip)) {
pDelegate->OnDrawWidget(pGraphics, &widgetMatrix);