layout/reftests/bugs/508816-1-ref.xul

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <!DOCTYPE window>
michael@0 3 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="RTL overflow test" width="640px" height="480px" style="direction: rtl" onload="load()" class="reftest-wait">
michael@0 4
michael@0 5 <hbox style="max-width: 200px; border: 1px solid red;">
michael@0 6 <scrollbox id="sb" align="start" pack="start" orient="horizontal" flex="1">
michael@0 7 <button id="sb1" label="test1"/><button label="test2"/><button label="test3"/><button label="test4"/><button label="test5"/>
michael@0 8 </scrollbox>
michael@0 9 </hbox>
michael@0 10
michael@0 11 <hbox style="max-width: 200px; border: 1px solid blue">
michael@0 12 <arrowscrollbox id="asb" align="start" pack="start" orient="horizontal" flex="1">
michael@0 13 <button id="asb1" label="test1"/><button label="test2"/><button label="test3"/><button label="test4"/><button label="test5"/>
michael@0 14 </arrowscrollbox>
michael@0 15 </hbox>
michael@0 16
michael@0 17 <hbox style="max-width: 200px; border: 1px solid black">
michael@0 18 <hbox align="end" pack="end" flex="1">
michael@0 19 <button label="test1"/><button label="test2"/><button label="test3"/><button label="test4"/><button label="test5"/>
michael@0 20 </hbox>
michael@0 21 </hbox>
michael@0 22
michael@0 23 <script type="text/javascript">
michael@0 24 <![CDATA[
michael@0 25 function load() {
michael@0 26 // arrowscrollbox provides a helper ensureElementIsVisible method
michael@0 27 document.getElementById("asb").ensureElementIsVisible(document.getElementById("asb1"), false);
michael@0 28
michael@0 29 // scrollbox doesn't provide that, so we have to do the heavy lifting directly
michael@0 30 var sb = document.getElementById("sb");
michael@0 31 var sb1 = document.getElementById("sb1");
michael@0 32 var rect = sb.getBoundingClientRect();
michael@0 33 var containerStart = rect.left;
michael@0 34 var containerEnd = rect.right;
michael@0 35 rect = sb1.getBoundingClientRect();
michael@0 36 var elementStart = rect.left;
michael@0 37 var elementEnd = rect.right;
michael@0 38
michael@0 39 var amountToScroll = 0;
michael@0 40 if (elementStart < containerStart) {
michael@0 41 amountToScroll = elementStart - containerStart;
michael@0 42 } else if (elementEnd > containerEnd) {
michael@0 43 amountToScroll = elementEnd - containerEnd;
michael@0 44 }
michael@0 45 sb.scrollLeft += amountToScroll;
michael@0 46
michael@0 47 document.documentElement.removeAttribute("class");
michael@0 48 }
michael@0 49 ]]>
michael@0 50 </script>
michael@0 51
michael@0 52 </window>

mercurial