With the following `test.html`: ```HTML <body> <div id="scroller" style="height: 100px; width: 100px; overflow: scroll; background: red;"> <div style="background: green; margin-top: 100px; width: 100px; height: 100px;"></div> </div> <script> var scroller = document.getElementById("scroller"); console.log(scroller.clientHeight) console.log(scroller.scrollHeight) </script> </body> ``` Firefox will get: ``` 96 <--- this is caused by scrollbar 200 ``` Servo will get: ``` 100 <---- servo count scrollbar currently 100 <---- this is wrong ``` As `clientHeight` is a known issue, we may need to check out `scrollHeight` This might be an issue related to #19268 https://github.com/servo/servo/blob/b2b51d333e99c1d2a7322ae53357f2b095ba2d40/components/script/dom/element.rs#L373-L376
Activity
tigercosmos commentedon Nov 19, 2017
I figure out that
ScrollHeightcannot deal withmargin-top: 100px;If we change the second line of this:
to
andmargin-top: 100pxheight: 190px;ScrollHeightwill get correct answser190tigercosmos commentedon Nov 20, 2017
Seems
scrollHeightwill returnmax(margin-top, height)As shown in following:
scroller.scrollHeightwill get100scroller.scrollHeightwill get190I also test changing
margintopadding, andpaddingwill run correctly.tigercosmos commentedon Nov 26, 2017
Something might be related:
servo/components/layout/query.rs
Lines 135 to 139 in fe4139b
servo/components/layout/query.rs
Lines 628 to 656 in fe4139b
tigercosmos commentedon Nov 30, 2017
servo/components/layout/query.rs
Lines 874 to 886 in fe4139b
Auto merge of #19469 - tigercosmos:z1, r=<try>
Auto merge of #19469 - tigercosmos:z1, r=<try>
lumiscosity commentedon May 17, 2026
Servo now correctly returns
100and200and so does Firefox. Tested on Arch Linux x86_64, Servo built against commit 6c2ac81, Firefox 150.0.3.