Changeset 198843 in webkit
- Timestamp:
- Mar 30, 2016 10:34:20 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r198838 r198843 1 2016-03-30 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [OS X] [RTL Scrollbars] List boxes should obey RTL scrollbars 4 https://bugs.webkit.org/show_bug.cgi?id=155991 5 6 Reviewed by Darin Adler. 7 8 As with the previous patches, mark new tests as failing on all OSes that 9 don't support RTL scrollbars. 10 11 * TestExpectations: 12 * fast/scrolling/rtl-scrollbars-listbox-expected.html: Added. 13 * fast/scrolling/rtl-scrollbars-listbox-scroll-expected.html: Added. 14 * fast/scrolling/rtl-scrollbars-listbox-scroll.html: Added. 15 * fast/scrolling/rtl-scrollbars-listbox-select-left-expected.html: Added. 16 * fast/scrolling/rtl-scrollbars-listbox-select-left.html: Added. 17 * fast/scrolling/rtl-scrollbars-listbox-select-right-expected.html: Added. 18 * fast/scrolling/rtl-scrollbars-listbox-select-right.html: Added. 19 * fast/scrolling/rtl-scrollbars-listbox-simple-expected-mismatch.html: Added. 20 * fast/scrolling/rtl-scrollbars-listbox-simple.html: Added. 21 * fast/scrolling/rtl-scrollbars-listbox.html: Added. 22 1 23 2016-03-30 Yusuke Suzuki <utatane.tea@gmail.com> 2 24 -
trunk/LayoutTests/TestExpectations
r198828 r198843 1014 1014 fast/scrolling/rtl-scrollbars-iframe-scrolled.html [ ImageOnlyFailure ] 1015 1015 fast/scrolling/rtl-scrollbars-positioning.html [ ImageOnlyFailure ] 1016 fast/scrolling/rtl-scrollbars-listbox-scroll.html [ ImageOnlyFailure ] 1017 fast/scrolling/rtl-scrollbars-listbox-select-left.html [ ImageOnlyFailure ] 1018 fast/scrolling/rtl-scrollbars-listbox-select-right.html [ ImageOnlyFailure ] 1019 fast/scrolling/rtl-scrollbars-listbox-simple.html [ ImageOnlyFailure ] 1020 fast/scrolling/rtl-scrollbars-listbox.html [ ImageOnlyFailure ] -
trunk/Source/WebCore/ChangeLog
r198841 r198843 1 2016-03-30 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [OS X] [RTL Scrollbars] List boxes should obey RTL scrollbars 4 https://bugs.webkit.org/show_bug.cgi?id=155991 5 6 Reviewed by Darin Adler. 7 8 List boxes were created before RenderLayers, and therefore don't share 9 the scollbar logic with them. Instead, they manage their own Scrollbars. 10 The placement logic needs to be updated to take RTL scrollbars into 11 account. 12 13 Tests: fast/scrolling/rtl-scrollbars-listbox-scroll.html 14 fast/scrolling/rtl-scrollbars-listbox-select-left.html 15 fast/scrolling/rtl-scrollbars-listbox-select-right.html 16 fast/scrolling/rtl-scrollbars-listbox-simple.html 17 fast/scrolling/rtl-scrollbars-listbox.html 18 19 * rendering/RenderBox.cpp: 20 (WebCore::RenderBox::contentBoxRect): 21 * rendering/RenderBox.h: 22 (WebCore::RenderBox::contentBoxRect): Deleted. 23 * rendering/RenderListBox.cpp: 24 (WebCore::RenderListBox::itemBoundingBoxRect): 25 (WebCore::RenderListBox::paintScrollbar): 26 (WebCore::RenderListBox::paintItemBackground): 27 (WebCore::RenderListBox::isPointInOverflowControl): 28 (WebCore::RenderListBox::listIndexAtOffset): 29 (WebCore::RenderListBox::nodeAtPoint): 30 (WebCore::RenderListBox::controlClipRect): 31 (WebCore::RenderListBox::invalidateScrollbarRect): 32 (WebCore::RenderListBox::convertFromScrollbarToContainingView): 33 (WebCore::RenderListBox::convertFromContainingViewToScrollbar): 34 (WebCore::RenderListBox::scrolledToTop): 35 (WebCore::RenderListBox::scrolledToBottom): 36 1 37 2016-03-30 Myles C. Maxfield <mmaxfield@apple.com> 2 38 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r198828 r198843 691 691 } 692 692 693 LayoutRect RenderBox::contentBoxRect() const 694 { 695 LayoutUnit x = borderLeft() + paddingLeft(); 696 if (layer() && layer()->verticalScrollbarIsOnLeft()) 697 x += verticalScrollbarWidth(); 698 LayoutUnit y = borderTop() + paddingTop(); 699 return LayoutRect(x, y, contentWidth(), contentHeight()); 700 } 701 693 702 IntRect RenderBox::absoluteContentBox() const 694 703 { -
trunk/Source/WebCore/rendering/RenderBox.h
r198771 r198843 159 159 160 160 // The content area of the box (excludes padding - and intrinsic padding for table cells, etc... - and border). 161 LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), contentWidth(), contentHeight()); }161 LayoutRect contentBoxRect() const; 162 162 // The content box in absolute coords. Ignores transforms. 163 163 IntRect absoluteContentBox() const; -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r198841 r198843 266 266 LayoutRect RenderListBox::itemBoundingBoxRect(const LayoutPoint& additionalOffset, int index) 267 267 { 268 return LayoutRect(additionalOffset.x() + borderLeft() + paddingLeft(), 269 additionalOffset.y() + borderTop() + paddingTop() + itemHeight() * (index - m_indexOffset), 270 contentWidth(), itemHeight()); 268 LayoutUnit x = additionalOffset.x() + borderLeft() + paddingLeft(); 269 if (verticalScrollbarIsOnLeft() && m_vBar) 270 x += m_vBar->occupiedWidth(); 271 LayoutUnit y = additionalOffset.y() + borderTop() + paddingTop() + itemHeight() * (index - m_indexOffset); 272 return LayoutRect(x, y, contentWidth(), itemHeight()); 271 273 } 272 274 … … 341 343 void RenderListBox::paintScrollbar(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 342 344 { 343 if (m_vBar) { 344 IntRect scrollRect = snappedIntRect(paintOffset.x() + width() - borderRight() - m_vBar->width(), 345 paintOffset.y() + borderTop(), 346 m_vBar->width(), 347 height() - (borderTop() + borderBottom())); 348 m_vBar->setFrameRect(scrollRect); 349 m_vBar->paint(paintInfo.context(), snappedIntRect(paintInfo.rect)); 350 } 345 if (!m_vBar) 346 return; 347 348 LayoutUnit left = paintOffset.x() + (verticalScrollbarIsOnLeft() ? borderLeft() : width() - borderRight() - m_vBar->width()); 349 LayoutUnit top = paintOffset.y() + borderTop(); 350 LayoutUnit width = m_vBar->width(); 351 LayoutUnit height = this->height() - (borderTop() + borderBottom()); 352 IntRect scrollRect = snappedIntRect(left, top, width, height); 353 m_vBar->setFrameRect(scrollRect); 354 m_vBar->paint(paintInfo.context(), snappedIntRect(paintInfo.rect)); 351 355 } 352 356 … … 432 436 433 437 // Draw the background for this list box item 434 if (itemStyle.visibility() != HIDDEN) { 435 LayoutRect itemRect = itemBoundingBoxRect(paintOffset, listIndex); 436 itemRect.intersect(controlClipRect(paintOffset)); 437 paintInfo.context().fillRect(snappedIntRect(itemRect), backColor); 438 } 438 if (itemStyle.visibility() == HIDDEN) 439 return; 440 441 LayoutRect itemRect = itemBoundingBoxRect(paintOffset, listIndex); 442 itemRect.intersect(controlClipRect(paintOffset)); 443 paintInfo.context().fillRect(snappedIntRect(itemRect), backColor); 439 444 } 440 445 … … 444 449 return false; 445 450 446 LayoutRect vertRect(accumulatedOffset.x() + width() - borderRight() - m_vBar->width(), 447 accumulatedOffset.y() + borderTop(), 448 m_vBar->width(), 449 height() - borderTop() - borderBottom()); 450 451 if (vertRect.contains(locationInContainer)) { 452 result.setScrollbar(m_vBar.get()); 453 return true; 454 } 455 return false; 451 LayoutUnit x = accumulatedOffset.x() + (verticalScrollbarIsOnLeft() ? borderLeft() : width() - borderRight() - m_vBar->width()); 452 LayoutUnit y = accumulatedOffset.y() + borderTop(); 453 LayoutUnit width = m_vBar->width(); 454 LayoutUnit height = this->height() - borderTop() - borderBottom(); 455 LayoutRect vertRect(x, y, width, height); 456 457 if (!vertRect.contains(locationInContainer)) 458 return false; 459 460 result.setScrollbar(m_vBar.get()); 461 return true; 456 462 } 457 463 … … 465 471 466 472 int scrollbarWidth = m_vBar ? m_vBar->width() : 0; 467 if (offset.width() < borderLeft() + paddingLeft() || offset.width() > width() - borderRight() - paddingRight() - scrollbarWidth) 473 if (verticalScrollbarIsOnLeft() && (offset.width() < borderLeft() + paddingLeft() + scrollbarWidth || offset.width() > width() - borderRight() - paddingRight())) 474 return -1; 475 if (!verticalScrollbarIsOnLeft() && (offset.width() < borderLeft() + paddingLeft() || offset.width() > width() - borderRight() - paddingRight() - scrollbarWidth)) 468 476 return -1; 469 477 … … 703 711 704 712 for (int i = 0; i < size; ++i) { 705 if ( itemBoundingBoxRect(adjustedLocation, i).contains(locationInContainer.point())) {706 if (Element* node = listItems[i]) {707 result.setInnerNode(node);708 if (!result.innerNonSharedNode())709 result.setInnerNonSharedNode(node);710 result.set LocalPoint(locationInContainer.point() - toLayoutSize(adjustedLocation));711 break;712 }713 if (!itemBoundingBoxRect(adjustedLocation, i).contains(locationInContainer.point())) 714 continue; 715 if (Element* node = listItems[i]) { 716 result.setInnerNode(node); 717 if (!result.innerNonSharedNode()) 718 result.setInnerNonSharedNode(node); 719 result.setLocalPoint(locationInContainer.point() - toLayoutSize(adjustedLocation)); 720 break; 713 721 } 714 722 } … … 720 728 { 721 729 LayoutRect clipRect = contentBoxRect(); 730 if (verticalScrollbarIsOnLeft() && (!layer() || !layer()->verticalScrollbarIsOnLeft())) 731 clipRect.move(m_vBar->occupiedWidth(), 0); 722 732 clipRect.moveBy(additionalOffset); 723 733 return clipRect; … … 733 743 { 734 744 IntRect scrollRect = rect; 735 scrollRect.move( width() - borderRight() - scrollbar.width(), borderTop());745 scrollRect.move(verticalScrollbarIsOnLeft() ? borderLeft() : width() - borderRight() - scrollbar.width(), borderTop()); 736 746 repaintRectangle(scrollRect); 737 747 } … … 740 750 { 741 751 IntRect rect = scrollbarRect; 742 int scrollbarLeft = width() - borderRight() - scrollbar.width();752 int scrollbarLeft = verticalScrollbarIsOnLeft() ? borderLeft() : width() - borderRight() - scrollbar.width(); 743 753 int scrollbarTop = borderTop(); 744 754 rect.move(scrollbarLeft, scrollbarTop); … … 749 759 { 750 760 IntRect rect = view().frameView().convertFromContainingViewToRenderer(this, parentRect); 751 int scrollbarLeft = width() - borderRight() - scrollbar.width();761 int scrollbarLeft = verticalScrollbarIsOnLeft() ? borderLeft() : width() - borderRight() - scrollbar.width(); 752 762 int scrollbarTop = borderTop(); 753 763 rect.move(-scrollbarLeft, -scrollbarTop); … … 758 768 { 759 769 IntPoint point = scrollbarPoint; 760 int scrollbarLeft = width() - borderRight() - scrollbar.width();770 int scrollbarLeft = verticalScrollbarIsOnLeft() ? borderLeft() : width() - borderRight() - scrollbar.width(); 761 771 int scrollbarTop = borderTop(); 762 772 point.move(scrollbarLeft, scrollbarTop); … … 767 777 { 768 778 IntPoint point = view().frameView().convertFromContainingViewToRenderer(this, parentPoint); 769 int scrollbarLeft = width() - borderRight() - scrollbar.width();779 int scrollbarLeft = verticalScrollbarIsOnLeft() ? borderLeft() : width() - borderRight() - scrollbar.width(); 770 780 int scrollbarTop = borderTop(); 771 781 point.move(-scrollbarLeft, -scrollbarTop); … … 881 891 bool RenderListBox::scrolledToTop() const 882 892 { 893 if (Scrollbar* vbar = verticalScrollbar()) 894 return vbar->value() <= 0; 895 896 return true; 897 } 898 899 bool RenderListBox::scrolledToBottom() const 900 { 883 901 Scrollbar* vbar = verticalScrollbar(); 884 902 if (!vbar) 885 903 return true; 886 887 return vbar->value() <= 0;888 }889 890 bool RenderListBox::scrolledToBottom() const891 {892 Scrollbar* vbar = verticalScrollbar();893 if (!vbar)894 return true;895 904 896 905 return vbar->value() >= vbar->maximum();
Note: See TracChangeset
for help on using the changeset viewer.