summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderScrollbarPart.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
commit2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch)
tree988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebCore/rendering/RenderScrollbarPart.cpp
parentdd91e772430dc294e3bf478c119ef8d43c0a3358 (diff)
downloadqtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebCore/rendering/RenderScrollbarPart.cpp')
-rw-r--r--Source/WebCore/rendering/RenderScrollbarPart.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/Source/WebCore/rendering/RenderScrollbarPart.cpp b/Source/WebCore/rendering/RenderScrollbarPart.cpp
index cbae68c02..1a45be2de 100644
--- a/Source/WebCore/rendering/RenderScrollbarPart.cpp
+++ b/Source/WebCore/rendering/RenderScrollbarPart.cpp
@@ -79,41 +79,43 @@ void RenderScrollbarPart::layoutVerticalPart()
}
}
-static int calcScrollbarThicknessUsing(const Length& l, int containingLength)
+static int calcScrollbarThicknessUsing(const Length& length, int containingLength, RenderView* renderView)
{
- if (l.isIntrinsicOrAuto())
+ if (length.isIntrinsicOrAuto())
return ScrollbarTheme::theme()->scrollbarThickness();
- return l.calcMinValue(containingLength);
+ return minimumValueForLength(length, containingLength, renderView);
}
void RenderScrollbarPart::computeScrollbarWidth()
{
if (!m_scrollbar->owningRenderer())
return;
+ RenderView* renderView = view();
int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->borderLeft() - m_scrollbar->owningRenderer()->borderRight();
- int w = calcScrollbarThicknessUsing(style()->width(), visibleSize);
- int minWidth = calcScrollbarThicknessUsing(style()->minWidth(), visibleSize);
- int maxWidth = style()->maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(style()->maxWidth(), visibleSize);
+ int w = calcScrollbarThicknessUsing(style()->width(), visibleSize, renderView);
+ int minWidth = calcScrollbarThicknessUsing(style()->minWidth(), visibleSize, renderView);
+ int maxWidth = style()->maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(style()->maxWidth(), visibleSize, renderView);
setWidth(max(minWidth, min(maxWidth, w)));
// Buttons and track pieces can all have margins along the axis of the scrollbar.
- m_marginLeft = style()->marginLeft().calcMinValue(visibleSize);
- m_marginRight = style()->marginRight().calcMinValue(visibleSize);
+ m_marginLeft = minimumValueForLength(style()->marginLeft(), visibleSize, renderView);
+ m_marginRight = minimumValueForLength(style()->marginRight(), visibleSize, renderView);
}
void RenderScrollbarPart::computeScrollbarHeight()
{
if (!m_scrollbar->owningRenderer())
return;
+ RenderView* renderView = view();
int visibleSize = m_scrollbar->owningRenderer()->height() - m_scrollbar->owningRenderer()->borderTop() - m_scrollbar->owningRenderer()->borderBottom();
- int h = calcScrollbarThicknessUsing(style()->height(), visibleSize);
- int minHeight = calcScrollbarThicknessUsing(style()->minHeight(), visibleSize);
- int maxHeight = style()->maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(style()->maxHeight(), visibleSize);
+ int h = calcScrollbarThicknessUsing(style()->height(), visibleSize, renderView);
+ int minHeight = calcScrollbarThicknessUsing(style()->minHeight(), visibleSize, renderView);
+ int maxHeight = style()->maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(style()->maxHeight(), visibleSize, renderView);
setHeight(max(minHeight, min(maxHeight, h)));
// Buttons and track pieces can all have margins along the axis of the scrollbar.
- m_marginTop = style()->marginTop().calcMinValue(visibleSize);
- m_marginBottom = style()->marginBottom().calcMinValue(visibleSize);
+ m_marginTop = minimumValueForLength(style()->marginTop(), visibleSize, renderView);
+ m_marginBottom = minimumValueForLength(style()->marginBottom(), visibleSize, renderView);
}
void RenderScrollbarPart::computePreferredLogicalWidths()
@@ -170,7 +172,7 @@ void RenderScrollbarPart::paintIntoRect(GraphicsContext* graphicsContext, const
return;
// Now do the paint.
- PaintInfo paintInfo(graphicsContext, rect, PaintPhaseBlockBackground, false, 0, 0, 0);
+ PaintInfo paintInfo(graphicsContext, pixelSnappedIntRect(rect), PaintPhaseBlockBackground, false, 0, 0, 0);
paint(paintInfo, paintOffset);
paintInfo.phase = PaintPhaseChildBlockBackgrounds;
paint(paintInfo, paintOffset);