Fix for RenderListBox not showing vertical scrollbar with overlay-scrollbar enabled.

The scrollbars does not paint as verticalScrollbarWidth() returns 0 in paint in case of overlay-scrollbars.
We should use actual scrollbar width while placing and painting the scrollbar.

BUG=385463

Review URL: https://codereview.chromium.org/337323002

git-svn-id: svn://svn.chromium.org/blink/trunk@176395 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8879eaef
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
margin: 0;
padding: 0;
}
.container {
width: 100px;
height: 100px;
background-color: lime;
position: relative;
}
.scrollbar {
background-color: #808080;
position: absolute;
}
.vertical {
width: 3px;
height: 92px;
}
</style>
<script>
</script>
</head>
<body>
<p>You should see 2 green boxes with overlay scrollbar. The second box
should have a scrollbar on the left.</p>
<div class="container">
<div class="scrollbar vertical" style="right: 4px; top: 4px;"></div>
</div>
<div dir="rtl" class="container">
<div class="scrollbar vertical" style="left: 0px; top: 4px;"></div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
margin: 0;
padding: 0;
}
.sel {
border: 0;
width: 100px;
height: 100px;
background-color: lime;
}
</style>
<script>
if (window.internals) {
testRunner.dumpAsTextWithPixelResults();
internals.settings.setOverlayScrollbarsEnabled(true);
internals.settings.setMockScrollbarsEnabled(true);
}
</script>
</head>
<body>
<p>You should see 2 green boxes with overlay scrollbar. The second box
should have a scrollbar on the left.</p>
<div>
<select multiple class="sel"></select>
</div>
<div>
<select multiple dir="rtl" class="sel"></select>
</div>
</body>
</html>
......@@ -227,9 +227,7 @@ void RenderListBox::scrollToRevealSelection()
void RenderListBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
maxLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal;
if (m_vBar)
maxLogicalWidth += verticalScrollbarWidth();
maxLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal + verticalScrollbarWidth();
if (!style()->width().isPercent())
minLogicalWidth = maxLogicalWidth;
}
......@@ -389,7 +387,7 @@ int RenderListBox::scrollbarLeft() const
if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
scrollbarLeft = borderLeft();
else
scrollbarLeft = width() - borderRight() - verticalScrollbarWidth();
scrollbarLeft = width() - borderRight() - (m_vBar ? m_vBar->width() : 0);
return scrollbarLeft;
}
......@@ -398,7 +396,7 @@ void RenderListBox::paintScrollbar(PaintInfo& paintInfo, const LayoutPoint& pain
if (m_vBar) {
IntRect scrollRect = pixelSnappedIntRect(paintOffset.x() + scrollbarLeft(),
paintOffset.y() + borderTop(),
verticalScrollbarWidth(),
m_vBar->width(),
height() - (borderTop() + borderBottom()));
m_vBar->setFrameRect(scrollRect);
m_vBar->paint(paintInfo.context, paintInfo.rect);
......
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