From 0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Tue, 11 Aug 2009 17:01:47 +0100 Subject: Merge in WebKit r47029. --- WebCore/rendering/RenderListBox.cpp | 70 +++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 6 deletions(-) (limited to 'WebCore/rendering/RenderListBox.cpp') diff --git a/WebCore/rendering/RenderListBox.cpp b/WebCore/rendering/RenderListBox.cpp index 83c569e..e6c28f7 100644 --- a/WebCore/rendering/RenderListBox.cpp +++ b/WebCore/rendering/RenderListBox.cpp @@ -370,7 +370,7 @@ bool RenderListBox::isPointInOverflowControl(HitTestResult& result, int _x, int return false; IntRect vertRect(_tx + width() - borderRight() - m_vBar->width(), - _ty, + _ty + borderTop(), m_vBar->width(), height() - borderTop() - borderBottom()); @@ -416,22 +416,22 @@ void RenderListBox::panScroll(const IntPoint& panStartMousePosition) int yDelta = currentMousePosition.y() - panStartMousePosition.y(); - // If the point is too far from the center we limit the speed + // If the point is too far from the center we limit the speed yDelta = max(min(yDelta, maxSpeed), -maxSpeed); - if(abs(yDelta) < iconRadius) // at the center we let the space for the icon + if (abs(yDelta) < iconRadius) // at the center we let the space for the icon return; if (yDelta > 0) //offsetY = view()->viewHeight(); absOffset.move(0, listHeight()); - else if (yDelta < 0) - yDelta--; + else if (yDelta < 0) + yDelta--; // Let's attenuate the speed yDelta /= speedReducer; - IntPoint scrollPoint(0,0); + IntPoint scrollPoint(0, 0); scrollPoint.setY(absOffset.y() + yDelta); int newOffset = scrollToward(scrollPoint); if (newOffset < 0) @@ -623,6 +623,64 @@ void RenderListBox::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& repaintRectangle(scrollRect); } +IntRect RenderListBox::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntRect& scrollbarRect) const +{ + RenderView* view = this->view(); + if (!view) + return scrollbarRect; + + IntRect rect = scrollbarRect; + + int scrollbarLeft = width() - borderRight() - scrollbar->width(); + int scrollbarTop = borderTop(); + rect.move(scrollbarLeft, scrollbarTop); + + return view->frameView()->convertFromRenderer(this, rect); +} + +IntRect RenderListBox::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const +{ + RenderView* view = this->view(); + if (!view) + return parentRect; + + IntRect rect = view->frameView()->convertToRenderer(this, parentRect); + + int scrollbarLeft = width() - borderRight() - scrollbar->width(); + int scrollbarTop = borderTop(); + rect.move(-scrollbarLeft, -scrollbarTop); + return rect; +} + +IntPoint RenderListBox::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntPoint& scrollbarPoint) const +{ + RenderView* view = this->view(); + if (!view) + return scrollbarPoint; + + IntPoint point = scrollbarPoint; + + int scrollbarLeft = width() - borderRight() - scrollbar->width(); + int scrollbarTop = borderTop(); + point.move(scrollbarLeft, scrollbarTop); + + return view->frameView()->convertFromRenderer(this, point); +} + +IntPoint RenderListBox::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const +{ + RenderView* view = this->view(); + if (!view) + return parentPoint; + + IntPoint point = view->frameView()->convertToRenderer(this, parentPoint); + + int scrollbarLeft = width() - borderRight() - scrollbar->width(); + int scrollbarTop = borderTop(); + point.move(-scrollbarLeft, -scrollbarTop); + return point; +} + PassRefPtr RenderListBox::createScrollbar() { RefPtr widget; -- cgit v1.1