summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-27 11:13:09 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-27 11:13:09 -0700
commita54bc400fa69491ad72ad97f74742ec28cbe849a (patch)
tree3e3897a7b0014a54a70f4c1d992a76566a2ceb99 /xfa
parent816ff7b92ff0f94e4ffaafc975b08d2c4c1a6417 (diff)
downloadpdfium-a54bc400fa69491ad72ad97f74742ec28cbe849a.tar.xz
Add back-pointer to "Associated widget" to CFWL_WidgetImp.
This is the last use of CFX_PrivateData, which is now removed. Review-Url: https://codereview.chromium.org/2016743002
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fwl/core/fwl_widgetimp.cpp37
-rw-r--r--xfa/fwl/core/fwl_widgetimp.h8
-rw-r--r--xfa/fwl/core/ifwl_widget.h13
-rw-r--r--xfa/fwl/lightwidget/cfwl_widget.cpp26
4 files changed, 31 insertions, 53 deletions
diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp
index 38e3a1ff28..1c0d28379d 100644
--- a/xfa/fwl/core/fwl_widgetimp.cpp
+++ b/xfa/fwl/core/fwl_widgetimp.cpp
@@ -111,14 +111,14 @@ void IFWL_Widget::SetLayoutItem(void* pItem) {
GetImpl()->SetLayoutItem(pItem);
}
-FWL_Error IFWL_Widget::SetPrivateData(void* module_id,
- void* pData,
- PD_CALLBACK_FREEDATA callback) {
- return GetImpl()->SetPrivateData(module_id, pData, callback);
+void* IFWL_Widget::GetAssociateWidget() const {
+ return GetImpl()->GetAssociateWidget();
}
-void* IFWL_Widget::GetPrivateData(void* module_id) {
- return GetImpl()->GetPrivateData(module_id);
+
+void IFWL_Widget::SetAssociateWidget(void* pAssociate) {
+ GetImpl()->SetAssociateWidget(pAssociate);
}
+
FWL_Error IFWL_Widget::Update() {
return GetImpl()->Update();
}
@@ -330,20 +330,6 @@ void CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
}
return;
}
-FWL_Error CFWL_WidgetImp::SetPrivateData(void* module_id,
- void* pData,
- PD_CALLBACK_FREEDATA callback) {
- if (!m_pPrivateData) {
- m_pPrivateData = new CFX_PrivateData;
- }
- m_pPrivateData->SetPrivateData(module_id, pData, callback);
- return FWL_Error::Succeeded;
-}
-void* CFWL_WidgetImp::GetPrivateData(void* module_id) {
- if (!m_pPrivateData)
- return NULL;
- return m_pPrivateData->GetPrivateData(module_id);
-}
FWL_Error CFWL_WidgetImp::Update() {
return FWL_Error::Succeeded;
}
@@ -533,15 +519,23 @@ void CFWL_WidgetImp::SetLayoutItem(void* pItem) {
m_pLayoutItem = pItem;
}
+void* CFWL_WidgetImp::GetAssociateWidget() const {
+ return m_pAssociate;
+}
+
+void CFWL_WidgetImp::SetAssociateWidget(void* pAssociate) {
+ m_pAssociate = pAssociate;
+}
+
CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: m_pProperties(new CFWL_WidgetImpProperties),
- m_pPrivateData(nullptr),
m_pDelegate(nullptr),
m_pCurDelegate(nullptr),
m_pOuter(pOuter),
m_pInterface(nullptr),
m_pLayoutItem(nullptr),
+ m_pAssociate(nullptr),
m_iLock(0),
m_nEventKey(0) {
*m_pProperties = properties;
@@ -550,7 +544,6 @@ CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
}
CFWL_WidgetImp::~CFWL_WidgetImp() {
- delete m_pPrivateData;
delete m_pProperties;
}
diff --git a/xfa/fwl/core/fwl_widgetimp.h b/xfa/fwl/core/fwl_widgetimp.h
index 8a887126e3..be97c060f2 100644
--- a/xfa/fwl/core/fwl_widgetimp.h
+++ b/xfa/fwl/core/fwl_widgetimp.h
@@ -52,10 +52,6 @@ class CFWL_WidgetImp {
uint32_t dwStylesExRemoved);
virtual uint32_t GetStates();
virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
- virtual FWL_Error SetPrivateData(void* module_id,
- void* pData,
- PD_CALLBACK_FREEDATA callback);
- virtual void* GetPrivateData(void* module_id);
virtual FWL_Error Update();
virtual FWL_Error LockUpdate();
virtual FWL_Error UnlockUpdate();
@@ -82,6 +78,8 @@ class CFWL_WidgetImp {
void SetEventKey(uint32_t key);
void* GetLayoutItem() const;
void SetLayoutItem(void* pItem);
+ void* GetAssociateWidget() const;
+ void SetAssociateWidget(void* pAssociate);
protected:
friend class CFWL_WidgetImpDelegate;
@@ -159,12 +157,12 @@ class CFWL_WidgetImp {
CFWL_WidgetMgr* m_pWidgetMgr;
CFWL_AppImp* m_pOwnerApp;
CFWL_WidgetImpProperties* m_pProperties;
- CFX_PrivateData* m_pPrivateData;
IFWL_WidgetDelegate* m_pDelegate;
IFWL_WidgetDelegate* m_pCurDelegate;
IFWL_Widget* m_pOuter;
IFWL_Widget* m_pInterface;
void* m_pLayoutItem;
+ void* m_pAssociate;
int32_t m_iLock;
uint32_t m_nEventKey;
};
diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h
index e9da806291..0b864fee7d 100644
--- a/xfa/fwl/core/ifwl_widget.h
+++ b/xfa/fwl/core/ifwl_widget.h
@@ -18,13 +18,16 @@
// FWL contains three parallel inheritance hierarchies, which reference each
// other via pointers as follows:
//
-// m_pIface m_pImpl
+// m_pAssociate
+// <----------------------------------
// CFWL_Widget ----------> IFWL_Widget ----------> CFWL_WidgetImp
-// | | |
+// | m_pIface | m_pImpl |
// A A A
// | | |
// CFWL_... IFWL_... CFWL_...Imp
//
+// TODO(tsepez): Collapse these into a single hierarchy.
+//
enum class FWL_Type {
Unknown = 0,
@@ -79,10 +82,8 @@ class IFWL_Widget {
void SetEventKey(uint32_t key);
void* GetLayoutItem() const;
void SetLayoutItem(void* pItem);
- FWL_Error SetPrivateData(void* module_id,
- void* pData,
- PD_CALLBACK_FREEDATA callback);
- void* GetPrivateData(void* module_id);
+ void* GetAssociateWidget() const;
+ void SetAssociateWidget(void* pAssociate);
FWL_Error Update();
FWL_Error LockUpdate();
FWL_Error UnlockUpdate();
diff --git a/xfa/fwl/lightwidget/cfwl_widget.cpp b/xfa/fwl/lightwidget/cfwl_widget.cpp
index 239796d03a..8022f0afb0 100644
--- a/xfa/fwl/lightwidget/cfwl_widget.cpp
+++ b/xfa/fwl/lightwidget/cfwl_widget.cpp
@@ -41,12 +41,11 @@ FX_BOOL CFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const {
return m_pIface->IsInstance(wsClass);
}
-static void* gs_pFWLWidget = (void*)FXBSTR_ID('l', 'i', 'g', 't');
-
FWL_Error CFWL_Widget::Initialize(const CFWL_WidgetProperties* pProperties) {
if (!m_pIface)
return FWL_Error::Indefinite;
- return m_pIface->SetPrivateData(gs_pFWLWidget, this, nullptr);
+ m_pIface->SetAssociateWidget(this);
+ return FWL_Error::Succeeded;
}
FWL_Error CFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
@@ -78,9 +77,10 @@ CFWL_Widget* CFWL_Widget::GetParent() {
return nullptr;
IFWL_Widget* parent = m_pIface->GetParent();
- if (parent)
- return static_cast<CFWL_Widget*>(parent->GetPrivateData(gs_pFWLWidget));
- return nullptr;
+ if (!parent)
+ return nullptr;
+
+ return static_cast<CFWL_Widget*>(parent->GetAssociateWidget());
}
FWL_Error CFWL_Widget::SetParent(CFWL_Widget* pParent) {
@@ -141,20 +141,6 @@ void CFWL_Widget::SetLayoutItem(void* pItem) {
m_pIface->SetLayoutItem(pItem);
}
-FWL_Error CFWL_Widget::SetPrivateData(void* module_id,
- void* pData,
- PD_CALLBACK_FREEDATA callback) {
- if (!m_pIface)
- return FWL_Error::Indefinite;
- return m_pIface->SetPrivateData(module_id, pData, callback);
-}
-
-void* CFWL_Widget::GetPrivateData(void* module_id) {
- if (!m_pIface)
- return nullptr;
- return m_pIface->GetPrivateData(module_id);
-}
-
FWL_Error CFWL_Widget::Update() {
if (!m_pIface)
return FWL_Error::Indefinite;