summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-04-09 17:18:24 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-09 17:18:24 +0000
commit6f26db4dcbc64cc3602ffe22d1178a1abca83c96 (patch)
treea67cbc588f64725e3fc9b7d6185bd99739cd8efa /xfa/fxfa
parent2b4ad9ff5bf1727d12ef2bcce7e3fa925bbe8978 (diff)
downloadpdfium-6f26db4dcbc64cc3602ffe22d1178a1abca83c96.tar.xz
Remove m_pOldFocusWidget from CXFA_FFDocView.
It can be refactored to a local, then the local can be refactored out too. There should be no functional changes. Change-Id: I4b49cbf27736f856a567db5db952c03aba743818 Reviewed-on: https://pdfium-review.googlesource.com/29911 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp43
-rw-r--r--xfa/fxfa/cxfa_ffdocview.h3
2 files changed, 20 insertions, 26 deletions
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 86a2a9fee9..51277c91ae 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -261,44 +261,40 @@ CXFA_FFDocView::CreateReadyNodeIterator() {
: nullptr;
}
-bool CXFA_FFDocView::SetFocus(CXFA_FFWidget* hWidget) {
- CXFA_FFWidget* pNewFocus = hWidget;
- if (m_pOldFocusWidget == pNewFocus)
+bool CXFA_FFDocView::SetFocus(CXFA_FFWidget* pNewFocus) {
+ CXFA_FFWidget* pOldFocus = m_pFocusWidget.Get();
+
+ if (pOldFocus == pNewFocus)
return false;
- CXFA_FFWidget* pOldFocus = m_pOldFocusWidget.Get();
- m_pOldFocusWidget = pNewFocus;
if (pOldFocus) {
- if (m_pFocusWidget != m_pOldFocusWidget &&
- (pOldFocus->GetStatus() & XFA_WidgetStatus_Focused)) {
- m_pFocusWidget = pOldFocus;
- pOldFocus->OnKillFocus(pNewFocus);
- } else if ((pOldFocus->GetStatus() & XFA_WidgetStatus_Visible)) {
+ if (!(pOldFocus->GetStatus() & XFA_WidgetStatus_Focused) &&
+ (pOldFocus->GetStatus() & XFA_WidgetStatus_Visible)) {
if (!pOldFocus->IsLoaded())
pOldFocus->LoadWidget();
- pOldFocus->OnSetFocus(m_pFocusWidget.Get());
- m_pFocusWidget = pOldFocus;
- pOldFocus->OnKillFocus(pNewFocus);
+ pOldFocus->OnSetFocus(pOldFocus);
}
- }
- if (m_pFocusWidget == m_pOldFocusWidget)
- return false;
- pNewFocus = m_pOldFocusWidget.Get();
- if (pNewFocus && (pNewFocus->GetStatus() & XFA_WidgetStatus_Visible)) {
- if (!pNewFocus->IsLoaded())
- pNewFocus->LoadWidget();
- pNewFocus->OnSetFocus(m_pFocusWidget.Get());
+ pOldFocus->OnKillFocus(pNewFocus);
}
+
if (pNewFocus) {
+ if (pNewFocus->GetStatus() & XFA_WidgetStatus_Visible) {
+ if (!pNewFocus->IsLoaded())
+ pNewFocus->LoadWidget();
+
+ pNewFocus->OnSetFocus(pOldFocus);
+ }
+
CXFA_Node* node = pNewFocus->GetNode();
m_pFocusNode = node->IsWidgetReady() ? node : nullptr;
+ m_pFocusWidget = pNewFocus;
} else {
m_pFocusNode = nullptr;
+ m_pFocusWidget = nullptr;
}
- m_pFocusWidget = pNewFocus;
- m_pOldFocusWidget = m_pFocusWidget;
+
return true;
}
@@ -323,7 +319,6 @@ void CXFA_FFDocView::DeleteLayoutItem(CXFA_FFWidget* pWidget) {
m_pFocusNode = nullptr;
m_pFocusWidget = nullptr;
- m_pOldFocusWidget = nullptr;
}
static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView,
diff --git a/xfa/fxfa/cxfa_ffdocview.h b/xfa/fxfa/cxfa_ffdocview.h
index dbc7672caa..2b8358264c 100644
--- a/xfa/fxfa/cxfa_ffdocview.h
+++ b/xfa/fxfa/cxfa_ffdocview.h
@@ -60,7 +60,7 @@ class CXFA_FFDocView {
CXFA_FFWidgetHandler* GetWidgetHandler();
std::unique_ptr<CXFA_ReadyNodeIterator> CreateReadyNodeIterator();
CXFA_FFWidget* GetFocusWidget() const { return m_pFocusWidget.Get(); }
- bool SetFocus(CXFA_FFWidget* hWidget);
+ bool SetFocus(CXFA_FFWidget* pNewFocus);
CXFA_FFWidget* GetWidgetForNode(CXFA_Node* node);
CXFA_FFWidget* GetWidgetByName(const WideString& wsName,
CXFA_FFWidget* pRefWidget);
@@ -118,7 +118,6 @@ class CXFA_FFDocView {
CXFA_LayoutProcessor* m_pXFADocLayout = nullptr; // Not owned.
UnownedPtr<CXFA_Node> m_pFocusNode;
UnownedPtr<CXFA_FFWidget> m_pFocusWidget;
- UnownedPtr<CXFA_FFWidget> m_pOldFocusWidget;
std::vector<CXFA_Node*> m_ValidateNodes;
std::vector<CXFA_Node*> m_CalculateNodes;
std::vector<CXFA_BindItems*> m_BindItems;