mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibWeb: Implement Element::scroll_by(x, y)
This commit is contained in:
parent
e640a68733
commit
31977cc0ac
Notes:
sideshowbarker
2024-07-17 21:16:31 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/31977cc0ac Pull-request: https://github.com/SerenityOS/serenity/pull/24200 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/awesomekling
1 changed files with 12 additions and 2 deletions
|
@ -2153,10 +2153,20 @@ void Element::scroll(HTML::ScrollToOptions const&)
|
|||
dbgln("FIXME: Implement Element::scroll(ScrollToOptions)");
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom-view/#dom-window-scrollby
|
||||
// https://drafts.csswg.org/cssom-view/#dom-element-scrollby
|
||||
void Element::scroll_by(double x, double y)
|
||||
{
|
||||
dbgln("FIXME: Implement Element::scroll_by({}, {})", x, y);
|
||||
// 1. Let options be null converted to a ScrollToOptions dictionary. [WEBIDL]
|
||||
HTML::ScrollToOptions options;
|
||||
|
||||
// 2. Let x and y be the arguments, respectively.
|
||||
// 3. Normalize non-finite values for x and y.
|
||||
// 4. Let the left dictionary member of options have the value x.
|
||||
// 5. Let the top dictionary member of options have the value y.
|
||||
// NOTE: Element::scroll_by(HTML::ScrollToOptions) performs the normalization and following steps.
|
||||
options.left = x;
|
||||
options.top = y;
|
||||
scroll_by(options);
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom-view/#dom-element-scrollby
|
||||
|
|
Loading…
Reference in a new issue