mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-29 16:21:29 +00:00
LibWeb: Propagate scrollbar-width property from root element to viewport
This commit is contained in:
parent
50920b0595
commit
eb909118bf
Notes:
sideshowbarker
2024-07-16 16:23:32 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/eb909118bf Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/21
|
@ -1026,6 +1026,15 @@ void Document::invalidate_layout()
|
||||||
schedule_layout_update();
|
schedule_layout_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void propagate_scrollbar_width_to_viewport(Element& root_element, Layout::Viewport& viewport)
|
||||||
|
{
|
||||||
|
// https://drafts.csswg.org/css-scrollbars/#scrollbar-width
|
||||||
|
// UAs must apply the scrollbar-color value set on the root element to the viewport.
|
||||||
|
auto& viewport_computed_values = viewport.mutable_computed_values();
|
||||||
|
auto& root_element_computed_values = root_element.layout_node()->computed_values();
|
||||||
|
viewport_computed_values.set_scrollbar_width(root_element_computed_values.scrollbar_width());
|
||||||
|
}
|
||||||
|
|
||||||
static void propagate_overflow_to_viewport(Element& root_element, Layout::Viewport& viewport)
|
static void propagate_overflow_to_viewport(Element& root_element, Layout::Viewport& viewport)
|
||||||
{
|
{
|
||||||
// https://drafts.csswg.org/css-overflow-3/#overflow-propagation
|
// https://drafts.csswg.org/css-overflow-3/#overflow-propagation
|
||||||
|
@ -1090,6 +1099,7 @@ void Document::update_layout()
|
||||||
|
|
||||||
if (document_element && document_element->layout_node()) {
|
if (document_element && document_element->layout_node()) {
|
||||||
propagate_overflow_to_viewport(*document_element, *m_layout_root);
|
propagate_overflow_to_viewport(*document_element, *m_layout_root);
|
||||||
|
propagate_scrollbar_width_to_viewport(*document_element, *m_layout_root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue