blob: 28748fd6ac69721d34f4c9d2ed9f7d09ffbc4864 [file] [log] [blame]
<!DOCTYPE html>
<html>
<title>Test that horizontal scrollbar should appear as the content width encroaches upon the vertical scrollbar and also test if WebKit can show the left side of the inner elements regardless of the position of its scrollbars. To test manually, open this document and verify we can see "ABC" both in the LTR element and in the RTL element.</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<body dir="ltr">
<div dir="ltr" id="outer-ltr" style="width: 200px; height: 200px; overflow: auto;">
<div id="inner-ltr" style="text-align: left; width: 195px; height: 300px;">ABC</div>
</div>
<div dir="rtl" id="outer-rtl" style="width: 200px; height: 200px; overflow: auto;">
<div id="inner-rtl" style="text-align: left; width: 195px; height: 300px;">ABC</div>
</div>
<script>
test(function() {
var outerLTR = document.getElementById("outer-ltr");
var innerLTR = document.getElementById("inner-ltr");
var outerRTL = document.getElementById("outer-rtl");
var innerRTL = document.getElementById("inner-rtl");
outerLTR.scrollLeft = 0;
outerRTL.scrollLeft = 0;
// Verify the widths of the outer RTL elements are the same as the widths of the outer LTR elements.
assert_equals(outerLTR.offsetWidth, outerRTL.offsetWidth);
assert_equals(outerLTR.clientWidth, outerRTL.clientWidth);
assert_equals(outerLTR.scrollWidth, outerRTL.scrollWidth);
// Verify the widths of the inner RTL elements are the same as the widths of the inner LTR elements.
assert_equals(innerLTR.offsetWidth, innerRTL.offsetWidth);
assert_equals(innerLTR.clientWidth, innerRTL.clientWidth);
assert_equals(innerLTR.scrollWidth, innerRTL.scrollWidth);
// Verify the width of the vertical scrollbar of the outer RTL element is the same as the one of the outer LTR element regardless of their scrollbar positions.
var scrollbarWidthLTR = outerLTR.offsetWidth - outerLTR.clientWidth;
var scrollbarWidthRTL = outerRTL.offsetWidth - outerRTL.clientWidth;
assert_equals(scrollbarWidthLTR, scrollbarWidthRTL);
assert_equals(outerRTL.clientLeft, scrollbarWidthRTL);
});
</script>
</body>
</html>