From 591c8d2b68f0d61ff562bbc359798939b8d5857d Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Fri, 16 Feb 2024 01:22:52 +0100 Subject: [PATCH] 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. --- .../expected/DOM/element-scroll-height.txt | 1 + .../Text/input/DOM/element-scroll-height.html | 25 +++++++++++++++++++ Userland/Libraries/LibWeb/DOM/Element.cpp | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 Tests/LibWeb/Text/expected/DOM/element-scroll-height.txt create mode 100644 Tests/LibWeb/Text/input/DOM/element-scroll-height.html diff --git a/Tests/LibWeb/Text/expected/DOM/element-scroll-height.txt b/Tests/LibWeb/Text/expected/DOM/element-scroll-height.txt new file mode 100644 index 0000000000..52ea7a30cf --- /dev/null +++ b/Tests/LibWeb/Text/expected/DOM/element-scroll-height.txt @@ -0,0 +1 @@ +Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Item 11Item 12 1200 diff --git a/Tests/LibWeb/Text/input/DOM/element-scroll-height.html b/Tests/LibWeb/Text/input/DOM/element-scroll-height.html new file mode 100644 index 0000000000..527ccba732 --- /dev/null +++ b/Tests/LibWeb/Text/input/DOM/element-scroll-height.html @@ -0,0 +1,25 @@ + + + +
Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Item 11Item 12
+ diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 1c05221d79..b9306a3c75 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -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