mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 16:49:54 +00:00
LibWeb/DOM: Move pseudo-element scroll offsets into PseudoElement
This commit is contained in:
parent
2c7310553a
commit
f98312d022
Notes:
github-actions[bot]
2025-06-19 11:36:37 +00:00
Author: https://github.com/AtkinsSJ
Commit: f98312d022
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5132
Reviewed-by: https://github.com/tcl3
4 changed files with 33 additions and 19 deletions
|
@ -3031,7 +3031,7 @@ void Element::scroll(double x, double y)
|
|||
// as the element is not eligible to be the Document.scrollingElement.
|
||||
if (x == 0
|
||||
&& y == 0
|
||||
&& scroll_offset(ScrollOffsetFor::Self).is_zero()
|
||||
&& scroll_offset({}).is_zero()
|
||||
&& this != document.body()
|
||||
&& this != document.document_element()) {
|
||||
return;
|
||||
|
@ -3397,6 +3397,25 @@ IntersectionObserver::IntersectionObserverRegistration& Element::get_intersectio
|
|||
return *registration_iterator;
|
||||
}
|
||||
|
||||
CSSPixelPoint Element::scroll_offset(Optional<CSS::PseudoElement> pseudo_element_type) const
|
||||
{
|
||||
if (pseudo_element_type.has_value()) {
|
||||
if (auto pseudo_element = get_pseudo_element(*pseudo_element_type); pseudo_element.has_value())
|
||||
return pseudo_element->scroll_offset();
|
||||
return {};
|
||||
}
|
||||
return m_scroll_offset;
|
||||
}
|
||||
|
||||
void Element::set_scroll_offset(Optional<CSS::PseudoElement> pseudo_element_type, CSSPixelPoint offset)
|
||||
{
|
||||
if (pseudo_element_type.has_value()) {
|
||||
if (auto pseudo_element = get_pseudo_element(*pseudo_element_type); pseudo_element.has_value())
|
||||
pseudo_element->set_scroll_offset(offset);
|
||||
}
|
||||
m_scroll_offset = offset;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#translation-mode
|
||||
Element::TranslationMode Element::translation_mode() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue