Bug 367246. When the scrolled frame's width exceeds its available width (because its padding alone is greater than the available width) and the direction is RTL, the scrolled frame should be positioned with its right edge at the right edge of the scrollport. r+sr=dbaron

This commit is contained in:
Robert O'Callahan 2008-07-14 09:50:35 +12:00
parent 59f23d63e8
commit 042de9c4e3
3 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<html>
<body>
<div style="direction: rtl">
<div style="padding: 10px; width: 1px; overflow: scroll;">Foopy</div>
</div>
</body>
</html>

View File

@ -31,6 +31,7 @@ load 364686-1.xhtml
load 366021-1.xhtml
load 366667-1.html
load 366952-1.html
load 367246-1.html
load 368330-1.html
load 368461-1.xhtml
load 368860-1.html

View File

@ -2610,6 +2610,14 @@ nsGfxScrollFrameInner::GetScrolledRect(const nsSize& aScrollPortSize) const
} else {
if (x2 > aScrollPortSize.width)
x2 = aScrollPortSize.width;
// When the scrolled frame chooses a size larger than its available width (because
// its padding alone is larger than the available width), we need to keep the
// start-edge of the scroll frame anchored to the start-edge of the scrollport.
// When the scrolled frame is RTL, this means moving it in our left-based
// coordinate system, so we need to compensate for its extra width here by
// effectively repositioning the frame.
nscoord extraWidth = PR_MAX(0, mScrolledFrame->GetSize().width - aScrollPortSize.width);
x2 += extraWidth;
}
return nsRect(x1, y1, x2 - x1, y2 - y1);