mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-27 21:21:50 +03:00
LibWeb: Return overflow rect height from Element::scroll_height()
Spec says that this function has to return "height of the element scrolling area" which is height of "scrolling overflow rect" in our model.
This commit is contained in:
parent
9f581d0bc9
commit
591c8d2b68
Notes:
sideshowbarker
2024-07-17 04:03:27 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/591c8d2b68 Pull-request: https://github.com/SerenityOS/serenity/pull/23210
1
Tests/LibWeb/Text/expected/DOM/element-scroll-height.txt
Normal file
1
Tests/LibWeb/Text/expected/DOM/element-scroll-height.txt
Normal file
@ -0,0 +1 @@
|
||||
Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Item 11Item 12 1200
|
25
Tests/LibWeb/Text/input/DOM/element-scroll-height.html
Normal file
25
Tests/LibWeb/Text/input/DOM/element-scroll-height.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<style>
|
||||
* {
|
||||
outline: 1px solid black;
|
||||
}
|
||||
|
||||
.scrollable {
|
||||
height: 300px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
span {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
display: block
|
||||
}
|
||||
</style>
|
||||
<div class="scrollable"><span>Item 1</span><span>Item 2</span><span>Item 3</span><span>Item 4</span><span>Item 5</span><span>Item 6</span><span>Item 7</span><span>Item 8</span><span>Item 9</span><span>Item 10</span><span>Item 11</span><span>Item 12</span></div>
|
||||
<script>
|
||||
test(() => {
|
||||
const scrollable = document.querySelector(".scrollable");
|
||||
println(scrollable.scrollHeight);
|
||||
});
|
||||
</script>
|
@ -1430,7 +1430,7 @@ int Element::scroll_height() const
|
||||
return 0;
|
||||
|
||||
// 7. Return the height of the element’s scrolling area.
|
||||
return paintable_box()->border_box_height().to_int();
|
||||
return paintable_box()->scrollable_overflow_rect()->height().to_int();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics-other.html#concept-element-disabled
|
||||
|
Loading…
Reference in New Issue
Block a user