Scrollbar width is not applied when element hidden

Webkit has css properties through which custom scroll bars can be added.
In case the element's visibility property is hidden and custom scrollbar 
properties are applied the scrollbar width is not considered when querying
the element.clientWidth. In case of non-custom scrollbars whether the
element's visibility property is hidden or not correct scrollbar width is
considered.

When a custom scrollbar is created there is a check whether the renderer to
which scrollbar is added is visible or not. This check is not required since
for non-custom scrollbars the same check is not present. Also whether the
element's visibility property is hidden or not a placeholder is set for the
element.

Both behavior i.e custom and non-custom scrollbars should be same.

I already landed this patch on Webkit. Just modified the layout test file.
http://trac.webkit.org/changeset/155323

R=esprehn@chromium.org,eseidel@chromium.org
BUG=343521

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

git-svn-id: svn://svn.chromium.org/blink/trunk@175123 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 5b93bdd3
Tests that element.clientWidth of visible element with scrollbars returns proper values
PASS
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/check-layout.js"></script>
<style type="text/css">
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: #CCCCCC;
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}
div {
position: absolute;
top: 200px;
left: 0px;
background-color: red;
width: 200px;
height: 150px;
padding: 0px;
overflow: scroll;
visibility: hidden;
}
#scrollChild {
width: 150%;
height: 200px;
padding: 0px;
}
</style>
</head>
<body>
Tests that element.clientWidth of visible element with scrollbars returns proper values
<div id="scrollDiv" data-expected-client-width="190"><p id="scrollChild"></p></div>
<p id="test-output"></p>
</body>
<script type="text/javascript">
window.checkLayout("div", document.getElementById("test-output"));
</script>
</html>
Tests that element.clientWidth of visible element with scrollbars returns proper values
PASS
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/check-layout.js"></script>
<style type="text/css">
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: #CCCCCC;
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}
div {
position: absolute;
top: 200px;
left: 0px;
background-color: red;
width: 200px;
height: 150px;
padding: 0px;
overflow: scroll;
}
#scrollChild {
width: 150%;
height: 200px;
padding: 0px;
}
</style>
</head>
<body>
Tests that element.clientWidth of visible element with scrollbars returns proper values
<div id="scrollDiv" data-expected-client-width="190"><p id="scrollChild"></p></div>
<p id="test-output"></p>
</body>
<script type="text/javascript">
window.checkLayout("div", document.getElementById("test-output"));
</script>
</html>
...@@ -225,7 +225,7 @@ void RenderScrollbar::updateScrollbarPart(ScrollbarPart partType, bool destroy) ...@@ -225,7 +225,7 @@ void RenderScrollbar::updateScrollbarPart(ScrollbarPart partType, bool destroy)
RefPtr<RenderStyle> partStyle = !destroy ? getScrollbarPseudoStyle(partType, pseudoForScrollbarPart(partType)) : PassRefPtr<RenderStyle>(nullptr); RefPtr<RenderStyle> partStyle = !destroy ? getScrollbarPseudoStyle(partType, pseudoForScrollbarPart(partType)) : PassRefPtr<RenderStyle>(nullptr);
bool needRenderer = !destroy && partStyle && partStyle->display() != NONE && partStyle->visibility() == VISIBLE; bool needRenderer = !destroy && partStyle && partStyle->display() != NONE;
if (needRenderer && partStyle->display() != BLOCK) { if (needRenderer && partStyle->display() != BLOCK) {
// See if we are a button that should not be visible according to OS settings. // See if we are a button that should not be visible according to OS settings.
......
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