Changeset 19037 in webkit
- Timestamp:
- Jan 22, 2007 5:36:22 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r19036 r19037 1 2007-01-22 Mitz Pettel <mitz@webkit.org> 2 3 Reviewed by Darin. 4 5 - test for http://bugs.webkit.org/show_bug.cgi?id=12344 6 NativeListBox: item hit testing does not account for top padding and border 7 8 * fast/forms/listbox-selection-2-expected.checksum: Added. 9 * fast/forms/listbox-selection-2-expected.png: Added. 10 * fast/forms/listbox-selection-2-expected.txt: Added. 11 * fast/forms/listbox-selection-2.html: Added. 12 1 13 2007-01-22 Justin Garcia <justin.garcia@apple.com> 2 14 -
trunk/WebCore/ChangeLog
r19036 r19037 1 2007-01-22 Mitz Pettel <mitz@webkit.org> 2 3 Reviewed by Darin. 4 5 - fix http://bugs.webkit.org/show_bug.cgi?id=12344 6 NativeListBox: item hit testing does not account for top padding and border 7 8 Test: fast/forms/listbox-selection-2.html 9 10 * rendering/RenderListBox.cpp: 11 (WebCore::RenderListBox::numVisibleItems): Changed height() to contentHeight() 12 since items are visible only in the content box. 13 (WebCore::RenderListBox::listIndexAtOffset): Adjusted for vertical padding and 14 borders. Changed to return -1 instead of the last item's index if the given offset 15 is below the last item. 16 (WebCore::RenderListBox::autoscroll): Adjusted for vertical padding and borders. 17 (WebCore::RenderListBox::controlClipRect): Changed to return the content box since 18 items should not spill into the padding box. This change is the reason the test 19 generates pixel results. 20 1 21 2007-01-22 Justin Garcia <justin.garcia@apple.com> 2 22 -
trunk/WebCore/rendering/RenderListBox.cpp
r19033 r19037 206 206 { 207 207 // Only count fully visible rows. But don't return 0 even if only part of a row shows. 208 return max(1, ( height() + rowSpacing) / itemHeight());208 return max(1, (contentHeight() + rowSpacing) / itemHeight()); 209 209 } 210 210 … … 374 374 int RenderListBox::listIndexAtOffset(int offsetX, int offsetY) 375 375 { 376 if (numItems() > 0) { 377 int newOffset = max(0, offsetY / itemHeight()) + m_indexOffset; 378 newOffset = min(max(0, newOffset), numItems() - 1); 379 int scrollbarWidth = m_vBar ? m_vBar->width() : 0; 380 if (offsetX >= borderLeft() + paddingLeft() && offsetX < absoluteBoundingBoxRect().width() - borderRight() - paddingRight() - scrollbarWidth) 381 return newOffset; 382 } 383 384 return -1; 376 if (!numItems()) 377 return -1; 378 379 if (offsetY < borderTop() + paddingTop() || offsetY > height() - paddingBottom() - borderBottom()) 380 return -1; 381 382 int scrollbarWidth = m_vBar ? m_vBar->width() : 0; 383 if (offsetX < borderLeft() + paddingLeft() || offsetX > width() - borderRight() - paddingRight() - scrollbarWidth) 384 return -1; 385 386 int newOffset = (offsetY - borderTop() - paddingTop()) / itemHeight() + m_indexOffset; 387 return newOffset < numItems() ? newOffset : -1; 385 388 } 386 389 … … 398 401 int rows = numVisibleItems(); 399 402 int offset = m_indexOffset; 400 if (offsetY < 0&& scrollToRevealElementAtListIndex(offset - 1))403 if (offsetY < borderTop() + paddingTop() && scrollToRevealElementAtListIndex(offset - 1)) 401 404 endIndex = offset - 1; 402 else if (offsetY > absoluteBoundingBoxRect().height() && scrollToRevealElementAtListIndex(offset + rows))405 else if (offsetY > height() - paddingBottom() - borderBottom() && scrollToRevealElementAtListIndex(offset + rows)) 403 406 endIndex = offset + rows - 1; 404 407 else … … 517 520 IntRect RenderListBox::controlClipRect(int tx, int ty) const 518 521 { 519 // Clip to the padding box, since we have a scrollbar inside the padding box. 520 return IntRect(tx + borderLeft(), ty + borderTop(), clientWidth(), clientHeight()); 522 IntRect clipRect = contentBox(); 523 clipRect.move(tx, ty); 524 return clipRect; 521 525 } 522 526
Note: See TracChangeset
for help on using the changeset viewer.