https://bugs.webkit.org/show_bug.cgi?id=60737

ThumbPosition() in ScrollbarTheme should be ceiled before returned.
Otherwise, some topest/leftest content can not be shown by dragging
scrollbar thumb.

Source/WebCore:

Patch by Robin Qiu <robin.qiu.dev@gmail.com> on 2011-07-21
Reviewed by Antonio Gomes.

Test: scrollbars/scrollbar-drag-thumb-with-large-content.html

* platform/ScrollbarThemeComposite.cpp:
(WebCore::ScrollbarThemeComposite::thumbPosition):
* platform/qt/ScrollbarThemeQt.cpp:
(WebCore::ScrollbarThemeQt::thumbPosition):

LayoutTests:

Patch by Robin Qiu <robin.qiu.dev@gmail.com> on 2011-07-21
Reviewed by Antonio Gomes.

* scrollbars/scrollbar-drag-thumb-with-large-content-expected.txt: Added.
* scrollbars/scrollbar-drag-thumb-with-large-content.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@91547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8a6aa51f
2011-07-21 Robin Qiu <robin.qiu.dev@gmail.com>
https://bugs.webkit.org/show_bug.cgi?id=60737
ThumbPosition() in ScrollbarTheme should be ceiled before returned.
Otherwise, some topest/leftest content can not be shown by dragging
scrollbar thumb.
Reviewed by Antonio Gomes.
* scrollbars/scrollbar-drag-thumb-with-large-content-expected.txt: Added.
* scrollbars/scrollbar-drag-thumb-with-large-content.html: Added.
2011-07-21 Ryosuke Niwa <rniwa@webkit.org>
Chromium test expectation update after r91533.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Bug 60737 test case</title>
<style type="text/css">
/* Use customized scrollbar to avoid platform differences. */
<!--
::-webkit-scrollbar {
width: 20px;
height: 20px;
}
::-webkit-scrollbar-button {
height: 20px;
width: 20px;
background-color: blue;
}
::-webkit-scrollbar-track-piece {
background-color: gray;
}
::-webkit-scrollbar-thumb {
height: 20px;
width: 20px;
background-color: red;
}
-->
</style>
</head>
<body style="margin:0px">
<div id="container" style="border:1px solid black; height:150px; width:100px; overflow:auto;">
<div id="expander" style="height:100px; width:5000px; background-color:green; border:2px solid red;">
</div>
</div>
<p id="result">Test did not run.</p>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
var container = document.getElementById("container");
container.scrollLeft = 2;
// Drag scrollbar thumber to left most:
if (window.eventSender) {
eventSender.mouseMoveTo(30, 145);
eventSender.mouseDown();
eventSender.mouseMoveTo(0, 145);
eventSender.mouseUp();
}
if (window.layoutTestController)
document.getElementById("result").innerText = container.scrollLeft == 0 ? "PASS" : "FAIL";
</script>
</body>
</html>
2011-07-21 Robin Qiu <robin.qiu.dev@gmail.com>
https://bugs.webkit.org/show_bug.cgi?id=60737
ThumbPosition() in ScrollbarTheme should be ceiled before returned.
Otherwise, some topest/leftest content can not be shown by dragging
scrollbar thumb.
Reviewed by Antonio Gomes.
Test: scrollbars/scrollbar-drag-thumb-with-large-content.html
* platform/ScrollbarThemeComposite.cpp:
(WebCore::ScrollbarThemeComposite::thumbPosition):
* platform/qt/ScrollbarThemeQt.cpp:
(WebCore::ScrollbarThemeQt::thumbPosition):
2011-07-21 Simon Fraser <simon.fraser@apple.com>
GraphicsLayers in subframes can get sync'd multiple times
......@@ -268,8 +268,10 @@ static float usedTotalSize(Scrollbar* scrollbar)
int ScrollbarThemeComposite::thumbPosition(Scrollbar* scrollbar)
{
if (scrollbar->enabled())
return max(0.0f, scrollbar->currentPos()) * (trackLength(scrollbar) - thumbLength(scrollbar)) / (usedTotalSize(scrollbar) - scrollbar->visibleSize());
if (scrollbar->enabled()) {
float pos = max(0.0f, scrollbar->currentPos()) * (trackLength(scrollbar) - thumbLength(scrollbar)) / (usedTotalSize(scrollbar) - scrollbar->visibleSize());
return (pos < 1 && pos > 0) ? 1 : pos;
}
return 0;
}
......
......@@ -213,8 +213,10 @@ int ScrollbarThemeQt::scrollbarThickness(ScrollbarControlSize controlSize)
int ScrollbarThemeQt::thumbPosition(Scrollbar* scrollbar)
{
if (scrollbar->enabled())
return (int)((float)scrollbar->currentPos() * (trackLength(scrollbar) - thumbLength(scrollbar)) / scrollbar->maximum());
if (scrollbar->enabled()) {
float pos = (float)scrollbar->currentPos() * (trackLength(scrollbar) - thumbLength(scrollbar)) / scrollbar->maximum();
return (pos < 1 && pos > 0) ? 1 : pos;
}
return 0;
}
......
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