summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-14 15:32:35 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-14 15:32:35 -0700
commit70c5520270ab41b71e8ae8d2e888b9ba25383190 (patch)
treeedfa22ea2a5eec835fa13394b034b416fe58312d
parentff242e0b62173718a6e98aee1306ac48f6372572 (diff)
downloadpdfium-70c5520270ab41b71e8ae8d2e888b9ba25383190.tar.xz
Pass CFX_WideString to CXFA_FFDocView::GetWidgetByName.
Avoids downgrade followed by duplication of existing strings. Review URL: https://codereview.chromium.org/1891673003
-rw-r--r--fpdfsdk/fsdk_baseform.cpp4
-rw-r--r--xfa/fxfa/app/xfa_ffdocview.cpp22
-rw-r--r--xfa/fxfa/app/xfa_ffpageview.cpp4
-rw-r--r--xfa/fxfa/include/xfa_ffdocview.h16
-rw-r--r--xfa/fxfa/include/xfa_ffpageview.h2
5 files changed, 24 insertions, 24 deletions
diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp
index 86f5c5e501..4a2540093f 100644
--- a/fpdfsdk/fsdk_baseform.cpp
+++ b/fpdfsdk/fsdk_baseform.cpp
@@ -64,7 +64,7 @@ CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
}
if (!sName.IsEmpty())
- m_hMixXFAWidget = pDocView->GetWidgetByName(sName.AsStringC());
+ m_hMixXFAWidget = pDocView->GetWidgetByName(sName);
}
}
return m_hMixXFAWidget;
@@ -80,7 +80,7 @@ CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
CFX_WideString sName = GetName();
if (!sName.IsEmpty())
- return pDocView->GetWidgetByName(sName.AsStringC());
+ return pDocView->GetWidgetByName(sName);
}
}
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp
index daa5fd6277..4f818e0dd7 100644
--- a/xfa/fxfa/app/xfa_ffdocview.cpp
+++ b/xfa/fxfa/app/xfa_ffdocview.cpp
@@ -491,25 +491,25 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
iRet |= XFA_ProcessEvent(this, pWidgetAcc, &eParam);
return iRet;
}
-CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const CFX_WideStringC& wsName,
+
+CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const CFX_WideString& wsName,
CXFA_FFWidget* pRefWidget) {
- CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : NULL;
- if (CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc)) {
- return pAcc->GetNextWidget(NULL);
- }
- return NULL;
+ CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : nullptr;
+ CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc);
+ return pAcc ? pAcc->GetNextWidget(nullptr) : nullptr;
}
+
CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName(
- const CFX_WideStringC& wsName,
+ const CFX_WideString& wsName,
CXFA_WidgetAcc* pRefWidgetAcc) {
CFX_WideString wsExpression;
uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent;
CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext();
if (!pScriptContext) {
- return NULL;
+ return nullptr;
}
- CXFA_Node* refNode = NULL;
+ CXFA_Node* refNode = nullptr;
if (pRefWidgetAcc) {
refNode = pRefWidgetAcc->GetNode();
wsExpression = wsName;
@@ -520,7 +520,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName(
int32_t iRet = pScriptContext->ResolveObjects(
refNode, wsExpression.AsStringC(), resoveNodeRS, dwStyle);
if (iRet < 1) {
- return NULL;
+ return nullptr;
}
if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
CXFA_Node* pNode = resoveNodeRS.nodes[0]->AsNode();
@@ -528,7 +528,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName(
return (CXFA_WidgetAcc*)pNode->GetWidgetData();
}
}
- return NULL;
+ return nullptr;
}
void CXFA_FFDocView::OnPageEvent(CXFA_ContainerLayoutItem* pSender,
diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp
index a480737281..fe2e3ab4b4 100644
--- a/xfa/fxfa/app/xfa_ffpageview.cpp
+++ b/xfa/fxfa/app/xfa_ffpageview.cpp
@@ -232,14 +232,14 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget(
if (pTraverse) {
CFX_WideString wsTraverseWidgetName;
if (pTraverse->GetAttribute(XFA_ATTRIBUTE_Ref, wsTraverseWidgetName)) {
- return FindWidgetByName(wsTraverseWidgetName.AsStringC(), pWidget);
+ return FindWidgetByName(wsTraverseWidgetName, pWidget);
}
}
}
return NULL;
}
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::FindWidgetByName(
- const CFX_WideStringC& wsWidgetName,
+ const CFX_WideString& wsWidgetName,
CXFA_FFWidget* pRefWidget) {
return pRefWidget->GetDocView()->GetWidgetByName(wsWidgetName, pRefWidget);
}
diff --git a/xfa/fxfa/include/xfa_ffdocview.h b/xfa/fxfa/include/xfa_ffdocview.h
index 27ef8e96d4..dc9598850a 100644
--- a/xfa/fxfa/include/xfa_ffdocview.h
+++ b/xfa/fxfa/include/xfa_ffdocview.h
@@ -38,16 +38,16 @@ class CXFA_FFDocView {
CXFA_FFDoc* GetDoc() { return m_pDoc; }
int32_t StartLayout(int32_t iStartPage = 0);
- int32_t DoLayout(IFX_Pause* pPause = NULL);
+ int32_t DoLayout(IFX_Pause* pPause = nullptr);
void StopLayout();
int32_t GetLayoutStatus();
void UpdateDocView();
int32_t CountPageViews();
CXFA_FFPageView* GetPageView(int32_t nIndex);
- void ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc = NULL);
+ void ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc = nullptr);
int32_t ProcessWidgetEvent(CXFA_EventParam* pParam,
- CXFA_WidgetAcc* pWidgetAcc = NULL);
+ CXFA_WidgetAcc* pWidgetAcc = nullptr);
CXFA_FFWidgetHandler* GetWidgetHandler();
IXFA_WidgetIterator* CreateWidgetIterator();
CXFA_WidgetAccIterator* CreateWidgetAccIterator(
@@ -55,10 +55,10 @@ class CXFA_FFDocView {
CXFA_FFWidget* GetFocusWidget();
void KillFocus();
FX_BOOL SetFocus(CXFA_FFWidget* hWidget);
- CXFA_FFWidget* GetWidgetByName(const CFX_WideStringC& wsName,
- CXFA_FFWidget* pRefWidget = NULL);
- CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideStringC& wsName,
- CXFA_WidgetAcc* pRefWidgetAcc = NULL);
+ CXFA_FFWidget* GetWidgetByName(const CFX_WideString& wsName,
+ CXFA_FFWidget* pRefWidget = nullptr);
+ CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideString& wsName,
+ CXFA_WidgetAcc* pRefWidgetAcc = nullptr);
CXFA_LayoutProcessor* GetXFALayout() const;
void OnPageEvent(CXFA_ContainerLayoutItem* pSender,
XFA_PAGEEVENT eEvent,
@@ -95,7 +95,7 @@ class CXFA_FFDocView {
XFA_EVENTTYPE eEventType,
FX_BOOL bIsFormReady = FALSE,
FX_BOOL bRecursive = TRUE,
- CXFA_Node* pExclude = NULL);
+ CXFA_Node* pExclude = nullptr);
FX_BOOL m_bLayoutEvent;
CFX_WideStringArray m_arrNullTestMsg;
CXFA_FFWidget* m_pListFocusWidget;
diff --git a/xfa/fxfa/include/xfa_ffpageview.h b/xfa/fxfa/include/xfa_ffpageview.h
index dcac3f1106..75e418b25b 100644
--- a/xfa/fxfa/include/xfa_ffpageview.h
+++ b/xfa/fxfa/include/xfa_ffpageview.h
@@ -87,7 +87,7 @@ class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator {
protected:
CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget);
- CXFA_FFWidget* FindWidgetByName(const CFX_WideStringC& wsWidgetName,
+ CXFA_FFWidget* FindWidgetByName(const CFX_WideString& wsWidgetName,
CXFA_FFWidget* pRefWidget);
void CreateTabOrderWidgetArray();
void CreateSpaceOrderWidgetArray(CXFA_WidgetArray& WidgetArray);