diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-04 13:40:07 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-04 18:58:11 +0000 |
commit | 4a1de7211af344f6acc784f4fe346ef8c8da7bd1 (patch) | |
tree | 563ae3e7eda4a4d440e0c2246319e385f96948b9 /xfa/fxfa/cxfa_ffdocview.cpp | |
parent | c1e5756a43020665855d9d309c47b9dfe625b54f (diff) | |
download | pdfium-4a1de7211af344f6acc784f4fe346ef8c8da7bd1.tar.xz |
Change CXFA_WidgetAcc::GetNextWidget to not require the FFDocView
This CL changes GetNextWidget to assume that a valid parameter is passed
to the method. For callers which passed nullptr, we change to get a
vaild initial widget from the doc view directly.
Change-Id: I50c06082831645f62339ade59d5026f546e07840
Reviewed-on: https://pdfium-review.googlesource.com/22254
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffdocview.cpp')
-rw-r--r-- | xfa/fxfa/cxfa_ffdocview.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index cb4c72d0b3..5856809167 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -309,6 +309,10 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, return XFA_EVENTERROR_Success; } +CXFA_FFWidget* CXFA_FFDocView::GetWidgetForNode(CXFA_Node* node) { + return static_cast<CXFA_FFWidget*>(GetXFALayout()->GetLayoutItem(node)); +} + CXFA_FFWidgetHandler* CXFA_FFDocView::GetWidgetHandler() { if (!m_pWidgetHandler) m_pWidgetHandler = pdfium::MakeUnique<CXFA_FFWidgetHandler>(this); @@ -376,8 +380,9 @@ bool CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) { } void CXFA_FFDocView::SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) { - CXFA_FFWidget* pNewFocus = - pWidgetAcc ? pWidgetAcc->GetNextWidget(nullptr) : nullptr; + CXFA_FFWidget* pNewFocus = nullptr; + if (pWidgetAcc) + pNewFocus = GetWidgetForNode(pWidgetAcc->GetNode()); if (!SetFocus(pNewFocus)) return; @@ -487,7 +492,9 @@ CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const WideString& wsName, CXFA_FFWidget* pRefWidget) { CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : nullptr; CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc); - return pAcc ? pAcc->GetNextWidget(nullptr) : nullptr; + if (!pAcc) + return nullptr; + return GetWidgetForNode(pAcc->GetNode()); } CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( |