Commit f2f444a2 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/listview: Don't use special value (1) for item width to represent both…

comctl32/listview: Don't use special value (1) for item width to represent both zero and one pixel width.
parent a5c970de
......@@ -1239,12 +1239,25 @@ static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, cons
INT nPerCol = max((infoPtr->rcList.bottom - infoPtr->rcList.top) / infoPtr->nItemHeight, 1);
INT nFirstRow = max(frame.top / infoPtr->nItemHeight, 0);
INT nLastRow = min((frame.bottom - 1) / infoPtr->nItemHeight, nPerCol - 1);
INT nFirstCol = max(frame.left / infoPtr->nItemWidth, 0);
INT nLastCol = min((frame.right - 1) / infoPtr->nItemWidth, (infoPtr->nItemCount + nPerCol - 1) / nPerCol);
INT lower = nFirstCol * nPerCol + nFirstRow;
INT nFirstCol;
INT nLastCol;
INT lower;
RANGE item_range;
INT nCol;
if (infoPtr->nItemWidth)
{
nFirstCol = max(frame.left / infoPtr->nItemWidth, 0);
nLastCol = min((frame.right - 1) / infoPtr->nItemWidth, (infoPtr->nItemCount + nPerCol - 1) / nPerCol);
}
else
{
nFirstCol = max(frame.left, 0);
nLastCol = min(frame.right - 1, (infoPtr->nItemCount + nPerCol - 1) / nPerCol);
}
lower = nFirstCol * nPerCol + nFirstRow;
TRACE("nPerCol=%d, nFirstRow=%d, nLastRow=%d, nFirstCol=%d, nLastCol=%d, lower=%d\n",
nPerCol, nFirstRow, nLastRow, nFirstCol, nLastCol, lower);
......@@ -1493,7 +1506,7 @@ static inline INT LISTVIEW_GetCountPerRow(const LISTVIEW_INFO *infoPtr)
{
INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left;
return max(nListWidth/infoPtr->nItemWidth, 1);
return max(nListWidth/(infoPtr->nItemWidth ? infoPtr->nItemWidth : 1), 1);
}
/***
......@@ -1736,7 +1749,8 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
if(horzInfo.nPage < infoPtr->nItemWidth)
horzInfo.nPage = infoPtr->nItemWidth;
horzInfo.nPage /= infoPtr->nItemWidth;
if (infoPtr->nItemWidth)
horzInfo.nPage /= infoPtr->nItemWidth;
}
else if (infoPtr->uView == LV_VIEW_DETAILS)
{
......@@ -2530,7 +2544,7 @@ static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr)
nItemWidth = max(DEFAULT_COLUMN_WIDTH, nItemWidth + WIDTH_PADDING);
}
return max(nItemWidth, 1);
return nItemWidth;
}
/***
......
......@@ -2829,7 +2829,7 @@ static void test_getitemrect(void)
/* zero width rectangle with no padding */
expect(0, rect.left);
todo_wine expect(0, rect.right);
expect(0, rect.right);
insert_column(hwnd, 0);
insert_column(hwnd, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment