summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/cfwl_widgetmgr.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-12-07 17:58:41 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-07 17:58:41 -0800
commit442997cbb3a9e970946dd294acd1498e9fa9bfc7 (patch)
tree99041d1d439501ee4616efa87ee2ab76b3d2fca0 /xfa/fwl/core/cfwl_widgetmgr.cpp
parent31559c91c4983b42361415d30b0b2a518c7ef383 (diff)
downloadpdfium-442997cbb3a9e970946dd294acd1498e9fa9bfc7.tar.xz
Cleanup FWL default values part II.
This CL cleans up the remaining default values in the fwl/core directory. Some methods are renamed to better represent what they do. Review-Url: https://codereview.chromium.org/2557103002
Diffstat (limited to 'xfa/fwl/core/cfwl_widgetmgr.cpp')
-rw-r--r--xfa/fwl/core/cfwl_widgetmgr.cpp52
1 files changed, 12 insertions, 40 deletions
diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp
index fc9f150ac3..1649ee76b9 100644
--- a/xfa/fwl/core/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/core/cfwl_widgetmgr.cpp
@@ -104,7 +104,7 @@ CFWL_Widget* CFWL_WidgetMgr::GetSystemFormWidget(CFWL_Widget* pWidget) const {
return nullptr;
}
-void CFWL_WidgetMgr::SetWidgetIndex(CFWL_Widget* pWidget, int32_t nIndex) {
+void CFWL_WidgetMgr::AppendWidget(CFWL_Widget* pWidget) {
Item* pItem = GetWidgetMgrItem(pWidget);
if (!pItem)
return;
@@ -115,8 +115,6 @@ void CFWL_WidgetMgr::SetWidgetIndex(CFWL_Widget* pWidget, int32_t nIndex) {
int32_t i = 0;
while (pChild) {
if (pChild == pItem) {
- if (i == nIndex)
- return;
if (pChild->pPrevious)
pChild->pPrevious->pNext = pChild->pNext;
if (pChild->pNext)
@@ -137,40 +135,16 @@ void CFWL_WidgetMgr::SetWidgetIndex(CFWL_Widget* pWidget, int32_t nIndex) {
pChild = pItem->pParent->pChild;
if (pChild) {
- if (nIndex < 0) {
- while (pChild->pNext)
- pChild = pChild->pNext;
-
- pChild->pNext = pItem;
- pItem->pPrevious = pChild;
- pItem->pNext = nullptr;
- return;
- }
-
- i = 0;
- while (i < nIndex && pChild->pNext) {
+ while (pChild->pNext)
pChild = pChild->pNext;
- ++i;
- }
- if (!pChild->pNext) {
- pChild->pNext = pItem;
- pItem->pPrevious = pChild;
- pItem->pNext = nullptr;
- return;
- }
- if (pChild->pPrevious) {
- pItem->pPrevious = pChild->pPrevious;
- pChild->pPrevious->pNext = pItem;
- }
- pChild->pPrevious = pItem;
- pItem->pNext = pChild;
- if (pItem->pParent->pChild == pChild)
- pItem->pParent->pChild = pItem;
+
+ pChild->pNext = pItem;
+ pItem->pPrevious = pChild;
} else {
pItem->pParent->pChild = pItem;
pItem->pPrevious = nullptr;
- pItem->pNext = nullptr;
}
+ pItem->pNext = nullptr;
}
void CFWL_WidgetMgr::RepaintWidget(CFWL_Widget* pWidget,
@@ -201,9 +175,7 @@ void CFWL_WidgetMgr::RepaintWidget(CFWL_Widget* pWidget,
m_pAdapter->RepaintWidget(pNative, &rect);
}
-void CFWL_WidgetMgr::InsertWidget(CFWL_Widget* pParent,
- CFWL_Widget* pChild,
- int32_t nIndex) {
+void CFWL_WidgetMgr::InsertWidget(CFWL_Widget* pParent, CFWL_Widget* pChild) {
Item* pParentItem = GetWidgetMgrItem(pParent);
if (!pParentItem) {
auto item = pdfium::MakeUnique<Item>(pParent);
@@ -211,7 +183,7 @@ void CFWL_WidgetMgr::InsertWidget(CFWL_Widget* pParent,
m_mapWidgetItem[pParent] = std::move(item);
pParentItem->pParent = GetWidgetMgrItem(nullptr);
- SetWidgetIndex(pParent, -1);
+ AppendWidget(pParent);
}
Item* pItem = GetWidgetMgrItem(pChild);
@@ -229,7 +201,7 @@ void CFWL_WidgetMgr::InsertWidget(CFWL_Widget* pParent,
pItem->pParent->pChild = pItem->pNext;
}
pItem->pParent = pParentItem;
- SetWidgetIndex(pChild, nIndex);
+ AppendWidget(pChild);
}
void CFWL_WidgetMgr::RemoveWidget(CFWL_Widget* pWidget) {
@@ -260,7 +232,7 @@ void CFWL_WidgetMgr::SetOwner(CFWL_Widget* pOwner, CFWL_Widget* pOwned) {
m_mapWidgetItem[pOwner] = std::move(item);
pParentItem->pParent = GetWidgetMgrItem(nullptr);
- SetWidgetIndex(pOwner, -1);
+ AppendWidget(pOwner);
}
Item* pItem = GetWidgetMgrItem(pOwned);
@@ -288,7 +260,7 @@ void CFWL_WidgetMgr::SetParent(CFWL_Widget* pParent, CFWL_Widget* pChild) {
pItem->pPrevious = nullptr;
}
pItem->pParent = pParentItem;
- SetWidgetIndex(pChild, -1);
+ AppendWidget(pChild);
}
void CFWL_WidgetMgr::SetWidgetRect_Native(CFWL_Widget* pWidget,
@@ -327,7 +299,7 @@ CFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(CFWL_Widget* parent,
x1 = x;
y1 = y;
CFX_Matrix matrixOnParent;
- child->GetMatrix(matrixOnParent);
+ child->GetMatrix(matrixOnParent, false);
CFX_Matrix m;
m.SetIdentity();
m.SetReverse(matrixOnParent);