Misc tidy in CFWL_WidgetMgr. - remove unused local variables. - don't re-get WidgetMgr, just re-use |this| (it is a singleton). - use the plural |children| in one method name. - remove redundant zeroing of counts Change-Id: I77fbb8d022429f576df70ade21cb4f7810c5b431 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/72773 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index 5ca6b9e..fccab7e 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -132,8 +132,7 @@ return pParent; } - CFWL_Widget* child = - pParent->GetOwnerApp()->GetWidgetMgr()->GetFirstChildWidget(pParent); + CFWL_Widget* child = GetFirstChildWidget(pParent); while (child) { if ((child->GetClassID() == FWL_Type::PushButton) && (child->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { @@ -142,7 +141,7 @@ if (CFWL_Widget* find = GetDefaultButton(child)) return find; - child = child->GetOwnerApp()->GetWidgetMgr()->GetNextSiblingWidget(child); + child = GetNextSiblingWidget(child); } return nullptr; } @@ -198,24 +197,19 @@ if (!pWidget || !pGraphics) return; - CFX_RectF clipCopy(0, 0, pWidget->GetWidgetRect().Size()); - CFX_RectF clipBounds; - pWidget->GetDelegate()->OnDrawWidget(pGraphics, matrix); - clipBounds = pGraphics->GetClipRect(); - clipCopy = clipBounds; + CFX_RectF clipBounds = pGraphics->GetClipRect(); if (!clipBounds.IsEmpty()) - DrawChild(pWidget, clipBounds, pGraphics, &matrix); + DrawChildren(pWidget, clipBounds, pGraphics, &matrix); - GetWidgetMgrItem(pWidget)->iRedrawCounter = 0; ResetRedrawCounts(pWidget); } -void CFWL_WidgetMgr::DrawChild(CFWL_Widget* parent, - const CFX_RectF& rtClip, - CXFA_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void CFWL_WidgetMgr::DrawChildren(CFWL_Widget* parent, + const CFX_RectF& rtClip, + CXFA_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!parent) return; @@ -240,7 +234,7 @@ if (IFWL_WidgetDelegate* pDelegate = child->GetDelegate()) pDelegate->OnDrawWidget(pGraphics, widgetMatrix); - DrawChild(child, clipBounds, pGraphics, &widgetMatrix); + DrawChildren(child, clipBounds, pGraphics, &widgetMatrix); } }
diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h index 235dfdd..7bb0f11 100644 --- a/xfa/fwl/cfwl_widgetmgr.h +++ b/xfa/fwl/cfwl_widgetmgr.h
@@ -80,10 +80,10 @@ Item* CreateWidgetMgrItem(CFWL_Widget* pWidget); void ResetRedrawCounts(CFWL_Widget* pWidget); - void DrawChild(CFWL_Widget* pParent, - const CFX_RectF& rtClip, - CXFA_Graphics* pGraphics, - const CFX_Matrix* pMatrix); + void DrawChildren(CFWL_Widget* pParent, + const CFX_RectF& rtClip, + CXFA_Graphics* pGraphics, + const CFX_Matrix* pMatrix); std::map<const CFWL_Widget*, std::unique_ptr<Item>> m_mapWidgetItem; UnownedPtr<AdapterIface> const m_pAdapter;