summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_combolist.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-12-14 06:25:02 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-14 06:25:02 -0800
commit603f57b85c0643f0598f03b97c4525501f3e1221 (patch)
tree85c9521a8f0fec47ba84041d64cb84e6bc019638 /xfa/fwl/cfwl_combolist.cpp
parenta9caab94c1f16929e5acf2676117224617d80f53 (diff)
downloadpdfium-603f57b85c0643f0598f03b97c4525501f3e1221.tar.xz
Update CFWL_ListBox to return instead of using out params.
This CL updates the CFWL_ListBox code to work with return values instead of out params. This also extracts the CFWL_ListItem code out of CFWL_ListBox and puts into the correct class. Review-Url: https://codereview.chromium.org/2572783002
Diffstat (limited to 'xfa/fwl/cfwl_combolist.cpp')
-rw-r--r--xfa/fwl/cfwl_combolist.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp
index 1fa9acb68e..e78372cb26 100644
--- a/xfa/fwl/cfwl_combolist.cpp
+++ b/xfa/fwl/cfwl_combolist.cpp
@@ -32,7 +32,7 @@ int32_t CFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) {
int32_t iCount = CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
CFWL_ListItem* hItem = GetItem(this, i);
- CFX_WideString wsText = GetItemText(this, hItem);
+ CFX_WideString wsText = hItem ? hItem->GetText() : L"";
FX_STRSIZE pos = wsText.Find(wsMatch.c_str());
if (!pos)
return i;
@@ -42,22 +42,20 @@ int32_t CFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) {
void CFWL_ComboList::ChangeSelected(int32_t iSel) {
CFWL_ListItem* hItem = GetItem(this, iSel);
- CFX_RectF rtInvalidate;
- rtInvalidate.Reset();
CFWL_ListItem* hOld = GetSelItem(0);
int32_t iOld = GetItemIndex(this, hOld);
if (iOld == iSel)
return;
+
+ CFX_RectF rtInvalidate;
if (iOld > -1) {
- CFWL_ListItem* hItem = GetItem(this, iOld);
- GetItemRect(this, hItem, rtInvalidate);
+ if (CFWL_ListItem* hOldItem = GetItem(this, iOld))
+ rtInvalidate = hOldItem->GetRect();
SetSelItem(hOld, false);
}
if (hItem) {
- CFX_RectF rect;
- CFWL_ListItem* hItem = GetItem(this, iSel);
- GetItemRect(this, hItem, rect);
- rtInvalidate.Union(rect);
+ if (CFWL_ListItem* hOldItem = GetItem(this, iSel))
+ rtInvalidate.Union(hOldItem->GetRect());
CFWL_ListItem* hSel = GetItem(this, iSel);
SetSelItem(hSel, true);
}